theme preview ui fixes

This commit is contained in:
Mariotaku Lee 2015-03-13 06:07:59 +08:00
parent b370fee671
commit b88ffa055a
5 changed files with 32 additions and 22 deletions

View File

@ -382,7 +382,7 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
if (attachLocation) {
mLocationIcon.setColorFilter(getCurrentThemeColor(), Mode.SRC_ATOP);
mLocationText.setText(R.string.getting_location);
mLocationText.setText(R.string.ellipsis);
} else {
mLocationIcon.setColorFilter(mLocationIcon.getDefaultColor(), Mode.SRC_ATOP);
mLocationText.setText(R.string.no_location);

View File

@ -26,6 +26,7 @@ import android.preference.Preference;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.InflateException;
@ -39,6 +40,7 @@ import android.widget.TextView;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.ColorUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.accessor.ViewAccessor;
import org.mariotaku.twidere.view.iface.IExtendedView;
@ -97,22 +99,24 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
}
final View windowBackgroundView = view.findViewById(R.id.theme_preview_window_background);
final View windowContentOverlayView = view.findViewById(R.id.theme_preview_window_content_overlay);
final View actionBarView = view.findViewById(R.id.actionbar);
final TextView actionBarTitleView = (TextView) view.findViewById(R.id.actionbar_title);
final View actionBarOverlay = view.findViewById(R.id.actionbar_overlay);
final Toolbar actionBarView = (Toolbar) view.findViewById(R.id.actionbar);
final ActionMenuView menuBar = (ActionMenuView) view.findViewById(R.id.menu_bar);
final View statusContentView = view.findViewById(R.id.theme_preview_status_content);
final CardView cardView = (CardView) view.findViewById(R.id.card);
final int defaultTextSize = getDefaultTextSize(context);
final int titleTextAppearance = ThemeUtils.getTitleTextAppearance(context);
final int cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context);
final int accentColor = ThemeUtils.getUserAccentColor(context);
ViewAccessor.setBackground(windowBackgroundView, ThemeUtils.getWindowBackground(context));
ViewAccessor.setBackground(windowContentOverlayView, ThemeUtils.getWindowContentOverlay(context));
ViewAccessor.setBackground(actionBarView, ThemeUtils.getActionBarBackground(context, themeRes));
// ViewAccessor.setBackground(windowContentOverlayView, ThemeUtils.getWindowContentOverlay(context));
ViewAccessor.setBackground(actionBarView, ThemeUtils.getActionBarBackground(context, themeRes, accentColor));
ViewAccessor.setBackground(actionBarOverlay, ThemeUtils.getWindowContentOverlay(context));
cardView.setCardBackgroundColor(cardBackgroundColor);
actionBarTitleView.setTextAppearance(context, titleTextAppearance);
actionBarView.setTitle(R.string.app_name);
actionBarView.setTitleTextColor(ColorUtils.getContrastYIQ(accentColor, 192));
menuBar.setEnabled(false);
final MenuInflater inflater = new SupportMenuInflater(context);
inflater.inflate(R.menu.menu_status, menuBar.getMenu());
@ -126,6 +130,9 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
final TextView screenNameView = (TextView) statusContentView.findViewById(R.id.screen_name);
final TextView textView = (TextView) statusContentView.findViewById(R.id.text);
final TextView timeSourceView = (TextView) statusContentView.findViewById(R.id.time_source);
final View retweetedByContainer = statusContentView.findViewById(R.id.retweeted_by_container);
retweetedByContainer.setVisibility(View.GONE);
nameView.setTextSize(defaultTextSize * 1.25f);
textView.setTextSize(defaultTextSize * 1.25f);

View File

@ -30,9 +30,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing_normal"
app:cardBackgroundColor="?cardItemBackgroundColor"
app:cardCornerRadius="@dimen/corner_radius_card"
app:cardElevation="@dimen/elevation_card"
tools:cardBackgroundColor="?cardItemBackgroundColor">
app:cardElevation="@dimen/elevation_card">
<include layout="@layout/header_status_common"/>

View File

@ -43,24 +43,26 @@
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout
<org.mariotaku.twidere.view.TwidereToolbar
android:id="@+id/actionbar"
style="?actionBarStyle"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_height="?actionBarSize"
android:gravity="center_vertical"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.mariotaku.twidere.view.ActionBarTitleView
android:id="@+id/actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/app_name"
android:textAppearance="?android:textAppearanceMedium"/>
</LinearLayout>
<include layout="@layout/theme_preview_status_content"/>
<View
android:id="@+id/actionbar_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<include layout="@layout/theme_preview_status_content"/>
</LinearLayout>
</merge>

View File

@ -726,5 +726,6 @@
<string name="research_ucdavis_earlybird">UCDavis Earlybird</string>
<string name="research_tsinghua_spice">Tsinghua Spice</string>
<string name="unknown_location">Unknown location</string>
<string name="ellipsis"></string>
</resources>