This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://github.com/codepath/android_guides/wiki/Endless-Scrolling-with-AdapterViews-and-RecyclerView | |
Contributed content licensed under cc-wiki with attribution required | |
*/ | |
abstract class PaginationScrollListener(var layoutManager: LinearLayoutManager) : RecyclerView.OnScrollListener() { | |
// The minimum number of items to have below your current scroll position | |
// before loading more. | |
private var visibleThreshold = 20 | |
// The current offset index of data you have loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { ... } | |
allprojects { ... } | |
subprojects { | |
project.configurations.all { | |
resolutionStrategy.eachDependency { details -> | |
if (details.requested.group == 'com.android.support') { | |
details.useVersion "27.1.1" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintSet set = new ConstraintSet(); | |
ConstraintLayout layout; | |
layout = (ConstraintLayout) findViewById(R.id.layout); | |
set.clone(layout); | |
// The following breaks the connection. | |
set.clear(R.id.bottomText, ConstraintSet.TOP); | |
// Comment out line above and uncomment line below to make the connection. | |
// set.connect(R.id.bottomText, ConstraintSet.TOP, R.id.imageView, ConstraintSet.BOTTOM, 0); | |
set.applyTo(layout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static View getParentView(Activity activity) { | |
return ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void setMultilineImeAction(EditText view, int imeAction) { | |
int inputType = view.getInputType(); | |
inputType &= ~InputType.TYPE_TEXT_FLAG_MULTI_LINE; | |
view.setInputType(inputType); | |
view.setHorizontallyScrolling(false); | |
view.setMaxLines(Integer.MAX_VALUE); | |
view.setImeOptions(imeAction); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int getResIdByName(Context appContext, String resType, String name) { | |
return appContext.getResources().getIdentifier(name, resType, appContext.getPackageName()); | |
} | |
// usage: | |
getResIdByName(appContext, "string", name); | |
getResIdByName(appContext, "drawable", name); | |
getResIdByName(appContext, "layout", name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext { | |
support_version = '25.0.0' | |
play_service_version = '11.0.0' | |
} | |
android { | |
... | |
} | |
dependencies { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
android { | |
def versionPropsFile = file('version.properties') | |
def Properties versionProps = new Properties() | |
versionProps.load(new FileInputStream(versionPropsFile)) | |
def buildNumber = versionProps['VERSION_BUILD'].toInteger() + 1 | |
defaultConfig { | |
versionCode buildNumber |