This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # first install pygmentize to the mac OS X or macOS system with the built-in python | |
| sudo easy_install Pygments | |
| # then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc. | |
| alias pcat='pygmentize -f terminal256 -O style=native -g' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // make custom spinner (use icon image) | |
| <TextView | |
| android:id="@+id/spinner_first" | |
| android:layout_width="0dp" | |
| android:layout_height="36dp" | |
| android:layout_weight="1" | |
| style="?android:attr/spinnerItemStyle" | |
| android:background="@drawable/spinner_back" | |
| android:drawableRight="@drawable/icon_search_more" | |
| android:drawableEnd="@drawable/icon_search_more"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); | |
| logging.setLevel(HttpLoggingInterceptor.Level.BODY); | |
| OkHttpClient client = new OkHttpClient | |
| .Builder().addInterceptor(logging).build(); | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://stackoverflow.com/questions/12128331/how-to-change-fontfamily-of-textview-in-android | |
| android:fontFamily="sans-serif" // roboto regular | |
| android:fontFamily="sans-serif-light" // roboto light | |
| android:fontFamily="sans-serif-condensed" // roboto condensed | |
| android:fontFamily="sans-serif-thin" // roboto thin (android 4.2) | |
| android:fontFamily="sans-serif-medium" // roboto medium (android 5.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // library build.gradle | |
| apply plugin: 'com.android.library' | |
| apply plugin: 'com.novoda.bintray-release' | |
| publish { | |
| userOrg = 'user' | |
| groupId = 'package' | |
| artifactId = 'artifactId' | |
| publishVersion = '1.0' | |
| desc = 'Description for library' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // api >= 16 | |
| Intent i = SomeActivity.newIntent(CallerActivity.this, mMember); | |
| Bundle bundle = ActivityOptions.makeCustomAnimation(CallerActivity.this, | |
| R.anim.slide_in_right, | |
| R.anim.slide_out_left).toBundle(); | |
| startActivity(i, bundle); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NumberFormat.getCurrencyInstance(Locale.US).format(org); | |
| NumberFormat.getCurrencyInstance(Locale.KOREA).format(org); | |
| Locale locale = new Locale("ko", "KR"); | |
| NumberFormat.getCurrencyInstance(locale).format(org); | |
| NumberFormat.getCurrencyInstance(Locale.getDefault()).format(org); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Snackbar snackbar = Snackbar.make(findViewById(R.id.main_content), "TEST", Snackbar.LENGTH_INDEFINITE); | |
| View snackbarView = snackbar.getView(); | |
| // change background color of snackbar | |
| snackbarView.setBackgroundColor(ContextCompat.getColor(this, R.color.my_color)); | |
| // align text to right end and add image icon to left | |
| TextView textView = (TextView)snackbarView.findViewById(android.support.design.R.id.snackbar_text); | |
| textView.setTextSize(16); | |
| textView.setGravity(Gravity.END | Gravity.CENTER_VERTICAL); | |
| textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_test, 0, 0, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private class SpinnerAdapter extends ArrayAdapter<String> { | |
| private Context mContext; | |
| private int mResource; | |
| private String[] mObjects; | |
| public SpinnerAdapter(Context context, int resource, String[] objects) { | |
| super(context, resource, objects); | |
| mContext = context; | |
| mResource = resource; | |
| mObjects = objects; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String getVersion(Context context) { | |
| try { | |
| return context.getPackageManager() | |
| .getPackageInfo(context.getPackageName(), 0).versionName; | |
| } catch (PackageManager.NameNotFoundException e) { | |
| e.printStackTrace(); | |
| return ""; | |
| } | |
| } |
NewerOlder