Settings homepage redesign
- Support new suggestion design - Search bar relayout - Move avatar icon to the top right corner Test: robotest Bug: 178068045 Change-Id: I07f1577488d6d1827ee07d55db6759f02d655d5f
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.accounts;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -65,14 +64,23 @@ public class AvatarViewMixin implements LifecycleObserver {
|
||||
private final Context mContext;
|
||||
private final ImageView mAvatarView;
|
||||
private final MutableLiveData<Bitmap> mAvatarImage;
|
||||
private final ActivityManager mActivityManager;
|
||||
|
||||
@VisibleForTesting
|
||||
String mAccountName;
|
||||
|
||||
/**
|
||||
* @return true if the avatar icon is supported.
|
||||
*/
|
||||
public static boolean isAvatarSupported(Context context) {
|
||||
if (!context.getResources().getBoolean(R.bool.config_show_avatar_in_homepage)) {
|
||||
Log.d(TAG, "Feature disabled by config. Skipping");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public AvatarViewMixin(SettingsHomepageActivity activity, ImageView avatarView) {
|
||||
mContext = activity.getApplicationContext();
|
||||
mActivityManager = mContext.getSystemService(ActivityManager.class);
|
||||
mAvatarView = avatarView;
|
||||
mAvatarView.setOnClickListener(v -> {
|
||||
Intent intent;
|
||||
@@ -117,14 +125,6 @@ public class AvatarViewMixin implements LifecycleObserver {
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||
public void onStart() {
|
||||
if (!mContext.getResources().getBoolean(R.bool.config_show_avatar_in_homepage)) {
|
||||
Log.d(TAG, "Feature disabled by config. Skipping");
|
||||
return;
|
||||
}
|
||||
if (mActivityManager.isLowRamDevice()) {
|
||||
Log.d(TAG, "Feature disabled on low ram device. Skipping");
|
||||
return;
|
||||
}
|
||||
if (hasAccount()) {
|
||||
loadAccount();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user