Add shortcut manager support to Settings (2/2)

b/28298258

Locale change will be handled in future CL/ dynamic shortcut list
change using a UI will be handled in follow up CL.

Change-Id: I5468b17e8c8b32625139ab0484d5d0386be0961d
This commit is contained in:
Hyunyoung Song
2016-05-04 10:49:59 -07:00
parent 00b127b134
commit 79ec6df771
3 changed files with 152 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ import android.transition.TransitionManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
@@ -536,6 +537,8 @@ public class SettingsActivity extends SettingsDrawerActivity
final ComponentName cn = intent.getComponent();
final String className = cn.getClassName();
publishShortcuts();
mIsShowingDashboard = className.equals(Settings.class.getName())
|| className.equals(Settings.WirelessSettings.class.getName())
|| className.equals(Settings.DeviceSettings.class.getName())
@@ -1016,6 +1019,18 @@ public class SettingsActivity extends SettingsDrawerActivity
return f;
}
private void publishShortcuts() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
if (!getSharedPreferences(ShortcutInfoPublisher.PREF_FILE, Context.MODE_PRIVATE)
.getBoolean(ShortcutInfoPublisher.PREF_KEY, false)) {
ShortcutInfoPublisher.setDynamicShortcuts(SettingsActivity.this, getTileCache());
}
}
});
}
private void updateTilesList() {
// Generally the items that are will be changing from these updates will
// not be in the top list of tiles, so run it in the background and the