Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae23161a authored by Wenyi Wang's avatar Wenyi Wang Committed by android-build-merger
Browse files

Redesign settings on tablets

am: 86f2a86b

* commit '86f2a86b':
  Redesign settings on tablets
parents 85baeb0d 86f2a86b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@

        <!-- Used to set options -->
        <activity
            android:name=".preference.ContactsPreferenceActivity"
            android:name=".common.preference.ContactsPreferenceActivity"
            android:label="@string/activity_title_settings"
            android:theme="@style/ContactsPreferencesTheme"
            android:exported="false"/>
+9 −2
Original line number Diff line number Diff line
@@ -299,8 +299,10 @@
        <item name="android:layout_height">match_parent</item>
    </style>

    <style name="ContactsPreferencesTheme" parent="@style/PeopleTheme">
        <item name="android:listViewStyle">@style/ListViewStyle</item>
    <style name="ContactsPreferencesTheme" parent="@style/PeopleThemeAppCompat">
        <!-- Styles that require AppCompat compatibility, remember to update both sets -->
        <item name="android:alertDialogTheme">@style/ContactsAlertDialogThemeAppCompat</item>
        <item name="alertDialogTheme">@style/ContactsAlertDialogThemeAppCompat</item>
    </style>

    <style name="ContactListFilterTheme" parent="@style/PeopleThemeAppCompat">
@@ -420,6 +422,11 @@
        <item name="android:colorAccent">@color/primary_color</item>
    </style>

    <style name="ContactsAlertDialogThemeAppCompat" parent="Theme.AppCompat.Light.Dialog">
        <item name="android:colorAccent">@color/primary_color</item>
        <item name="colorAccent">@color/primary_color</item>
    </style>

    <style name="EditKindIconStyle">
        <item name="android:layout_width">24dp</item>
        <item name="android:layout_height">24dp</item>

res/xml/preference_headers.xml

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->

<preference-headers
    xmlns:android="http://schemas.android.com/apk/res/android">

    <header
        android:fragment="com.android.contacts.common.preference.DisplayOptionsPreferenceFragment"
        android:title="@string/preference_displayOptions" />

</preference-headers>
+2 −13
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ import com.android.contacts.list.ProviderStatusWatcher.ProviderStatusListener;
import com.android.contacts.common.list.ViewPagerTabs;
import com.android.contacts.common.logging.Logger;
import com.android.contacts.common.logging.ScreenEvent;
import com.android.contacts.preference.ContactsPreferenceActivity;
import com.android.contacts.common.preference.ContactsPreferenceActivity;
import com.android.contacts.common.util.AccountFilterUtil;
import com.android.contacts.common.util.ViewUtil;
import com.android.contacts.quickcontact.QuickContactActivity;
@@ -1192,18 +1192,7 @@ public class PeopleActivity extends AppCompatContactsActivity implements
                return true;
            }
            case R.id.menu_settings: {
                final Intent intent = new Intent(this, ContactsPreferenceActivity.class);
                // Since there is only one section right now, make sure it is selected on
                // small screens.
                intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                        DisplayOptionsPreferenceFragment.class.getName());
                // By default, the title of the activity should be equivalent to the fragment
                // title. We set this argument to avoid this. Because of a bug, the following
                // line isn't necessary. But, once the bug is fixed this may become necessary.
                // b/5045558 refers to this issue, as well as another.
                intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE,
                        R.string.activity_title_settings);
                startActivity(intent);
                startActivity(new Intent(this, ContactsPreferenceActivity.class));
                return true;
            }
            case R.id.menu_contacts_filter: {
+0 −85
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 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.contacts.preference;

import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;

import com.android.contacts.R;
import com.android.contacts.activities.PeopleActivity;

import java.util.List;

/**
 * Contacts settings.
 */
public final class ContactsPreferenceActivity extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // This Activity will always fall back to the "top" Contacts screen when touched on the
        // app up icon, regardless of launch context.
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
        }
    }

    /**
     * Populate the activity with the top-level headers.
     */
    @Override
    public void onBuildHeaders(List<Header> target) {
        loadHeadersFromResource(R.xml.preference_headers, target);
    }

    /**
     * Returns true if there are no preferences to display and therefore the
     * corresponding menu item can be removed.
     */
    public static boolean isEmpty(Context context) {
        return !context.getResources().getBoolean(R.bool.config_sort_order_user_changeable)
                && !context.getResources().getBoolean(R.bool.config_display_order_user_changeable)
                && !context.getResources().getBoolean(
                        R.bool.config_default_account_user_changeable);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home: {
                Intent intent = new Intent(this, PeopleActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                finish();
                return true;
            }
        }
        return false;
    }

    @Override
    protected boolean isValidFragment(String fragmentName) {
        return true;
    }
}