Add user and account dashboard category for new IA.
Add the initial version for the User & accounts category and set the tile's intent if it contains metadata but fragment is null. Test: RunSettingsRoboTests Bug: 31801423 Change-Id: Ic63bf8aeaf47f68a184af73c9a8a72b89b597a17
This commit is contained in:
@@ -168,6 +168,7 @@ public class Settings extends SettingsActivity {
|
||||
public static class ConnectedDeviceDashboardActivity extends SettingsActivity {}
|
||||
public static class AppAndNotificationDashboardActivity extends SettingsActivity {}
|
||||
public static class StorageDashboardActivity extends SettingsActivity {}
|
||||
public static class UserAndAccountDashboardActivity extends SettingsActivity {}
|
||||
public static class SystemDashboardActivity extends SettingsActivity {}
|
||||
public static class SupportDashboardActivity extends SettingsActivity {}
|
||||
|
||||
|
@@ -61,6 +61,7 @@ import com.android.settings.accounts.AccountSettings;
|
||||
import com.android.settings.accounts.AccountSyncSettings;
|
||||
import com.android.settings.accounts.ChooseAccountActivity;
|
||||
import com.android.settings.accounts.ManagedProfileSettings;
|
||||
import com.android.settings.accounts.UserAndAccountDashboardFragment;
|
||||
import com.android.settings.applications.AppAndNotificationDashboardFragment;
|
||||
import com.android.settings.applications.AdvancedAppSettings;
|
||||
import com.android.settings.applications.DrawOverlayDetails;
|
||||
@@ -279,6 +280,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
"com.android.settings.Settings.DisplayDashboardAlias",
|
||||
"com.android.settings.Settings.SoundDashboardAlias",
|
||||
"com.android.settings.Settings.SecurityDashboardAlias",
|
||||
Settings.UserAndAccountDashboardActivity.class.getName(),
|
||||
Settings.SystemDashboardActivity.class.getName(),
|
||||
Settings.SupportDashboardActivity.class.getName(),
|
||||
// Home page > Apps & Notifications
|
||||
@@ -396,6 +398,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
NetworkDashboardFragment.class.getName(),
|
||||
ConnectedDeviceDashboardFragment.class.getName(),
|
||||
AppAndNotificationDashboardFragment.class.getName(),
|
||||
UserAndAccountDashboardFragment.class.getName(),
|
||||
};
|
||||
|
||||
|
||||
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.accounts;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settingslib.drawer.CategoryKey;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserAndAccountDashboardFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "UserAndAccountDashboard";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.ACCOUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCategoryKey() {
|
||||
return CategoryKey.CATEGORY_ACCOUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.account_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PreferenceController> getPreferenceControllers(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -344,11 +344,12 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
pref.setIcon(tile.icon.loadDrawable(context));
|
||||
}
|
||||
final Bundle metadata = tile.metaData;
|
||||
String clsName = null;
|
||||
if (metadata != null) {
|
||||
String clsName = metadata.getString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
|
||||
if (!TextUtils.isEmpty(clsName)) {
|
||||
pref.setFragment(clsName);
|
||||
}
|
||||
clsName = metadata.getString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
|
||||
}
|
||||
if (!TextUtils.isEmpty(clsName)) {
|
||||
pref.setFragment(clsName);
|
||||
} else if (tile.intent != null) {
|
||||
final Intent intent = new Intent(tile.intent);
|
||||
pref.setOnPreferenceClickListener(preference -> {
|
||||
|
Reference in New Issue
Block a user