repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
javagl/CommonUI | src/main/java/de/javagl/common/ui/JScrollPanes.java | JScrollPanes.createVerticalScrollPane | public static JScrollPane createVerticalScrollPane(
final JComponent component)
{
JScrollPane scrollPane = new JScrollPane(component)
{
/**
* Serial UID
*/
private static final long serialVersionUID = -177913025197077320L;
... | java | public static JScrollPane createVerticalScrollPane(
final JComponent component)
{
JScrollPane scrollPane = new JScrollPane(component)
{
/**
* Serial UID
*/
private static final long serialVersionUID = -177913025197077320L;
... | [
"public",
"static",
"JScrollPane",
"createVerticalScrollPane",
"(",
"final",
"JComponent",
"component",
")",
"{",
"JScrollPane",
"scrollPane",
"=",
"new",
"JScrollPane",
"(",
"component",
")",
"{",
"/**\r\n * Serial UID\r\n */",
"private",
"static",
... | Creates a JScrollPane for vertically scrolling the given component.
The scroll pane will take into account that the vertical scroll bar
will be shown when needed, and return a preferred size that takes
the width of this scroll bar into account, so that when the vertical
scroll bar appears, the contained component can s... | [
"Creates",
"a",
"JScrollPane",
"for",
"vertically",
"scrolling",
"the",
"given",
"component",
".",
"The",
"scroll",
"pane",
"will",
"take",
"into",
"account",
"that",
"the",
"vertical",
"scroll",
"bar",
"will",
"be",
"shown",
"when",
"needed",
"and",
"return",... | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JScrollPanes.java#L51-L82 | train |
blackdoor/blackdoor | src/main/java/black/door/struct/SortedArrayList.java | SortedArrayList.addSorted | public boolean addSorted(E element) {
boolean added = false;
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i > 0 && cmp.compareTo(get(i - 1)) < 0; i--)
Collections.swap(this, i, i - 1);
return added;
} | java | public boolean addSorted(E element) {
boolean added = false;
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i > 0 && cmp.compareTo(get(i - 1)) < 0; i--)
Collections.swap(this, i, i - 1);
return added;
} | [
"public",
"boolean",
"addSorted",
"(",
"E",
"element",
")",
"{",
"boolean",
"added",
"=",
"false",
";",
"added",
"=",
"super",
".",
"add",
"(",
"element",
")",
";",
"Comparable",
"<",
"E",
">",
"cmp",
"=",
"(",
"Comparable",
"<",
"E",
">",
")",
"el... | adds an element to the list in its place based on natural order. allows duplicates.
@param element
element to be appended to this list
@return true if this collection changed as a result of the call | [
"adds",
"an",
"element",
"to",
"the",
"list",
"in",
"its",
"place",
"based",
"on",
"natural",
"order",
".",
"allows",
"duplicates",
"."
] | 060c7a71dfafb85e10e8717736e6d3160262e96b | https://github.com/blackdoor/blackdoor/blob/060c7a71dfafb85e10e8717736e6d3160262e96b/src/main/java/black/door/struct/SortedArrayList.java#L26-L33 | train |
blackdoor/blackdoor | src/main/java/black/door/struct/SortedArrayList.java | SortedArrayList.addSorted | public boolean addSorted(E element, boolean allowDuplicates) {
boolean added = false;
if(!allowDuplicates){
if(this.contains(element)){
System.err.println("item is a duplicate");
return added;
}}
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i ... | java | public boolean addSorted(E element, boolean allowDuplicates) {
boolean added = false;
if(!allowDuplicates){
if(this.contains(element)){
System.err.println("item is a duplicate");
return added;
}}
added = super.add(element);
Comparable<E> cmp = (Comparable<E>) element;
for (int i = size() - 1; i ... | [
"public",
"boolean",
"addSorted",
"(",
"E",
"element",
",",
"boolean",
"allowDuplicates",
")",
"{",
"boolean",
"added",
"=",
"false",
";",
"if",
"(",
"!",
"allowDuplicates",
")",
"{",
"if",
"(",
"this",
".",
"contains",
"(",
"element",
")",
")",
"{",
"... | adds an element to the list in its place based on natural order.
@param element
element to be appended to this list
@param allowDuplicates if true will allow multiple of the same item to be added, else returns false.
@return true if this collection changed as a result of the call | [
"adds",
"an",
"element",
"to",
"the",
"list",
"in",
"its",
"place",
"based",
"on",
"natural",
"order",
"."
] | 060c7a71dfafb85e10e8717736e6d3160262e96b | https://github.com/blackdoor/blackdoor/blob/060c7a71dfafb85e10e8717736e6d3160262e96b/src/main/java/black/door/struct/SortedArrayList.java#L43-L55 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/LocationBasedPopupHandler.java | LocationBasedPopupHandler.prepareMenu | private void prepareMenu(Container menu, Component component, int x, int y)
{
int n = menu.getComponentCount();
for (int i=0; i<n; i++)
{
Component menuComponent = popupMenu.getComponent(i);
if (menuComponent instanceof JMenu)
{
JMe... | java | private void prepareMenu(Container menu, Component component, int x, int y)
{
int n = menu.getComponentCount();
for (int i=0; i<n; i++)
{
Component menuComponent = popupMenu.getComponent(i);
if (menuComponent instanceof JMenu)
{
JMe... | [
"private",
"void",
"prepareMenu",
"(",
"Container",
"menu",
",",
"Component",
"component",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"n",
"=",
"menu",
".",
"getComponentCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<"... | Prepare the given menu recursively with the given parameters
@param menu The menu
@param component The component
@param x The x-coordinate
@param y THe y-coordinate | [
"Prepare",
"the",
"given",
"menu",
"recursively",
"with",
"the",
"given",
"parameters"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/LocationBasedPopupHandler.java#L102-L125 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java | CustomizedTableHeader.removeColumn | private void removeColumn(int index)
{
TableColumn column = tableColumns.get(index);
column.removePropertyChangeListener(widthListener);
tableColumns.remove(index);
JComponent component = customComponents.remove(index);
remove(component);
if (componentRemover !... | java | private void removeColumn(int index)
{
TableColumn column = tableColumns.get(index);
column.removePropertyChangeListener(widthListener);
tableColumns.remove(index);
JComponent component = customComponents.remove(index);
remove(component);
if (componentRemover !... | [
"private",
"void",
"removeColumn",
"(",
"int",
"index",
")",
"{",
"TableColumn",
"column",
"=",
"tableColumns",
".",
"get",
"(",
"index",
")",
";",
"column",
".",
"removePropertyChangeListener",
"(",
"widthListener",
")",
";",
"tableColumns",
".",
"remove",
"(... | Remove the column and the custom component at the given index
@param index The index | [
"Remove",
"the",
"column",
"and",
"the",
"custom",
"component",
"at",
"the",
"given",
"index"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java#L242-L253 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java | CustomizedTableHeader.addColumn | private void addColumn(int index)
{
TableColumnModel columnModel = getColumnModel();
TableColumn column = columnModel.getColumn(index);
while (tableColumns.size() - 1 < index)
{
tableColumns.add(null);
}
tableColumns.set(index, column);
co... | java | private void addColumn(int index)
{
TableColumnModel columnModel = getColumnModel();
TableColumn column = columnModel.getColumn(index);
while (tableColumns.size() - 1 < index)
{
tableColumns.add(null);
}
tableColumns.set(index, column);
co... | [
"private",
"void",
"addColumn",
"(",
"int",
"index",
")",
"{",
"TableColumnModel",
"columnModel",
"=",
"getColumnModel",
"(",
")",
";",
"TableColumn",
"column",
"=",
"columnModel",
".",
"getColumn",
"(",
"index",
")",
";",
"while",
"(",
"tableColumns",
".",
... | Add the column and the custom component at the given index
@param index The index | [
"Add",
"the",
"column",
"and",
"the",
"custom",
"component",
"at",
"the",
"given",
"index"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java#L260-L278 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java | CustomizedTableHeader.updateCustomComponentBounds | private void updateCustomComponentBounds()
{
if (customComponents == null)
{
return;
}
if (table == null)
{
return;
}
for (int i = 0; i < customComponents.size(); i++)
{
JComponent component = customCompo... | java | private void updateCustomComponentBounds()
{
if (customComponents == null)
{
return;
}
if (table == null)
{
return;
}
for (int i = 0; i < customComponents.size(); i++)
{
JComponent component = customCompo... | [
"private",
"void",
"updateCustomComponentBounds",
"(",
")",
"{",
"if",
"(",
"customComponents",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Update the bounds of all custom components, based on the current
column widths | [
"Update",
"the",
"bounds",
"of",
"all",
"custom",
"components",
"based",
"on",
"the",
"current",
"column",
"widths"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java#L284-L302 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/BaseClient.java | BaseClient.initialiseLifecycleObserver | private void initialiseLifecycleObserver(Application application) {
LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
for (LifecycleListener listener : lifecycleListeners) {
... | java | private void initialiseLifecycleObserver(Application application) {
LifeCycleController.registerLifeCycleObserver(application, new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
for (LifecycleListener listener : lifecycleListeners) {
... | [
"private",
"void",
"initialiseLifecycleObserver",
"(",
"Application",
"application",
")",
"{",
"LifeCycleController",
".",
"registerLifeCycleObserver",
"(",
"application",
",",
"new",
"LifecycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onForegrounded... | Register for application lifecycle callbacks.
@param application Application instance. | [
"Register",
"for",
"application",
"lifecycle",
"callbacks",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/BaseClient.java#L242-L258 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/BaseClient.java | BaseClient.getSession | @Override
public Session getSession() {
return state.get() > GlobalState.INITIALISING ? new Session(dataMgr.getSessionDAO().session()) : new Session();
} | java | @Override
public Session getSession() {
return state.get() > GlobalState.INITIALISING ? new Session(dataMgr.getSessionDAO().session()) : new Session();
} | [
"@",
"Override",
"public",
"Session",
"getSession",
"(",
")",
"{",
"return",
"state",
".",
"get",
"(",
")",
">",
"GlobalState",
".",
"INITIALISING",
"?",
"new",
"Session",
"(",
"dataMgr",
".",
"getSessionDAO",
"(",
")",
".",
"session",
"(",
")",
")",
"... | Gets the active session data.
@return Active session data. | [
"Gets",
"the",
"active",
"session",
"data",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/BaseClient.java#L275-L278 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/BaseClient.java | BaseClient.loadSession | private Observable<SessionData> loadSession(final Boolean initialised) {
if (initialised) {
final SessionData session = dataMgr.getSessionDAO().session();
if (session != null) {
if (session.getExpiresOn() > System.currentTimeMillis()) {
state.compare... | java | private Observable<SessionData> loadSession(final Boolean initialised) {
if (initialised) {
final SessionData session = dataMgr.getSessionDAO().session();
if (session != null) {
if (session.getExpiresOn() > System.currentTimeMillis()) {
state.compare... | [
"private",
"Observable",
"<",
"SessionData",
">",
"loadSession",
"(",
"final",
"Boolean",
"initialised",
")",
"{",
"if",
"(",
"initialised",
")",
"{",
"final",
"SessionData",
"session",
"=",
"dataMgr",
".",
"getSessionDAO",
"(",
")",
".",
"session",
"(",
")"... | Loads local session state.
@return Returns local session state. | [
"Loads",
"local",
"session",
"state",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/BaseClient.java#L310-L334 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/AbstractConfig.java | AbstractConfig.getMeters | public final AbstractMeter[] getMeters() {
final AbstractMeter[] returnVal = new AbstractMeter[meters.length];
System.arraycopy(meters, 0, returnVal, 0, returnVal.length);
return returnVal;
} | java | public final AbstractMeter[] getMeters() {
final AbstractMeter[] returnVal = new AbstractMeter[meters.length];
System.arraycopy(meters, 0, returnVal, 0, returnVal.length);
return returnVal;
} | [
"public",
"final",
"AbstractMeter",
"[",
"]",
"getMeters",
"(",
")",
"{",
"final",
"AbstractMeter",
"[",
"]",
"returnVal",
"=",
"new",
"AbstractMeter",
"[",
"meters",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"meters",
",",
"0",
",",
"ret... | Getter for member meters
@return the meters | [
"Getter",
"for",
"member",
"meters"
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/AbstractConfig.java#L129-L133 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/AbstractConfig.java | AbstractConfig.getListener | public final AbstractOutput[] getListener() {
final AbstractOutput[] returnVal = new AbstractOutput[listeners.length];
System.arraycopy(listeners, 0, returnVal, 0, returnVal.length);
return returnVal;
} | java | public final AbstractOutput[] getListener() {
final AbstractOutput[] returnVal = new AbstractOutput[listeners.length];
System.arraycopy(listeners, 0, returnVal, 0, returnVal.length);
return returnVal;
} | [
"public",
"final",
"AbstractOutput",
"[",
"]",
"getListener",
"(",
")",
"{",
"final",
"AbstractOutput",
"[",
"]",
"returnVal",
"=",
"new",
"AbstractOutput",
"[",
"listeners",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"listeners",
",",
"0",
... | Getter for member listeners
@return the listeners | [
"Getter",
"for",
"member",
"listeners"
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/AbstractConfig.java#L158-L162 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/CallbackAdapter.java | CallbackAdapter.adapt | public <T> void adapt(@NonNull final Observable<T> subscriber, @Nullable final Callback<T> callback) {
subscriber.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<T>() {
@Override
public voi... | java | public <T> void adapt(@NonNull final Observable<T> subscriber, @Nullable final Callback<T> callback) {
subscriber.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<T>() {
@Override
public voi... | [
"public",
"<",
"T",
">",
"void",
"adapt",
"(",
"@",
"NonNull",
"final",
"Observable",
"<",
"T",
">",
"subscriber",
",",
"@",
"Nullable",
"final",
"Callback",
"<",
"T",
">",
"callback",
")",
"{",
"subscriber",
".",
"subscribeOn",
"(",
"Schedulers",
".",
... | Changes observables into callbacks.
@param subscriber Observable to subscribe to.
@param callback Callback where onError and onNext from Observable will be delivered
@param <T> Class of the result. | [
"Changes",
"observables",
"into",
"callbacks",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/CallbackAdapter.java#L49-L73 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.setSelectionStateOfAll | private void setSelectionStateOfAll(State state)
{
Objects.requireNonNull(state, "The state may not be null");
List<Object> allNodes = JTrees.getAllNodes(getModel());
for (Object node : allNodes)
{
setSelectionState(node, state);
}
} | java | private void setSelectionStateOfAll(State state)
{
Objects.requireNonNull(state, "The state may not be null");
List<Object> allNodes = JTrees.getAllNodes(getModel());
for (Object node : allNodes)
{
setSelectionState(node, state);
}
} | [
"private",
"void",
"setSelectionStateOfAll",
"(",
"State",
"state",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"state",
",",
"\"The state may not be null\"",
")",
";",
"List",
"<",
"Object",
">",
"allNodes",
"=",
"JTrees",
".",
"getAllNodes",
"(",
"getMode... | Set the selection state of all nodes to the given state
@param state The state | [
"Set",
"the",
"selection",
"state",
"of",
"all",
"nodes",
"to",
"the",
"given",
"state"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L227-L235 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.setSelectionState | private void setSelectionState(Object node, State state, boolean propagate)
{
Objects.requireNonNull(state, "The state may not be null");
Objects.requireNonNull(node, "The node may not be null");
State oldState = selectionStates.put(node, state);
if (!state.equals(oldState))
... | java | private void setSelectionState(Object node, State state, boolean propagate)
{
Objects.requireNonNull(state, "The state may not be null");
Objects.requireNonNull(node, "The node may not be null");
State oldState = selectionStates.put(node, state);
if (!state.equals(oldState))
... | [
"private",
"void",
"setSelectionState",
"(",
"Object",
"node",
",",
"State",
"state",
",",
"boolean",
"propagate",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"state",
",",
"\"The state may not be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"n... | Set the selection state of the given node
@param node The node
@param state The state
@param propagate Whether the state change should be propagated
to its children and ancestor nodes | [
"Set",
"the",
"selection",
"state",
"of",
"the",
"given",
"node"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L256-L270 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.handleMousePress | private void handleMousePress(MouseEvent e)
{
int row = getRowForLocation(e.getX(), e.getY());
TreePath path = getPathForLocation(e.getX(), e.getY());
if (path == null)
{
return;
}
TreeCellRenderer cellRenderer = getCellRenderer();
TreeNod... | java | private void handleMousePress(MouseEvent e)
{
int row = getRowForLocation(e.getX(), e.getY());
TreePath path = getPathForLocation(e.getX(), e.getY());
if (path == null)
{
return;
}
TreeCellRenderer cellRenderer = getCellRenderer();
TreeNod... | [
"private",
"void",
"handleMousePress",
"(",
"MouseEvent",
"e",
")",
"{",
"int",
"row",
"=",
"getRowForLocation",
"(",
"e",
".",
"getX",
"(",
")",
",",
"e",
".",
"getY",
"(",
")",
")",
";",
"TreePath",
"path",
"=",
"getPathForLocation",
"(",
"e",
".",
... | Handle a mouse press and possibly toggle the selection state
@param e The mouse event | [
"Handle",
"a",
"mouse",
"press",
"and",
"possibly",
"toggle",
"the",
"selection",
"state"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L279-L314 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.toggleSelection | private void toggleSelection(TreePath path)
{
Object node = path.getLastPathComponent();
State state = getSelectionState(node);
if (state == null)
{
return;
}
if (state == State.SELECTED)
{
setSelectionState(node, State.UNSELE... | java | private void toggleSelection(TreePath path)
{
Object node = path.getLastPathComponent();
State state = getSelectionState(node);
if (state == null)
{
return;
}
if (state == State.SELECTED)
{
setSelectionState(node, State.UNSELE... | [
"private",
"void",
"toggleSelection",
"(",
"TreePath",
"path",
")",
"{",
"Object",
"node",
"=",
"path",
".",
"getLastPathComponent",
"(",
")",
";",
"State",
"state",
"=",
"getSelectionState",
"(",
"node",
")",
";",
"if",
"(",
"state",
"==",
"null",
")",
... | Toggle the selection of the given path due to a mouse click
@param path The path | [
"Toggle",
"the",
"selection",
"of",
"the",
"given",
"path",
"due",
"to",
"a",
"mouse",
"click"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L321-L345 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.updateSelection | private void updateSelection(Object node)
{
State newState = getSelectionState(node);
List<Object> descendants =
JTrees.getAllDescendants(getModel(), node);
for (Object descendant : descendants)
{
setSelectionState(descendant, newState, false);
... | java | private void updateSelection(Object node)
{
State newState = getSelectionState(node);
List<Object> descendants =
JTrees.getAllDescendants(getModel(), node);
for (Object descendant : descendants)
{
setSelectionState(descendant, newState, false);
... | [
"private",
"void",
"updateSelection",
"(",
"Object",
"node",
")",
"{",
"State",
"newState",
"=",
"getSelectionState",
"(",
"node",
")",
";",
"List",
"<",
"Object",
">",
"descendants",
"=",
"JTrees",
".",
"getAllDescendants",
"(",
"getModel",
"(",
")",
",",
... | Update the selection state of the given node based on the state
of its children
@param node The node | [
"Update",
"the",
"selection",
"state",
"of",
"the",
"given",
"node",
"based",
"on",
"the",
"state",
"of",
"its",
"children"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L353-L372 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.computeState | private State computeState(List<Object> nodes)
{
Set<State> set = new LinkedHashSet<State>();
for (Object node : nodes)
{
set.add(getSelectionState(node));
}
// Should never happen
while (set.contains(null))
{
logger.warning("... | java | private State computeState(List<Object> nodes)
{
Set<State> set = new LinkedHashSet<State>();
for (Object node : nodes)
{
set.add(getSelectionState(node));
}
// Should never happen
while (set.contains(null))
{
logger.warning("... | [
"private",
"State",
"computeState",
"(",
"List",
"<",
"Object",
">",
"nodes",
")",
"{",
"Set",
"<",
"State",
">",
"set",
"=",
"new",
"LinkedHashSet",
"<",
"State",
">",
"(",
")",
";",
"for",
"(",
"Object",
"node",
":",
"nodes",
")",
"{",
"set",
"."... | Compute the state for a node with the given children
@param nodes The nodes
@return The state | [
"Compute",
"the",
"state",
"for",
"a",
"node",
"with",
"the",
"given",
"children"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L380-L404 | train |
javagl/CommonUI | src/main/java/de/javagl/common/ui/panel/collapsible/AccordionPanel.java | AccordionPanel.removeFromAccordion | public void removeFromAccordion(JComponent component)
{
CollapsiblePanel collapsiblePanel = collapsiblePanels.get(component);
if (collapsiblePanel != null)
{
contentPanel.remove(collapsiblePanel);
collapsiblePanels.remove(component);
revalidate();
... | java | public void removeFromAccordion(JComponent component)
{
CollapsiblePanel collapsiblePanel = collapsiblePanels.get(component);
if (collapsiblePanel != null)
{
contentPanel.remove(collapsiblePanel);
collapsiblePanels.remove(component);
revalidate();
... | [
"public",
"void",
"removeFromAccordion",
"(",
"JComponent",
"component",
")",
"{",
"CollapsiblePanel",
"collapsiblePanel",
"=",
"collapsiblePanels",
".",
"get",
"(",
"component",
")",
";",
"if",
"(",
"collapsiblePanel",
"!=",
"null",
")",
"{",
"contentPanel",
".",... | Remove the given component from this accordion
@param component The component to remove | [
"Remove",
"the",
"given",
"component",
"from",
"this",
"accordion"
] | b2c7a7637d4e288271392ba148dc17e4c9780255 | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/panel/collapsible/AccordionPanel.java#L128-L137 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java | SocketController.connectSocket | public void connectSocket() {
synchronized (lock) {
if (isForegrounded) {
if (socketConnection == null) {
SocketFactory factory = new SocketFactory(socketURI, new SocketEventDispatcher(listener, new Parser()).setLogger(log), log);
socketConnec... | java | public void connectSocket() {
synchronized (lock) {
if (isForegrounded) {
if (socketConnection == null) {
SocketFactory factory = new SocketFactory(socketURI, new SocketEventDispatcher(listener, new Parser()).setLogger(log), log);
socketConnec... | [
"public",
"void",
"connectSocket",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isForegrounded",
")",
"{",
"if",
"(",
"socketConnection",
"==",
"null",
")",
"{",
"SocketFactory",
"factory",
"=",
"new",
"SocketFactory",
"(",
"socketURI",
... | Create and connect socket. | [
"Create",
"and",
"connect",
"socket",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java#L89-L106 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java | SocketController.disconnectSocket | public void disconnectSocket() {
synchronized (lock) {
if (socketConnection != null) {
socketConnection.setManageReconnection(false);
socketConnection.disconnect();
}
lock.notifyAll();
}
} | java | public void disconnectSocket() {
synchronized (lock) {
if (socketConnection != null) {
socketConnection.setManageReconnection(false);
socketConnection.disconnect();
}
lock.notifyAll();
}
} | [
"public",
"void",
"disconnectSocket",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"socketConnection",
"!=",
"null",
")",
"{",
"socketConnection",
".",
"setManageReconnection",
"(",
"false",
")",
";",
"socketConnection",
".",
"disconnect",
... | Disconnect socket. | [
"Disconnect",
"socket",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java#L111-L119 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java | SocketController.createLifecycleListener | public LifecycleListener createLifecycleListener() {
return new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
synchronized (lock) {
if (!isForegrounded) {
isForegrounded = true;
... | java | public LifecycleListener createLifecycleListener() {
return new LifecycleListener() {
@Override
public void onForegrounded(Context context) {
synchronized (lock) {
if (!isForegrounded) {
isForegrounded = true;
... | [
"public",
"LifecycleListener",
"createLifecycleListener",
"(",
")",
"{",
"return",
"new",
"LifecycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onForegrounded",
"(",
"Context",
"context",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
... | creates application lifecycle and network connectivity callbacks.
@return Application lifecycle and network connectivity callbacks. | [
"creates",
"application",
"lifecycle",
"and",
"network",
"connectivity",
"callbacks",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketController.java#L126-L158 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java | SocketViewProgressUpdater.initProgressView | public boolean initProgressView(final Map<BenchmarkMethod, Integer> mapping)
throws SocketViewException {
if (mapping != null) {
final Set<BenchmarkMethod> methodSet = mapping.keySet();
final Map<String, Integer> finalMap = new HashMap<String, Integer>();
for (BenchmarkMethod benchmarkMethod : methodSet)... | java | public boolean initProgressView(final Map<BenchmarkMethod, Integer> mapping)
throws SocketViewException {
if (mapping != null) {
final Set<BenchmarkMethod> methodSet = mapping.keySet();
final Map<String, Integer> finalMap = new HashMap<String, Integer>();
for (BenchmarkMethod benchmarkMethod : methodSet)... | [
"public",
"boolean",
"initProgressView",
"(",
"final",
"Map",
"<",
"BenchmarkMethod",
",",
"Integer",
">",
"mapping",
")",
"throws",
"SocketViewException",
"{",
"if",
"(",
"mapping",
"!=",
"null",
")",
"{",
"final",
"Set",
"<",
"BenchmarkMethod",
">",
"methodS... | This method initializes the values of the eclipse view and resets the
progress bar.
@param mapping
a mapping with all methods to benchmark and the related runs
@throws SocketViewException
if init fails | [
"This",
"method",
"initializes",
"the",
"values",
"of",
"the",
"eclipse",
"view",
"and",
"resets",
"the",
"progress",
"bar",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java#L73-L88 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java | SocketViewProgressUpdater.updateCurrentElement | public boolean updateCurrentElement(final AbstractMeter meter,
final String name) throws SocketViewException {
if (meter != null && !regMeterHash) {
registerFirstMeterHash(meter);
}
if (name != null && meter.hashCode() == (getRegMeter())) {
viewStub.updateCurrentRun(name);
}
return true;
} | java | public boolean updateCurrentElement(final AbstractMeter meter,
final String name) throws SocketViewException {
if (meter != null && !regMeterHash) {
registerFirstMeterHash(meter);
}
if (name != null && meter.hashCode() == (getRegMeter())) {
viewStub.updateCurrentRun(name);
}
return true;
} | [
"public",
"boolean",
"updateCurrentElement",
"(",
"final",
"AbstractMeter",
"meter",
",",
"final",
"String",
"name",
")",
"throws",
"SocketViewException",
"{",
"if",
"(",
"meter",
"!=",
"null",
"&&",
"!",
"regMeterHash",
")",
"{",
"registerFirstMeterHash",
"(",
... | This method notifies the eclipse view which element is currently benched.
@param meter
The current meter.
@param name
This param represents the java element which is currently
benched and which is fully qualified.
@throws SocketViewException
if update fails | [
"This",
"method",
"notifies",
"the",
"eclipse",
"view",
"which",
"element",
"is",
"currently",
"benched",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java#L101-L110 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java | SocketViewProgressUpdater.updateErrorInElement | public boolean updateErrorInElement(final String name,
final Exception exception) throws SocketViewException {
if (name != null && exception != null) {
if (exception instanceof AbstractPerfidixMethodException) {
final AbstractPerfidixMethodException exc = (AbstractPerfidixMethodException) exception;
vie... | java | public boolean updateErrorInElement(final String name,
final Exception exception) throws SocketViewException {
if (name != null && exception != null) {
if (exception instanceof AbstractPerfidixMethodException) {
final AbstractPerfidixMethodException exc = (AbstractPerfidixMethodException) exception;
vie... | [
"public",
"boolean",
"updateErrorInElement",
"(",
"final",
"String",
"name",
",",
"final",
"Exception",
"exception",
")",
"throws",
"SocketViewException",
"{",
"if",
"(",
"name",
"!=",
"null",
"&&",
"exception",
"!=",
"null",
")",
"{",
"if",
"(",
"exception",
... | This method informs the view that an error occurred while benching the
current element.
@param name
Element represents the java element which has not been
executed successfully.
@param exception
The exception caused by the element.
@throws SocketViewException
if update fails | [
"This",
"method",
"informs",
"the",
"view",
"that",
"an",
"error",
"occurred",
"while",
"benching",
"the",
"current",
"element",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/socketadapter/SocketViewProgressUpdater.java#L124-L139 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/log/Formatter.java | Formatter.getLevelTag | static String getLevelTag(final int logLevel) {
switch (logLevel) {
case LogLevelConst.FATAL:
return LogConstants.TAG_FATAL;
case LogLevelConst.ERROR:
return LogConstants.TAG_ERROR;
case LogLevelConst.WARNING:
return LogCons... | java | static String getLevelTag(final int logLevel) {
switch (logLevel) {
case LogLevelConst.FATAL:
return LogConstants.TAG_FATAL;
case LogLevelConst.ERROR:
return LogConstants.TAG_ERROR;
case LogLevelConst.WARNING:
return LogCons... | [
"static",
"String",
"getLevelTag",
"(",
"final",
"int",
"logLevel",
")",
"{",
"switch",
"(",
"logLevel",
")",
"{",
"case",
"LogLevelConst",
".",
"FATAL",
":",
"return",
"LogConstants",
".",
"TAG_FATAL",
";",
"case",
"LogLevelConst",
".",
"ERROR",
":",
"retur... | Gets the string representation of the log level.
@param logLevel Level of the log message.
@return String representation of the log level. | [
"Gets",
"the",
"string",
"representation",
"of",
"the",
"log",
"level",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/log/Formatter.java#L37-L60 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java | OrphanedEvent.getMessageId | public String getMessageId() {
return (data != null && data.payload != null) ? data.payload.messageId : null;
} | java | public String getMessageId() {
return (data != null && data.payload != null) ? data.payload.messageId : null;
} | [
"public",
"String",
"getMessageId",
"(",
")",
"{",
"return",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"payload",
"!=",
"null",
")",
"?",
"data",
".",
"payload",
".",
"messageId",
":",
"null",
";",
"}"
] | Gets id of the updated message.
@return Id of the updated message. | [
"Gets",
"id",
"of",
"the",
"updated",
"message",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java#L106-L108 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java | OrphanedEvent.getConversationId | public String getConversationId() {
return (data != null && data.payload != null) ? data.payload.conversationId : null;
} | java | public String getConversationId() {
return (data != null && data.payload != null) ? data.payload.conversationId : null;
} | [
"public",
"String",
"getConversationId",
"(",
")",
"{",
"return",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"payload",
"!=",
"null",
")",
"?",
"data",
".",
"payload",
".",
"conversationId",
":",
"null",
";",
"}"
] | Gets id of the conversation for which message was updated.
@return Id of the updated message. | [
"Gets",
"id",
"of",
"the",
"conversation",
"for",
"which",
"message",
"was",
"updated",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java#L115-L117 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java | OrphanedEvent.getProfileId | public String getProfileId() {
return (data != null && data.payload != null) ? data.payload.profileId : null;
} | java | public String getProfileId() {
return (data != null && data.payload != null) ? data.payload.profileId : null;
} | [
"public",
"String",
"getProfileId",
"(",
")",
"{",
"return",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"payload",
"!=",
"null",
")",
"?",
"data",
".",
"payload",
".",
"profileId",
":",
"null",
";",
"}"
] | Gets profile id of the user that changed the message status.
@return Profile id of the user that changed the message status. | [
"Gets",
"profile",
"id",
"of",
"the",
"user",
"that",
"changed",
"the",
"message",
"status",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java#L124-L126 | train |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java | OrphanedEvent.getTimestamp | public String getTimestamp() {
return (data != null && data.payload != null) ? data.payload.timestamp : null;
} | java | public String getTimestamp() {
return (data != null && data.payload != null) ? data.payload.timestamp : null;
} | [
"public",
"String",
"getTimestamp",
"(",
")",
"{",
"return",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"payload",
"!=",
"null",
")",
"?",
"data",
".",
"payload",
".",
"timestamp",
":",
"null",
";",
"}"
] | Gets time when the message status changed.
@return Time when the message status changed. | [
"Gets",
"time",
"when",
"the",
"message",
"status",
"changed",
"."
] | 53140a58d5a62afe196047ccc5120bfe090ef211 | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/model/messaging/OrphanedEvent.java#L133-L135 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/ouput/asciitable/Util.java | Util.combine | static String combine(final String... args) {
final StringBuilder builder = new StringBuilder();
for (final String arg : args) {
builder.append(arg);
}
return builder.toString();
} | java | static String combine(final String... args) {
final StringBuilder builder = new StringBuilder();
for (final String arg : args) {
builder.append(arg);
}
return builder.toString();
} | [
"static",
"String",
"combine",
"(",
"final",
"String",
"...",
"args",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"arg",
":",
"args",
")",
"{",
"builder",
".",
"append",
"(",
... | Combines an unknown number of Strings to one String.
@param args multiple Strings
@return the combined string | [
"Combines",
"an",
"unknown",
"number",
"of",
"Strings",
"to",
"one",
"String",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/Util.java#L43-L49 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/ouput/asciitable/Util.java | Util.implode | static String implode(final String glue, final String[] what) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < what.length; i++) {
builder.append(what[i]);
if (i + 1 != what.length) {
builder.append(glue);
}
}
r... | java | static String implode(final String glue, final String[] what) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < what.length; i++) {
builder.append(what[i]);
if (i + 1 != what.length) {
builder.append(glue);
}
}
r... | [
"static",
"String",
"implode",
"(",
"final",
"String",
"glue",
",",
"final",
"String",
"[",
"]",
"what",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"what... | Concantenate a String array "what" with glue "glue".
@param what the array of strings to concantenate
@param glue the glue string to use.
<p/>
<pre>
String[] what = { "a", "b", "c" };
String s = Util.implode("-", what);
// result is "a-b-c"
</pre>
@return String | [
"Concantenate",
"a",
"String",
"array",
"what",
"with",
"glue",
"glue",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/Util.java#L106-L116 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/ouput/asciitable/Util.java | Util.repeat | static String repeat(final String toBeRepeated, final int numTimes) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < numTimes; i++) {
builder.append(toBeRepeated);
}
return builder.toString();
} | java | static String repeat(final String toBeRepeated, final int numTimes) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < numTimes; i++) {
builder.append(toBeRepeated);
}
return builder.toString();
} | [
"static",
"String",
"repeat",
"(",
"final",
"String",
"toBeRepeated",
",",
"final",
"int",
"numTimes",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numTimes",... | a str_repeat function.
@param toBeRepeated the string to repeat
@param numTimes how many times to concantenate the string
@return the repeated string. | [
"a",
"str_repeat",
"function",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/Util.java#L125-L132 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/ouput/asciitable/Util.java | Util.numNewLines | private static int numNewLines(final String toExamine) {
final char[] arr = toExamine.toCharArray();
int result = 0;
for (char ch : arr) {
if (AbstractTabularComponent.NEWLINE.equals(new String(new char[]{ch}))) {
result++;
}
}
return resul... | java | private static int numNewLines(final String toExamine) {
final char[] arr = toExamine.toCharArray();
int result = 0;
for (char ch : arr) {
if (AbstractTabularComponent.NEWLINE.equals(new String(new char[]{ch}))) {
result++;
}
}
return resul... | [
"private",
"static",
"int",
"numNewLines",
"(",
"final",
"String",
"toExamine",
")",
"{",
"final",
"char",
"[",
"]",
"arr",
"=",
"toExamine",
".",
"toCharArray",
"(",
")",
";",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"char",
"ch",
":",
"arr",
")"... | Returns how many new lines are in the string.
@param toExamine the string to look upon.
@return the number of occurences of {@link org.perfidix.ouput.asciitable.AbstractTabularComponent#NEWLINE} in the string. | [
"Returns",
"how",
"many",
"new",
"lines",
"are",
"in",
"the",
"string",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/Util.java#L150-L159 | train |
sebastiangraf/perfidix | src/main/java/org/perfidix/ouput/asciitable/Util.java | Util.createMatrix | public static String[][] createMatrix(final String[] data) {
int maxNewLines = 0;
for (final String col : data) {
maxNewLines = Math.max(maxNewLines, Util.numNewLines(col));
}
final String[][] matrix = new String[maxNewLines + 1][data.length];
for (int col = 0; col < ... | java | public static String[][] createMatrix(final String[] data) {
int maxNewLines = 0;
for (final String col : data) {
maxNewLines = Math.max(maxNewLines, Util.numNewLines(col));
}
final String[][] matrix = new String[maxNewLines + 1][data.length];
for (int col = 0; col < ... | [
"public",
"static",
"String",
"[",
"]",
"[",
"]",
"createMatrix",
"(",
"final",
"String",
"[",
"]",
"data",
")",
"{",
"int",
"maxNewLines",
"=",
"0",
";",
"for",
"(",
"final",
"String",
"col",
":",
"data",
")",
"{",
"maxNewLines",
"=",
"Math",
".",
... | Creates a matrix according to the number of new lines given into the method.
@param data an array of row data
@return the matrix. | [
"Creates",
"a",
"matrix",
"according",
"to",
"the",
"number",
"of",
"new",
"lines",
"given",
"into",
"the",
"method",
"."
] | f13aa793b6a3055215ed4edbb946c1bb5d564886 | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/asciitable/Util.java#L178-L197 | train |
JoeKerouac/utils | src/main/java/com/joe/utils/common/telnet/TelnetProtocolHandler.java | TelnetProtocolHandler.handleCommand | private void handleCommand(byte b) throws IOException {
if (b == SE) {
telnetCommand += (char) b;
handleNegotiation();
reset();
} else if (isWill || isDo) {
if (isWill && b == TERMINAL_TYPE) {
socketChannel
.write(ByteBu... | java | private void handleCommand(byte b) throws IOException {
if (b == SE) {
telnetCommand += (char) b;
handleNegotiation();
reset();
} else if (isWill || isDo) {
if (isWill && b == TERMINAL_TYPE) {
socketChannel
.write(ByteBu... | [
"private",
"void",
"handleCommand",
"(",
"byte",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"b",
"==",
"SE",
")",
"{",
"telnetCommand",
"+=",
"(",
"char",
")",
"b",
";",
"handleNegotiation",
"(",
")",
";",
"reset",
"(",
")",
";",
"}",
"else",... | Handle telnet command
@param b | [
"Handle",
"telnet",
"command"
] | 45e1b2dc4d736956674fc4dcbe6cf84eaee69278 | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/telnet/TelnetProtocolHandler.java#L254-L275 | train |
JoeKerouac/utils | src/main/java/com/joe/utils/common/telnet/TelnetProtocolHandler.java | TelnetProtocolHandler.handleNegotiation | private void handleNegotiation() throws IOException {
if (telnetCommand.contains(new String(new byte[] { TERMINAL_TYPE }))) {
// IAC SB TERMINAL_TYPE IS XXX IAC SE
boolean isSuccess = false;
clientTerminalType = telnetCommand.substring(4, telnetCommand.length() - 2);
... | java | private void handleNegotiation() throws IOException {
if (telnetCommand.contains(new String(new byte[] { TERMINAL_TYPE }))) {
// IAC SB TERMINAL_TYPE IS XXX IAC SE
boolean isSuccess = false;
clientTerminalType = telnetCommand.substring(4, telnetCommand.length() - 2);
... | [
"private",
"void",
"handleNegotiation",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"telnetCommand",
".",
"contains",
"(",
"new",
"String",
"(",
"new",
"byte",
"[",
"]",
"{",
"TERMINAL_TYPE",
"}",
")",
")",
")",
"{",
"// IAC SB TERMINAL_TYPE IS XXX IAC... | Handle negotiation of terminal type | [
"Handle",
"negotiation",
"of",
"terminal",
"type"
] | 45e1b2dc4d736956674fc4dcbe6cf84eaee69278 | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/telnet/TelnetProtocolHandler.java#L280-L298 | train |
codelibs/analyzers | src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java | KanjiNumberFilter.normalizeNumber | public String normalizeNumber(final String number) {
try {
final BigDecimal normalizedNumber = parseNumber(new NumberBuffer(
number));
if (normalizedNumber == null) {
return number;
}
return normalizedNumber.toBigIntegerExact().... | java | public String normalizeNumber(final String number) {
try {
final BigDecimal normalizedNumber = parseNumber(new NumberBuffer(
number));
if (normalizedNumber == null) {
return number;
}
return normalizedNumber.toBigIntegerExact().... | [
"public",
"String",
"normalizeNumber",
"(",
"final",
"String",
"number",
")",
"{",
"try",
"{",
"final",
"BigDecimal",
"normalizedNumber",
"=",
"parseNumber",
"(",
"new",
"NumberBuffer",
"(",
"number",
")",
")",
";",
"if",
"(",
"normalizedNumber",
"==",
"null",... | Normalizes a Japanese number
@param number number or normalize
@return normalized number, or number to normalize on error (no op) | [
"Normalizes",
"a",
"Japanese",
"number"
] | 1d959f072e06c92b2b123d00a186845c19eb3a13 | https://github.com/codelibs/analyzers/blob/1d959f072e06c92b2b123d00a186845c19eb3a13/src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java#L189-L202 | train |
codelibs/analyzers | src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java | KanjiNumberFilter.parseNumber | private BigDecimal parseNumber(final NumberBuffer buffer) {
BigDecimal sum = BigDecimal.ZERO;
BigDecimal result = parseLargePair(buffer);
if (result == null) {
return null;
}
while (result != null) {
sum = sum.add(result);
result = parseLarge... | java | private BigDecimal parseNumber(final NumberBuffer buffer) {
BigDecimal sum = BigDecimal.ZERO;
BigDecimal result = parseLargePair(buffer);
if (result == null) {
return null;
}
while (result != null) {
sum = sum.add(result);
result = parseLarge... | [
"private",
"BigDecimal",
"parseNumber",
"(",
"final",
"NumberBuffer",
"buffer",
")",
"{",
"BigDecimal",
"sum",
"=",
"BigDecimal",
".",
"ZERO",
";",
"BigDecimal",
"result",
"=",
"parseLargePair",
"(",
"buffer",
")",
";",
"if",
"(",
"result",
"==",
"null",
")"... | Parses a Japanese number
@param buffer buffer to parse
@return parsed number, or null on error or end of input | [
"Parses",
"a",
"Japanese",
"number"
] | 1d959f072e06c92b2b123d00a186845c19eb3a13 | https://github.com/codelibs/analyzers/blob/1d959f072e06c92b2b123d00a186845c19eb3a13/src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java#L210-L224 | train |
codelibs/analyzers | src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java | KanjiNumberFilter.isNumeralPunctuation | public boolean isNumeralPunctuation(final String input) {
for (int i = 0; i < input.length(); i++) {
if (!isNumeralPunctuation(input.charAt(i))) {
return false;
}
}
return true;
} | java | public boolean isNumeralPunctuation(final String input) {
for (int i = 0; i < input.length(); i++) {
if (!isNumeralPunctuation(input.charAt(i))) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"isNumeralPunctuation",
"(",
"final",
"String",
"input",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"input",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isNumeralPunctuation",
"(",
"input",... | Numeral punctuation predicate
@param input string to test
@return true if and only if c is a numeral punctuation string | [
"Numeral",
"punctuation",
"predicate"
] | 1d959f072e06c92b2b123d00a186845c19eb3a13 | https://github.com/codelibs/analyzers/blob/1d959f072e06c92b2b123d00a186845c19eb3a13/src/main/java/org/codelibs/analysis/ja/KanjiNumberFilter.java#L428-L435 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DividableGridView.java | DividableGridView.adaptHeightToChildren | public void adaptHeightToChildren() {
DividableGridAdapter adapter = (DividableGridAdapter) getAdapter();
if (adapter != null) {
int height = getPaddingTop() + getPaddingBottom();
for (int i = 0; i < adapter.getCount(); i += adapter.getColumnCount()) {
AbstractI... | java | public void adaptHeightToChildren() {
DividableGridAdapter adapter = (DividableGridAdapter) getAdapter();
if (adapter != null) {
int height = getPaddingTop() + getPaddingBottom();
for (int i = 0; i < adapter.getCount(); i += adapter.getColumnCount()) {
AbstractI... | [
"public",
"void",
"adaptHeightToChildren",
"(",
")",
"{",
"DividableGridAdapter",
"adapter",
"=",
"(",
"DividableGridAdapter",
")",
"getAdapter",
"(",
")",
";",
"if",
"(",
"adapter",
"!=",
"null",
")",
"{",
"int",
"height",
"=",
"getPaddingTop",
"(",
")",
"+... | Adapts the height of the grid view to the height of its children. | [
"Adapts",
"the",
"height",
"of",
"the",
"grid",
"view",
"to",
"the",
"height",
"of",
"its",
"children",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DividableGridView.java#L118-L145 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.getRawItems | private List<AbstractItem> getRawItems() {
if (rawItems == null) {
rawItems = new ArrayList<>();
for (int i = 0; i < items.size(); i++) {
AbstractItem item = items.get(i);
if (item instanceof Divider && columnCount > 1) {
for (int j =... | java | private List<AbstractItem> getRawItems() {
if (rawItems == null) {
rawItems = new ArrayList<>();
for (int i = 0; i < items.size(); i++) {
AbstractItem item = items.get(i);
if (item instanceof Divider && columnCount > 1) {
for (int j =... | [
"private",
"List",
"<",
"AbstractItem",
">",
"getRawItems",
"(",
")",
"{",
"if",
"(",
"rawItems",
"==",
"null",
")",
"{",
"rawItems",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"si... | Returns a list, which contains the items of the adapter including placeholders.
@return A list, which contains the items of the adapter including placeholders, as an
instance of the type {@link List} or an empty list, if the adapter contains no items | [
"Returns",
"a",
"list",
"which",
"contains",
"the",
"items",
"of",
"the",
"adapter",
"including",
"placeholders",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L170-L194 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.inflateItemView | private View inflateItemView(@Nullable final ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater
.inflate(style == Style.GRID ? R.layout.grid_item : R.layout.list_item, parent,
false);
ItemViewHolder... | java | private View inflateItemView(@Nullable final ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater
.inflate(style == Style.GRID ? R.layout.grid_item : R.layout.list_item, parent,
false);
ItemViewHolder... | [
"private",
"View",
"inflateItemView",
"(",
"@",
"Nullable",
"final",
"ViewGroup",
"parent",
")",
"{",
"LayoutInflater",
"layoutInflater",
"=",
"LayoutInflater",
".",
"from",
"(",
"context",
")",
";",
"View",
"view",
"=",
"layoutInflater",
".",
"inflate",
"(",
... | Inflates the view, which is used to visualize an item.
@param parent
The parent of the view, which should be inflated, as an instance of the class {@link
ViewGroup} or null, if no parent is available
@return The view, which has been inflated, as an instance of the class {@link View} | [
"Inflates",
"the",
"view",
"which",
"is",
"used",
"to",
"visualize",
"an",
"item",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L228-L238 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.visualizeItem | @SuppressWarnings("PrimitiveArrayArgumentToVariableArgMethod")
private void visualizeItem(@NonNull final Item item, @NonNull final ItemViewHolder viewHolder) {
viewHolder.iconImageView.setVisibility(iconCount > 0 ? View.VISIBLE : View.GONE);
viewHolder.iconImageView.setEnabled(item.isEnabled());
... | java | @SuppressWarnings("PrimitiveArrayArgumentToVariableArgMethod")
private void visualizeItem(@NonNull final Item item, @NonNull final ItemViewHolder viewHolder) {
viewHolder.iconImageView.setVisibility(iconCount > 0 ? View.VISIBLE : View.GONE);
viewHolder.iconImageView.setEnabled(item.isEnabled());
... | [
"@",
"SuppressWarnings",
"(",
"\"PrimitiveArrayArgumentToVariableArgMethod\"",
")",
"private",
"void",
"visualizeItem",
"(",
"@",
"NonNull",
"final",
"Item",
"item",
",",
"@",
"NonNull",
"final",
"ItemViewHolder",
"viewHolder",
")",
"{",
"viewHolder",
".",
"iconImageV... | Visualizes a specific item.
@param item
The item, which should be visualized, as an instance of the class {@link Item}. The
item may not be null
@param viewHolder
The view holder, which contains the views, which should be used to visualize the
item, as an instance of the class {@link ItemViewHolder}. The view holder m... | [
"Visualizes",
"a",
"specific",
"item",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L251-L281 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.inflateDividerView | private View inflateDividerView(@Nullable final ViewGroup parent,
@NonNull final Divider divider, final int position) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.divider, parent, false);
DividerVi... | java | private View inflateDividerView(@Nullable final ViewGroup parent,
@NonNull final Divider divider, final int position) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.divider, parent, false);
DividerVi... | [
"private",
"View",
"inflateDividerView",
"(",
"@",
"Nullable",
"final",
"ViewGroup",
"parent",
",",
"@",
"NonNull",
"final",
"Divider",
"divider",
",",
"final",
"int",
"position",
")",
"{",
"LayoutInflater",
"layoutInflater",
"=",
"LayoutInflater",
".",
"from",
... | Inflates the view, which is used to visualize a divider.
@param parent
The parent of the view, which should be inflated, as an instance of the class {@link
ViewGroup} or null, if no parent is available
@param divider
The divider, which should be visualized, as an instance of the class {@link Divider}.
The divider may ... | [
"Inflates",
"the",
"view",
"which",
"is",
"used",
"to",
"visualize",
"a",
"divider",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L296-L313 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.visualizeDivider | private void visualizeDivider(@NonNull final Divider divider,
@NonNull final DividerViewHolder viewHolder) {
if (!TextUtils.isEmpty(divider.getTitle())) {
viewHolder.titleTextView.setText(divider.getTitle());
viewHolder.titleTextView.setVisibility(View.V... | java | private void visualizeDivider(@NonNull final Divider divider,
@NonNull final DividerViewHolder viewHolder) {
if (!TextUtils.isEmpty(divider.getTitle())) {
viewHolder.titleTextView.setText(divider.getTitle());
viewHolder.titleTextView.setVisibility(View.V... | [
"private",
"void",
"visualizeDivider",
"(",
"@",
"NonNull",
"final",
"Divider",
"divider",
",",
"@",
"NonNull",
"final",
"DividerViewHolder",
"viewHolder",
")",
"{",
"if",
"(",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"divider",
".",
"getTitle",
"(",
")",
")",... | Visualizes a specific divider.
@param divider
The divider, which should be visualized, as an instance of the class {@link Divider}.
The divider may not be null
@param viewHolder
The view holder, which contains the views, which should be used to visualize the
divider, as an instance of the class {@link DividerViewHolde... | [
"Visualizes",
"a",
"specific",
"divider",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L326-L342 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.setStyle | public final void setStyle(@NonNull final Style style) {
Condition.INSTANCE.ensureNotNull(style, "The style may not be null");
this.style = style;
this.rawItems = null;
notifyDataSetChanged();
} | java | public final void setStyle(@NonNull final Style style) {
Condition.INSTANCE.ensureNotNull(style, "The style may not be null");
this.style = style;
this.rawItems = null;
notifyDataSetChanged();
} | [
"public",
"final",
"void",
"setStyle",
"(",
"@",
"NonNull",
"final",
"Style",
"style",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"style",
",",
"\"The style may not be null\"",
")",
";",
"this",
".",
"style",
"=",
"style",
";",
"this"... | Sets the style, which should be used to display the adapter's items.
@param style
The style, which should be set, as a value of the enum {@link Style}. The style may
either be <code>LIST</code>, <code>LIST_COLUMNS</code> or <code>GRID</code> | [
"Sets",
"the",
"style",
"which",
"should",
"be",
"used",
"to",
"display",
"the",
"adapter",
"s",
"items",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L392-L397 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.setWidth | public final void setWidth(final int width) {
if (style == Style.LIST_COLUMNS && (getDeviceType(context) == DeviceType.TABLET ||
getOrientation(context) == Orientation.LANDSCAPE)) {
columnCount = 2;
} else if (style == Style.GRID) {
int padding = context.getResour... | java | public final void setWidth(final int width) {
if (style == Style.LIST_COLUMNS && (getDeviceType(context) == DeviceType.TABLET ||
getOrientation(context) == Orientation.LANDSCAPE)) {
columnCount = 2;
} else if (style == Style.GRID) {
int padding = context.getResour... | [
"public",
"final",
"void",
"setWidth",
"(",
"final",
"int",
"width",
")",
"{",
"if",
"(",
"style",
"==",
"Style",
".",
"LIST_COLUMNS",
"&&",
"(",
"getDeviceType",
"(",
"context",
")",
"==",
"DeviceType",
".",
"TABLET",
"||",
"getOrientation",
"(",
"context... | Sets the width of the bottom sheet, the items, which are displayed by the adapter, belong
to.
@param width
The width, which should be set, as an {@link Integer} value | [
"Sets",
"the",
"width",
"of",
"the",
"bottom",
"sheet",
"the",
"items",
"which",
"are",
"displayed",
"by",
"the",
"adapter",
"belong",
"to",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L406-L426 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.add | public final void add(@NonNull final AbstractItem item) {
Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
items.add(item);
if (item instanceof Item && ((Item) item).getIcon() != null) {
iconCount++;
} else if (item instanceof Divider) {
divide... | java | public final void add(@NonNull final AbstractItem item) {
Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
items.add(item);
if (item instanceof Item && ((Item) item).getIcon() != null) {
iconCount++;
} else if (item instanceof Divider) {
divide... | [
"public",
"final",
"void",
"add",
"(",
"@",
"NonNull",
"final",
"AbstractItem",
"item",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"item",
",",
"\"The item may not be null\"",
")",
";",
"items",
".",
"add",
"(",
"item",
")",
";",
"i... | Adds a new item to the adapter.
@param item
The item, which should be added, as an instance of the class {@link AbstractItem}.
The item may not be null | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"adapter",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L495-L507 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.set | public final void set(final int index, @NonNull final AbstractItem item) {
Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
AbstractItem replacedItem = items.set(index, item);
if (replacedItem instanceof Item && ((Item) replacedItem).getIcon() != null) {
iconCount... | java | public final void set(final int index, @NonNull final AbstractItem item) {
Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
AbstractItem replacedItem = items.set(index, item);
if (replacedItem instanceof Item && ((Item) replacedItem).getIcon() != null) {
iconCount... | [
"public",
"final",
"void",
"set",
"(",
"final",
"int",
"index",
",",
"@",
"NonNull",
"final",
"AbstractItem",
"item",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"item",
",",
"\"The item may not be null\"",
")",
";",
"AbstractItem",
"rep... | Replaces the item with at a specific index
@param index
The index of the item, which should be replaced, as an {@link Integer} value
@param item
The item, which should be set, as an instance of the class {@link AbstractItem}. The
item may not be null | [
"Replaces",
"the",
"item",
"with",
"at",
"a",
"specific",
"index"
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L518-L536 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.remove | public final void remove(final int index) {
AbstractItem removedItem = items.remove(index);
if (removedItem instanceof Item && ((Item) removedItem).getIcon() != null) {
iconCount--;
} else if (removedItem instanceof Divider) {
dividerCount--;
}
rawItems ... | java | public final void remove(final int index) {
AbstractItem removedItem = items.remove(index);
if (removedItem instanceof Item && ((Item) removedItem).getIcon() != null) {
iconCount--;
} else if (removedItem instanceof Divider) {
dividerCount--;
}
rawItems ... | [
"public",
"final",
"void",
"remove",
"(",
"final",
"int",
"index",
")",
"{",
"AbstractItem",
"removedItem",
"=",
"items",
".",
"remove",
"(",
"index",
")",
";",
"if",
"(",
"removedItem",
"instanceof",
"Item",
"&&",
"(",
"(",
"Item",
")",
"removedItem",
"... | Removes the item at a specific index.
@param index
The index of the item, which should be removed, as an {@link Integer} value | [
"Removes",
"the",
"item",
"at",
"a",
"specific",
"index",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L544-L555 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.clear | public final void clear() {
items.clear();
iconCount = 0;
dividerCount = 0;
if (rawItems != null) {
rawItems.clear();
}
notifyOnDataSetChanged();
} | java | public final void clear() {
items.clear();
iconCount = 0;
dividerCount = 0;
if (rawItems != null) {
rawItems.clear();
}
notifyOnDataSetChanged();
} | [
"public",
"final",
"void",
"clear",
"(",
")",
"{",
"items",
".",
"clear",
"(",
")",
";",
"iconCount",
"=",
"0",
";",
"dividerCount",
"=",
"0",
";",
"if",
"(",
"rawItems",
"!=",
"null",
")",
"{",
"rawItems",
".",
"clear",
"(",
")",
";",
"}",
"noti... | Removes all items from the adapter. | [
"Removes",
"all",
"items",
"from",
"the",
"adapter",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L560-L570 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.isItemEnabled | public final boolean isItemEnabled(final int index) {
AbstractItem item = items.get(index);
return item instanceof Item && ((Item) item).isEnabled();
} | java | public final boolean isItemEnabled(final int index) {
AbstractItem item = items.get(index);
return item instanceof Item && ((Item) item).isEnabled();
} | [
"public",
"final",
"boolean",
"isItemEnabled",
"(",
"final",
"int",
"index",
")",
"{",
"AbstractItem",
"item",
"=",
"items",
".",
"get",
"(",
"index",
")",
";",
"return",
"item",
"instanceof",
"Item",
"&&",
"(",
"(",
"Item",
")",
"item",
")",
".",
"isE... | Returns, whether the item at a specific index is enabled, or not.
@param index
The index of the item, which should be checked, as an {@link Integer} value
@return True, if the item is enabled, false otherwise | [
"Returns",
"whether",
"the",
"item",
"at",
"a",
"specific",
"index",
"is",
"enabled",
"or",
"not",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L586-L589 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java | DividableGridAdapter.setItemEnabled | public final void setItemEnabled(final int index, final boolean enabled) {
AbstractItem item = items.get(index);
if (item instanceof Item) {
((Item) item).setEnabled(enabled);
rawItems = null;
notifyOnDataSetChanged();
}
} | java | public final void setItemEnabled(final int index, final boolean enabled) {
AbstractItem item = items.get(index);
if (item instanceof Item) {
((Item) item).setEnabled(enabled);
rawItems = null;
notifyOnDataSetChanged();
}
} | [
"public",
"final",
"void",
"setItemEnabled",
"(",
"final",
"int",
"index",
",",
"final",
"boolean",
"enabled",
")",
"{",
"AbstractItem",
"item",
"=",
"items",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"item",
"instanceof",
"Item",
")",
"{",
"(",
"... | Sets, whether the item at a specific index should be enabled, or not.
@param index
The index of the item as an {@link Integer} value
@param enabled
True, if the item should be enabled, false otherwise | [
"Sets",
"whether",
"the",
"item",
"at",
"a",
"specific",
"index",
"should",
"be",
"enabled",
"or",
"not",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L599-L607 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/model/Divider.java | Divider.setTitle | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
setTitle(context.getText(resourceId));
} | java | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
setTitle(context.getText(resourceId));
} | [
"public",
"final",
"void",
"setTitle",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"StringRes",
"final",
"int",
"resourceId",
")",
"{",
"setTitle",
"(",
"context",
".",
"getText",
"(",
"resourceId",
")",
")",
";",
"}"
] | Sets the divider's title.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the title, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid string resource | [
"Sets",
"the",
"divider",
"s",
"title",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Divider.java#L55-L57 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.isScrollUpEvent | private boolean isScrollUpEvent(final float x, final float y,
@NonNull final ViewGroup viewGroup) {
int location[] = new int[2];
viewGroup.getLocationOnScreen(location);
if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] &&
... | java | private boolean isScrollUpEvent(final float x, final float y,
@NonNull final ViewGroup viewGroup) {
int location[] = new int[2];
viewGroup.getLocationOnScreen(location);
if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] &&
... | [
"private",
"boolean",
"isScrollUpEvent",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"@",
"NonNull",
"final",
"ViewGroup",
"viewGroup",
")",
"{",
"int",
"location",
"[",
"]",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"viewGroup",
".",
"ge... | Returns, whether a touch event at a specific position targets a view, which can be scrolled
up.
@param x
The horizontal position of the touch event in pixels as a {@link Float} value
@param y
The vertical position of the touch event in pixels as a {@link Float} value
@param viewGroup
The view group, which should be us... | [
"Returns",
"whether",
"a",
"touch",
"event",
"at",
"a",
"specific",
"position",
"targets",
"a",
"view",
"which",
"can",
"be",
"scrolled",
"up",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L166-L185 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.handleDrag | private boolean handleDrag() {
if (!isAnimationRunning()) {
if (dragHelper.hasThresholdBeenReached()) {
int margin = Math.round(isMaximized() ? dragHelper.getDragDistance() :
initialMargin + dragHelper.getDragDistance());
margin = Math.max(Math... | java | private boolean handleDrag() {
if (!isAnimationRunning()) {
if (dragHelper.hasThresholdBeenReached()) {
int margin = Math.round(isMaximized() ? dragHelper.getDragDistance() :
initialMargin + dragHelper.getDragDistance());
margin = Math.max(Math... | [
"private",
"boolean",
"handleDrag",
"(",
")",
"{",
"if",
"(",
"!",
"isAnimationRunning",
"(",
")",
")",
"{",
"if",
"(",
"dragHelper",
".",
"hasThresholdBeenReached",
"(",
")",
")",
"{",
"int",
"margin",
"=",
"Math",
".",
"round",
"(",
"isMaximized",
"(",... | Handles when a drag gesture is performed by the user.
@return True, if the view has been moved by the drag gesture, false otherwise | [
"Handles",
"when",
"a",
"drag",
"gesture",
"is",
"performed",
"by",
"the",
"user",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L192-L205 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.handleRelease | private void handleRelease() {
float speed = Math.max(dragHelper.getDragSpeed(), animationSpeed);
if (getTopMargin() > initialMargin ||
(dragHelper.getDragSpeed() > animationSpeed && dragHelper.getDragDistance() > 0) ||
(getDeviceType(getContext()) == DeviceType.TABLET &... | java | private void handleRelease() {
float speed = Math.max(dragHelper.getDragSpeed(), animationSpeed);
if (getTopMargin() > initialMargin ||
(dragHelper.getDragSpeed() > animationSpeed && dragHelper.getDragDistance() > 0) ||
(getDeviceType(getContext()) == DeviceType.TABLET &... | [
"private",
"void",
"handleRelease",
"(",
")",
"{",
"float",
"speed",
"=",
"Math",
".",
"max",
"(",
"dragHelper",
".",
"getDragSpeed",
"(",
")",
",",
"animationSpeed",
")",
";",
"if",
"(",
"getTopMargin",
"(",
")",
">",
"initialMargin",
"||",
"(",
"dragHe... | Handles when a drag gesture has been ended by the user. | [
"Handles",
"when",
"a",
"drag",
"gesture",
"has",
"been",
"ended",
"by",
"the",
"user",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L210-L222 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.setTopMargin | private void setTopMargin(final int margin) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
layoutParams.topMargin = margin;
setLayoutParams(layoutParams);
} | java | private void setTopMargin(final int margin) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
layoutParams.topMargin = margin;
setLayoutParams(layoutParams);
} | [
"private",
"void",
"setTopMargin",
"(",
"final",
"int",
"margin",
")",
"{",
"FrameLayout",
".",
"LayoutParams",
"layoutParams",
"=",
"(",
"FrameLayout",
".",
"LayoutParams",
")",
"getLayoutParams",
"(",
")",
";",
"layoutParams",
".",
"topMargin",
"=",
"margin",
... | Set the top margin of the view.
@param margin
The top margin, which should be set, in pixels as an {@link Integer} value | [
"Set",
"the",
"top",
"margin",
"of",
"the",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L240-L244 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.animateShowView | private void animateShowView(final int diff, final float animationSpeed,
@NonNull final Interpolator interpolator) {
animateView(diff, animationSpeed, createAnimationListener(true, false), interpolator);
} | java | private void animateShowView(final int diff, final float animationSpeed,
@NonNull final Interpolator interpolator) {
animateView(diff, animationSpeed, createAnimationListener(true, false), interpolator);
} | [
"private",
"void",
"animateShowView",
"(",
"final",
"int",
"diff",
",",
"final",
"float",
"animationSpeed",
",",
"@",
"NonNull",
"final",
"Interpolator",
"interpolator",
")",
"{",
"animateView",
"(",
"diff",
",",
"animationSpeed",
",",
"createAnimationListener",
"... | Animates the view to become show.
@param diff
The distance the view has to be vertically moved by, as an {@link Integer} value
@param animationSpeed
The speed of the animation in pixels per milliseconds as a {@link Float} value
@param interpolator
The interpolator, which should be used by the animation, as an instance... | [
"Animates",
"the",
"view",
"to",
"become",
"show",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L257-L260 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.animateHideView | private void animateHideView(final int diff, final float animationSpeed,
@NonNull final Interpolator interpolator, final boolean cancel) {
animateView(diff, animationSpeed, createAnimationListener(false, cancel), interpolator);
} | java | private void animateHideView(final int diff, final float animationSpeed,
@NonNull final Interpolator interpolator, final boolean cancel) {
animateView(diff, animationSpeed, createAnimationListener(false, cancel), interpolator);
} | [
"private",
"void",
"animateHideView",
"(",
"final",
"int",
"diff",
",",
"final",
"float",
"animationSpeed",
",",
"@",
"NonNull",
"final",
"Interpolator",
"interpolator",
",",
"final",
"boolean",
"cancel",
")",
"{",
"animateView",
"(",
"diff",
",",
"animationSpee... | Animates the view to become hidden.
@param diff
The distance the view has to be vertically moved by, as an {@link Integer} value
@param animationSpeed
The speed of the animation in pixels per milliseconds as a {@link Float} value
@param interpolator
The interpolator, which should be used by the animation, as an instan... | [
"Animates",
"the",
"view",
"to",
"become",
"hidden",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L275-L278 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.animateView | private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimat... | java | private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimat... | [
"private",
"void",
"animateView",
"(",
"final",
"int",
"diff",
",",
"final",
"float",
"animationSpeed",
",",
"@",
"NonNull",
"final",
"AnimationListener",
"animationListener",
",",
"@",
"NonNull",
"final",
"Interpolator",
"interpolator",
")",
"{",
"if",
"(",
"!"... | Animates the view to become shown or hidden.
@param diff
The distance the view has to be vertically moved by, as an {@link Integer} value
@param animationSpeed
The speed of the animation in pixels per millisecond as a {@link Float} value
@param animationListener
The listener, which should be notified about the animati... | [
"Animates",
"the",
"view",
"to",
"become",
"shown",
"or",
"hidden",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L294-L304 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.createAnimationListener | private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
return new AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}
@Override
public void onAnimationEnd(final Animation... | java | private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
return new AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}
@Override
public void onAnimationEnd(final Animation... | [
"private",
"AnimationListener",
"createAnimationListener",
"(",
"final",
"boolean",
"show",
",",
"final",
"boolean",
"cancel",
")",
"{",
"return",
"new",
"AnimationListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onAnimationStart",
"(",
"final",
"Anim... | Creates and returns a listener, which allows to handle the end of an animation, which has
been used to show or hide the view.
@param show
True, if the view should be shown at the end of the animation, false otherwise
@param cancel
True, if the view should be canceled, false otherwise
@return The listener, which has be... | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"handle",
"the",
"end",
"of",
"an",
"animation",
"which",
"has",
"been",
"used",
"to",
"show",
"or",
"hide",
"the",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L331-L357 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java | Item.setIcon | public final void setIcon(@NonNull final Context context, @DrawableRes final int resourceId) {
setIcon(ContextCompat.getDrawable(context, resourceId));
} | java | public final void setIcon(@NonNull final Context context, @DrawableRes final int resourceId) {
setIcon(ContextCompat.getDrawable(context, resourceId));
} | [
"public",
"final",
"void",
"setIcon",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"DrawableRes",
"final",
"int",
"resourceId",
")",
"{",
"setIcon",
"(",
"ContextCompat",
".",
"getDrawable",
"(",
"context",
",",
"resourceId",
")",
")",
";",
... | Sets the item's icon.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the icon, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid drawable resource | [
"Sets",
"the",
"item",
"s",
"icon",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java#L113-L115 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java | Item.setTitle | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
setTitle(context.getText(resourceId));
} | java | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
setTitle(context.getText(resourceId));
} | [
"public",
"final",
"void",
"setTitle",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"StringRes",
"final",
"int",
"resourceId",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"context",
",",
"\"The context may not be null\"",
... | Sets the title of the item.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the title, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid string resource | [
"Sets",
"the",
"title",
"of",
"the",
"item",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java#L146-L149 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.initialize | private void initialize() {
width = getContext().getResources().getDimensionPixelSize(R.dimen.default_width);
maximize = false;
adapter = new DividableGridAdapter(getContext(), Style.LIST, width);
super.setOnShowListener(createOnShowListener());
} | java | private void initialize() {
width = getContext().getResources().getDimensionPixelSize(R.dimen.default_width);
maximize = false;
adapter = new DividableGridAdapter(getContext(), Style.LIST, width);
super.setOnShowListener(createOnShowListener());
} | [
"private",
"void",
"initialize",
"(",
")",
"{",
"width",
"=",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getDimensionPixelSize",
"(",
"R",
".",
"dimen",
".",
"default_width",
")",
";",
"maximize",
"=",
"false",
";",
"adapter",
"=",
"new... | Initializes the bottom sheet. | [
"Initializes",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1144-L1149 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createLayoutParams | private WindowManager.LayoutParams createLayoutParams() {
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
return layoutParams;
} | java | private WindowManager.LayoutParams createLayoutParams() {
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
return layoutParams;
} | [
"private",
"WindowManager",
".",
"LayoutParams",
"createLayoutParams",
"(",
")",
"{",
"WindowManager",
".",
"LayoutParams",
"layoutParams",
"=",
"getWindow",
"(",
")",
".",
"getAttributes",
"(",
")",
";",
"layoutParams",
".",
"width",
"=",
"ViewGroup",
".",
"Lay... | Creates and returns the layout params, which should be used to show the bottom sheet.
@return The layout params, which have been created, as an instance of the class {@link
android.view.WindowManager.LayoutParams} | [
"Creates",
"and",
"returns",
"the",
"layout",
"params",
"which",
"should",
"be",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1157-L1162 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createRootViewLayoutParams | private FrameLayout.LayoutParams createRootViewLayoutParams() {
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.BOTTOM | Gravity.CENT... | java | private FrameLayout.LayoutParams createRootViewLayoutParams() {
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.BOTTOM | Gravity.CENT... | [
"private",
"FrameLayout",
".",
"LayoutParams",
"createRootViewLayoutParams",
"(",
")",
"{",
"FrameLayout",
".",
"LayoutParams",
"layoutParams",
"=",
"new",
"FrameLayout",
".",
"LayoutParams",
"(",
"FrameLayout",
".",
"LayoutParams",
".",
"MATCH_PARENT",
",",
"FrameLay... | Creates and returns the layout params, which should be used to show the bottom sheet's root
view.
@return The layout params, which have been created, as an instance of the class {@link
android.widget.FrameLayout.LayoutParams } | [
"Creates",
"and",
"returns",
"the",
"layout",
"params",
"which",
"should",
"be",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"s",
"root",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1171-L1177 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.inflateRootView | private void inflateRootView() {
ViewGroup contentView = findViewById(android.R.id.content);
contentView.removeAllViews();
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
rootView =
(DraggableView) layoutInflater.inflate(R.layout.bottom_sheet, contentVi... | java | private void inflateRootView() {
ViewGroup contentView = findViewById(android.R.id.content);
contentView.removeAllViews();
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
rootView =
(DraggableView) layoutInflater.inflate(R.layout.bottom_sheet, contentVi... | [
"private",
"void",
"inflateRootView",
"(",
")",
"{",
"ViewGroup",
"contentView",
"=",
"findViewById",
"(",
"android",
".",
"R",
".",
"id",
".",
"content",
")",
";",
"contentView",
".",
"removeAllViews",
"(",
")",
";",
"LayoutInflater",
"layoutInflater",
"=",
... | Initializes the bottom sheet's root view. | [
"Initializes",
"the",
"bottom",
"sheet",
"s",
"root",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1182-L1190 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.inflateTitleView | private void inflateTitleView() {
titleContainer = rootView.findViewById(R.id.title_container);
titleContainer.removeAllViews();
if (customTitleView != null) {
titleContainer.addView(customTitleView);
} else if (customTitleViewId != -1) {
LayoutInflater layoutInf... | java | private void inflateTitleView() {
titleContainer = rootView.findViewById(R.id.title_container);
titleContainer.removeAllViews();
if (customTitleView != null) {
titleContainer.addView(customTitleView);
} else if (customTitleViewId != -1) {
LayoutInflater layoutInf... | [
"private",
"void",
"inflateTitleView",
"(",
")",
"{",
"titleContainer",
"=",
"rootView",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"title_container",
")",
";",
"titleContainer",
".",
"removeAllViews",
"(",
")",
";",
"if",
"(",
"customTitleView",
"!=",
"... | Inflates the layout, which is used to show the bottom sheet's title. The layout may either be
the default one or a custom view, if one has been set before. | [
"Inflates",
"the",
"layout",
"which",
"is",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"s",
"title",
".",
"The",
"layout",
"may",
"either",
"be",
"the",
"default",
"one",
"or",
"a",
"custom",
"view",
"if",
"one",
"has",
"been",
"set",
"before",
".... | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1196-L1224 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.inflateContentView | private void inflateContentView() {
contentContainer = rootView.findViewById(R.id.content_container);
contentContainer.removeAllViews();
if (customView != null) {
contentContainer.setVisibility(View.VISIBLE);
contentContainer.addView(customView);
} else if (custo... | java | private void inflateContentView() {
contentContainer = rootView.findViewById(R.id.content_container);
contentContainer.removeAllViews();
if (customView != null) {
contentContainer.setVisibility(View.VISIBLE);
contentContainer.addView(customView);
} else if (custo... | [
"private",
"void",
"inflateContentView",
"(",
")",
"{",
"contentContainer",
"=",
"rootView",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"content_container",
")",
";",
"contentContainer",
".",
"removeAllViews",
"(",
")",
";",
"if",
"(",
"customView",
"!=",
... | Inflates the layout, which is used to show the bottom sheet's content. The layout may either
be the default one or a custom view, if one has been set before. | [
"Inflates",
"the",
"layout",
"which",
"is",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"s",
"content",
".",
"The",
"layout",
"may",
"either",
"be",
"the",
"default",
"one",
"or",
"a",
"custom",
"view",
"if",
"one",
"has",
"been",
"set",
"before",
... | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1230-L1250 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.showGridView | private void showGridView() {
gridView = contentContainer.findViewById(R.id.bottom_sheet_grid_view);
if (gridView != null) {
contentContainer.setVisibility(View.VISIBLE);
if (getStyle() == Style.GRID) {
int horizontalPadding = getContext().getResources()
... | java | private void showGridView() {
gridView = contentContainer.findViewById(R.id.bottom_sheet_grid_view);
if (gridView != null) {
contentContainer.setVisibility(View.VISIBLE);
if (getStyle() == Style.GRID) {
int horizontalPadding = getContext().getResources()
... | [
"private",
"void",
"showGridView",
"(",
")",
"{",
"gridView",
"=",
"contentContainer",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"bottom_sheet_grid_view",
")",
";",
"if",
"(",
"gridView",
"!=",
"null",
")",
"{",
"contentContainer",
".",
"setVisibility",
... | Shows the grid view, which is used to show the bottom sheet's items. | [
"Shows",
"the",
"grid",
"view",
"which",
"is",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"s",
"items",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1255-L1284 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.adaptRootView | private void adaptRootView() {
if (rootView != null) {
if (getStyle() == Style.LIST) {
int paddingTop = getContext().getResources()
.getDimensionPixelSize(R.dimen.bottom_sheet_list_padding_top);
rootView.setPadding(0, paddingTop, 0, 0);
... | java | private void adaptRootView() {
if (rootView != null) {
if (getStyle() == Style.LIST) {
int paddingTop = getContext().getResources()
.getDimensionPixelSize(R.dimen.bottom_sheet_list_padding_top);
rootView.setPadding(0, paddingTop, 0, 0);
... | [
"private",
"void",
"adaptRootView",
"(",
")",
"{",
"if",
"(",
"rootView",
"!=",
"null",
")",
"{",
"if",
"(",
"getStyle",
"(",
")",
"==",
"Style",
".",
"LIST",
")",
"{",
"int",
"paddingTop",
"=",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
... | Adapts the root view. | [
"Adapts",
"the",
"root",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1298-L1310 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.adaptIcon | private void adaptIcon() {
if (titleTextView != null) {
titleTextView.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
}
adaptTitleContainerVisibility();
} | java | private void adaptIcon() {
if (titleTextView != null) {
titleTextView.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
}
adaptTitleContainerVisibility();
} | [
"private",
"void",
"adaptIcon",
"(",
")",
"{",
"if",
"(",
"titleTextView",
"!=",
"null",
")",
"{",
"titleTextView",
".",
"setCompoundDrawablesWithIntrinsicBounds",
"(",
"icon",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"adaptTitleContainerVisibility"... | Adapts the bottom sheet's icon. | [
"Adapts",
"the",
"bottom",
"sheet",
"s",
"icon",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1347-L1353 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.adaptTitleContainerVisibility | private void adaptTitleContainerVisibility() {
if (titleContainer != null) {
if (customTitleView == null && customTitleViewId == -1) {
titleContainer.setVisibility(
!TextUtils.isEmpty(title) || icon != null ? View.VISIBLE : View.GONE);
} else {
... | java | private void adaptTitleContainerVisibility() {
if (titleContainer != null) {
if (customTitleView == null && customTitleViewId == -1) {
titleContainer.setVisibility(
!TextUtils.isEmpty(title) || icon != null ? View.VISIBLE : View.GONE);
} else {
... | [
"private",
"void",
"adaptTitleContainerVisibility",
"(",
")",
"{",
"if",
"(",
"titleContainer",
"!=",
"null",
")",
"{",
"if",
"(",
"customTitleView",
"==",
"null",
"&&",
"customTitleViewId",
"==",
"-",
"1",
")",
"{",
"titleContainer",
".",
"setVisibility",
"("... | Adapts the visibility of the layout, which is used to show the bottom sheet's title. | [
"Adapts",
"the",
"visibility",
"of",
"the",
"layout",
"which",
"is",
"used",
"to",
"show",
"the",
"bottom",
"sheet",
"s",
"title",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1358-L1367 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.adaptWidth | private void adaptWidth() {
adapter.setWidth(width);
if (rootView != null) {
rootView.setWidth(width);
rootView.requestLayout();
}
} | java | private void adaptWidth() {
adapter.setWidth(width);
if (rootView != null) {
rootView.setWidth(width);
rootView.requestLayout();
}
} | [
"private",
"void",
"adaptWidth",
"(",
")",
"{",
"adapter",
".",
"setWidth",
"(",
"width",
")",
";",
"if",
"(",
"rootView",
"!=",
"null",
")",
"{",
"rootView",
".",
"setWidth",
"(",
"width",
")",
";",
"rootView",
".",
"requestLayout",
"(",
")",
";",
"... | Adapts the width of the bottom sheet. | [
"Adapts",
"the",
"width",
"of",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1390-L1397 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createOnShowListener | @TargetApi(VERSION_CODES.FROYO)
private OnShowListener createOnShowListener() {
return new OnShowListener() {
@Override
public void onShow(final DialogInterface dialog) {
if (onShowListener != null) {
onShowListener.onShow(dialog);
... | java | @TargetApi(VERSION_CODES.FROYO)
private OnShowListener createOnShowListener() {
return new OnShowListener() {
@Override
public void onShow(final DialogInterface dialog) {
if (onShowListener != null) {
onShowListener.onShow(dialog);
... | [
"@",
"TargetApi",
"(",
"VERSION_CODES",
".",
"FROYO",
")",
"private",
"OnShowListener",
"createOnShowListener",
"(",
")",
"{",
"return",
"new",
"OnShowListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onShow",
"(",
"final",
"DialogInterface",
"dialog... | Creates and returns a listener, which allows to immediately maximize the bottom sheet after
it has been shown.
@return The listener, which has been created, as an instance of the type {@link
OnShowListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"immediately",
"maximize",
"the",
"bottom",
"sheet",
"after",
"it",
"has",
"been",
"shown",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1415-L1432 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createCancelOnTouchListener | private View.OnTouchListener createCancelOnTouchListener() {
return new View.OnTouchListener() {
@Override
public boolean onTouch(final View v, final MotionEvent event) {
if (cancelable && canceledOnTouchOutside) {
cancel();
v.perf... | java | private View.OnTouchListener createCancelOnTouchListener() {
return new View.OnTouchListener() {
@Override
public boolean onTouch(final View v, final MotionEvent event) {
if (cancelable && canceledOnTouchOutside) {
cancel();
v.perf... | [
"private",
"View",
".",
"OnTouchListener",
"createCancelOnTouchListener",
"(",
")",
"{",
"return",
"new",
"View",
".",
"OnTouchListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onTouch",
"(",
"final",
"View",
"v",
",",
"final",
"MotionEvent",
"e... | Creates and returns a listener, which allows to cancel the bottom sheet, when the decor view
is touched.
@return The listener, which has been created, as an instance of the type {@link
View.OnTouchListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"cancel",
"the",
"bottom",
"sheet",
"when",
"the",
"decor",
"view",
"is",
"touched",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1441-L1456 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createItemClickListener | private OnItemClickListener createItemClickListener() {
return new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> parent, final View view,
final int position, final long id) {
if (itemClickListener != nu... | java | private OnItemClickListener createItemClickListener() {
return new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> parent, final View view,
final int position, final long id) {
if (itemClickListener != nu... | [
"private",
"OnItemClickListener",
"createItemClickListener",
"(",
")",
"{",
"return",
"new",
"OnItemClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onItemClick",
"(",
"final",
"AdapterView",
"<",
"?",
">",
"parent",
",",
"final",
"View",
"view... | Creates and returns a listener, which allows to observe when the items of a bottom sheet have
been clicked.
@return The listener, which has been created, as an instance of the type {@link
OnItemClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"observe",
"when",
"the",
"items",
"of",
"a",
"bottom",
"sheet",
"have",
"been",
"clicked",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1478-L1505 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createItemLongClickListener | private OnItemLongClickListener createItemLongClickListener() {
return new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(final AdapterView<?> parent, final View view,
final int position, final long id) {
... | java | private OnItemLongClickListener createItemLongClickListener() {
return new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(final AdapterView<?> parent, final View view,
final int position, final long id) {
... | [
"private",
"OnItemLongClickListener",
"createItemLongClickListener",
"(",
")",
"{",
"return",
"new",
"OnItemLongClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onItemLongClick",
"(",
"final",
"AdapterView",
"<",
"?",
">",
"parent",
",",
"final"... | Creates and returns a listener, which allows to observe when the items of a bottom sheet have
been long-clicked.
@return The listener, which has been created, as an instance of the type {qlink
OnItemLongClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"observe",
"when",
"the",
"items",
"of",
"a",
"bottom",
"sheet",
"have",
"been",
"long",
"-",
"clicked",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1514-L1543 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.createIntentClickListener | private OnItemClickListener createIntentClickListener(@NonNull final Activity activity,
@NonNull final Intent intent,
@NonNull final List<ResolveInfo> resolveInfos) {
return new OnItemClickListene... | java | private OnItemClickListener createIntentClickListener(@NonNull final Activity activity,
@NonNull final Intent intent,
@NonNull final List<ResolveInfo> resolveInfos) {
return new OnItemClickListene... | [
"private",
"OnItemClickListener",
"createIntentClickListener",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"final",
"Intent",
"intent",
",",
"@",
"NonNull",
"final",
"List",
"<",
"ResolveInfo",
">",
"resolveInfos",
")",
"{",
"return"... | Creates and returns a listener, which allows to start an app, when an item of the bottom
sheet has been clicked.
@param activity
The activity, the bottom sheet belongs to, as an instance of the class {@link
Activity}. The activity may not be null
@param intent
The intent, which should be passed to the started app, as ... | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"start",
"an",
"app",
"when",
"an",
"item",
"of",
"the",
"bottom",
"sheet",
"has",
"been",
"clicked",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1562-L1582 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.getGridView | public final GridView getGridView() {
return (gridView != null && gridView.getVisibility() == View.VISIBLE) ? gridView : null;
} | java | public final GridView getGridView() {
return (gridView != null && gridView.getVisibility() == View.VISIBLE) ? gridView : null;
} | [
"public",
"final",
"GridView",
"getGridView",
"(",
")",
"{",
"return",
"(",
"gridView",
"!=",
"null",
"&&",
"gridView",
".",
"getVisibility",
"(",
")",
"==",
"View",
".",
"VISIBLE",
")",
"?",
"gridView",
":",
"null",
";",
"}"
] | Returns the grid view, which is contained by the bottom sheet.
@return The grid view, which is contained by the bottom sheet, as an instance of the class
{@link GridView} or null, if the bottom sheet does not show any items or has not been shown
yet | [
"Returns",
"the",
"grid",
"view",
"which",
"is",
"contained",
"by",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1652-L1654 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setIcon | public final void setIcon(@DrawableRes final int resourceId) {
this.icon = ContextCompat.getDrawable(getContext(), resourceId);
this.iconBitmap = null;
this.iconId = resourceId;
this.iconAttributeId = -1;
adaptIcon();
} | java | public final void setIcon(@DrawableRes final int resourceId) {
this.icon = ContextCompat.getDrawable(getContext(), resourceId);
this.iconBitmap = null;
this.iconId = resourceId;
this.iconAttributeId = -1;
adaptIcon();
} | [
"public",
"final",
"void",
"setIcon",
"(",
"@",
"DrawableRes",
"final",
"int",
"resourceId",
")",
"{",
"this",
".",
"icon",
"=",
"ContextCompat",
".",
"getDrawable",
"(",
"getContext",
"(",
")",
",",
"resourceId",
")",
";",
"this",
".",
"iconBitmap",
"=",
... | Sets the icon of the bottom sheet.
@param resourceId
The resource id of the icon, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid drawable resource | [
"Sets",
"the",
"icon",
"of",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1698-L1704 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setIconAttribute | public final void setIconAttribute(@AttrRes final int attributeId) {
TypedArray typedArray =
getContext().getTheme().obtainStyledAttributes(new int[]{attributeId});
this.icon = typedArray.getDrawable(0);
this.iconBitmap = null;
this.iconId = -1;
this.iconAttribute... | java | public final void setIconAttribute(@AttrRes final int attributeId) {
TypedArray typedArray =
getContext().getTheme().obtainStyledAttributes(new int[]{attributeId});
this.icon = typedArray.getDrawable(0);
this.iconBitmap = null;
this.iconId = -1;
this.iconAttribute... | [
"public",
"final",
"void",
"setIconAttribute",
"(",
"@",
"AttrRes",
"final",
"int",
"attributeId",
")",
"{",
"TypedArray",
"typedArray",
"=",
"getContext",
"(",
")",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"new",
"int",
"[",
"]",
"{",
... | Set the icon of the bottom sheet.
@param attributeId
The id of the theme attribute, which supplies the icon, which should be set, as an
{@link Integer} value. The id must point to a valid drawable resource | [
"Set",
"the",
"icon",
"of",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1713-L1721 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setBackgroundColor | public final void setBackgroundColor(@ColorInt final int color) {
this.background = new ColorDrawable(color);
this.backgroundBitmap = null;
this.backgroundId = -1;
this.backgroundColor = color;
adaptBackground();
} | java | public final void setBackgroundColor(@ColorInt final int color) {
this.background = new ColorDrawable(color);
this.backgroundBitmap = null;
this.backgroundId = -1;
this.backgroundColor = color;
adaptBackground();
} | [
"public",
"final",
"void",
"setBackgroundColor",
"(",
"@",
"ColorInt",
"final",
"int",
"color",
")",
"{",
"this",
".",
"background",
"=",
"new",
"ColorDrawable",
"(",
"color",
")",
";",
"this",
".",
"backgroundBitmap",
"=",
"null",
";",
"this",
".",
"backg... | Sets the background color of the bottom sheet.
@param color
The background color, which should be set, as an {@link Integer} value or -1, if no
custom background color should be set | [
"Sets",
"the",
"background",
"color",
"of",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1835-L1841 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setDragSensitivity | public final void setDragSensitivity(final float dragSensitivity) {
Condition.INSTANCE
.ensureAtLeast(dragSensitivity, 0, "The drag sensitivity must be at least 0");
Condition.INSTANCE
.ensureAtMaximum(dragSensitivity, 1, "The drag sensitivity must be at maximum 1");
... | java | public final void setDragSensitivity(final float dragSensitivity) {
Condition.INSTANCE
.ensureAtLeast(dragSensitivity, 0, "The drag sensitivity must be at least 0");
Condition.INSTANCE
.ensureAtMaximum(dragSensitivity, 1, "The drag sensitivity must be at maximum 1");
... | [
"public",
"final",
"void",
"setDragSensitivity",
"(",
"final",
"float",
"dragSensitivity",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureAtLeast",
"(",
"dragSensitivity",
",",
"0",
",",
"\"The drag sensitivity must be at least 0\"",
")",
";",
"Condition",
".",
... | Sets the sensitivity, which specifies the distance after which dragging has an effect on the
bottom sheet, in relation to an internal value range.
@param dragSensitivity
The drag sensitivity, which should be set, as a {@link Float} value. The drag
sensitivity must be at lest 0 and at maximum 1 | [
"Sets",
"the",
"sensitivity",
"which",
"specifies",
"the",
"distance",
"after",
"which",
"dragging",
"has",
"an",
"effect",
"on",
"the",
"bottom",
"sheet",
"in",
"relation",
"to",
"an",
"internal",
"value",
"range",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1915-L1922 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setDimAmount | public final void setDimAmount(final float dimAmount) {
Condition.INSTANCE.ensureAtLeast(dimAmount, 0, "The dim amount must be at least 0");
Condition.INSTANCE.ensureAtMaximum(dimAmount, 1, "The dim amount must be at maximum 1");
this.dimAmount = dimAmount;
getWindow().getAttributes().di... | java | public final void setDimAmount(final float dimAmount) {
Condition.INSTANCE.ensureAtLeast(dimAmount, 0, "The dim amount must be at least 0");
Condition.INSTANCE.ensureAtMaximum(dimAmount, 1, "The dim amount must be at maximum 1");
this.dimAmount = dimAmount;
getWindow().getAttributes().di... | [
"public",
"final",
"void",
"setDimAmount",
"(",
"final",
"float",
"dimAmount",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureAtLeast",
"(",
"dimAmount",
",",
"0",
",",
"\"The dim amount must be at least 0\"",
")",
";",
"Condition",
".",
"INSTANCE",
".",
"e... | Sets the dim amount, which should be used to darken the area outside the bottom sheet.
@param dimAmount
The dim amount, which should be set, as a {@link Float} value. The dim amount must be
at least 0 (fully transparent) and at maximum 1 (fully opaque) | [
"Sets",
"the",
"dim",
"amount",
"which",
"should",
"be",
"used",
"to",
"darken",
"the",
"area",
"outside",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L1941-L1946 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.indexOf | public final int indexOf(final int id) {
Condition.INSTANCE.ensureAtLeast(id, 0, "The id must be at least 0");
for (int i = 0; i < getItemCount(); i++) {
AbstractItem item = adapter.getItem(i);
if (item.getId() == id) {
return i;
}
}
... | java | public final int indexOf(final int id) {
Condition.INSTANCE.ensureAtLeast(id, 0, "The id must be at least 0");
for (int i = 0; i < getItemCount(); i++) {
AbstractItem item = adapter.getItem(i);
if (item.getId() == id) {
return i;
}
}
... | [
"public",
"final",
"int",
"indexOf",
"(",
"final",
"int",
"id",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureAtLeast",
"(",
"id",
",",
"0",
",",
"\"The id must be at least 0\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getItem... | Returns the index of the item, which corresponds to a specific id.
@param id
The id of the item, whose index should be returned, as an {@link Integer} value. The
id must be at least 0
@return The index of the item, which corresponds to the given id, or -1, if no item, which
corresponds to the given id, is contained by... | [
"Returns",
"the",
"index",
"of",
"the",
"item",
"which",
"corresponds",
"to",
"a",
"specific",
"id",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2255-L2267 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setIntent | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManage... | java | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManage... | [
"public",
"final",
"void",
"setIntent",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"final",
"Intent",
"intent",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"activity",
",",
"\"The activity may not be null\"",
... | Adds the apps, which are able to handle a specific intent, as items to the bottom sheet. This
causes all previously added items to be removed. When an item is clicked, the corresponding
app is started.
@param activity
The activity, the bottom sheet belongs to, as an instance of the class {@link
Activity}. The activity... | [
"Adds",
"the",
"apps",
"which",
"are",
"able",
"to",
"handle",
"a",
"specific",
"intent",
"as",
"items",
"to",
"the",
"bottom",
"sheet",
".",
"This",
"causes",
"all",
"previously",
"added",
"items",
"to",
"be",
"removed",
".",
"When",
"an",
"item",
"is",... | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2315-L2329 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.maximize | @TargetApi(VERSION_CODES.FROYO)
public final void maximize() {
if (!isMaximized()) {
if (!isShowing()) {
maximize = true;
show();
} else {
rootView.maximize(new AccelerateDecelerateInterpolator());
}
}
} | java | @TargetApi(VERSION_CODES.FROYO)
public final void maximize() {
if (!isMaximized()) {
if (!isShowing()) {
maximize = true;
show();
} else {
rootView.maximize(new AccelerateDecelerateInterpolator());
}
}
} | [
"@",
"TargetApi",
"(",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"final",
"void",
"maximize",
"(",
")",
"{",
"if",
"(",
"!",
"isMaximized",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isShowing",
"(",
")",
")",
"{",
"maximize",
"=",
"true",
";",
"show... | Maximizes the bottom sheet. | [
"Maximizes",
"the",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2363-L2373 | train |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setStyle | public final void setStyle(@NonNull final Style style) {
Condition.INSTANCE.ensureNotNull(style, "The style may not be null");
adapter.setStyle(style);
adaptRootView();
adaptTitleView();
adaptContentView();
adaptGridViewHeight();
} | java | public final void setStyle(@NonNull final Style style) {
Condition.INSTANCE.ensureNotNull(style, "The style may not be null");
adapter.setStyle(style);
adaptRootView();
adaptTitleView();
adaptContentView();
adaptGridViewHeight();
} | [
"public",
"final",
"void",
"setStyle",
"(",
"@",
"NonNull",
"final",
"Style",
"style",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"style",
",",
"\"The style may not be null\"",
")",
";",
"adapter",
".",
"setStyle",
"(",
"style",
")",
... | Sets the style, which should be used to display the bottom sheet's items.
@param style
The style, which should be set, as a value of the enum {@link Style}. The style may
either be <code>LIST</code>, <code>LIST_COLUMNS</code> or <code>GRID</code> | [
"Sets",
"the",
"style",
"which",
"should",
"be",
"used",
"to",
"display",
"the",
"bottom",
"sheet",
"s",
"items",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2392-L2399 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeBottomSheet | private void initializeBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
addItems(builder);
bottomSheet = builder.create();
} | java | private void initializeBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
addItems(builder);
bottomSheet = builder.create();
} | [
"private",
"void",
"initializeBottomSheet",
"(",
")",
"{",
"BottomSheet",
".",
"Builder",
"builder",
"=",
"createBottomSheetBuilder",
"(",
")",
";",
"addItems",
"(",
"builder",
")",
";",
"bottomSheet",
"=",
"builder",
".",
"create",
"(",
")",
";",
"}"
] | Initializes the regular bottom sheet containing list items. | [
"Initializes",
"the",
"regular",
"bottom",
"sheet",
"containing",
"list",
"items",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L92-L96 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeCustomBottomSheet | private void initializeCustomBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
builder.setView(R.layout.custom_view);
customBottomSheet = builder.create();
} | java | private void initializeCustomBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
builder.setView(R.layout.custom_view);
customBottomSheet = builder.create();
} | [
"private",
"void",
"initializeCustomBottomSheet",
"(",
")",
"{",
"BottomSheet",
".",
"Builder",
"builder",
"=",
"createBottomSheetBuilder",
"(",
")",
";",
"builder",
".",
"setView",
"(",
"R",
".",
"layout",
".",
"custom_view",
")",
";",
"customBottomSheet",
"=",... | Initializes the bottom sheet containing a custom view. | [
"Initializes",
"the",
"bottom",
"sheet",
"containing",
"a",
"custom",
"view",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L101-L105 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeIntentBottomSheet | private void initializeIntentBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
intent.setType("text/plain");
builder... | java | private void initializeIntentBottomSheet() {
BottomSheet.Builder builder = createBottomSheetBuilder();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
intent.setType("text/plain");
builder... | [
"private",
"void",
"initializeIntentBottomSheet",
"(",
")",
"{",
"BottomSheet",
".",
"Builder",
"builder",
"=",
"createBottomSheetBuilder",
"(",
")",
";",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setAction",
"(",
"Intent",
".",
... | Initializes the bottom sheet containing possible receivers for an intent. | [
"Initializes",
"the",
"bottom",
"sheet",
"containing",
"possible",
"receivers",
"for",
"an",
"intent",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L110-L118 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeShowBottomSheetPreference | private void initializeShowBottomSheetPreference() {
Preference showBottomSheetPreference =
findPreference(getString(R.string.show_bottom_sheet_preference_key));
showBottomSheetPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
pu... | java | private void initializeShowBottomSheetPreference() {
Preference showBottomSheetPreference =
findPreference(getString(R.string.show_bottom_sheet_preference_key));
showBottomSheetPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
pu... | [
"private",
"void",
"initializeShowBottomSheetPreference",
"(",
")",
"{",
"Preference",
"showBottomSheetPreference",
"=",
"findPreference",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"show_bottom_sheet_preference_key",
")",
")",
";",
"showBottomSheetPreference",
".",
... | Initializes the preference, which allows to show a bottom sheet. | [
"Initializes",
"the",
"preference",
"which",
"allows",
"to",
"show",
"a",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L150-L163 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeShowCustomBottomSheetPreference | private void initializeShowCustomBottomSheetPreference() {
Preference showCustomBottomSheetPreference =
findPreference(getString(R.string.show_custom_bottom_sheet_preference_key));
showCustomBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener... | java | private void initializeShowCustomBottomSheetPreference() {
Preference showCustomBottomSheetPreference =
findPreference(getString(R.string.show_custom_bottom_sheet_preference_key));
showCustomBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener... | [
"private",
"void",
"initializeShowCustomBottomSheetPreference",
"(",
")",
"{",
"Preference",
"showCustomBottomSheetPreference",
"=",
"findPreference",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"show_custom_bottom_sheet_preference_key",
")",
")",
";",
"showCustomBottom... | Initializes the preference, which allows to show a bottom sheet with custom content. | [
"Initializes",
"the",
"preference",
"which",
"allows",
"to",
"show",
"a",
"bottom",
"sheet",
"with",
"custom",
"content",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L168-L182 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.initializeShowIntentBottmSheetPreference | private void initializeShowIntentBottmSheetPreference() {
Preference showIntentBottomSheetPreference =
findPreference(getString(R.string.show_intent_bottom_sheet_preference_key));
showIntentBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener(... | java | private void initializeShowIntentBottmSheetPreference() {
Preference showIntentBottomSheetPreference =
findPreference(getString(R.string.show_intent_bottom_sheet_preference_key));
showIntentBottomSheetPreference
.setOnPreferenceClickListener(new OnPreferenceClickListener(... | [
"private",
"void",
"initializeShowIntentBottmSheetPreference",
"(",
")",
"{",
"Preference",
"showIntentBottomSheetPreference",
"=",
"findPreference",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"show_intent_bottom_sheet_preference_key",
")",
")",
";",
"showIntentBottomS... | Initializes the preference, which allows to display the applications, which are suited for
handling an intent. | [
"Initializes",
"the",
"preference",
"which",
"allows",
"to",
"display",
"the",
"applications",
"which",
"are",
"suited",
"for",
"handling",
"an",
"intent",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L188-L202 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.createBottomSheetBuilder | private BottomSheet.Builder createBottomSheetBuilder() {
BottomSheet.Builder builder = new BottomSheet.Builder(getActivity());
builder.setStyle(getStyle());
if (shouldTitleBeShown()) {
builder.setTitle(getBottomSheetTitle());
}
if (shouldIconBeShown()) {
... | java | private BottomSheet.Builder createBottomSheetBuilder() {
BottomSheet.Builder builder = new BottomSheet.Builder(getActivity());
builder.setStyle(getStyle());
if (shouldTitleBeShown()) {
builder.setTitle(getBottomSheetTitle());
}
if (shouldIconBeShown()) {
... | [
"private",
"BottomSheet",
".",
"Builder",
"createBottomSheetBuilder",
"(",
")",
"{",
"BottomSheet",
".",
"Builder",
"builder",
"=",
"new",
"BottomSheet",
".",
"Builder",
"(",
"getActivity",
"(",
")",
")",
";",
"builder",
".",
"setStyle",
"(",
"getStyle",
"(",
... | Creates and returns a builder, which allows to create bottom sheets, depending on the app's
settings.
@return The builder, which has been created, as an instance of the class {@link
BottomSheet.Builder} | [
"Creates",
"and",
"returns",
"a",
"builder",
"which",
"allows",
"to",
"create",
"bottom",
"sheets",
"depending",
"on",
"the",
"app",
"s",
"settings",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L211-L224 | train |
michael-rapp/AndroidBottomSheet | example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java | PreferenceFragment.addItems | private void addItems(@NonNull final BottomSheet.Builder builder) {
int dividerCount = getDividerCount();
boolean showDividerTitle = shouldDividerTitleBeShown();
int itemCount = getItemCount();
boolean showIcon = shouldItemIconsBeShown();
boolean disableItems = shouldItemsBeDisab... | java | private void addItems(@NonNull final BottomSheet.Builder builder) {
int dividerCount = getDividerCount();
boolean showDividerTitle = shouldDividerTitleBeShown();
int itemCount = getItemCount();
boolean showIcon = shouldItemIconsBeShown();
boolean disableItems = shouldItemsBeDisab... | [
"private",
"void",
"addItems",
"(",
"@",
"NonNull",
"final",
"BottomSheet",
".",
"Builder",
"builder",
")",
"{",
"int",
"dividerCount",
"=",
"getDividerCount",
"(",
")",
";",
"boolean",
"showDividerTitle",
"=",
"shouldDividerTitleBeShown",
"(",
")",
";",
"int",
... | Adds items, depending on the app's settings, to a builder, which allows to create a bottom
sheet.
@param builder
The builder, which allows to create the bottom sheet, as an instance of the class
{@link BottomSheet.Builder}. The builder may not be null | [
"Adds",
"items",
"depending",
"on",
"the",
"app",
"s",
"settings",
"to",
"a",
"builder",
"which",
"allows",
"to",
"create",
"a",
"bottom",
"sheet",
"."
] | 6e4690ee9f63b14a7b143d3a3717b5f8a11ca503 | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/example/src/main/java/de/mrapp/android/bottomsheet/example/PreferenceFragment.java#L234-L273 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.