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
{"lastUpload":"2019-02-27T02:08:16.923Z","extensionVersion":"v3.2.4"} |
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
static void restart() { | |
killBackgroundProcesses(); | |
Runtime.getRuntime().addShutdownHook(new Thread() { | |
@Override | |
public void run() { | |
super.run(); | |
PackageManager packageManager = context.getPackageManager(); | |
Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName()); | |
ComponentName componentName = intent.getComponent(); | |
Intent mainIntent = Intent.makeRestartActivityTask(componentName); |
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
//The behavior you are experiencing is caused by an issue that exists in some Android launchers since API 1. You can find details about the bug as well as possible solutions here: https://code.google.com/p/android/issues/detail?id=2373. | |
//It's a relatively common issue on Samsung devices as well as other manufacturers that use a custom launcher/skin. I haven't seen the issue occur on a stock Android launcher. | |
//Basically, the app is not actually restarting completely, but your launch Activity is being started and added to the top of the Activity stack when the app is being resumed by the launcher. You can confirm this is the case by clicking the back button when you resume the app and are shown the launch Activity. You should then be brought to the Activity that you expected to be shown when you resumed the app. | |
//The workaround I chose to implement to resolve this issue is to check for the Intent.CATEGORY_LAUNCHER category and Intent.ACTION_MAIN action in the intent that starts the initial Activity. If those |
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 static View createProgressView(Activity activity) { | |
ViewGroup viewGroup = (ViewGroup) activity.findViewById(android.R.id.content); | |
View progressView = LayoutInflater.from(activity).inflate(R.layout.view_progress_bar, viewGroup, false); | |
viewGroup.addView(progressView); | |
return progressView; | |
} |
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 static void applyDim(@NonNull Activity activity){ | |
float dimAmount = 0.5f; | |
ViewGroup rootView = (ViewGroup) (activity.getWindow().getDecorView().getRootView()); | |
Drawable dim = new ColorDrawable(Color.BLACK); | |
dim.setBounds(0, 0, rootView.getWidth(), rootView.getHeight()); | |
dim.setAlpha((int) (255 * dimAmount)); | |
ViewGroupOverlay overlay = rootView.getOverlay(); | |
overlay.add(dim); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<integer name="design_snackbar_text_max_lines">5</integer> | |
</resources> |
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
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | |
@Override | |
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |
} | |
@Override | |
public void onPageSelected(int position) { | |
invalidateActionbar(position); | |
} |
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
editText.setFilters(new InputFilter[] { | |
new InputFilter() { | |
@Override | |
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { | |
if (!somePattern.matcher(source).matches()) { | |
//return empty to refuse | |
return ""; | |
} else { | |
//return null if accept | |
return null; |
NewerOlder