Simplification

pull/159/head
M66B 6 years ago
parent c8ed3a4a33
commit 0421ecb5c7

@ -436,8 +436,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
if (savedInstanceState != null)
drawerToggle.setDrawerIndicatorEnabled(savedInstanceState.getBoolean("fair:toggle"));
new Handler().post(checkIntent);
checkIntent();
checkFirst();
checkCrash();
@ -470,60 +469,58 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
fragmentTransaction.commit();
}
private Runnable checkIntent = new Runnable() {
@Override
public void run() {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
return;
Intent intent = getIntent();
private void checkIntent() {
Intent intent = getIntent();
String action = intent.getAction();
Log.i("View intent=" + intent + " action=" + action);
if (action != null) {
intent.setAction(null);
setIntent(intent);
String action = intent.getAction();
Log.i("View intent=" + intent + " action=" + action);
if (action != null) {
intent.setAction(null);
setIntent(intent);
if ("unified".equals(action)) {
if ("unified".equals(action)) {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack("unified", 0);
} else if ("why".equals(action)) {
} else if ("why".equals(action)) {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack("unified", 0);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityView.this);
boolean why = prefs.getBoolean("why", false);
if (!why) {
prefs.edit().putBoolean("why", true).apply();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityView.this);
boolean why = prefs.getBoolean("why", false);
if (!why) {
prefs.edit().putBoolean("why", true).apply();
Intent iwhy = new Intent(Intent.ACTION_VIEW);
iwhy.setData(Uri.parse(Helper.FAQ_URI + "#user-content-faq2"));
iwhy.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (iwhy.resolveActivity(getPackageManager()) != null)
startActivity(iwhy);
}
Intent iwhy = new Intent(Intent.ACTION_VIEW);
iwhy.setData(Uri.parse(Helper.FAQ_URI + "#user-content-faq2"));
iwhy.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (iwhy.resolveActivity(getPackageManager()) != null)
startActivity(iwhy);
}
} else if ("outbox".equals(action))
onMenuOutbox();
else if (action.startsWith("thread")) {
intent.putExtra("thread", action.split(":", 2)[1]);
onViewThread(intent);
} else if (action.equals("widget"))
onViewThread(intent);
}
} else if ("outbox".equals(action))
onMenuOutbox();
if (intent.hasExtra(Intent.EXTRA_PROCESS_TEXT)) {
searching = true;
String search = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString();
else if (action.startsWith("thread")) {
intent.putExtra("thread", action.split(":", 2)[1]);
onViewThread(intent);
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
setIntent(intent);
} else if (action.equals("widget"))
onViewThread(intent);
}
FragmentMessages.search(
ActivityView.this, ActivityView.this, getSupportFragmentManager(),
-1, false, search);
}
if (intent.hasExtra(Intent.EXTRA_PROCESS_TEXT)) {
searching = true;
String search = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString();
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
setIntent(intent);
FragmentMessages.search(
ActivityView.this, ActivityView.this, getSupportFragmentManager(),
-1, false, search);
}
};
}
@Override
protected void onSaveInstanceState(Bundle outState) {
@ -542,7 +539,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
new Handler().post(checkIntent);
checkIntent();
}
@Override

Loading…
Cancel
Save