Simplification

This commit is contained in:
M66B 2019-09-10 09:05:21 +02:00
parent 3369ef9431
commit 541de9e257
7 changed files with 13 additions and 13 deletions

View File

@ -102,7 +102,7 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
getSupportFragmentManager().addOnBackStackChangedListener(this); getSupportFragmentManager().addOnBackStackChangedListener(this);
} }
if (Helper.isPlayStoreInstall(this)) { if (Helper.isPlayStoreInstall()) {
Log.i("IAB start"); Log.i("IAB start");
billingClient = BillingClient.newBuilder(this) billingClient = BillingClient.newBuilder(this)
.enablePendingPurchases() .enablePendingPurchases()
@ -219,7 +219,7 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
}; };
private void onPurchase(Intent intent) { private void onPurchase(Intent intent) {
if (Helper.isPlayStoreInstall(this)) { if (Helper.isPlayStoreInstall()) {
BillingFlowParams.Builder flowParams = BillingFlowParams.newBuilder(); BillingFlowParams.Builder flowParams = BillingFlowParams.newBuilder();
if (skuDetails.containsKey(getSkuPro())) { if (skuDetails.containsKey(getSkuPro())) {
Log.i("IAB purchase SKU=" + skuDetails.get(getSkuPro())); Log.i("IAB purchase SKU=" + skuDetails.get(getSkuPro()));

View File

@ -39,7 +39,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getSupportFragmentManager().addOnBackStackChangedListener(this); getSupportFragmentManager().addOnBackStackChangedListener(this);
if (!Log.isSupportedDevice() && Helper.isPlayStoreInstall(this)) { if (!Log.isSupportedDevice() && Helper.isPlayStoreInstall()) {
setTheme(R.style.AppThemeLight); setTheme(R.style.AppThemeLight);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_unsupported); setContentView(R.layout.activity_unsupported);

View File

@ -336,7 +336,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}, new Runnable() { }, new Runnable() {
@Override @Override
public void run() { public void run() {
if (!Helper.isPlayStoreInstall(ActivityView.this)) { if (!Helper.isPlayStoreInstall()) {
drawerLayout.closeDrawer(drawerContainer); drawerLayout.closeDrawer(drawerContainer);
checkUpdate(true); checkUpdate(true);
} }
@ -360,7 +360,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
} }
}).setExternal(true)); }).setExternal(true));
if ((Helper.isPlayStoreInstall(this) || BuildConfig.DEBUG) && if ((Helper.isPlayStoreInstall() || BuildConfig.DEBUG) &&
getIntentRate(this).resolveActivity(pm) != null) getIntentRate(this).resolveActivity(pm) != null)
extra.add(new NavMenuItem(R.drawable.baseline_star_24, R.string.menu_rate, new Runnable() { extra.add(new NavMenuItem(R.drawable.baseline_star_24, R.string.menu_rate, new Runnable() {
@Override @Override
@ -687,7 +687,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
} }
private void checkUpdate(boolean always) { private void checkUpdate(boolean always) {
if (Helper.isPlayStoreInstall(this) || !Helper.hasValidFingerprint(this)) if (Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(this))
return; return;
long now = new Date().getTime(); long now = new Date().getTime();
@ -813,7 +813,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private Intent getIntentOtherApps() { private Intent getIntentOtherApps() {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(Helper.isPlayStoreInstall(this) intent.setData(Uri.parse(Helper.isPlayStoreInstall()
? Helper.PLAY_APPS_URI : Helper.XDA_APPS_URI)); ? Helper.PLAY_APPS_URI : Helper.XDA_APPS_URI));
return intent; return intent;
} }

View File

@ -61,7 +61,7 @@ public class ApplicationEx extends Application {
Log.e(ex); Log.e(ex);
if (BuildConfig.BETA_RELEASE || if (BuildConfig.BETA_RELEASE ||
!Helper.isPlayStoreInstall(ApplicationEx.this)) !Helper.isPlayStoreInstall())
Log.writeCrashLog(ApplicationEx.this, ex); Log.writeCrashLog(ApplicationEx.this, ex);
if (prev != null) if (prev != null)
@ -190,7 +190,7 @@ public class ApplicationEx extends Application {
nm.createNotificationChannel(notification); nm.createNotificationChannel(notification);
// Update // Update
if (!Helper.isPlayStoreInstall(this)) { if (!Helper.isPlayStoreInstall()) {
NotificationChannel update = new NotificationChannel( NotificationChannel update = new NotificationChannel(
"update", getString(R.string.channel_update), "update", getString(R.string.channel_update),
NotificationManager.IMPORTANCE_HIGH); NotificationManager.IMPORTANCE_HIGH);

View File

@ -303,7 +303,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
swUpdates.setChecked(prefs.getBoolean("updates", true)); swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setVisibility( swUpdates.setVisibility(
Helper.isPlayStoreInstall(getContext()) || !Helper.hasValidFingerprint(getContext()) Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext())
? View.GONE : View.VISIBLE); ? View.GONE : View.VISIBLE);
swExperiments.setChecked(prefs.getBoolean("experiments", false)); swExperiments.setChecked(prefs.getBoolean("experiments", false));
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false)); swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));

View File

@ -101,7 +101,7 @@ public class FragmentPro extends FragmentBase implements SharedPreferences.OnSha
btnPurchase.setEnabled(false); btnPurchase.setEnabled(false);
tvPrice.setText(null); tvPrice.setText(null);
btnCheck.setEnabled(false); btnCheck.setEnabled(false);
btnCheck.setVisibility(Helper.isPlayStoreInstall(getContext()) && debug ? View.VISIBLE : View.GONE); btnCheck.setVisibility(Helper.isPlayStoreInstall() && debug ? View.VISIBLE : View.GONE);
return view; return view;
} }
@ -182,7 +182,7 @@ public class FragmentPro extends FragmentBase implements SharedPreferences.OnSha
boolean pro = prefs.getBoolean(key, false); boolean pro = prefs.getBoolean(key, false);
tvActivated.setVisibility(pro ? View.VISIBLE : View.GONE); tvActivated.setVisibility(pro ? View.VISIBLE : View.GONE);
if (!Helper.isPlayStoreInstall(getContext())) if (!Helper.isPlayStoreInstall())
btnPurchase.setEnabled(!pro || BuildConfig.DEBUG); btnPurchase.setEnabled(!pro || BuildConfig.DEBUG);
} }
} }

View File

@ -813,7 +813,7 @@ public class Helper {
return sb.toString(); return sb.toString();
} }
static boolean isPlayStoreInstall(Context context) { static boolean isPlayStoreInstall() {
return BuildConfig.PLAY_STORE_RELEASE; return BuildConfig.PLAY_STORE_RELEASE;
} }