Remove isMOnkeyRunnerCheck
This commit is contained in:
parent
7689c988a2
commit
3cac3b4cb3
@ -9,9 +9,6 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<!--TODO: REMOVE IN PRODUCTION-->
|
||||
<!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
|
||||
|
||||
<!-- for onscreen -->
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
@ -27,7 +27,6 @@ import android.app.Application;
|
||||
import android.content.*;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
@ -47,9 +46,6 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.TextView;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Strings;
|
||||
import com.squareup.otto.Bus;
|
||||
import org.solovyev.android.Check;
|
||||
import org.solovyev.android.calculator.floating.FloatingCalculatorService;
|
||||
@ -299,65 +295,6 @@ public final class App {
|
||||
return context.getResources().getBoolean(R.bool.cpp_tablet);
|
||||
}
|
||||
|
||||
static void addHelpInfo(@Nonnull Activity activity, @Nonnull View root) {
|
||||
if (!isMonkeyRunner(activity)) {
|
||||
return;
|
||||
}
|
||||
if (!(root instanceof ViewGroup)) {
|
||||
return;
|
||||
}
|
||||
final TextView helperTextView = new TextView(activity);
|
||||
|
||||
final DisplayMetrics dm = new DisplayMetrics();
|
||||
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
|
||||
helperTextView.setTextSize(15);
|
||||
helperTextView.setTextColor(Color.WHITE);
|
||||
|
||||
final Configuration c = activity.getResources().getConfiguration();
|
||||
|
||||
final StringBuilder helpText = new StringBuilder();
|
||||
helpText.append("Size: ");
|
||||
if (isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
|
||||
helpText.append("xlarge");
|
||||
} else if (isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
|
||||
helpText.append("large");
|
||||
} else if (isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
|
||||
helpText.append("normal");
|
||||
} else if (isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
|
||||
helpText.append("small");
|
||||
} else {
|
||||
helpText.append("unknown");
|
||||
}
|
||||
|
||||
helpText.append(" (").append(dm.widthPixels).append("x").append(dm.heightPixels).append(")");
|
||||
|
||||
helpText.append(" Density: ");
|
||||
switch (dm.densityDpi) {
|
||||
case DisplayMetrics.DENSITY_LOW:
|
||||
helpText.append("ldpi");
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_MEDIUM:
|
||||
helpText.append("mdpi");
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_HIGH:
|
||||
helpText.append("hdpi");
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_XHIGH:
|
||||
helpText.append("xhdpi");
|
||||
break;
|
||||
case DisplayMetrics.DENSITY_TV:
|
||||
helpText.append("tv");
|
||||
break;
|
||||
}
|
||||
|
||||
helpText.append(" (").append(dm.densityDpi).append(")");
|
||||
|
||||
helperTextView.setText(helpText);
|
||||
|
||||
((ViewGroup) root).addView(helperTextView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
|
||||
static boolean isFloatingCalculator(@NonNull Context context) {
|
||||
return unwrap(context) instanceof FloatingCalculatorService;
|
||||
}
|
||||
@ -378,12 +315,6 @@ public final class App {
|
||||
return Looper.myLooper() == Looper.getMainLooper();
|
||||
}
|
||||
|
||||
public static boolean isLayoutSizeAtLeast(int size, @Nonnull Configuration configuration) {
|
||||
int cur = configuration.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
|
||||
if (cur == Configuration.SCREENLAYOUT_SIZE_UNDEFINED) return false;
|
||||
return cur >= size;
|
||||
}
|
||||
|
||||
public static void restartActivity(@Nonnull Activity activity) {
|
||||
final Intent intent = activity.getIntent();
|
||||
activity.finish();
|
||||
|
@ -146,7 +146,6 @@ public class BaseActivity extends AppCompatActivity {
|
||||
ButterKnife.bind(this, this);
|
||||
|
||||
fixFonts(mainView);
|
||||
App.addHelpInfo(this, mainView);
|
||||
initToolbar();
|
||||
populateTabs(tabs);
|
||||
tabs.onCreate();
|
||||
|
Loading…
Reference in New Issue
Block a user