improved settings screen style

This commit is contained in:
Mariotaku Lee 2015-10-07 14:44:42 +08:00
parent 27a1660336
commit 1bdb494c81
6 changed files with 84 additions and 21 deletions

View File

@ -52,7 +52,6 @@ import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewParent;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
@ -300,9 +299,9 @@ public class SettingsActivity extends BasePreferenceActivity {
}
final ListView listView = getListView();
if (listView != null) {
listView.setDivider(new EmptyDrawable());
// listView.setChoiceMode(isMultiPane() ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE);
listView.setDividerHeight(0);
// listView.setDivider(new EmptyDrawable());
listView.setChoiceMode(isMultiPane() ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE);
// listView.setDividerHeight(0);
final LayoutParams lp = listView.getLayoutParams();
if (lp instanceof MarginLayoutParams) {
final MarginLayoutParams mlp = (MarginLayoutParams) lp;
@ -539,12 +538,6 @@ public class SettingsActivity extends BasePreferenceActivity {
}
holder.icon.setColorFilter(mActionIconColor, Mode.SRC_ATOP);
if (position > 0 && position <= getCount() - 1) {
final boolean prevCategory = getItemViewType(position - 1) == HEADER_TYPE_CATEGORY;
holder.content.setShowDividers(prevCategory ? LinearLayout.SHOW_DIVIDER_NONE : LinearLayout.SHOW_DIVIDER_END);
} else {
holder.content.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
}
}
private int getCategoriesCount(final int start, final int end) {
@ -585,14 +578,12 @@ public class SettingsActivity extends BasePreferenceActivity {
private static class HeaderViewHolder extends ViewListHolder {
private final TextView title, summary;
private final ImageView icon;
private final LinearLayout content;
HeaderViewHolder(final View view) {
super(view);
title = (TextView) findViewById(android.R.id.title);
summary = (TextView) findViewById(android.R.id.summary);
icon = (ImageView) findViewById(android.R.id.icon);
content = (LinearLayout) findViewById(android.R.id.content);
}
}

View File

@ -35,14 +35,11 @@
android:contentDescription="@string/icon" />
<LinearLayout
android:id="@android:id/content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:divider="?android:dividerVertical"
android:gravity="center_vertical"
android:orientation="vertical"
android:showDividers="end">
android:orientation="vertical">
<TextView
android:id="@android:id/title"

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
@ -19,4 +18,9 @@
-->
<resources>
<style name="Widget.Base.TextView.Light" parent="android:Widget.Material.TextView" />
<style name="Widget.Base.TextView.Dark" parent="android:Widget.Material.Light.TextView" />
</resources>

View File

@ -83,4 +83,24 @@
<!--<item name="android:background"></item>-->
<!--<item name="android:backgroundSplit"></item>-->
</style>
<style name="Widget.Dark.TextView.ListSeparator" parent="Widget.Base.TextView.Dark">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textColor">?colorAccent</item>
<item name="android:textStyle">bold</item>
<item name="android:padding">@dimen/element_spacing_normal</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="Widget.Light.TextView.ListSeparator" parent="Widget.Base.TextView.Light">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textColor">?colorAccent</item>
<item name="android:textStyle">bold</item>
<item name="android:padding">@dimen/element_spacing_normal</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
</resources>

View File

@ -27,4 +27,9 @@
<item name="android:height">?actionBarSize</item>
</style>
<style name="Widget.Base.TextView.Light" parent="android:Widget.Holo.TextView" />
<style name="Widget.Base.TextView.Dark" parent="android:Widget.Holo.Light.TextView" />
</resources>

View File

@ -12,6 +12,10 @@
<!-- Window attributes -->
<item name="android:windowBackground">@color/background_color_window_dark</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
@ -31,6 +35,10 @@
<!-- Window attributes -->
<item name="android:windowBackground">@color/background_color_window_light</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
@ -50,6 +58,10 @@
<!-- Window attributes -->
<item name="android:windowBackground">@color/background_color_window_dark</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
@ -69,6 +81,10 @@
<!-- Window attributes -->
<item name="android:windowBackground">@color/background_color_window_light</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
@ -88,6 +104,11 @@
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
@ -107,6 +128,11 @@
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">false</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
@ -125,6 +151,10 @@
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
@ -144,6 +174,10 @@
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
@ -174,6 +208,10 @@
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.ProfileImage</item>
@ -203,6 +241,10 @@
<!-- Custom view styles -->
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Light.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.Light.CardActionButton</item>
<item name="profileImageStyle">@style/Widget.Light.ProfileImage</item>
@ -246,6 +288,10 @@
<item name="actionBarStyle">@style/Widget.Twidere.Viewer.ActionBar</item>
<item name="actionModeShareDrawable">@drawable/ic_action_share</item>
<!-- Widget styles -->
<item name="android:listSeparatorTextViewStyle">@style/Widget.Dark.TextView.ListSeparator
</item>
<!-- Card UI styles -->
<item name="cardActionButtonStyle">@style/Widget.CardActionButton</item>
@ -276,7 +322,7 @@
</style>
<style name="Theme.Twidere.Dark.NoDisplay" parent="Theme.Twidere.Dark.NoActionBar">
<item name="android:windowBackground">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
@ -285,7 +331,7 @@
</style>
<style name="Theme.Twidere.Light.NoDisplay" parent="Theme.Twidere.Light.NoActionBar">
<item name="android:windowBackground">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
@ -293,7 +339,7 @@
<item name="android:windowNoDisplay">true</item>
</style>
<style name="Theme.Test" parent="Theme.Compat.Base"/>
<style name="Theme.Test" parent="Theme.Compat.Base" />
<style name="Theme.Nyan" parent="Theme.Compat.Base.NoActionBar">
<item name="android:windowBackground">@color/nyan_background</item>