Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cd90e01 authored by Jason Monk's avatar Jason Monk Committed by Android (Google) Code Review
Browse files

Merge "Move Home settings to Default apps"

parents 4e88857d 7ea14c56
Loading
Loading
Loading
Loading
+4 −24
Original line number Diff line number Diff line
@@ -864,30 +864,6 @@
                android:value="true" />
        </activity>

        <activity android:name="Settings$HomeSettingsActivity"
                android:label="@string/home_settings"
                android:icon="@drawable/ic_settings_home"
                android:taskAffinity="">
            <intent-filter android:priority="1">
                <action android:name="android.settings.HOME_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.VOICE_LAUNCH" />
            </intent-filter>
            <intent-filter android:priority="10">
                <action android:name="com.android.settings.action.SETTINGS" />
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                android:value="com.android.settings.category.device" />
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.HomeSettings" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                android:value="true" />
        </activity>

        <activity android:name="Settings$DisplaySettingsActivity"
                android:label="@string/display_settings"
                android:icon="@drawable/ic_settings_display"
@@ -2711,6 +2687,10 @@
                <action android:name="android.settings.MANAGE_DEFAULT_APPS_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.settings.HOME_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.applications.ManageDefaultApps" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+35 −15
Original line number Diff line number Diff line
@@ -18,35 +18,55 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:padding="6dip">
    <ImageView
        android:id="@+id/app_image"
        android:id="@android:id/icon"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:padding="6dip"
        android:duplicateParentState="true"
        />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:duplicateParentState="true"
        android:orientation="vertical">
        <TextView
        android:id="@+id/app_label"
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        android:minHeight="?android:attr/listPreferredItemHeight"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="?android:attr/textColorAlertDialogListItem"
            android:gravity="center_vertical"
            android:paddingEnd="7dip"
            android:ellipsize="marquee"
            android:duplicateParentState="true"
            />
        <TextView
        android:id="@+id/default_label"
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        android:minHeight="?android:attr/listPreferredItemHeight"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:gravity="center_vertical"
            android:paddingEnd="7dip"
            android:ellipsize="marquee"
            android:visibility="gone"
            android:duplicateParentState="true"
            />
    </LinearLayout>
    <TextView
        android:id="@+id/default_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_gravity="center_vertical"
        android:text="@string/default_app"
        android:visibility="gone"
        android:paddingEnd="7dip"
        android:duplicateParentState="true"
        />
</LinearLayout>
+6 −0
Original line number Diff line number Diff line
@@ -7001,4 +7001,10 @@
    <!-- Title for switch to allow app unrestricted data usage [CHAR LIMIT=30] -->
    <string name="unrestricted_app_summary">Allow unrestricted data access when Data Saver is on</string>
    <!-- Button to switch the default home app [CHAR LIMIT=60] -->
    <string name="home_app">Home app</string>
    <!-- No default home set summary [CHAR LIMIT=NONE] -->
    <string name="no_default_home">No default Home</string>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,12 @@
        android:title="@string/assist_and_voice_input_title"
        />

    <com.android.settings.applications.DefaultHomePreference
            android:key="default_home"
            android:title="@string/home_app"
            android:summary="@string/no_default_home"
            />

    <com.android.settings.applications.DefaultBrowserPreference
            android:key="default_browser"
            android:title="@string/default_browser_title"
