本文整理汇总了Java中com.jakewharton.processphoenix.ProcessPhoenix类的典型用法代码示例。如果您正苦于以下问题:Java ProcessPhoenix类的具体用法?Java ProcessPhoenix怎么用?Java ProcessPhoenix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProcessPhoenix类属于com.jakewharton.processphoenix包,在下文中一共展示了ProcessPhoenix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this) || ProcessPhoenix.isPhoenixProcess(this)) {
return;
}
LeakCanary.install(this);
AndroidThreeTen.init(this);
component = DaggerInitializer.init(this);
component.inject(this);
appInitializer.init(this);
lumberYard.cleanUp();
Timber.plant(lumberYard.tree());
registerActivityLifecycleCallbacks(activityHierarchyServer);
}
示例2: onCreate
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findViewById(net.skoumal.forceupdate.R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ExampleApp.getInstance().getForceUpdate().clearCache();
ExampleApp.getInstance().getMinAllowedVersionProvider().resetVersion();
ExampleApp.getInstance().getExcludedVersionProvider().resetVersion();
ExampleApp.getInstance().getRecommendedVersionProvider().resetVersion();
ProcessPhoenix.triggerRebirth(ResetVersionsForceUpdateActivity.this);
}
});
}
示例3: onCreate
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showVersions();
initPlusMinusButtonsListener();
findViewById(R.id.restart_app_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ProcessPhoenix.triggerRebirth(MainActivity.this);
}
});
}
示例4: onCreate
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findViewById(net.skoumal.forceupdate.R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ExampleApp.getInstance().getMinAllowedVersionProvider().resetVersion();
ExampleApp.getInstance().getExcludedVersionProvider().resetVersion();
ExampleApp.getInstance().getRecommendedVersionProvider().resetVersion();
ProcessPhoenix.triggerRebirth(ResetVersionsRecommendedUpdateActivity.this);
}
});
}
示例5: restart
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@OnClick(R.id.restart)
void restart() {
final Intent nextIntent = new Intent(this, Activity3.class);
mRealm.close();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
ProcessPhoenix.triggerRebirth(Activity3.this);
}
}, 3000);
}
示例6: onNavigationItemSelected
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
showPreferences();
} else if (id == R.id.action_goto_start_url) {
mWebView.loadStartUrl();
} else if (id == R.id.action_reload) {
mWebView.reload();
} else if (id == R.id.action_start_app) {
Intent launchIntent = getLaunchIntent(this);
if (launchIntent != null) {
startActivity(launchIntent);
}
} else if (id == R.id.action_info) {
showInfoScreen();
} else if (id == R.id.action_help) {
showHelpScreen();
} else if (id == R.id.action_restart) {
destroy();
ProcessPhoenix.triggerRebirth(this);
} else if (id == R.id.action_exit) {
destroy();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
finishAndRemoveTask();
} else {
finish();
}
Runtime.getRuntime().exit(0);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawers();
return true;
}
示例7: onStop
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
public void onStop() {
if (newApi != ((CheckBoxPreference) findPreference("pref_motion_detection_new_api")).isChecked()) {
ProcessPhoenix.triggerRebirth(getActivity());
}
super.onStop();
}
示例8: restartApp
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
static void restartApp(MainActivity context, int count) {
Intent mStartActivity = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
mStartActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (count != -1) {
mStartActivity.putExtra("crash", true);
mStartActivity.putExtra("restartCount", count + 1);
}
context.destroy();
ProcessPhoenix.triggerRebirth(context, mStartActivity);
}
示例9: showNewNetworkProxyDialog
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
private void showNewNetworkProxyDialog(final ProxyAdapter proxyAdapter) {
final int originalSelection = networkProxyAddress.isSet() ? ProxyAdapter.PROXY : ProxyAdapter.NONE;
View view = LayoutInflater.from(app).inflate(R.layout.debug_drawer_network_proxy, null);
final EditText hostView = findById(view, R.id.debug_drawer_network_proxy_host);
if (networkProxyAddress.isSet()) {
String host = networkProxyAddress.get().getHostName();
hostView.setText(host); // Set the current host.
hostView.setSelection(0, host.length()); // Pre-select it for editing.
// Show the keyboard. Post this to the next frame when the dialog has been attached.
hostView.post(() -> Keyboards.showKeyboard(hostView));
}
new AlertDialog.Builder(getContext()) //
.setTitle("Set Network Proxy")
.setView(view)
.setNegativeButton("Cancel", (dialog, i) -> {
networkProxyView.setSelection(originalSelection);
dialog.cancel();
})
.setPositiveButton("Use", (dialog, i) -> {
String in = hostView.getText().toString();
InetSocketAddress address = InetSocketAddressPreferenceAdapter.parse(in);
if (address != null) {
networkProxyAddress.set(address);
// Force a restart to re-initialize the app with the new proxy.
ProcessPhoenix.triggerRebirth(getContext());
} else {
networkProxyView.setSelection(originalSelection);
}
})
.setOnCancelListener(dialogInterface -> networkProxyView.setSelection(originalSelection))
.show();
}
示例10: onPreferenceChange
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
public boolean onPreferenceChange(final Preference preference, Object value) {
final String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(listPreference.getEntries()[index]);
} else if (preference instanceof SwitchPreference) {
if (((SwitchPreference) preference).isChecked() != Boolean.valueOf(stringValue)) {
if (preference.getKey().equals(Constants.KEY_PREFERENCES_THEME)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ProcessPhoenix.triggerRebirth(preference.getContext(),
new Intent(preference.getContext(), MainActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
}
}, 250);
}
preference.setSummary(stringValue);
return true;
} else {
return false;
}
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
示例11: onClick
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
protected void onClick() {
new MaterialDialog.Builder(getContext())
.content(R.string.reset_set_question)
.cancelable(false)
.canceledOnTouchOutside(false)
.positiveText(R.string.reset)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Prefs.with(getContext()).writeBoolean(Constants.KEY_PREFERENCES_THEME, false);
Prefs.with(getContext()).write(Constants.KEY_PREFERENCES_SORT, Constants.SORT_BY_TITLE);
Prefs.with(getContext()).writeBoolean(Constants.KEY_PREFERENCES_ANIMATION, true);
Prefs.with(getContext()).writeBoolean(Constants.KEY_PREFERENCES_QUALITY, true);
Prefs.with(getContext()).write(Constants.KEY_PREFERENCES_DELETE_DIALOG_ACTION, Constants.DELETE_DIALOG_ACTION_NONE);
Prefs.with(getContext()).writeBoolean(Constants.KEY_PREFERENCES_SHOW_DIALOG, true);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ProcessPhoenix.triggerRebirth(getContext(),
new Intent(getContext(), MainActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
}
}, 250);
}
})
.negativeText(android.R.string.cancel)
.show();
}
示例12: onOptionsItemSelected
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_restart_app:
ProcessPhoenix.triggerRebirth(this);
return true;
default:
return false;
}
}
示例13: restartApp
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
private void restartApp(PrintStream writer) {
writer.println("Restarting app...");
// Restart app after a few delay to make sure stetho can print the previous message.
new Thread(() -> {
SystemClock.sleep(500);
ProcessPhoenix.triggerRebirth(context, new Intent(context, DrawerActivity.class));
}).start();
}
示例14: forceRestart
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
public static void forceRestart(Context context) {
if (appRestart.contains("back")) {
appRestart.edit().remove("back").apply();
}
appRestart.edit().putBoolean("isRestarting", true).apply();
isRestarting = true;
ProcessPhoenix.triggerRebirth(context, new Intent(context, MainActivity.class));
}
示例15: onCreate
import com.jakewharton.processphoenix.ProcessPhoenix; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// LeakCanary.install(this);
if (ProcessPhoenix.isPhoenixProcess(this)) {
return;
}
proxy = new HttpProxyCacheServer.Builder(this).maxCacheSize(5*1024).maxCacheFilesCount(20).build();
UpgradeUtil.upgrade(getApplicationContext());
doMainStuff();
}