First pass at drawer to Settings
Change-Id: I94c3bc69ff773e48c33f59f37bfc0d91139c187a
This commit is contained in:
@@ -31,19 +31,13 @@ import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.android.settings.Settings.TetherSettingsActivity;
|
||||
import com.android.settings.dashboard.DashboardCategory;
|
||||
import com.android.settings.dashboard.DashboardTile;
|
||||
import com.android.settingslib.TetherUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateShortcut extends LauncherActivity {
|
||||
|
||||
private static final String TOP_LEVEL_HEADER = "com.android.settings.TOP_LEVEL_HEADER_ID";
|
||||
|
||||
@Override
|
||||
protected Intent getTargetIntent() {
|
||||
Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||
@@ -63,10 +57,8 @@ public class CreateShortcut extends LauncherActivity {
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, itemForPosition(position).label);
|
||||
ResolveInfo resolveInfo = itemForPosition(position).resolveInfo;
|
||||
ActivityInfo activityInfo = resolveInfo.activityInfo;
|
||||
if (activityInfo.metaData != null && activityInfo.metaData.containsKey(TOP_LEVEL_HEADER)) {
|
||||
int topLevelId = activityInfo.metaData.getInt(TOP_LEVEL_HEADER);
|
||||
int resourceId = getDrawableResource(topLevelId);
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(resourceId));
|
||||
if (activityInfo.icon != 0) {
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, createIcon(activityInfo.icon));
|
||||
}
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
@@ -87,19 +79,6 @@ public class CreateShortcut extends LauncherActivity {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private int getDrawableResource(int topLevelId) {
|
||||
ArrayList<DashboardCategory> categories = new ArrayList<>();
|
||||
SettingsActivity.loadCategoriesFromResource(R.xml.dashboard_categories, categories, this);
|
||||
for (DashboardCategory category : categories) {
|
||||
for (DashboardTile tile : category.tiles) {
|
||||
if (tile.id == topLevelId) {
|
||||
return tile.iconRes;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onEvaluateShowIcons() {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user