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
52inc/android-52Kit
library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LibraryAdapter.java
LibraryAdapter.buildSectionHeaders
private void buildSectionHeaders(){ // Update Artist maps HashMap<String, List<com.ftinc.kit.attributr.model.Library>> currMap = new HashMap<>(); // Loop through tuneRefs for(int i=0; i<getItemCount(); i++){ com.ftinc.kit.attributr.model.Library library = getItem(i); ...
java
private void buildSectionHeaders(){ // Update Artist maps HashMap<String, List<com.ftinc.kit.attributr.model.Library>> currMap = new HashMap<>(); // Loop through tuneRefs for(int i=0; i<getItemCount(); i++){ com.ftinc.kit.attributr.model.Library library = getItem(i); ...
[ "private", "void", "buildSectionHeaders", "(", ")", "{", "// Update Artist maps", "HashMap", "<", "String", ",", "List", "<", "com", ".", "ftinc", ".", "kit", ".", "attributr", ".", "model", ".", "Library", ">", ">", "currMap", "=", "new", "HashMap", "<>",...
Build the section headers for use in creating the headers
[ "Build", "the", "section", "headers", "for", "use", "in", "creating", "the", "headers" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LibraryAdapter.java#L118-L142
train
52inc/android-52Kit
library-winds/src/main/java/com/ftinc/kit/winds/ui/ChangeLogAdapter.java
ChangeLogAdapter.setChangeLog
public void setChangeLog(ChangeLog log){ mChangeLog = log; // Clear out any existing entries clear(); //sort all the changes Collections.sort(mChangeLog.versions, new VersionComparator()); // Iterate and add all the 'Change' objects in the adapter for(Version v...
java
public void setChangeLog(ChangeLog log){ mChangeLog = log; // Clear out any existing entries clear(); //sort all the changes Collections.sort(mChangeLog.versions, new VersionComparator()); // Iterate and add all the 'Change' objects in the adapter for(Version v...
[ "public", "void", "setChangeLog", "(", "ChangeLog", "log", ")", "{", "mChangeLog", "=", "log", ";", "// Clear out any existing entries", "clear", "(", ")", ";", "//sort all the changes", "Collections", ".", "sort", "(", "mChangeLog", ".", "versions", ",", "new", ...
Set the changelog for this adapter @param log
[ "Set", "the", "changelog", "for", "this", "adapter" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/ui/ChangeLogAdapter.java#L63-L79
train
52inc/android-52Kit
library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LicenseActivity.java
LicenseActivity.onItemClick
@SuppressLint("NewApi") @Override public void onItemClick(View v, com.ftinc.kit.attributr.model.Library item, int position) { if(BuildUtils.isLollipop()){ v.setElevation(SizeUtils.dpToPx(this, 4)); } View name = ButterKnife.findById(v, R.id.line_1); View author = But...
java
@SuppressLint("NewApi") @Override public void onItemClick(View v, com.ftinc.kit.attributr.model.Library item, int position) { if(BuildUtils.isLollipop()){ v.setElevation(SizeUtils.dpToPx(this, 4)); } View name = ButterKnife.findById(v, R.id.line_1); View author = But...
[ "@", "SuppressLint", "(", "\"NewApi\"", ")", "@", "Override", "public", "void", "onItemClick", "(", "View", "v", ",", "com", ".", "ftinc", ".", "kit", ".", "attributr", ".", "model", ".", "Library", "item", ",", "int", "position", ")", "{", "if", "(", ...
Called when a Library item is clicked.
[ "Called", "when", "a", "Library", "item", "is", "clicked", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LicenseActivity.java#L137-L159
train
52inc/android-52Kit
library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LicenseActivity.java
LicenseActivity.parseExtras
private void parseExtras(Bundle icicle){ Intent intent = getIntent(); if(intent != null){ mXmlConfigId = intent.getIntExtra(EXTRA_CONFIG, -1); mTitle = intent.getStringExtra(EXTRA_TITLE); } if(icicle != null){ mXmlConfigId = icicle.getInt(EXTRA_CONFI...
java
private void parseExtras(Bundle icicle){ Intent intent = getIntent(); if(intent != null){ mXmlConfigId = intent.getIntExtra(EXTRA_CONFIG, -1); mTitle = intent.getStringExtra(EXTRA_TITLE); } if(icicle != null){ mXmlConfigId = icicle.getInt(EXTRA_CONFI...
[ "private", "void", "parseExtras", "(", "Bundle", "icicle", ")", "{", "Intent", "intent", "=", "getIntent", "(", ")", ";", "if", "(", "intent", "!=", "null", ")", "{", "mXmlConfigId", "=", "intent", ".", "getIntExtra", "(", "EXTRA_CONFIG", ",", "-", "1", ...
Parse the Intent or saved bundle extras for the configuration and title data
[ "Parse", "the", "Intent", "or", "saved", "bundle", "extras", "for", "the", "configuration", "and", "title", "data" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/ui/LicenseActivity.java#L170-L194
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/BuildUtils.java
BuildUtils.checkForRunningService
public static boolean checkForRunningService(Context ctx, String serviceClassName) { ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass...
java
public static boolean checkForRunningService(Context ctx, String serviceClassName) { ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass...
[ "public", "static", "boolean", "checkForRunningService", "(", "Context", "ctx", ",", "String", "serviceClassName", ")", "{", "ActivityManager", "manager", "=", "(", "ActivityManager", ")", "ctx", ".", "getSystemService", "(", "Context", ".", "ACTIVITY_SERVICE", ")",...
Check for a running service @param ctx the application context @param serviceClassName the service class name @return true if service is running, false overwise
[ "Check", "for", "a", "running", "service" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/BuildUtils.java#L120-L128
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.openPlayStore
public static Intent openPlayStore(Context context, boolean openInBrowser) { String appPackageName = context.getPackageName(); Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)); if (isIntentAvailable(context, marketIntent)) { ret...
java
public static Intent openPlayStore(Context context, boolean openInBrowser) { String appPackageName = context.getPackageName(); Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)); if (isIntentAvailable(context, marketIntent)) { ret...
[ "public", "static", "Intent", "openPlayStore", "(", "Context", "context", ",", "boolean", "openInBrowser", ")", "{", "String", "appPackageName", "=", "context", ".", "getPackageName", "(", ")", ";", "Intent", "marketIntent", "=", "new", "Intent", "(", "Intent", ...
Open app page at Google Play @param context Application context @param openInBrowser Should we try to open application page in web browser if Play Store app not found on device
[ "Open", "app", "page", "at", "Google", "Play" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L58-L68
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.sendEmail
public static Intent sendEmail(String to, String subject, String text) { return sendEmail(new String[]{to}, subject, text); }
java
public static Intent sendEmail(String to, String subject, String text) { return sendEmail(new String[]{to}, subject, text); }
[ "public", "static", "Intent", "sendEmail", "(", "String", "to", ",", "String", "subject", ",", "String", "text", ")", "{", "return", "sendEmail", "(", "new", "String", "[", "]", "{", "to", "}", ",", "subject", ",", "text", ")", ";", "}" ]
Send email message @param to Receiver email @param subject Message subject @param text Message body @see #sendEmail(String[], String, String)
[ "Send", "email", "message" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L78-L80
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.shareText
public static Intent shareText(String subject, String text) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); if (!TextUtils.isEmpty(subject)) { intent.putExtra(Intent.EXTRA_SUBJECT, subject); } intent.putExtra(Intent.EXTRA_TEXT, text); int...
java
public static Intent shareText(String subject, String text) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); if (!TextUtils.isEmpty(subject)) { intent.putExtra(Intent.EXTRA_SUBJECT, subject); } intent.putExtra(Intent.EXTRA_TEXT, text); int...
[ "public", "static", "Intent", "shareText", "(", "String", "subject", ",", "String", "text", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ")", ";", "intent", ".", "setAction", "(", "Intent", ".", "ACTION_SEND", ")", ";", "if", "(", "!", "Tex...
Share text via thirdparty app like twitter, facebook, email, sms etc. @param subject Optional subject of the message @param text Text to share
[ "Share", "text", "via", "thirdparty", "app", "like", "twitter", "facebook", "email", "sms", "etc", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L100-L109
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.showLocation
public static Intent showLocation(float latitude, float longitude, Integer zoomLevel) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String data = String.format("geo:%s,%s", latitude, longitude); if (zoomLevel != null) { data = String.format("%s?z=%s", ...
java
public static Intent showLocation(float latitude, float longitude, Integer zoomLevel) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String data = String.format("geo:%s,%s", latitude, longitude); if (zoomLevel != null) { data = String.format("%s?z=%s", ...
[ "public", "static", "Intent", "showLocation", "(", "float", "latitude", ",", "float", "longitude", ",", "Integer", "zoomLevel", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ")", ";", "intent", ".", "setAction", "(", "Intent", ".", "ACTION_VIEW", ...
Opens the Maps application to the given location. @param latitude Latitude @param longitude Longitude @param zoomLevel A zoom level of 1 shows the whole Earth, centered at the given lat,lng. A zoom level of 2 shows a quarter of the Earth, and so on. The highest zoom level is 23. A larger zoom level will be clamped to...
[ "Opens", "the", "Maps", "application", "to", "the", "given", "location", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L177-L186
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.findLocation
public static Intent findLocation(String query) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String data = String.format("geo:0,0?q=%s", query); intent.setData(Uri.parse(data)); return intent; }
java
public static Intent findLocation(String query) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String data = String.format("geo:0,0?q=%s", query); intent.setData(Uri.parse(data)); return intent; }
[ "public", "static", "Intent", "findLocation", "(", "String", "query", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ")", ";", "intent", ".", "setAction", "(", "Intent", ".", "ACTION_VIEW", ")", ";", "String", "data", "=", "String", ".", "forma...
Opens the Maps application to the given query. @param query Query string @see #showLocation(float, float, Integer)
[ "Opens", "the", "Maps", "application", "to", "the", "given", "query", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L194-L200
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.openLink
public static Intent openLink(String url) { // if protocol isn't defined use http by default if (!TextUtils.isEmpty(url) && !url.contains("://")) { url = "http://" + url; } Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri...
java
public static Intent openLink(String url) { // if protocol isn't defined use http by default if (!TextUtils.isEmpty(url) && !url.contains("://")) { url = "http://" + url; } Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri...
[ "public", "static", "Intent", "openLink", "(", "String", "url", ")", "{", "// if protocol isn't defined use http by default", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "url", ")", "&&", "!", "url", ".", "contains", "(", "\"://\"", ")", ")", "{", "url...
Open a browser window to the URL specified. @param url Target url
[ "Open", "a", "browser", "window", "to", "the", "URL", "specified", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L216-L226
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.pickImage
public static Intent pickImage() { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); return intent; }
java
public static Intent pickImage() { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); return intent; }
[ "public", "static", "Intent", "pickImage", "(", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_PICK", ")", ";", "intent", ".", "setType", "(", "\"image/*\"", ")", ";", "return", "intent", ";", "}" ]
Pick image from gallery
[ "Pick", "image", "from", "gallery" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L408-L412
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.isCropAvailable
public static boolean isCropAvailable(Context context) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); return IntentUtils.isIntentAvailable(context, intent); }
java
public static boolean isCropAvailable(Context context) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setType("image/*"); return IntentUtils.isIntentAvailable(context, intent); }
[ "public", "static", "boolean", "isCropAvailable", "(", "Context", "context", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "\"com.android.camera.action.CROP\"", ")", ";", "intent", ".", "setType", "(", "\"image/*\"", ")", ";", "return", "IntentUtils", ...
Check that cropping application is available @param context Application context @return true if cropping app is available @see #cropImage(android.content.Context, java.io.File, int, int, int, int, boolean)
[ "Check", "that", "cropping", "application", "is", "available" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L434-L438
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.photoCapture
public static Intent photoCapture(String file) { Uri uri = Uri.fromFile(new File(file)); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); return intent; }
java
public static Intent photoCapture(String file) { Uri uri = Uri.fromFile(new File(file)); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); return intent; }
[ "public", "static", "Intent", "photoCapture", "(", "String", "file", ")", "{", "Uri", "uri", "=", "Uri", ".", "fromFile", "(", "new", "File", "(", "file", ")", ")", ";", "Intent", "intent", "=", "new", "Intent", "(", "MediaStore", ".", "ACTION_IMAGE_CAPT...
Call standard camera application for capturing an image @param file Full path to captured file
[ "Call", "standard", "camera", "application", "for", "capturing", "an", "image" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L479-L484
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/IntentUtils.java
IntentUtils.isIntentAvailable
public static boolean isIntentAvailable(Context context, Intent intent) { PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; }
java
public static boolean isIntentAvailable(Context context, Intent intent) { PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; }
[ "public", "static", "boolean", "isIntentAvailable", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "PackageManager", "packageManager", "=", "context", ".", "getPackageManager", "(", ")", ";", "List", "<", "ResolveInfo", ">", "list", "=", "packageM...
Check that in the system exists application which can handle this intent @param context Application context @param intent Checked intent @return true if intent consumer exists, false otherwise
[ "Check", "that", "in", "the", "system", "exists", "application", "which", "can", "handle", "this", "intent" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L493-L497
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/SizeUtils.java
SizeUtils.spToPx
public static float spToPx(Context ctx, float spSize){ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spSize, ctx.getResources().getDisplayMetrics()); }
java
public static float spToPx(Context ctx, float spSize){ return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spSize, ctx.getResources().getDisplayMetrics()); }
[ "public", "static", "float", "spToPx", "(", "Context", "ctx", ",", "float", "spSize", ")", "{", "return", "TypedValue", ".", "applyDimension", "(", "TypedValue", ".", "COMPLEX_UNIT_SP", ",", "spSize", ",", "ctx", ".", "getResources", "(", ")", ".", "getDispl...
Convert Scale-Dependent Pixels to actual pixels @param ctx the application context @param spSize the size in SP units @return the size in Pixel units
[ "Convert", "Scale", "-", "Dependent", "Pixels", "to", "actual", "pixels" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/SizeUtils.java#L61-L63
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java
ForegroundLinearLayout.setForegroundGravity
public void setForegroundGravity(int foregroundGravity) { if (mForegroundGravity != foregroundGravity) { if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { foregroundGravity |= Gravity.START; } if ((foregroundGravity & Gravity.VERTICAL...
java
public void setForegroundGravity(int foregroundGravity) { if (mForegroundGravity != foregroundGravity) { if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { foregroundGravity |= Gravity.START; } if ((foregroundGravity & Gravity.VERTICAL...
[ "public", "void", "setForegroundGravity", "(", "int", "foregroundGravity", ")", "{", "if", "(", "mForegroundGravity", "!=", "foregroundGravity", ")", "{", "if", "(", "(", "foregroundGravity", "&", "Gravity", ".", "RELATIVE_HORIZONTAL_GRAVITY_MASK", ")", "==", "0", ...
Describes how the foreground is positioned. Defaults to START and TOP. @param foregroundGravity See {@link Gravity} @see #getForegroundGravity()
[ "Describes", "how", "the", "foreground", "is", "positioned", ".", "Defaults", "to", "START", "and", "TOP", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java#L94-L114
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java
ForegroundLinearLayout.setForeground
public void setForeground(Drawable drawable) { if (mForeground != drawable) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = drawable; if (drawable != null) { ...
java
public void setForeground(Drawable drawable) { if (mForeground != drawable) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = drawable; if (drawable != null) { ...
[ "public", "void", "setForeground", "(", "Drawable", "drawable", ")", "{", "if", "(", "mForeground", "!=", "drawable", ")", "{", "if", "(", "mForeground", "!=", "null", ")", "{", "mForeground", ".", "setCallback", "(", "null", ")", ";", "unscheduleDrawable", ...
Supply a Drawable that is to be rendered on top of all of the child views in the frame layout. Any padding in the Drawable will be taken into account by ensuring that the children are inset to be placed inside of the padding area. @param drawable The Drawable to be drawn on top of the children.
[ "Supply", "a", "Drawable", "that", "is", "to", "be", "rendered", "on", "top", "of", "all", "of", "the", "child", "views", "in", "the", "frame", "layout", ".", "Any", "padding", "in", "the", "Drawable", "will", "be", "taken", "into", "account", "by", "e...
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/ForegroundLinearLayout.java#L143-L168
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FileUtils.java
FileUtils.crapToDisk
public static int crapToDisk(Context ctx, String filename, byte[] data){ int code = IO_FAIL; File dir = Environment.getExternalStorageDirectory(); File output = new File(dir, filename); try { FileOutputStream fos = new FileOutputStream(output); try { ...
java
public static int crapToDisk(Context ctx, String filename, byte[] data){ int code = IO_FAIL; File dir = Environment.getExternalStorageDirectory(); File output = new File(dir, filename); try { FileOutputStream fos = new FileOutputStream(output); try { ...
[ "public", "static", "int", "crapToDisk", "(", "Context", "ctx", ",", "String", "filename", ",", "byte", "[", "]", "data", ")", "{", "int", "code", "=", "IO_FAIL", ";", "File", "dir", "=", "Environment", ".", "getExternalStorageDirectory", "(", ")", ";", ...
Dump Data straight to the SDCard @param ctx the application context @param filename the dump filename @param data the data to dump @return the return
[ "Dump", "Data", "straight", "to", "the", "SDCard" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FileUtils.java#L196-L217
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FileUtils.java
FileUtils.getVideoThumbnail
public static Bitmap getVideoThumbnail(String videoPath){ MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(videoPath); return mmr.getFrameAtTime(); }
java
public static Bitmap getVideoThumbnail(String videoPath){ MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(videoPath); return mmr.getFrameAtTime(); }
[ "public", "static", "Bitmap", "getVideoThumbnail", "(", "String", "videoPath", ")", "{", "MediaMetadataRetriever", "mmr", "=", "new", "MediaMetadataRetriever", "(", ")", ";", "mmr", ".", "setDataSource", "(", "videoPath", ")", ";", "return", "mmr", ".", "getFram...
Get a thumbnail bitmap for a given video @param videoPath the path to the video @return the thumbnail of the video, or null
[ "Get", "a", "thumbnail", "bitmap", "for", "a", "given", "video" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FileUtils.java#L302-L306
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FileUtils.java
FileUtils.getVideoThumbnail
public static void getVideoThumbnail(String videoPath, final VideoThumbnailCallback cb){ new AsyncTask<String, Void, Bitmap>(){ @Override protected Bitmap doInBackground(String... params) { if(params.length > 0) { String path = params[0]; ...
java
public static void getVideoThumbnail(String videoPath, final VideoThumbnailCallback cb){ new AsyncTask<String, Void, Bitmap>(){ @Override protected Bitmap doInBackground(String... params) { if(params.length > 0) { String path = params[0]; ...
[ "public", "static", "void", "getVideoThumbnail", "(", "String", "videoPath", ",", "final", "VideoThumbnailCallback", "cb", ")", "{", "new", "AsyncTask", "<", "String", ",", "Void", ",", "Bitmap", ">", "(", ")", "{", "@", "Override", "protected", "Bitmap", "d...
Get the thumbnail of a video asynchronously @param videoPath the path to the video @param cb the callback
[ "Get", "the", "thumbnail", "of", "a", "video", "asynchronously" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FileUtils.java#L314-L332
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FileUtils.java
FileUtils.copy
public static boolean copy(File source, File output){ // Check to see if output exists if(output.exists() && output.canWrite()){ // Delete the existing file, and create a new one if(output.delete()) { try { output.createNewFile(); ...
java
public static boolean copy(File source, File output){ // Check to see if output exists if(output.exists() && output.canWrite()){ // Delete the existing file, and create a new one if(output.delete()) { try { output.createNewFile(); ...
[ "public", "static", "boolean", "copy", "(", "File", "source", ",", "File", "output", ")", "{", "// Check to see if output exists", "if", "(", "output", ".", "exists", "(", ")", "&&", "output", ".", "canWrite", "(", ")", ")", "{", "// Delete the existing file, ...
Copy a file from it's source input to the specified output file if it can. @param source the input file to copy @param output the output destination @return true if successful, false otherwise
[ "Copy", "a", "file", "from", "it", "s", "source", "input", "to", "the", "specified", "output", "file", "if", "it", "can", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FileUtils.java#L342-L388
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/TimeUtils.java
TimeUtils.fancyTimestamp
public static String fancyTimestamp(long epoch){ // First, check to see if it's within 1 minute of the current date if(System.currentTimeMillis() - epoch < 60000){ return "Just now"; } // Get calendar for just now Calendar now = Calendar.getInstance(); // G...
java
public static String fancyTimestamp(long epoch){ // First, check to see if it's within 1 minute of the current date if(System.currentTimeMillis() - epoch < 60000){ return "Just now"; } // Get calendar for just now Calendar now = Calendar.getInstance(); // G...
[ "public", "static", "String", "fancyTimestamp", "(", "long", "epoch", ")", "{", "// First, check to see if it's within 1 minute of the current date", "if", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "epoch", "<", "60000", ")", "{", "return", "\"Just now\"...
Generate a fancy timestamp based on unix epoch time that is more user friendly than just a raw output by collapsing the time into manageable formats based on how much time has elapsed since epoch @param epoch the time in unix epoch @return the fancy timestamp
[ "Generate", "a", "fancy", "timestamp", "based", "on", "unix", "epoch", "time", "that", "is", "more", "user", "friendly", "than", "just", "a", "raw", "output", "by", "collapsing", "the", "time", "into", "manageable", "formats", "based", "on", "how", "much", ...
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/TimeUtils.java#L91-L136
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/TimeUtils.java
TimeUtils.formatHumanFriendlyShortDate
public static String formatHumanFriendlyShortDate(final Context context, long timestamp) { long localTimestamp, localTime; long now = System.currentTimeMillis(); TimeZone tz = TimeZone.getDefault(); localTimestamp = timestamp + tz.getOffset(timestamp); localTime = now + tz.getOf...
java
public static String formatHumanFriendlyShortDate(final Context context, long timestamp) { long localTimestamp, localTime; long now = System.currentTimeMillis(); TimeZone tz = TimeZone.getDefault(); localTimestamp = timestamp + tz.getOffset(timestamp); localTime = now + tz.getOf...
[ "public", "static", "String", "formatHumanFriendlyShortDate", "(", "final", "Context", "context", ",", "long", "timestamp", ")", "{", "long", "localTimestamp", ",", "localTime", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "TimeZon...
Returns "Today", "Tomorrow", "Yesterday", or a short date format.
[ "Returns", "Today", "Tomorrow", "Yesterday", "or", "a", "short", "date", "format", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/TimeUtils.java#L141-L161
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/ColorUtils.java
ColorUtils.isColorDark
public static boolean isColorDark(int color) { return ((30 * Color.red(color) + 59 * Color.green(color) + 11 * Color.blue(color)) / 100) <= BRIGHTNESS_THRESHOLD; }
java
public static boolean isColorDark(int color) { return ((30 * Color.red(color) + 59 * Color.green(color) + 11 * Color.blue(color)) / 100) <= BRIGHTNESS_THRESHOLD; }
[ "public", "static", "boolean", "isColorDark", "(", "int", "color", ")", "{", "return", "(", "(", "30", "*", "Color", ".", "red", "(", "color", ")", "+", "59", "*", "Color", ".", "green", "(", "color", ")", "+", "11", "*", "Color", ".", "blue", "(...
Calculate whether a color is light or dark, based on a commonly known brightness formula. @see <a href="http://en.wikipedia.org/wiki/HSV_color_space%23Lightness">http://en.wikipedia.org/wiki/HSV_color_space%23Lightness</a>
[ "Calculate", "whether", "a", "color", "is", "light", "or", "dark", "based", "on", "a", "commonly", "known", "brightness", "formula", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/ColorUtils.java#L95-L99
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterListAdapter.java
BetterListAdapter.getView
@Override public View getView(int position, View convertView, ViewGroup parent){ VH holder; if(convertView == null){ // Load the view from scratch convertView = inflater.inflate(viewResource, parent, false); // Load the ViewHolder holder = createHolder(convertView); // set holder t...
java
@Override public View getView(int position, View convertView, ViewGroup parent){ VH holder; if(convertView == null){ // Load the view from scratch convertView = inflater.inflate(viewResource, parent, false); // Load the ViewHolder holder = createHolder(convertView); // set holder t...
[ "@", "Override", "public", "View", "getView", "(", "int", "position", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "VH", "holder", ";", "if", "(", "convertView", "==", "null", ")", "{", "// Load the view from scratch", "convertView", "=", ...
Called to retrieve the view
[ "Called", "to", "retrieve", "the", "view" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterListAdapter.java#L71-L99
train
52inc/android-52Kit
library-winds/src/main/java/com/ftinc/kit/winds/Winds.java
Winds.validateVersion
private static boolean validateVersion(Context ctx, ChangeLog clog){ // Get Preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); int lastSeen = prefs.getInt(PREF_CHANGELOG_LAST_SEEN, -1); // Second sort versions by it's code int latest = Int...
java
private static boolean validateVersion(Context ctx, ChangeLog clog){ // Get Preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); int lastSeen = prefs.getInt(PREF_CHANGELOG_LAST_SEEN, -1); // Second sort versions by it's code int latest = Int...
[ "private", "static", "boolean", "validateVersion", "(", "Context", "ctx", ",", "ChangeLog", "clog", ")", "{", "// Get Preferences", "SharedPreferences", "prefs", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "ctx", ")", ";", "int", "lastSeen", "...
Validate the last seen stored verion code against the current changelog configuration to see if there is any updates and whether or not we should show the changelog dialog when called. @param ctx @param clog @return
[ "Validate", "the", "last", "seen", "stored", "verion", "code", "against", "the", "current", "changelog", "configuration", "to", "see", "if", "there", "is", "any", "updates", "and", "whether", "or", "not", "we", "should", "show", "the", "changelog", "dialog", ...
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/Winds.java#L190-L211
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java
CompositeTextWatcher.enableWatcher
public void enableWatcher(TextWatcher watcher, boolean enabled){ int index = mWatchers.indexOfValue(watcher); if(index >= 0){ int key = mWatchers.keyAt(index); mEnabledKeys.put(key, enabled); } }
java
public void enableWatcher(TextWatcher watcher, boolean enabled){ int index = mWatchers.indexOfValue(watcher); if(index >= 0){ int key = mWatchers.keyAt(index); mEnabledKeys.put(key, enabled); } }
[ "public", "void", "enableWatcher", "(", "TextWatcher", "watcher", ",", "boolean", "enabled", ")", "{", "int", "index", "=", "mWatchers", ".", "indexOfValue", "(", "watcher", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "int", "key", "=", "mWatchers...
Enable or Disable a text watcher by reference @param watcher The {@link TextWatcher} to enable or disable @param enabled whether or not to enable or disable
[ "Enable", "or", "Disable", "a", "text", "watcher", "by", "reference" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java#L130-L136
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.parseAttributes
private void parseAttributes(Context context, AttributeSet attrs, int defStyle){ int defaultColor = context.getResources().getColor(R.color.black26); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EmptyView, defStyle, 0); if (a == null) { mEmpt...
java
private void parseAttributes(Context context, AttributeSet attrs, int defStyle){ int defaultColor = context.getResources().getColor(R.color.black26); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EmptyView, defStyle, 0); if (a == null) { mEmpt...
[ "private", "void", "parseAttributes", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "defStyle", ")", "{", "int", "defaultColor", "=", "context", ".", "getResources", "(", ")", ".", "getColor", "(", "R", ".", "color", ".", "black26", ...
Parse XML attributes @param attrs the attributes to parse
[ "Parse", "XML", "attributes" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L173-L208
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.setIcon
public void setIcon(Drawable drawable){ mIcon.setImageDrawable(drawable); mIcon.setVisibility(View.VISIBLE); }
java
public void setIcon(Drawable drawable){ mIcon.setImageDrawable(drawable); mIcon.setVisibility(View.VISIBLE); }
[ "public", "void", "setIcon", "(", "Drawable", "drawable", ")", "{", "mIcon", ".", "setImageDrawable", "(", "drawable", ")", ";", "mIcon", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}" ]
Set the icon for this empty view @param drawable the drawable icon
[ "Set", "the", "icon", "for", "this", "empty", "view" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L316-L319
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.setIconSize
public void setIconSize(int size){ mEmptyIconSize = size; int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height); mIco...
java
public void setIconSize(int size){ mEmptyIconSize = size; int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height); mIco...
[ "public", "void", "setIconSize", "(", "int", "size", ")", "{", "mEmptyIconSize", "=", "size", ";", "int", "width", "=", "mEmptyIconSize", "==", "-", "1", "?", "WRAP_CONTENT", ":", "mEmptyIconSize", ";", "int", "height", "=", "mEmptyIconSize", "==", "-", "1...
Set the size of the icon in the center of the view @param size the pixel size of the icon in the center
[ "Set", "the", "size", "of", "the", "icon", "in", "the", "center", "of", "the", "view" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L327-L333
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.setActionLabel
public void setActionLabel(CharSequence label){ mEmptyActionText = label; mAction.setText(mEmptyActionText); mAction.setVisibility(TextUtils.isEmpty(mEmptyActionText) ? View.GONE : View.VISIBLE); }
java
public void setActionLabel(CharSequence label){ mEmptyActionText = label; mAction.setText(mEmptyActionText); mAction.setVisibility(TextUtils.isEmpty(mEmptyActionText) ? View.GONE : View.VISIBLE); }
[ "public", "void", "setActionLabel", "(", "CharSequence", "label", ")", "{", "mEmptyActionText", "=", "label", ";", "mAction", ".", "setText", "(", "mEmptyActionText", ")", ";", "mAction", ".", "setVisibility", "(", "TextUtils", ".", "isEmpty", "(", "mEmptyAction...
Set the action button label, this in-turn enables it. Pass null to disable. @param label set the action label, thus enabling it
[ "Set", "the", "action", "button", "label", "this", "in", "-", "turn", "enables", "it", ".", "Pass", "null", "to", "disable", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L449-L453
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.setLoading
@Deprecated public void setLoading(){ mState = STATE_LOADING; mProgress.setVisibility(View.VISIBLE); mAction.setVisibility(View.GONE); mMessage.setVisibility(View.GONE); mIcon.setVisibility(View.GONE); }
java
@Deprecated public void setLoading(){ mState = STATE_LOADING; mProgress.setVisibility(View.VISIBLE); mAction.setVisibility(View.GONE); mMessage.setVisibility(View.GONE); mIcon.setVisibility(View.GONE); }
[ "@", "Deprecated", "public", "void", "setLoading", "(", ")", "{", "mState", "=", "STATE_LOADING", ";", "mProgress", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "mAction", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "mMessage"...
Set this view to loading state to show a loading indicator and hide the other parts of this view. @deprecated see {@link #setLoading(boolean)} and {@link #setState(int)}
[ "Set", "this", "view", "to", "loading", "state", "to", "show", "a", "loading", "indicator", "and", "hide", "the", "other", "parts", "of", "this", "view", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L514-L521
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/EmptyView.java
EmptyView.setEmpty
@Deprecated public void setEmpty(){ mState = STATE_EMPTY; mProgress.setVisibility(View.GONE); if(mEmptyIcon != -1) mIcon.setVisibility(View.VISIBLE); if(!TextUtils.isEmpty(mEmptyMessage)) mMessage.setVisibility(View.VISIBLE); if(!TextUtils.isEmpty(mEmptyActionText)) mAction.s...
java
@Deprecated public void setEmpty(){ mState = STATE_EMPTY; mProgress.setVisibility(View.GONE); if(mEmptyIcon != -1) mIcon.setVisibility(View.VISIBLE); if(!TextUtils.isEmpty(mEmptyMessage)) mMessage.setVisibility(View.VISIBLE); if(!TextUtils.isEmpty(mEmptyActionText)) mAction.s...
[ "@", "Deprecated", "public", "void", "setEmpty", "(", ")", "{", "mState", "=", "STATE_EMPTY", ";", "mProgress", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "if", "(", "mEmptyIcon", "!=", "-", "1", ")", "mIcon", ".", "setVisibility", "(", ...
Set this view to it's empty state showing the icon, message, and action if configured @deprecated see {@link #setLoading(boolean)} and {@link #setState(int)}
[ "Set", "this", "view", "to", "it", "s", "empty", "state", "showing", "the", "icon", "message", "and", "action", "if", "configured" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/EmptyView.java#L529-L536
train
52inc/android-52Kit
library-attributr/src/main/java/com/ftinc/kit/attributr/ui/widget/StickyRecyclerHeadersElevationDecoration.java
StickyRecyclerHeadersElevationDecoration.getNextView
private View getNextView(RecyclerView parent) { View firstView = parent.getChildAt(0); // draw the first visible child's header at the top of the view int firstPosition = parent.getChildPosition(firstView); View firstHeader = getHeaderView(parent, firstPosition); for (int i = 0...
java
private View getNextView(RecyclerView parent) { View firstView = parent.getChildAt(0); // draw the first visible child's header at the top of the view int firstPosition = parent.getChildPosition(firstView); View firstHeader = getHeaderView(parent, firstPosition); for (int i = 0...
[ "private", "View", "getNextView", "(", "RecyclerView", "parent", ")", "{", "View", "firstView", "=", "parent", ".", "getChildAt", "(", "0", ")", ";", "// draw the first visible child's header at the top of the view", "int", "firstPosition", "=", "parent", ".", "getChi...
Returns the first item currently in the recyclerview that's not obscured by a header. @param parent @return
[ "Returns", "the", "first", "item", "currently", "in", "the", "recyclerview", "that", "s", "not", "obscured", "by", "a", "header", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/ui/widget/StickyRecyclerHeadersElevationDecoration.java#L169-L196
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.buildAndAttach
@SuppressLint("NewApi") private void buildAndAttach(){ // Disable any pending transition on the activity since we are transforming it mActivity.overridePendingTransition(0, 0); // Setup window flags if Lollipop if(BuildUtils.isLollipop()) { Window window = mActivity.getW...
java
@SuppressLint("NewApi") private void buildAndAttach(){ // Disable any pending transition on the activity since we are transforming it mActivity.overridePendingTransition(0, 0); // Setup window flags if Lollipop if(BuildUtils.isLollipop()) { Window window = mActivity.getW...
[ "@", "SuppressLint", "(", "\"NewApi\"", ")", "private", "void", "buildAndAttach", "(", ")", "{", "// Disable any pending transition on the activity since we are transforming it", "mActivity", ".", "overridePendingTransition", "(", "0", ",", "0", ")", ";", "// Setup window f...
Build the nav drawer layout, inflate it, then attach it to the activity
[ "Build", "the", "nav", "drawer", "layout", "inflate", "it", "then", "attach", "it", "to", "the", "activity" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L253-L274
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.setupDrawer
private void setupDrawer(){ // Setup drawer background color if set int backgroundColor = UIUtils.getColorAttr(mActivity, R.attr.drawerBackground); if(backgroundColor > 0){ mDrawerPane.setBackgroundColor(backgroundColor); } // Set the drawer layout statusbar color ...
java
private void setupDrawer(){ // Setup drawer background color if set int backgroundColor = UIUtils.getColorAttr(mActivity, R.attr.drawerBackground); if(backgroundColor > 0){ mDrawerPane.setBackgroundColor(backgroundColor); } // Set the drawer layout statusbar color ...
[ "private", "void", "setupDrawer", "(", ")", "{", "// Setup drawer background color if set", "int", "backgroundColor", "=", "UIUtils", ".", "getColorAttr", "(", "mActivity", ",", "R", ".", "attr", ".", "drawerBackground", ")", ";", "if", "(", "backgroundColor", ">"...
Setup the navigation drawer layout and whatnot
[ "Setup", "the", "navigation", "drawer", "layout", "and", "whatnot" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L302-L384
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.createNavDrawerItems
private void createNavDrawerItems(){ if (mDrawerItemsListContainer == null) { return; } mNavDrawerItemViews.clear(); mDrawerItemsListContainer.removeAllViews(); for (DrawerItem item: mDrawerItems) { item.setSelected(item.getId() == mSelectedItem); ...
java
private void createNavDrawerItems(){ if (mDrawerItemsListContainer == null) { return; } mNavDrawerItemViews.clear(); mDrawerItemsListContainer.removeAllViews(); for (DrawerItem item: mDrawerItems) { item.setSelected(item.getId() == mSelectedItem); ...
[ "private", "void", "createNavDrawerItems", "(", ")", "{", "if", "(", "mDrawerItemsListContainer", "==", "null", ")", "{", "return", ";", "}", "mNavDrawerItemViews", ".", "clear", "(", ")", ";", "mDrawerItemsListContainer", ".", "removeAllViews", "(", ")", ";", ...
Populate the nav drawer items into the view
[ "Populate", "the", "nav", "drawer", "items", "into", "the", "view" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L435-L465
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.onNavDrawerItemClicked
private void onNavDrawerItemClicked(final int itemId) { if (itemId == mSelectedItem) { mDrawerLayout.closeDrawer(GravityCompat.START); return; } if (isSpecialItem(itemId)) { goToNavDrawerItem(itemId); } else { // launch the target Activity...
java
private void onNavDrawerItemClicked(final int itemId) { if (itemId == mSelectedItem) { mDrawerLayout.closeDrawer(GravityCompat.START); return; } if (isSpecialItem(itemId)) { goToNavDrawerItem(itemId); } else { // launch the target Activity...
[ "private", "void", "onNavDrawerItemClicked", "(", "final", "int", "itemId", ")", "{", "if", "(", "itemId", "==", "mSelectedItem", ")", "{", "mDrawerLayout", ".", "closeDrawer", "(", "GravityCompat", ".", "START", ")", ";", "return", ";", "}", "if", "(", "i...
Call when a nav drawer item is clicked @param itemId the id of the item clicked
[ "Call", "when", "a", "nav", "drawer", "item", "is", "clicked" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L482-L509
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.formatNavDrawerItem
private void formatNavDrawerItem(DrawerItem item, boolean selected) { if (item instanceof SeperatorDrawerItem || item instanceof SwitchDrawerItem) { // not applicable return; } // Get the associated view View view = mNavDrawerItemViews.get(item.getId()); ...
java
private void formatNavDrawerItem(DrawerItem item, boolean selected) { if (item instanceof SeperatorDrawerItem || item instanceof SwitchDrawerItem) { // not applicable return; } // Get the associated view View view = mNavDrawerItemViews.get(item.getId()); ...
[ "private", "void", "formatNavDrawerItem", "(", "DrawerItem", "item", ",", "boolean", "selected", ")", "{", "if", "(", "item", "instanceof", "SeperatorDrawerItem", "||", "item", "instanceof", "SwitchDrawerItem", ")", "{", "// not applicable", "return", ";", "}", "/...
Format a nav drawer item based on current selected states @param item @param selected
[ "Format", "a", "nav", "drawer", "item", "based", "on", "current", "selected", "states" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L536-L556
train
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.inflateDrawerLayout
private DrawerLayout inflateDrawerLayout(ViewGroup parent){ DrawerLayout drawer = (DrawerLayout) mActivity.getLayoutInflater() .inflate(R.layout.material_drawer, parent, false); // Find the associated views mDrawerPane = ButterKnife.findById(drawer, R.id.navdrawer); mDra...
java
private DrawerLayout inflateDrawerLayout(ViewGroup parent){ DrawerLayout drawer = (DrawerLayout) mActivity.getLayoutInflater() .inflate(R.layout.material_drawer, parent, false); // Find the associated views mDrawerPane = ButterKnife.findById(drawer, R.id.navdrawer); mDra...
[ "private", "DrawerLayout", "inflateDrawerLayout", "(", "ViewGroup", "parent", ")", "{", "DrawerLayout", "drawer", "=", "(", "DrawerLayout", ")", "mActivity", ".", "getLayoutInflater", "(", ")", ".", "inflate", "(", "R", ".", "layout", ".", "material_drawer", ","...
Build the root drawer layout @return the root drawer layout
[ "Build", "the", "root", "drawer", "layout" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L569-L582
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/widget/AspectRatioImageView.java
AspectRatioImageView.onMeasure
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Drawable drawable = getDrawable(); if (getDrawable() != null) { if (ratioType == RATIO_WIDTH) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = Math.round(width * (((float) drawable.getIntrinsicHeight()) / ...
java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Drawable drawable = getDrawable(); if (getDrawable() != null) { if (ratioType == RATIO_WIDTH) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = Math.round(width * (((float) drawable.getIntrinsicHeight()) / ...
[ "@", "Override", "protected", "void", "onMeasure", "(", "int", "widthMeasureSpec", ",", "int", "heightMeasureSpec", ")", "{", "Drawable", "drawable", "=", "getDrawable", "(", ")", ";", "if", "(", "getDrawable", "(", ")", "!=", "null", ")", "{", "if", "(", ...
Maintain Image Aspect Ratio no matter the size
[ "Maintain", "Image", "Aspect", "Ratio", "no", "matter", "the", "size" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/widget/AspectRatioImageView.java#L72-L88
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/UIUtils.java
UIUtils.getStatusBarHeight
public static int getStatusBarHeight(Context ctx) { int result = 0; int resourceId = ctx.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = ctx.getResources().getDimensionPixelSize(resourceId); } return result; }
java
public static int getStatusBarHeight(Context ctx) { int result = 0; int resourceId = ctx.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = ctx.getResources().getDimensionPixelSize(resourceId); } return result; }
[ "public", "static", "int", "getStatusBarHeight", "(", "Context", "ctx", ")", "{", "int", "result", "=", "0", ";", "int", "resourceId", "=", "ctx", ".", "getResources", "(", ")", ".", "getIdentifier", "(", "\"status_bar_height\"", ",", "\"dimen\"", ",", "\"an...
Get the status bar height
[ "Get", "the", "status", "bar", "height" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/UIUtils.java#L166-L173
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.onItemClick
protected void onItemClick(View view, int position){ if(itemClickListener != null) itemClickListener.onItemClick(view, getItem(position), position); }
java
protected void onItemClick(View view, int position){ if(itemClickListener != null) itemClickListener.onItemClick(view, getItem(position), position); }
[ "protected", "void", "onItemClick", "(", "View", "view", ",", "int", "position", ")", "{", "if", "(", "itemClickListener", "!=", "null", ")", "itemClickListener", ".", "onItemClick", "(", "view", ",", "getItem", "(", "position", ")", ",", "position", ")", ...
Call this to trigger the user set item click listener @param view the view that was clicked @param position the position that was clicked
[ "Call", "this", "to", "trigger", "the", "user", "set", "item", "click", "listener" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L75-L77
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.onItemLongClick
protected void onItemLongClick(View view, int position){ if(itemLongClickListener != null) itemLongClickListener.onItemLongClick(view, getItem(position), position); }
java
protected void onItemLongClick(View view, int position){ if(itemLongClickListener != null) itemLongClickListener.onItemLongClick(view, getItem(position), position); }
[ "protected", "void", "onItemLongClick", "(", "View", "view", ",", "int", "position", ")", "{", "if", "(", "itemLongClickListener", "!=", "null", ")", "itemLongClickListener", ".", "onItemLongClick", "(", "view", ",", "getItem", "(", "position", ")", ",", "posi...
Call this to trigger the user set item long click lisetner @param view the view that was clicked @param position the position that was clicked
[ "Call", "this", "to", "trigger", "the", "user", "set", "item", "long", "click", "lisetner" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L84-L86
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.setEmptyView
public void setEmptyView(View emptyView){ if(this.emptyView != null){ unregisterAdapterDataObserver(mEmptyObserver); } this.emptyView = emptyView; registerAdapterDataObserver(mEmptyObserver); }
java
public void setEmptyView(View emptyView){ if(this.emptyView != null){ unregisterAdapterDataObserver(mEmptyObserver); } this.emptyView = emptyView; registerAdapterDataObserver(mEmptyObserver); }
[ "public", "void", "setEmptyView", "(", "View", "emptyView", ")", "{", "if", "(", "this", ".", "emptyView", "!=", "null", ")", "{", "unregisterAdapterDataObserver", "(", "mEmptyObserver", ")", ";", "}", "this", ".", "emptyView", "=", "emptyView", ";", "regist...
Set the empty view to be used so that @param emptyView
[ "Set", "the", "empty", "view", "to", "be", "used", "so", "that" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L130-L136
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.checkIfEmpty
private void checkIfEmpty(){ if(emptyView != null){ emptyView.setVisibility(getItemCount() > 0 ? View.GONE : View.VISIBLE); } }
java
private void checkIfEmpty(){ if(emptyView != null){ emptyView.setVisibility(getItemCount() > 0 ? View.GONE : View.VISIBLE); } }
[ "private", "void", "checkIfEmpty", "(", ")", "{", "if", "(", "emptyView", "!=", "null", ")", "{", "emptyView", ".", "setVisibility", "(", "getItemCount", "(", ")", ">", "0", "?", "View", ".", "GONE", ":", "View", ".", "VISIBLE", ")", ";", "}", "}" ]
Check if we should show the empty view
[ "Check", "if", "we", "should", "show", "the", "empty", "view" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L141-L145
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.addAll
public void addAll(Collection<? extends M> collection) { if (collection != null) { items.addAll(collection); applyFilter(); } }
java
public void addAll(Collection<? extends M> collection) { if (collection != null) { items.addAll(collection); applyFilter(); } }
[ "public", "void", "addAll", "(", "Collection", "<", "?", "extends", "M", ">", "collection", ")", "{", "if", "(", "collection", "!=", "null", ")", "{", "items", ".", "addAll", "(", "collection", ")", ";", "applyFilter", "(", ")", ";", "}", "}" ]
Add a collection of objects to this adapter @param collection the collection of objects to add
[ "Add", "a", "collection", "of", "objects", "to", "this", "adapter" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L203-L208
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.remove
public M remove(int index){ M item = items.remove(index); applyFilter(); return item; }
java
public M remove(int index){ M item = items.remove(index); applyFilter(); return item; }
[ "public", "M", "remove", "(", "int", "index", ")", "{", "M", "item", "=", "items", ".", "remove", "(", "index", ")", ";", "applyFilter", "(", ")", ";", "return", "item", ";", "}" ]
Remove an item at the given index @param index the index of the item to remove @return the removed item
[ "Remove", "an", "item", "at", "the", "given", "index" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L246-L250
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.moveItem
public void moveItem(int start, int end){ M startItem = filteredItems.get(start); M endItem = filteredItems.get(end); int realStart = items.indexOf(startItem); int realEnd = items.indexOf(endItem); Collections.swap(items, realStart, realEnd); applyFilter(); onI...
java
public void moveItem(int start, int end){ M startItem = filteredItems.get(start); M endItem = filteredItems.get(end); int realStart = items.indexOf(startItem); int realEnd = items.indexOf(endItem); Collections.swap(items, realStart, realEnd); applyFilter(); onI...
[ "public", "void", "moveItem", "(", "int", "start", ",", "int", "end", ")", "{", "M", "startItem", "=", "filteredItems", ".", "get", "(", "start", ")", ";", "M", "endItem", "=", "filteredItems", ".", "get", "(", "end", ")", ";", "int", "realStart", "=...
Move an item around in the underlying array @param start the item to move @param end the position to move to
[ "Move", "an", "item", "around", "in", "the", "underlying", "array" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L258-L270
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.applyFilter
private void applyFilter(){ filteredItems.clear(); Filter<M> filter = getFilter(); if(filter == null){ filteredItems.addAll(items); }else{ for (int i = 0; i < items.size(); i++) { M item = items.get(i); if(filter.filter(item, query...
java
private void applyFilter(){ filteredItems.clear(); Filter<M> filter = getFilter(); if(filter == null){ filteredItems.addAll(items); }else{ for (int i = 0; i < items.size(); i++) { M item = items.get(i); if(filter.filter(item, query...
[ "private", "void", "applyFilter", "(", ")", "{", "filteredItems", ".", "clear", "(", ")", ";", "Filter", "<", "M", ">", "filter", "=", "getFilter", "(", ")", ";", "if", "(", "filter", "==", "null", ")", "{", "filteredItems", ".", "addAll", "(", "item...
Apply the filter, if possible, to the adapter to update content
[ "Apply", "the", "filter", "if", "possible", "to", "the", "adapter", "to", "update", "content" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L353-L369
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.onBindViewHolder
@Override public void onBindViewHolder(final VH vh, final int i) { if(itemClickListener != null){ vh.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = vh.getAdapterPosition(); ...
java
@Override public void onBindViewHolder(final VH vh, final int i) { if(itemClickListener != null){ vh.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = vh.getAdapterPosition(); ...
[ "@", "Override", "public", "void", "onBindViewHolder", "(", "final", "VH", "vh", ",", "final", "int", "i", ")", "{", "if", "(", "itemClickListener", "!=", "null", ")", "{", "vh", ".", "itemView", ".", "setOnClickListener", "(", "new", "View", ".", "OnCli...
Intercept the bind View holder method to wire up the item click listener only if the listener is set by the user CAVEAT: Be sure that you still override this method and call it's super (or don't if you want to override this functionality and use the {@link #onItemClick(android.view.View, int)} method) @param vh ...
[ "Intercept", "the", "bind", "View", "holder", "method", "to", "wire", "up", "the", "item", "click", "listener", "only", "if", "the", "listener", "is", "set", "by", "the", "user" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L398-L424
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.getItemId
@Override public long getItemId(int position) { if(position > RecyclerView.NO_ID && position < getItemCount()) { M item = getItem(position); if (item != null) return item.hashCode(); return position; } return RecyclerView.NO_ID; }
java
@Override public long getItemId(int position) { if(position > RecyclerView.NO_ID && position < getItemCount()) { M item = getItem(position); if (item != null) return item.hashCode(); return position; } return RecyclerView.NO_ID; }
[ "@", "Override", "public", "long", "getItemId", "(", "int", "position", ")", "{", "if", "(", "position", ">", "RecyclerView", ".", "NO_ID", "&&", "position", "<", "getItemCount", "(", ")", ")", "{", "M", "item", "=", "getItem", "(", "position", ")", ";...
Get the item Id for a given position @param position @return
[ "Get", "the", "item", "Id", "for", "a", "given", "position" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L431-L439
train
52inc/android-52Kit
library-eula/src/main/java/com/ftinc/kit/eula/EulaActivity.java
EulaActivity.createIntent
public static Intent createIntent(Context ctx, int logoResId, CharSequence eulaText){ Intent intent = new Intent(ctx, EulaActivity.class); intent.putExtra(EXTRA_LOGO, logoResId); intent.putExtra(EXTRA_EULA_TEXT, eulaText); return intent; }
java
public static Intent createIntent(Context ctx, int logoResId, CharSequence eulaText){ Intent intent = new Intent(ctx, EulaActivity.class); intent.putExtra(EXTRA_LOGO, logoResId); intent.putExtra(EXTRA_EULA_TEXT, eulaText); return intent; }
[ "public", "static", "Intent", "createIntent", "(", "Context", "ctx", ",", "int", "logoResId", ",", "CharSequence", "eulaText", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "ctx", ",", "EulaActivity", ".", "class", ")", ";", "intent", ".", "putE...
Generate a pre-populated intent to launch this activity with @param ctx the context to create the intent with @param logoResId the resource id of the logo you want to use @param eulaText the EULA text to display @return the intent to launch
[ "Generate", "a", "pre", "-", "populated", "intent", "to", "launch", "this", "activity", "with" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-eula/src/main/java/com/ftinc/kit/eula/EulaActivity.java#L52-L57
train
52inc/android-52Kit
library-attributr/src/main/java/com/ftinc/kit/attributr/model/Library.java
Library.getLicenseText
public String getLicenseText(){ if(license != null){ return license.getLicense(description, year, author, email); } return "N/A"; }
java
public String getLicenseText(){ if(license != null){ return license.getLicense(description, year, author, email); } return "N/A"; }
[ "public", "String", "getLicenseText", "(", ")", "{", "if", "(", "license", "!=", "null", ")", "{", "return", "license", ".", "getLicense", "(", "description", ",", "year", ",", "author", ",", "email", ")", ";", "}", "return", "\"N/A\"", ";", "}" ]
Get the formatted license text for display @return the formatted user facing license text
[ "Get", "the", "formatted", "license", "text", "for", "display" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/model/Library.java#L78-L83
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.getCameraCaptureIntent
public static Intent getCameraCaptureIntent(Context ctx, String authority){ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); try { // Get the app's local file storage mCurrentCaptureUri = createAccessibleTempFile(ctx, authority); grantPermissions(ctx, mCur...
java
public static Intent getCameraCaptureIntent(Context ctx, String authority){ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); try { // Get the app's local file storage mCurrentCaptureUri = createAccessibleTempFile(ctx, authority); grantPermissions(ctx, mCur...
[ "public", "static", "Intent", "getCameraCaptureIntent", "(", "Context", "ctx", ",", "String", "authority", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "MediaStore", ".", "ACTION_IMAGE_CAPTURE", ")", ";", "try", "{", "// Get the app's local file storage"...
Generate the appropriate intent to launch the existing camera application to capture an image @see #CAPTURE_PHOTO_REQUEST_CODE @return the intent necessary to launch the camera to capture a photo
[ "Generate", "the", "appropriate", "intent", "to", "launch", "the", "existing", "camera", "application", "to", "capture", "an", "image" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L79-L91
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.getChooseMediaIntent
public static Intent getChooseMediaIntent(String mimeType){ Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(mimeType); return intent; }
java
public static Intent getChooseMediaIntent(String mimeType){ Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(mimeType); return intent; }
[ "public", "static", "Intent", "getChooseMediaIntent", "(", "String", "mimeType", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_GET_CONTENT", ")", ";", "intent", ".", "addCategory", "(", "Intent", ".", "CATEGORY_OPENABLE", ")", ...
Generate the appropriate intent to launch the document chooser to allow the user to pick an image to upload. @see #PICK_MEDIA_REQUEST_CODE @param mimeType the MIME type you want to constrict the chooser to @return the choose media intent
[ "Generate", "the", "appropriate", "intent", "to", "launch", "the", "document", "chooser", "to", "allow", "the", "user", "to", "pick", "an", "image", "to", "upload", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L101-L106
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.handleActivityResult
public static Observable<File> handleActivityResult(final Context context, int resultCode, int requestCode, Intent data){ if(resultCode == Activity.RESULT_OK){ switch (requestCode){ case CAPTURE_PHOTO_REQUEST_CODE: if(mCurrentCaptureUri != null){ ...
java
public static Observable<File> handleActivityResult(final Context context, int resultCode, int requestCode, Intent data){ if(resultCode == Activity.RESULT_OK){ switch (requestCode){ case CAPTURE_PHOTO_REQUEST_CODE: if(mCurrentCaptureUri != null){ ...
[ "public", "static", "Observable", "<", "File", ">", "handleActivityResult", "(", "final", "Context", "context", ",", "int", "resultCode", ",", "int", "requestCode", ",", "Intent", "data", ")", "{", "if", "(", "resultCode", "==", "Activity", ".", "RESULT_OK", ...
Handle the activity result of an intent launched to capture a photo or choose an image @see #getCameraCaptureIntent(Context, String) @see #getChooseMediaIntent(String) @param context the activity context @param resultCode the result of the return code @param requestCode the request code that la...
[ "Handle", "the", "activity", "result", "of", "an", "intent", "launched", "to", "capture", "a", "photo", "or", "choose", "an", "image" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L125-L194
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.createAccessibleTempFile
private static Uri createAccessibleTempFile(Context ctx, String authority) throws IOException { File dir = new File(ctx.getCacheDir(), "camera"); File tmp = createTempFile(dir); // Give permissions return FileProvider.getUriForFile(ctx, authority, tmp); }
java
private static Uri createAccessibleTempFile(Context ctx, String authority) throws IOException { File dir = new File(ctx.getCacheDir(), "camera"); File tmp = createTempFile(dir); // Give permissions return FileProvider.getUriForFile(ctx, authority, tmp); }
[ "private", "static", "Uri", "createAccessibleTempFile", "(", "Context", "ctx", ",", "String", "authority", ")", "throws", "IOException", "{", "File", "dir", "=", "new", "File", "(", "ctx", ".", "getCacheDir", "(", ")", ",", "\"camera\"", ")", ";", "File", ...
Generate an accessible temporary file URI to be used for camera captures @param ctx @return @throws IOException
[ "Generate", "an", "accessible", "temporary", "file", "URI", "to", "be", "used", "for", "camera", "captures" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L236-L242
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.grantPermissions
private static void grantPermissions(Context ctx, Uri uri){ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); List<ResolveInfo> resolvedIntentActivities = ctx.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolvedIntentInfo : re...
java
private static void grantPermissions(Context ctx, Uri uri){ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); List<ResolveInfo> resolvedIntentActivities = ctx.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolvedIntentInfo : re...
[ "private", "static", "void", "grantPermissions", "(", "Context", "ctx", ",", "Uri", "uri", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "MediaStore", ".", "ACTION_IMAGE_CAPTURE", ")", ";", "List", "<", "ResolveInfo", ">", "resolvedIntentActivities", ...
Grant URI permissions for all potential camera applications that can handle the capture intent.
[ "Grant", "URI", "permissions", "for", "all", "potential", "camera", "applications", "that", "can", "handle", "the", "capture", "intent", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L255-L266
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.revokePermissions
private static void revokePermissions(Context ctx, Uri uri){ ctx.revokeUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); }
java
private static void revokePermissions(Context ctx, Uri uri){ ctx.revokeUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); }
[ "private", "static", "void", "revokePermissions", "(", "Context", "ctx", ",", "Uri", "uri", ")", "{", "ctx", ".", "revokeUriPermission", "(", "uri", ",", "Intent", ".", "FLAG_GRANT_WRITE_URI_PERMISSION", "|", "Intent", ".", "FLAG_GRANT_READ_URI_PERMISSION", ")", "...
Revoke URI permissions to a specific URI that had been previously granted
[ "Revoke", "URI", "permissions", "to", "a", "specific", "URI", "that", "had", "been", "previously", "granted" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L271-L275
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/MediaUtils.java
MediaUtils.cleanFilename
public static String cleanFilename(String fileName){ int lastIndex = fileName.lastIndexOf("."); return fileName.substring(0, lastIndex); }
java
public static String cleanFilename(String fileName){ int lastIndex = fileName.lastIndexOf("."); return fileName.substring(0, lastIndex); }
[ "public", "static", "String", "cleanFilename", "(", "String", "fileName", ")", "{", "int", "lastIndex", "=", "fileName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "return", "fileName", ".", "substring", "(", "0", ",", "lastIndex", ")", ";", "}" ]
Clean the extension off of the file name. @param fileName the full file name @return The cleaned file name
[ "Clean", "the", "extension", "off", "of", "the", "file", "name", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L304-L307
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.isEmulator
public static boolean isEmulator(){ return "google_sdk".equals(Build.PRODUCT) || Build.PRODUCT.contains("sdk_google_phone") || "sdk".equals(Build.PRODUCT) || "sdk_x86".equals(Build.PRODUCT) || "vbox86p".equals(Build.PRODUCT); }
java
public static boolean isEmulator(){ return "google_sdk".equals(Build.PRODUCT) || Build.PRODUCT.contains("sdk_google_phone") || "sdk".equals(Build.PRODUCT) || "sdk_x86".equals(Build.PRODUCT) || "vbox86p".equals(Build.PRODUCT); }
[ "public", "static", "boolean", "isEmulator", "(", ")", "{", "return", "\"google_sdk\"", ".", "equals", "(", "Build", ".", "PRODUCT", ")", "||", "Build", ".", "PRODUCT", ".", "contains", "(", "\"sdk_google_phone\"", ")", "||", "\"sdk\"", ".", "equals", "(", ...
Return whether or not the current device is an emulator
[ "Return", "whether", "or", "not", "the", "current", "device", "is", "an", "emulator" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L85-L91
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.getGMTOffset
public static int getGMTOffset(){ Calendar now = Calendar.getInstance(); return (now.get(Calendar.ZONE_OFFSET) + now.get(Calendar.DST_OFFSET)) / 3600000; }
java
public static int getGMTOffset(){ Calendar now = Calendar.getInstance(); return (now.get(Calendar.ZONE_OFFSET) + now.get(Calendar.DST_OFFSET)) / 3600000; }
[ "public", "static", "int", "getGMTOffset", "(", ")", "{", "Calendar", "now", "=", "Calendar", ".", "getInstance", "(", ")", ";", "return", "(", "now", ".", "get", "(", "Calendar", ".", "ZONE_OFFSET", ")", "+", "now", ".", "get", "(", "Calendar", ".", ...
Get the Device's GMT Offset @return the gmt offset in hours
[ "Get", "the", "Device", "s", "GMT", "Offset" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L121-L124
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.getMimeType
public static String getMimeType(String url) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension != null) { MimeTypeMap mime = MimeTypeMap.getSingleton(); type = mime.getMimeTypeFromExtension(extension); } return type; }
java
public static String getMimeType(String url) { String type = null; String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension != null) { MimeTypeMap mime = MimeTypeMap.getSingleton(); type = mime.getMimeTypeFromExtension(extension); } return type; }
[ "public", "static", "String", "getMimeType", "(", "String", "url", ")", "{", "String", "type", "=", "null", ";", "String", "extension", "=", "MimeTypeMap", ".", "getFileExtensionFromUrl", "(", "url", ")", ";", "if", "(", "extension", "!=", "null", ")", "{"...
Get the MIME type of a file @param url @return
[ "Get", "the", "MIME", "type", "of", "a", "file" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L131-L140
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.distance
public static float distance(PointF p1, PointF p2){ return (float) Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow(p2.y - p1.y,2)); }
java
public static float distance(PointF p1, PointF p2){ return (float) Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow(p2.y - p1.y,2)); }
[ "public", "static", "float", "distance", "(", "PointF", "p1", ",", "PointF", "p2", ")", "{", "return", "(", "float", ")", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "(", "p2", ".", "x", "-", "p1", ".", "x", ")", ",", "2", ")", "+", "M...
Compute the distance between two points @param p1 the first point @param p2 the second point @return the distance between the two points
[ "Compute", "the", "distance", "between", "two", "points" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L167-L169
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseFloat
public static float parseFloat(String val, float defVal){ if(TextUtils.isEmpty(val)) return defVal; try{ return Float.parseFloat(val); }catch (NumberFormatException e){ return defVal; } }
java
public static float parseFloat(String val, float defVal){ if(TextUtils.isEmpty(val)) return defVal; try{ return Float.parseFloat(val); }catch (NumberFormatException e){ return defVal; } }
[ "public", "static", "float", "parseFloat", "(", "String", "val", ",", "float", "defVal", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defVal", ";", "try", "{", "return", "Float", ".", "parseFloat", "(", "val", ")",...
Parse a float from a String in a safe manner. @param val the string to parse @param defVal the default value to return if parsing fails @return the parsed float, or default value
[ "Parse", "a", "float", "from", "a", "String", "in", "a", "safe", "manner", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L246-L253
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseInt
public static int parseInt(String val, int defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Integer.parseInt(val); }catch (NumberFormatException e){ return defValue; } }
java
public static int parseInt(String val, int defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Integer.parseInt(val); }catch (NumberFormatException e){ return defValue; } }
[ "public", "static", "int", "parseInt", "(", "String", "val", ",", "int", "defValue", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defValue", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "val", ")", ...
Parse a int from a String in a safe manner. @param val the string to parse @param defValue the default value to return if parsing fails @return the parsed int, or default value
[ "Parse", "a", "int", "from", "a", "String", "in", "a", "safe", "manner", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L262-L269
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseLong
public static long parseLong(String val, long defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Long.parseLong(val); }catch (NumberFormatException e){ return defValue; } }
java
public static long parseLong(String val, long defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Long.parseLong(val); }catch (NumberFormatException e){ return defValue; } }
[ "public", "static", "long", "parseLong", "(", "String", "val", ",", "long", "defValue", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defValue", ";", "try", "{", "return", "Long", ".", "parseLong", "(", "val", ")", ...
Parse a long from a String in a safe manner. @param val the string to parse @param defValue the default value to return if parsing fails @return the parsed long, or default value
[ "Parse", "a", "long", "from", "a", "String", "in", "a", "safe", "manner", "." ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L278-L285
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/Utils.java
Utils.parseDouble
public static double parseDouble(String val, double defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Double.parseDouble(val); }catch(NumberFormatException e){ return defValue; } }
java
public static double parseDouble(String val, double defValue){ if(TextUtils.isEmpty(val)) return defValue; try{ return Double.parseDouble(val); }catch(NumberFormatException e){ return defValue; } }
[ "public", "static", "double", "parseDouble", "(", "String", "val", ",", "double", "defValue", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "val", ")", ")", "return", "defValue", ";", "try", "{", "return", "Double", ".", "parseDouble", "(", "val...
Parse a double from a String in a safe manner @param val the string to parse @param defValue the default value to return in parsing fails @return the parsed double, or default value
[ "Parse", "a", "double", "from", "a", "String", "in", "a", "safe", "manner" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/Utils.java#L294-L301
train
52inc/android-52Kit
library-winds/src/main/java/com/ftinc/kit/winds/ui/ChangeLogActivity.java
ChangeLogActivity.configAppBar
private void configAppBar(){ setSupportActionBar(mAppbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.changelog_activity_title); mAppbar.setNavigationOnClickListener(this); }
java
private void configAppBar(){ setSupportActionBar(mAppbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.changelog_activity_title); mAppbar.setNavigationOnClickListener(this); }
[ "private", "void", "configAppBar", "(", ")", "{", "setSupportActionBar", "(", "mAppbar", ")", ";", "getSupportActionBar", "(", ")", ".", "setDisplayHomeAsUpEnabled", "(", "true", ")", ";", "getSupportActionBar", "(", ")", ".", "setTitle", "(", "R", ".", "strin...
Configure the Appbar
[ "Configure", "the", "Appbar" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/ui/ChangeLogActivity.java#L119-L124
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/font/FontLoader.java
FontLoader.apply
public static void apply(TextView textView, Face type){ // First check for existing typefaces Typeface typeface = getTypeface(textView.getContext(), type); if (typeface != null) textView.setTypeface(typeface); }
java
public static void apply(TextView textView, Face type){ // First check for existing typefaces Typeface typeface = getTypeface(textView.getContext(), type); if (typeface != null) textView.setTypeface(typeface); }
[ "public", "static", "void", "apply", "(", "TextView", "textView", ",", "Face", "type", ")", "{", "// First check for existing typefaces", "Typeface", "typeface", "=", "getTypeface", "(", "textView", ".", "getContext", "(", ")", ",", "type", ")", ";", "if", "("...
Apply a typeface to a textview @see Face @param textView the text view you wish to apply to @param type the typeface to apply
[ "Apply", "a", "typeface", "to", "a", "textview" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/font/FontLoader.java#L51-L56
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/font/FontLoader.java
FontLoader.apply
public static void apply(Face type, TextView... textViews){ if(textViews.length == 0) return; for (int i = 0; i < textViews.length; i++) { apply(textViews[i], type); } }
java
public static void apply(Face type, TextView... textViews){ if(textViews.length == 0) return; for (int i = 0; i < textViews.length; i++) { apply(textViews[i], type); } }
[ "public", "static", "void", "apply", "(", "Face", "type", ",", "TextView", "...", "textViews", ")", "{", "if", "(", "textViews", ".", "length", "==", "0", ")", "return", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "textViews", ".", "lengt...
Apply a typeface to one or many textviews @param type the typeface to apply @param textViews the one or many textviews to apply to
[ "Apply", "a", "typeface", "to", "one", "or", "many", "textviews" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/font/FontLoader.java#L64-L69
train
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/font/FontLoader.java
FontLoader.getTypeface
public static Typeface getTypeface(Context ctx, Face type){ return getTypeface(ctx, "fonts/" + type.getFontFileName()); }
java
public static Typeface getTypeface(Context ctx, Face type){ return getTypeface(ctx, "fonts/" + type.getFontFileName()); }
[ "public", "static", "Typeface", "getTypeface", "(", "Context", "ctx", ",", "Face", "type", ")", "{", "return", "getTypeface", "(", "ctx", ",", "\"fonts/\"", "+", "type", ".", "getFontFileName", "(", ")", ")", ";", "}" ]
Get a Roboto typeface for a given string type @param ctx the application context @param type the typeface type argument @return the loaded typeface, or null
[ "Get", "a", "Roboto", "typeface", "for", "a", "given", "string", "type" ]
8644fab0f633477b1bb1dddd8147a9ef8bc03516
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/font/FontLoader.java#L104-L106
train
opendigitaleducation/web-utils
src/main/java/org/vertx/java/busmods/BusModBase.java
BusModBase.start
public void start() { eb = vertx.eventBus(); config = config(); FileResolver.getInstance().setBasePath(config); }
java
public void start() { eb = vertx.eventBus(); config = config(); FileResolver.getInstance().setBasePath(config); }
[ "public", "void", "start", "(", ")", "{", "eb", "=", "vertx", ".", "eventBus", "(", ")", ";", "config", "=", "config", "(", ")", ";", "FileResolver", ".", "getInstance", "(", ")", ".", "setBasePath", "(", "config", ")", ";", "}" ]
Start the busmod
[ "Start", "the", "busmod" ]
5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3
https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/busmods/BusModBase.java#L44-L48
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java
TablePlanner.makeSelectPlan
public Plan makeSelectPlan() { Plan p = makeIndexSelectPlan(); if (p == null) p = tp; return addSelectPredicate(p); }
java
public Plan makeSelectPlan() { Plan p = makeIndexSelectPlan(); if (p == null) p = tp; return addSelectPredicate(p); }
[ "public", "Plan", "makeSelectPlan", "(", ")", "{", "Plan", "p", "=", "makeIndexSelectPlan", "(", ")", ";", "if", "(", "p", "==", "null", ")", "p", "=", "tp", ";", "return", "addSelectPredicate", "(", "p", ")", ";", "}" ]
Constructs a select plan for the table. The plan will use an indexselect, if possible. @return a select plan for the table.
[ "Constructs", "a", "select", "plan", "for", "the", "table", ".", "The", "plan", "will", "use", "an", "indexselect", "if", "possible", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java#L94-L99
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java
TablePlanner.makeJoinPlan
public Plan makeJoinPlan(Plan trunk) { Schema trunkSch = trunk.schema(); Predicate joinPred = pred.joinPredicate(sch, trunkSch); if (joinPred == null) return null; Plan p = makeIndexJoinPlan(trunk, trunkSch); if (p == null) p = makeProductJoinPlan(trunk, trunkSch); return p; }
java
public Plan makeJoinPlan(Plan trunk) { Schema trunkSch = trunk.schema(); Predicate joinPred = pred.joinPredicate(sch, trunkSch); if (joinPred == null) return null; Plan p = makeIndexJoinPlan(trunk, trunkSch); if (p == null) p = makeProductJoinPlan(trunk, trunkSch); return p; }
[ "public", "Plan", "makeJoinPlan", "(", "Plan", "trunk", ")", "{", "Schema", "trunkSch", "=", "trunk", ".", "schema", "(", ")", ";", "Predicate", "joinPred", "=", "pred", ".", "joinPredicate", "(", "sch", ",", "trunkSch", ")", ";", "if", "(", "joinPred", ...
Constructs a join plan of the specified trunk and this table. The plan will use an indexjoin, if possible; otherwise a multi-buffer product join. The method returns null if no join is possible. <p> The select predicate applicable to this table is pushed down below the join. </p> @param trunk the specified trunk of jo...
[ "Constructs", "a", "join", "plan", "of", "the", "specified", "trunk", "and", "this", "table", ".", "The", "plan", "will", "use", "an", "indexjoin", "if", "possible", ";", "otherwise", "a", "multi", "-", "buffer", "product", "join", ".", "The", "method", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java#L115-L124
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java
TablePlanner.makeProductPlan
public Plan makeProductPlan(Plan trunk) { Plan p = makeSelectPlan(); return new MultiBufferProductPlan(trunk, p, tx); }
java
public Plan makeProductPlan(Plan trunk) { Plan p = makeSelectPlan(); return new MultiBufferProductPlan(trunk, p, tx); }
[ "public", "Plan", "makeProductPlan", "(", "Plan", "trunk", ")", "{", "Plan", "p", "=", "makeSelectPlan", "(", ")", ";", "return", "new", "MultiBufferProductPlan", "(", "trunk", ",", "p", ",", "tx", ")", ";", "}" ]
Constructs a product plan of the specified trunk and this table. <p> The select predicate applicable to this table is pushed down below the product. </p> @param trunk the specified trunk of join @return a product plan of the trunk and this table
[ "Constructs", "a", "product", "plan", "of", "the", "specified", "trunk", "and", "this", "table", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java#L138-L141
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getAccountService
public AccountService getAccountService() { if (_accountService == null) { synchronized (CCApi2.class) { if (_accountService == null) { _accountService = _retrofit.create(AccountService.class); } } } return _accountServ...
java
public AccountService getAccountService() { if (_accountService == null) { synchronized (CCApi2.class) { if (_accountService == null) { _accountService = _retrofit.create(AccountService.class); } } } return _accountServ...
[ "public", "AccountService", "getAccountService", "(", ")", "{", "if", "(", "_accountService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_accountService", "==", "null", ")", "{", "_accountService", "=", "_retro...
Gets the account service. @return the account service
[ "Gets", "the", "account", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L91-L101
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getCampaignService
public CampaignService getCampaignService() { if (_campaignService == null) { synchronized (CCApi2.class) { if (_campaignService == null) { _campaignService = _retrofit.create(CampaignService.class); } } } return _campa...
java
public CampaignService getCampaignService() { if (_campaignService == null) { synchronized (CCApi2.class) { if (_campaignService == null) { _campaignService = _retrofit.create(CampaignService.class); } } } return _campa...
[ "public", "CampaignService", "getCampaignService", "(", ")", "{", "if", "(", "_campaignService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_campaignService", "==", "null", ")", "{", "_campaignService", "=", "_...
Gets the campaign service. @return the campaign service
[ "Gets", "the", "campaign", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L108-L118
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getContactService
public ContactService getContactService() { if (_contactService == null) { synchronized (CCApi2.class) { if (_contactService == null) { _contactService = _retrofit.create(ContactService.class); } } } return _contactServ...
java
public ContactService getContactService() { if (_contactService == null) { synchronized (CCApi2.class) { if (_contactService == null) { _contactService = _retrofit.create(ContactService.class); } } } return _contactServ...
[ "public", "ContactService", "getContactService", "(", ")", "{", "if", "(", "_contactService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_contactService", "==", "null", ")", "{", "_contactService", "=", "_retro...
Gets the contact service. @return the contact service
[ "Gets", "the", "contact", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L125-L135
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getLibraryService
public LibraryService getLibraryService() { if (_libraryService == null) { synchronized (CCApi2.class) { if (_libraryService == null) { _libraryService = _retrofit.create(LibraryService.class); } } } return _libraryServ...
java
public LibraryService getLibraryService() { if (_libraryService == null) { synchronized (CCApi2.class) { if (_libraryService == null) { _libraryService = _retrofit.create(LibraryService.class); } } } return _libraryServ...
[ "public", "LibraryService", "getLibraryService", "(", ")", "{", "if", "(", "_libraryService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_libraryService", "==", "null", ")", "{", "_libraryService", "=", "_retro...
Gets the library service. @return the library service
[ "Gets", "the", "library", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L142-L152
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getCampaignTrackingService
public CampaignTrackingService getCampaignTrackingService() { if (_campaignTrackingService == null) { synchronized (CCApi2.class) { if (_campaignTrackingService == null) { _campaignTrackingService = _retrofit.create(CampaignTrackingService.class); ...
java
public CampaignTrackingService getCampaignTrackingService() { if (_campaignTrackingService == null) { synchronized (CCApi2.class) { if (_campaignTrackingService == null) { _campaignTrackingService = _retrofit.create(CampaignTrackingService.class); ...
[ "public", "CampaignTrackingService", "getCampaignTrackingService", "(", ")", "{", "if", "(", "_campaignTrackingService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_campaignTrackingService", "==", "null", ")", "{", ...
Gets the campaign tracking service. @return the campaign tracking service
[ "Gets", "the", "campaign", "tracking", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L159-L169
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getContactTrackingService
public ContactTrackingService getContactTrackingService() { if (_contactTrackingService == null) { synchronized (CCApi2.class) { if (_contactTrackingService == null) { _contactTrackingService = _retrofit.create(ContactTrackingService.class); } ...
java
public ContactTrackingService getContactTrackingService() { if (_contactTrackingService == null) { synchronized (CCApi2.class) { if (_contactTrackingService == null) { _contactTrackingService = _retrofit.create(ContactTrackingService.class); } ...
[ "public", "ContactTrackingService", "getContactTrackingService", "(", ")", "{", "if", "(", "_contactTrackingService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_contactTrackingService", "==", "null", ")", "{", "_c...
Gets the contact tracking service. @return the contact tracking service
[ "Gets", "the", "contact", "tracking", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L176-L186
train
constantcontact/java-sdk
sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java
CCApi2.getBulkActivitiesService
public BulkActivitiesService getBulkActivitiesService() { if (_bulkActivitiesService == null) { synchronized (CCApi2.class) { if (_bulkActivitiesService == null) { _bulkActivitiesService = _retrofit.create(BulkActivitiesService.class); } ...
java
public BulkActivitiesService getBulkActivitiesService() { if (_bulkActivitiesService == null) { synchronized (CCApi2.class) { if (_bulkActivitiesService == null) { _bulkActivitiesService = _retrofit.create(BulkActivitiesService.class); } ...
[ "public", "BulkActivitiesService", "getBulkActivitiesService", "(", ")", "{", "if", "(", "_bulkActivitiesService", "==", "null", ")", "{", "synchronized", "(", "CCApi2", ".", "class", ")", "{", "if", "(", "_bulkActivitiesService", "==", "null", ")", "{", "_bulkA...
Gets the bulk activities service. @return the bulk activities service
[ "Gets", "the", "bulk", "activities", "service", "." ]
08b176505b8c55073245f38a56d1d9e14a3ccb37
https://github.com/constantcontact/java-sdk/blob/08b176505b8c55073245f38a56d1d9e14a3ccb37/sdk-rx/src/main/java/com/constantcontact/v2/CCApi2.java#L193-L203
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java
TableMgr.createTable
public void createTable(String tblName, Schema sch, Transaction tx) { if (tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME) formatFileHeader(tblName, tx); // Optimization: store the ti tiMap.put(tblName, new TableInfo(tblName, sch)); // insert one record into tblcat RecordFile tcatfile = tcatInfo...
java
public void createTable(String tblName, Schema sch, Transaction tx) { if (tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME) formatFileHeader(tblName, tx); // Optimization: store the ti tiMap.put(tblName, new TableInfo(tblName, sch)); // insert one record into tblcat RecordFile tcatfile = tcatInfo...
[ "public", "void", "createTable", "(", "String", "tblName", ",", "Schema", "sch", ",", "Transaction", "tx", ")", "{", "if", "(", "tblName", "!=", "TCAT_TBLNAME", "&&", "tblName", "!=", "FCAT_TBLNAME", ")", "formatFileHeader", "(", "tblName", ",", "tx", ")", ...
Creates a new table having the specified name and schema. @param tblName the name of the new table @param sch the table's schema @param tx the transaction creating the table
[ "Creates", "a", "new", "table", "having", "the", "specified", "name", "and", "schema", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java#L121-L145
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java
TableMgr.dropTable
public void dropTable(String tblName, Transaction tx) { // Remove the file RecordFile rf = getTableInfo(tblName, tx).open(tx, true); rf.remove(); // Optimization: remove from the TableInfo map tiMap.remove(tblName); // remove the record from tblcat RecordFile tcatfile = tcatInfo.open(tx, true);...
java
public void dropTable(String tblName, Transaction tx) { // Remove the file RecordFile rf = getTableInfo(tblName, tx).open(tx, true); rf.remove(); // Optimization: remove from the TableInfo map tiMap.remove(tblName); // remove the record from tblcat RecordFile tcatfile = tcatInfo.open(tx, true);...
[ "public", "void", "dropTable", "(", "String", "tblName", ",", "Transaction", "tx", ")", "{", "// Remove the file\r", "RecordFile", "rf", "=", "getTableInfo", "(", "tblName", ",", "tx", ")", ".", "open", "(", "tx", ",", "true", ")", ";", "rf", ".", "remov...
Remove a table with the specified name. @param tblName the name of the new table @param tx the transaction creating the table
[ "Remove", "a", "table", "with", "the", "specified", "name", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java#L155-L200
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java
TableMgr.getTableInfo
public TableInfo getTableInfo(String tblName, Transaction tx) { // Optimization: TableInfo resultTi = tiMap.get(tblName); if (resultTi != null) return resultTi; RecordFile tcatfile = tcatInfo.open(tx, true); tcatfile.beforeFirst(); boolean found = false; while (tcatfile.next()) { String t...
java
public TableInfo getTableInfo(String tblName, Transaction tx) { // Optimization: TableInfo resultTi = tiMap.get(tblName); if (resultTi != null) return resultTi; RecordFile tcatfile = tcatInfo.open(tx, true); tcatfile.beforeFirst(); boolean found = false; while (tcatfile.next()) { String t...
[ "public", "TableInfo", "getTableInfo", "(", "String", "tblName", ",", "Transaction", "tx", ")", "{", "// Optimization:\r", "TableInfo", "resultTi", "=", "tiMap", ".", "get", "(", "tblName", ")", ";", "if", "(", "resultTi", "!=", "null", ")", "return", "resul...
Retrieves the metadata for the specified table out of the catalog. @param tblName the name of the table @param tx the transaction @return the table's stored metadata
[ "Retrieves", "the", "metadata", "for", "the", "specified", "table", "out", "of", "the", "catalog", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java#L211-L250
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/remote/storedprocedure/SpStartUp.java
SpStartUp.startUp
public static void startUp(int port) throws Exception { // create a registry specific for the server on the default port Registry reg = LocateRegistry.createRegistry(port); // and post the server entry in it RemoteDriver d = new RemoteDriverImpl(); reg.rebind("vanilladb-sp", d); }
java
public static void startUp(int port) throws Exception { // create a registry specific for the server on the default port Registry reg = LocateRegistry.createRegistry(port); // and post the server entry in it RemoteDriver d = new RemoteDriverImpl(); reg.rebind("vanilladb-sp", d); }
[ "public", "static", "void", "startUp", "(", "int", "port", ")", "throws", "Exception", "{", "// create a registry specific for the server on the default port\r", "Registry", "reg", "=", "LocateRegistry", ".", "createRegistry", "(", "port", ")", ";", "// and post the serve...
Starts up the stored procedure call driver in server side by binding the remote driver object to local registry. @param port the network port for the server @throws Exception if the registry could not be exported
[ "Starts", "up", "the", "stored", "procedure", "call", "driver", "in", "server", "side", "by", "binding", "the", "remote", "driver", "object", "to", "local", "registry", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/storedprocedure/SpStartUp.java#L31-L38
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/algebra/materialize/SortPlan.java
SortPlan.open
@Override public Scan open() { Scan src = p.open(); List<TempTable> runs = splitIntoRuns(src); /* * If the input source scan has no record, the temp table list will * result in size 0. Need to check the size of "runs" here. */ if (runs.size() == 0) return src; src.close(); while (run...
java
@Override public Scan open() { Scan src = p.open(); List<TempTable> runs = splitIntoRuns(src); /* * If the input source scan has no record, the temp table list will * result in size 0. Need to check the size of "runs" here. */ if (runs.size() == 0) return src; src.close(); while (run...
[ "@", "Override", "public", "Scan", "open", "(", ")", "{", "Scan", "src", "=", "p", ".", "open", "(", ")", ";", "List", "<", "TempTable", ">", "runs", "=", "splitIntoRuns", "(", "src", ")", ";", "/*\r\n\t\t * If the input source scan has no record, the temp tab...
This method is where most of the action is. Up to 2 sorted temporary tables are created, and are passed into SortScan for final merging. @see Plan#open()
[ "This", "method", "is", "where", "most", "of", "the", "action", "is", ".", "Up", "to", "2", "sorted", "temporary", "tables", "are", "created", "and", "are", "passed", "into", "SortScan", "for", "final", "merging", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/materialize/SortPlan.java#L88-L102
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/algebra/ProductScan.java
ProductScan.next
@Override public boolean next() { if (isLhsEmpty) return false; if (s2.next()) return true; else if (!(isLhsEmpty = !s1.next())) { s2.beforeFirst(); return s2.next(); } else { return false; } }
java
@Override public boolean next() { if (isLhsEmpty) return false; if (s2.next()) return true; else if (!(isLhsEmpty = !s1.next())) { s2.beforeFirst(); return s2.next(); } else { return false; } }
[ "@", "Override", "public", "boolean", "next", "(", ")", "{", "if", "(", "isLhsEmpty", ")", "return", "false", ";", "if", "(", "s2", ".", "next", "(", ")", ")", "return", "true", ";", "else", "if", "(", "!", "(", "isLhsEmpty", "=", "!", "s1", ".",...
Moves the scan to the next record. The method moves to the next RHS record, if possible. Otherwise, it moves to the next LHS record and the first RHS record. If there are no more LHS records, the method returns false. @see Scan#next()
[ "Moves", "the", "scan", "to", "the", "next", "record", ".", "The", "method", "moves", "to", "the", "next", "RHS", "record", "if", "possible", ".", "Otherwise", "it", "moves", "to", "the", "next", "LHS", "record", "and", "the", "first", "RHS", "record", ...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/ProductScan.java#L65-L77
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.sLock
void sLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasSLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!sLockable(lks, txNum) && !wai...
java
void sLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasSLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!sLockable(lks, txNum) && !wai...
[ "void", "sLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "lk...
Grants an slock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a tra...
[ "Grants", "an", "slock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "lo...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L186-L213
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.xLock
void xLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasXLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!xLockable(lks, txNum) && !wai...
java
void xLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasXLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!xLockable(lks, txNum) && !wai...
[ "void", "xLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "lk...
Grants an xlock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a tra...
[ "Grants", "an", "xlock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "lo...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L227-L254
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.sixLock
void sixLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasSixLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!sixLockable(lks, txNum) &...
java
void sixLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasSixLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!sixLockable(lks, txNum) &...
[ "void", "sixLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "...
Grants an sixlock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a t...
[ "Grants", "an", "sixlock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L268-L295
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.isLock
void isLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIsLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!isLockable(lks, txNum) && !wait...
java
void isLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIsLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!isLockable(lks, txNum) && !wait...
[ "void", "isLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "l...
Grants an islock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a tr...
[ "Grants", "an", "islock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "l...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L308-L333
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.ixLock
void ixLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIxLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!ixLockable(lks, txNum) && !...
java
void ixLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIxLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!ixLockable(lks, txNum) && !...
[ "void", "ixLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "l...
Grants an ixlock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a tr...
[ "Grants", "an", "ixlock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "l...
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L346-L373
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.release
void release(Object obj, long txNum, int lockType) { Object anchor = getAnchor(obj); synchronized (anchor) { Lockers lks = lockerMap.get(obj); /* * In some situation, tx will release the lock of the object that * have been released. */ if (lks != null) { releaseLock(lks, anchor, tx...
java
void release(Object obj, long txNum, int lockType) { Object anchor = getAnchor(obj); synchronized (anchor) { Lockers lks = lockerMap.get(obj); /* * In some situation, tx will release the lock of the object that * have been released. */ if (lks != null) { releaseLock(lks, anchor, tx...
[ "void", "release", "(", "Object", "obj", ",", "long", "txNum", ",", "int", "lockType", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "lks", "=", "lockerMap", ".", "get", "(", ...
Releases the specified type of lock on an item holding by a transaction. If a lock is the last lock on that block, then the waiting transactions are notified. @param obj a lockable item @param txNum a transaction number @param lockType the type of lock
[ "Releases", "the", "specified", "type", "of", "lock", "on", "an", "item", "holding", "by", "a", "transaction", ".", "If", "a", "lock", "is", "the", "last", "lock", "on", "that", "block", "then", "the", "waiting", "transactions", "are", "notified", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L387-L413
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.releaseAll
void releaseAll(long txNum, boolean sLockOnly) { Set<Object> objectsToRelease = getObjectSet(txNum); for (Object obj : objectsToRelease) { Object anchor = getAnchor(obj); synchronized (anchor) { Lockers lks = lockerMap.get(obj); if (lks != null) { if (hasSLock(lks, txNum)) relea...
java
void releaseAll(long txNum, boolean sLockOnly) { Set<Object> objectsToRelease = getObjectSet(txNum); for (Object obj : objectsToRelease) { Object anchor = getAnchor(obj); synchronized (anchor) { Lockers lks = lockerMap.get(obj); if (lks != null) { if (hasSLock(lks, txNum)) relea...
[ "void", "releaseAll", "(", "long", "txNum", ",", "boolean", "sLockOnly", ")", "{", "Set", "<", "Object", ">", "objectsToRelease", "=", "getObjectSet", "(", "txNum", ")", ";", "for", "(", "Object", "obj", ":", "objectsToRelease", ")", "{", "Object", "anchor...
Releases all locks held by a transaction. If a lock is the last lock on that block, then the waiting transactions are notified. @param txNum a transaction number @param sLockOnly release slocks only
[ "Releases", "all", "locks", "held", "by", "a", "transaction", ".", "If", "a", "lock", "is", "the", "last", "lock", "on", "that", "block", "then", "the", "waiting", "transactions", "are", "notified", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L425-L461
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java
FileHeaderPage.close
public void close() { if (blk != null) { tx.bufferMgr().unpin(currentBuff); blk = null; currentBuff = null; } }
java
public void close() { if (blk != null) { tx.bufferMgr().unpin(currentBuff); blk = null; currentBuff = null; } }
[ "public", "void", "close", "(", ")", "{", "if", "(", "blk", "!=", "null", ")", "{", "tx", ".", "bufferMgr", "(", ")", ".", "unpin", "(", "currentBuff", ")", ";", "blk", "=", "null", ";", "currentBuff", "=", "null", ";", "}", "}" ]
Closes the header manager, by unpinning the block.
[ "Closes", "the", "header", "manager", "by", "unpinning", "the", "block", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java#L73-L79
train
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java
FileHeaderPage.hasDataRecords
public boolean hasDataRecords() { long blkNum = (Long) getVal(OFFSET_TS_BLOCKID, BIGINT).asJavaVal(); return blkNum != NO_SLOT_BLOCKID ? true : false; }
java
public boolean hasDataRecords() { long blkNum = (Long) getVal(OFFSET_TS_BLOCKID, BIGINT).asJavaVal(); return blkNum != NO_SLOT_BLOCKID ? true : false; }
[ "public", "boolean", "hasDataRecords", "(", ")", "{", "long", "blkNum", "=", "(", "Long", ")", "getVal", "(", "OFFSET_TS_BLOCKID", ",", "BIGINT", ")", ".", "asJavaVal", "(", ")", ";", "return", "blkNum", "!=", "NO_SLOT_BLOCKID", "?", "true", ":", "false", ...
Return true if this file has inserted data records. @return true if this file has inserted data records
[ "Return", "true", "if", "this", "file", "has", "inserted", "data", "records", "." ]
d9a34e876b1b83226036d1fa982a614bbef59bd1
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/FileHeaderPage.java#L86-L89
train