mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Moving a few testing classes to a separate package
Change-Id: Ied1c063de3e938695493e4937f554686e0719dad
This commit is contained in:
32
src/com/android/launcher3/testing/ToggleWeightWatcher.java
Normal file
32
src/com/android/launcher3/testing/ToggleWeightWatcher.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.android.launcher3.testing;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
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.util.TestingUtils;
|
||||
|
||||
public class ToggleWeightWatcher extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String spKey = LauncherAppState.getSharedPreferencesKey();
|
||||
SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_PRIVATE);
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user