Refine the preference layout for homepage

Based on the Android S design, we update the layout
for homepage.

The scope covers the layout of preference and icons itself.

- Change the icon size for IA items.
- Change the layout spacing of preference.
- Change the margin or search bar.

Test: See the screen and confirm with UX
Bug: 177213699
Change-Id: I985966fdf39a5989d51991aa3c06ea5fd31e8fe2
This commit is contained in:
Tsung-Mao Fang
2021-01-11 22:57:45 +08:00
parent 0f81257a5f
commit 6c921e5b6c
27 changed files with 1268 additions and 71 deletions

View File

@@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.preference.Preference;
@@ -32,6 +33,8 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.FeatureFlags;
import com.android.settings.homepage.RestrictedHomepagePreference;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.RestrictedTopLevelPreference;
@@ -89,7 +92,11 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
@Override
public void updateState(Preference preference) {
disablePreferenceIfManaged((RestrictedTopLevelPreference) preference);
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
disablePreferenceIfManaged((RestrictedHomepagePreference) preference);
} else {
disablePreferenceIfManaged((RestrictedTopLevelPreference) preference);
}
}
@Override
@@ -133,4 +140,18 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
}
}
}
private void disablePreferenceIfManaged(RestrictedHomepagePreference pref) {
final String restriction = DISALLOW_SET_WALLPAPER;
if (pref != null) {
pref.setDisabledByAdmin(null);
if (RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext,
restriction, UserHandle.myUserId())) {
// Do not show the admin dialog for system restriction.
pref.setEnabled(false);
} else {
pref.checkRestrictionAndSetDisabled(restriction);
}
}
}
}