Remove duplicate layout mobile_network_settings_container_v2

- MobileNetworkActivity can use settings_base_layout.xml as layout.
- MobileNetworkActivity need to use Theme.Settings.Home because
it requests Window.FEATURE_NO_TITLE. Otherwise MobileNetworkActivity
will show title defined in xml first then change to new title.

Fixes: 123794771
Test: rebuild, manual
Change-Id: I39ae25b6d335437ffddb2f1562e7a0347db97108
This commit is contained in:
Raff Tsai
2019-11-08 12:04:16 +08:00
parent adfdb0ddf1
commit 8fe35bff52
6 changed files with 15 additions and 51 deletions

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Toolbar
android:id="@+id/mobile_action_bar"
style="?android:attr/actionBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:navigationContentDescription="@*android:string/action_bar_up_description"
android:theme="?android:attr/actionBarTheme"/>
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>

View File

@@ -56,7 +56,7 @@ public class NetworkDashboardFragment extends DashboardFragment implements
@Override @Override
protected int getPreferenceScreenResId() { protected int getPreferenceScreenResId() {
return R.xml.network_and_internet_v2; return R.xml.network_and_internet;
} }
@Override @Override
@@ -141,7 +141,7 @@ public class NetworkDashboardFragment extends DashboardFragment implements
} }
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.network_and_internet_v2) { new BaseSearchIndexProvider(R.xml.network_and_internet) {
@Override @Override
public List<AbstractPreferenceController> createPreferenceControllers(Context public List<AbstractPreferenceController> createPreferenceControllers(Context

View File

@@ -22,6 +22,8 @@ import android.os.Bundle;
import android.os.UserManager; import android.os.UserManager;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.view.View;
import android.widget.Toolbar;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
@@ -74,8 +76,14 @@ public class MobileNetworkActivity extends SettingsBaseActivity
return; return;
} }
setContentView(R.layout.mobile_network_settings_container_v2); final Toolbar toolbar = findViewById(R.id.action_bar);
setActionBar(findViewById(R.id.mobile_action_bar)); toolbar.setVisibility(View.VISIBLE);
setActionBar(toolbar);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
mProxySubscriptionMgr = ProxySubscriptionManager.getInstance(this); mProxySubscriptionMgr = ProxySubscriptionManager.getInstance(this);
mProxySubscriptionMgr.setLifecycle(getLifecycle()); mProxySubscriptionMgr.setLifecycle(getLifecycle());
@@ -85,11 +93,6 @@ public class MobileNetworkActivity extends SettingsBaseActivity
? savedInstanceState.getInt(Settings.EXTRA_SUB_ID, SUB_ID_NULL) ? savedInstanceState.getInt(Settings.EXTRA_SUB_ID, SUB_ID_NULL)
: SUB_ID_NULL; : SUB_ID_NULL;
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
final SubscriptionInfo subscription = getSubscription(); final SubscriptionInfo subscription = getSubscription();
updateTitleAndNavigation(subscription); updateTitleAndNavigation(subscription);
} }
@@ -178,7 +181,7 @@ public class MobileNetworkActivity extends SettingsBaseActivity
final Fragment fragment = new MobileNetworkSettings(); final Fragment fragment = new MobileNetworkSettings();
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragmentTransaction.replace(R.id.main_content, fragment, buildFragmentTag(subId)); fragmentTransaction.replace(R.id.content_frame, fragment, buildFragmentTag(subId));
fragmentTransaction.commit(); fragmentTransaction.commit();
} }

View File

@@ -195,7 +195,7 @@ public class MobileNetworkSettings extends RestrictedDashboardFragment {
@Override @Override
protected int getPreferenceScreenResId() { protected int getPreferenceScreenResId() {
return R.xml.mobile_network_settings_v2; return R.xml.mobile_network_settings;
} }
@Override @Override
@@ -259,7 +259,7 @@ public class MobileNetworkSettings extends RestrictedDashboardFragment {
} }
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.mobile_network_settings_v2) { new BaseSearchIndexProvider(R.xml.mobile_network_settings) {
/** suppress full page if user is not admin */ /** suppress full page if user is not admin */
@Override @Override