2015-06-25 19:35:49 -07:00
|
|
|
package com.android.launcher3.testing;
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
|
|
import com.android.launcher3.Launcher;
|
|
|
|
|
import com.android.launcher3.LauncherAppState;
|
2015-10-19 16:59:07 -07:00
|
|
|
import com.android.launcher3.Utilities;
|
2015-06-25 19:35:49 -07:00
|
|
|
import com.android.launcher3.util.TestingUtils;
|
|
|
|
|
|
|
|
|
|
public class ToggleWeightWatcher extends Activity {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
2015-10-19 16:59:07 -07:00
|
|
|
SharedPreferences sp = Utilities.getPrefs(this);
|
2015-06-25 19:35:49 -07:00
|
|
|
boolean show = sp.getBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, true);
|
|
|
|
|
|
|
|
|
|
show = !show;
|
|
|
|
|
sp.edit().putBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, show).apply();
|
|
|
|
|
|
2017-01-11 10:48:34 -08:00
|
|
|
Launcher launcher = (Launcher) LauncherAppState.getInstance(this).getModel().getCallback();
|
2015-06-25 19:35:49 -07:00
|
|
|
if (launcher != null && launcher.mWeightWatcher != null) {
|
|
|
|
|
launcher.mWeightWatcher.setVisibility(show ? View.VISIBLE : View.GONE);
|
|
|
|
|
}
|
|
|
|
|
finish();
|
|
|
|
|
}
|
|
|
|
|
}
|