Move Magisk Manager files into subfolder

This commit is contained in:
topjohnwu
2018-07-18 17:47:53 +08:00
parent 201d8a97d4
commit f8076825cb
248 changed files with 0 additions and 0 deletions
@@ -0,0 +1,34 @@
package com.topjohnwu.magisk.components;
import android.os.Handler;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.util.Locale;
public abstract class Application extends android.app.Application {
public static WeakReference<Application> weakSelf;
public static Locale locale;
public static Locale defaultLocale;
private static Handler mHandler = new Handler();
public Application() {
weakSelf = new WeakReference<>(this);
}
@Override
public void onCreate() {
super.onCreate();
locale = defaultLocale = Locale.getDefault();
}
public static void toast(CharSequence msg, int duration) {
mHandler.post(() -> Toast.makeText(weakSelf.get(), msg, duration).show());
}
public static void toast(int resId, int duration) {
mHandler.post(() -> Toast.makeText(weakSelf.get(), resId, duration).show());
}
}