42 lines
1.3 KiB
Java
Raw Normal View History

2017-02-07 02:01:32 +08:00
package com.topjohnwu.magisk.components;
2017-07-22 22:14:02 +08:00
import android.content.res.Configuration;
2017-02-07 02:01:32 +08:00
import android.support.v7.app.AppCompatActivity;
2017-05-24 21:21:15 +02:00
import android.view.WindowManager;
2017-02-07 02:01:32 +08:00
import com.topjohnwu.magisk.MagiskManager;
2017-05-24 21:21:15 +02:00
import com.topjohnwu.magisk.R;
2017-07-22 22:14:02 +08:00
import com.topjohnwu.magisk.utils.Utils;
import java.util.Locale;
2017-02-07 02:01:32 +08:00
public class Activity extends AppCompatActivity {
2017-07-22 22:14:02 +08:00
public Activity() {
super();
Configuration configuration = new Configuration();
configuration.setLocale(MagiskManager.locale);
applyOverrideConfiguration(configuration);
}
2017-02-17 08:51:51 +08:00
@Override
public MagiskManager getApplicationContext() {
2017-02-22 04:13:21 +08:00
return (MagiskManager) super.getApplicationContext();
2017-02-07 02:01:32 +08:00
}
2017-05-24 21:21:15 +02:00
protected void setFloating() {
boolean isTablet = getResources().getBoolean(R.bool.isTablet);
if (isTablet) {
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = getResources().getDimensionPixelSize(R.dimen.floating_height);
params.width = getResources().getDimensionPixelSize(R.dimen.floating_width);
params.alpha = 1.0f;
params.dimAmount = 0.6f;
params.flags |= 2;
getWindow().setAttributes(params);
setFinishOnTouchOutside(true);
}
}
2017-02-07 02:01:32 +08:00
}