blob: e08ec3aca06b1ee96e22c83b86a1987183b4485c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
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;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.TestingUtils;
public class ToggleWeightWatcher extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = Utilities.getPrefs(this);
boolean show = sp.getBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, true);
show = !show;
sp.edit().putBoolean(TestingUtils.SHOW_WEIGHT_WATCHER, show).apply();
Launcher launcher = (Launcher) LauncherAppState.getInstance().getModel().getCallback();
if (launcher != null && launcher.mWeightWatcher != null) {
launcher.mWeightWatcher.setVisibility(show ? View.VISIBLE : View.GONE);
}
finish();
}
}
|