+32 −7
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.settings;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
@@ -50,6 +49,7 @@ public class AppListPreference extends CustomListPreference {

    private Drawable[] mEntryDrawables;
    private boolean mShowItemNone = false;
    private CharSequence[] mSummaries;

    public class AppArrayAdapter extends ArrayAdapter<CharSequence> {
        private Drawable[] mImageDrawables = null;
@@ -62,17 +62,31 @@ public class AppListPreference extends CustomListPreference {
            mImageDrawables = imageDrawables;
        }

        @Override
        public boolean isEnabled(int position) {
            return mSummaries == null || mSummaries[position] == null;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(getContext());
            View view = inflater.inflate(R.layout.app_preference_item, parent, false);
            TextView textView = (TextView) view.findViewById(R.id.app_label);
            TextView textView = (TextView) view.findViewById(android.R.id.title);
            textView.setText(getItem(position));
            if (position == mSelectedIndex) {
                view.findViewById(R.id.default_label).setVisibility(View.VISIBLE);
            }
            ImageView imageView = (ImageView)view.findViewById(R.id.app_image);
            ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);
            imageView.setImageDrawable(mImageDrawables[position]);
            // Summaries are describing why a item is disabled, so anything with a summary
            // is not enabled.
            boolean enabled = mSummaries == null || mSummaries[position] == null;
            view.setEnabled(enabled);
            if (!enabled) {
                TextView summary = (TextView) view.findViewById(android.R.id.summary);
                summary.setText(mSummaries[position]);
                summary.setVisibility(View.VISIBLE);
            }
            return view;
        }
    }
@@ -133,6 +147,12 @@ public class AppListPreference extends CustomListPreference {
    }

    public void setComponentNames(ComponentName[] componentNames, ComponentName defaultCN) {
        setComponentNames(componentNames, defaultCN, null);
    }

    public void setComponentNames(ComponentName[] componentNames, ComponentName defaultCN,
            CharSequence[] summaries) {
        mSummaries = summaries;
        // Look up all package names in PackageManager. Skip ones we can't find.
        PackageManager pm = getContext().getPackageManager();
        final int entryCount = componentNames.length + (mShowItemNone ? 1 : 0);
@@ -192,7 +212,7 @@ public class AppListPreference extends CustomListPreference {
    @Override
    protected Parcelable onSaveInstanceState() {
        Parcelable superState = super.onSaveInstanceState();
        return new SavedState(getEntryValues(), getValue(), mShowItemNone, superState);
        return new SavedState(getEntryValues(), getValue(), mSummaries, mShowItemNone, superState);
    }

    @Override
@@ -201,6 +221,7 @@ public class AppListPreference extends CustomListPreference {
            SavedState savedState = (SavedState) state;
            mShowItemNone = savedState.showItemNone;
            setPackageNames(savedState.entryValues, savedState.value);
            mSummaries = savedState.summaries;
            super.onRestoreInstanceState(savedState.superState);
        } else {
            super.onRestoreInstanceState(state);
@@ -213,13 +234,15 @@ public class AppListPreference extends CustomListPreference {
        public final CharSequence value;
        public final boolean showItemNone;
        public final Parcelable superState;
        public final CharSequence[] summaries;

        public SavedState(CharSequence[] entryValues, CharSequence value, boolean showItemNone,
                Parcelable superState) {
        public SavedState(CharSequence[] entryValues, CharSequence value, CharSequence[] summaries,
                boolean showItemNone, Parcelable superState) {
            this.entryValues = entryValues;
            this.value = value;
            this.showItemNone = showItemNone;
            this.superState = superState;
            this.summaries = summaries;
        }

        @Override
@@ -233,6 +256,7 @@ public class AppListPreference extends CustomListPreference {
            dest.writeCharSequence(value);
            dest.writeInt(showItemNone ? 1 : 0);
            dest.writeParcelable(superState, flags);
            dest.writeCharSequenceArray(summaries);
        }

        public static Creator<SavedState> CREATOR = new Creator<SavedState>() {
@@ -242,7 +266,8 @@ public class AppListPreference extends CustomListPreference {
                CharSequence value = source.readCharSequence();
                boolean showItemNone = source.readInt() != 0;
                Parcelable superState = source.readParcelable(getClass().getClassLoader());
                return new SavedState(entryValues, value, showItemNone, superState);
                CharSequence[] summaries = source.readCharSequenceArray();
                return new SavedState(entryValues, value, summaries, showItemNone, superState);
            }

            @Override
Loading