Added dark version of borderless button

This commit is contained in:
daniel oeh 2012-11-23 18:44:15 +01:00
parent 56b93247fe
commit caa00a97cb
13 changed files with 54 additions and 30 deletions

View File

@ -29,7 +29,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:logo="@drawable/ic_launcher"
android:theme="@style/Theme.AntennaPod.Light" >
android:theme="@style/Theme.AntennaPod.Dark" >
<activity
android:name=".activity.MainActivity"
android:configChanges="keyboardHidden|orientation"

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="#FEBB20" />
<solid android:color="@color/selection_background_color_light" />
</shape></item>
<item android:state_focused="true"><shape android:shape="rectangle">
<solid android:color="#FEBB20" />
<solid android:color="@color/selection_background_color_light" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />

View File

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@color/selection_background" />
<solid android:color="@color/selection_background_color_dark" />
</shape></item>
<item android:state_focused="true"><shape android:shape="rectangle">
<solid android:color="@color/selection_background" />
<item android:state_focused="true"><shape android:shape="rectangle">
<solid android:color="@color/selection_background_color_dark" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />

View File

@ -38,7 +38,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="@drawable/av_pause" />
<ImageButton
@ -48,7 +48,7 @@
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@+id/butPlay"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="@drawable/av_fast_forward" />
<ImageButton
@ -58,7 +58,7 @@
android:layout_alignParentTop="true"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@+id/butPlay"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="@drawable/av_rewind" />
</RelativeLayout>

View File

@ -20,7 +20,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/borderless_button" >
android:background="?attr/borderless_button" >
<ImageView
android:id="@+id/imgvCover"
@ -78,7 +78,7 @@
android:id="@+id/butPlay"
android:layout_width="@dimen/external_player_height"
android:layout_height="@dimen/external_player_height"
android:background="@drawable/borderless_button" />
android:background="?attr/borderless_button" />
</LinearLayout>
</LinearLayout>

View File

@ -91,7 +91,7 @@
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"

View File

@ -23,7 +23,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.02"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind" />
<View
@ -38,7 +38,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.14"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="?attr/av_pause" />
<View
@ -53,7 +53,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.02"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward" />
</LinearLayout>

View File

@ -15,7 +15,7 @@
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_margin="12dp"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:src="@drawable/av_play" />
<LinearLayout
@ -24,7 +24,7 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/butPlay"
android:background="@drawable/borderless_button"
android:background="?attr/borderless_button"
android:gravity="center_vertical"
android:orientation="vertical" >

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="selection_background">#81CFEA</color>
<color name="selection_background_color_dark">#286E8A</color>
<color name="selection_background_color_light">#81CFEA</color>
</resources>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="action_about" format="reference" />
<attr name="action_search" format="reference" />
<attr name="action_settings" format="reference" />
@ -22,6 +23,8 @@
<attr name="stat_playlist" format="reference" />
<attr name="type_audio" format="reference" />
<attr name="type_video" format="reference" />
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" />
<attr name="borderless_button" format="reference" />
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" />
</resources>

View File

@ -22,9 +22,13 @@
<color name="selection_background">#FEBB20</color>
<color name="actionbar_gray">#DDDDDD</color>
<color name="download_success_green">#669900</color>
<color name="download_failed_red">#CC0000</color>
<color name="status_unread">#99CC00</color>
<color name="status_progress">#FFBB33</color>
<color name="status_playing">#EE5F52</color>
<color name="download_failed_red">#CC0000</color>
<color name="status_unread">#99CC00</color>
<color name="status_progress">#FFBB33</color>
<color name="status_playing">#EE5F52</color>
<!-- Use Gingerbread-orange -->
<color name="selection_background_color_dark">#FEBB20</color>
<color name="selection_background_color_light">#FEBB20</color>
</resources>

View File

@ -26,6 +26,8 @@
<item name="attr/type_audio">@drawable/type_audio</item>
<item name="attr/type_video">@drawable/type_video</item>
<item name="attr/non_transparent_background">@color/white</item>
<item name="attr/borderless_button">@drawable/borderless_button</item>
</style>
<style name="AntennaPod.LightTabPageIndicator" parent="Widget.TabPageIndicator">
@ -57,6 +59,7 @@
<item name="attr/type_audio">@drawable/type_audio_dark</item>
<item name="attr/type_video">@drawable/type_video_dark</item>
<item name="attr/non_transparent_background">@color/black</item>
<item name="attr/borderless_button">@drawable/borderless_button_dark</item>
</style>
<style name="AntennaPod.DarkTabPageIndicator" parent="Widget.TabPageIndicator">

View File

@ -2,12 +2,15 @@ package de.danoeh.antennapod.fragment;
import org.apache.commons.lang3.StringEscapeUtils;
import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -27,8 +30,6 @@ public class ItemDescriptionFragment extends SherlockFragment {
private static final String ARG_FEED_ID = "arg.feedId";
private static final String ARG_FEEDITEM_ID = "arg.feedItemId";
private static final String WEBVIEW_STYLE = "<head><style type=\"text/css\"> * { font-family: Helvetica; line-height: 1.5em; font-size: 12pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; }</style></head>";
private WebView webvDescription;
private FeedItem item;
@ -52,6 +53,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
if (AppConfig.DEBUG)
Log.d(TAG, "Creating view");
webvDescription = new WebView(getActivity());
webvDescription.setBackgroundColor(0);
webvDescription.getSettings().setUseWideViewPort(false);
return webvDescription;
}
@ -151,6 +153,14 @@ public class ItemDescriptionFragment extends SherlockFragment {
webViewLoader.execute();
}
}
/** Return the CSS style of the Webview.
* @param textColor the default color to use for the text in the webview. This value is inserted directly into the CSS String.
* */
private String getWebViewStyle(String textColor) {
final String WEBVIEW_STYLE = "<head><style type=\"text/css\"> * { color: %s; font-family: Helvetica; line-height: 1.5em; font-size: 12pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; }</style></head>";
return String.format(WEBVIEW_STYLE, textColor);
}
private AsyncTask<Void, Void, Void> createLoader() {
return new AsyncTask<Void, Void, Void>() {
@ -201,8 +211,13 @@ public class ItemDescriptionFragment extends SherlockFragment {
} else {
data = StringEscapeUtils.unescapeHtml4(contentEncodedRef);
}
data = WEBVIEW_STYLE + data;
TypedArray res = getActivity().getTheme().obtainStyledAttributes(new int[] {android.R.attr.textColorPrimary});
int colorResource = res.getColor(0, 0);
String colorString = String.format("#%06X", 0xFFFFFF & colorResource);
Log.i(TAG, "text color: " + colorString);
res.recycle();
data = getWebViewStyle(colorString) + data;
return null;
}