Fix crash when dynamic_homepage flag is off.
This partially rolls back ag/5650901. We should revert this change when dynamic_homepage flag is permanently on. Change-Id: I5e340421d04bc20c77dd30395fd8522693807954 Fixes: 118444000 Test: manual
This commit is contained in:
@@ -114,6 +114,14 @@
|
||||
<uses-library android:name="org.apache.http.legacy" />
|
||||
<!-- Settings -->
|
||||
|
||||
<!-- TODO(b/118444000): Remove this. -->
|
||||
<activity android:name="SettingsActivity"
|
||||
android:label="@string/settings_label_launcher"
|
||||
android:launchMode="singleTask">
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".homepage.SettingsHomepageActivity"
|
||||
android:label="@string/settings_label_launcher"
|
||||
android:theme="@style/Theme.Settings.Home"
|
||||
|
31
res/layout/settings_main_dashboard.xml
Normal file
31
res/layout/settings_main_dashboard.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018 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.
|
||||
-->
|
||||
|
||||
<!-- TODO(118444000): Remove this -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/search_bar" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent" />
|
||||
</LinearLayout>
|
@@ -54,6 +54,10 @@
|
||||
<item name="batteryGoodColor">@color/battery_good_color_light</item>
|
||||
<item name="batteryMaybeColor">@color/battery_maybe_color_light</item>
|
||||
<item name="batteryBadColor">@color/battery_bad_color_light</item>
|
||||
|
||||
<!-- TODO(118444000): Remove colorPrimary and colorPrimaryVariant -->
|
||||
<item name="colorPrimary">@*android:color/primary_device_default_settings_light</item>
|
||||
<item name="colorPrimaryVariant">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<!-- Variant of the settings theme with no action bar. -->
|
||||
|
@@ -35,9 +35,9 @@ import android.text.TextUtils;
|
||||
import android.transition.TransitionManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -168,6 +168,12 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
|
||||
private Button mNextButton;
|
||||
|
||||
/**
|
||||
* TODO(b/118444000): Remove this and all related code.
|
||||
*/
|
||||
@Deprecated
|
||||
private boolean mIsShowingDashboard;
|
||||
|
||||
private ViewGroup mContent;
|
||||
|
||||
// Categories
|
||||
@@ -250,7 +256,11 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
setTheme(R.style.Theme_SubSettings);
|
||||
}
|
||||
|
||||
setContentView(R.layout.settings_main_prefs);
|
||||
mIsShowingDashboard = TextUtils.equals(
|
||||
SettingsActivity.class.getName(), intent.getComponent().getClassName());
|
||||
|
||||
setContentView(mIsShowingDashboard ?
|
||||
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
|
||||
|
||||
mContent = findViewById(R.id.main_content);
|
||||
|
||||
@@ -273,12 +283,21 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
}
|
||||
|
||||
final boolean deviceProvisioned = Utils.isDeviceProvisioned(this);
|
||||
if (mIsShowingDashboard) {
|
||||
findViewById(R.id.search_bar).setVisibility(
|
||||
deviceProvisioned ? View.VISIBLE : View.INVISIBLE);
|
||||
findViewById(R.id.action_bar).setVisibility(View.GONE);
|
||||
final Toolbar toolbar = findViewById(R.id.search_action_bar);
|
||||
setActionBar(toolbar);
|
||||
FeatureFactory.getFactory(this).getSearchFeatureProvider()
|
||||
.initSearchToolbar(this, toolbar);
|
||||
}
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(deviceProvisioned);
|
||||
actionBar.setHomeButtonEnabled(deviceProvisioned);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayShowTitleEnabled(!mIsShowingDashboard);
|
||||
}
|
||||
mSwitchBar = findViewById(R.id.switch_bar);
|
||||
if (mSwitchBar != null) {
|
||||
@@ -292,26 +311,20 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
if (buttonBar != null) {
|
||||
buttonBar.setVisibility(View.VISIBLE);
|
||||
|
||||
Button backButton = (Button) findViewById(R.id.back_button);
|
||||
backButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_CANCELED, null);
|
||||
finish();
|
||||
}
|
||||
Button backButton = findViewById(R.id.back_button);
|
||||
backButton.setOnClickListener(v -> {
|
||||
setResult(RESULT_CANCELED, null);
|
||||
finish();
|
||||
});
|
||||
Button skipButton = (Button) findViewById(R.id.skip_button);
|
||||
skipButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
}
|
||||
Button skipButton = findViewById(R.id.skip_button);
|
||||
skipButton.setOnClickListener(v -> {
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
});
|
||||
mNextButton = (Button) findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
}
|
||||
mNextButton = findViewById(R.id.next_button);
|
||||
mNextButton.setOnClickListener(v -> {
|
||||
setResult(RESULT_OK, null);
|
||||
finish();
|
||||
});
|
||||
|
||||
// set our various button parameters
|
||||
|
Reference in New Issue
Block a user