Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Commit

Permalink
#49 : Back button close the left panel
Browse files Browse the repository at this point in the history
#48 : White left panel for light theme
#24 #39 : Option to disable the "mark all read" button
#34 : Black background for Black theme.
#54 : Headlines size reduction
#47 : New refresh button
  • Loading branch information
Etuldan committed Aug 21, 2015
1 parent af80e3f commit ea027f7
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 18 deletions.
14 changes: 14 additions & 0 deletions mobile/src/main/java/net/etuldan/sparss/activity/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ public void run() {
}
});

mLeftDrawer.setBackgroundColor(getResources().getColor(R.color.dark_theme_color_primary));
mDrawerList.setBackgroundColor(getResources().getColor(R.color.dark_background));
if (PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true)) {
mLeftDrawer.setBackgroundColor(getResources().getColor(R.color.light_theme_color_primary));
mDrawerList.setBackgroundColor(getResources().getColor(R.color.light_background));
}

mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
if (mDrawerLayout != null) {
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
Expand Down Expand Up @@ -196,6 +203,13 @@ protected void onPause() {

@Override
public void finish() {
if (mDrawerLayout != null) {
if(mDrawerLayout.isDrawerOpen(mLeftDrawer)) {
mDrawerLayout.closeDrawer(mLeftDrawer);
return;
}
}

if (mCanQuit) {
super.finish();
return;
Expand Down
17 changes: 12 additions & 5 deletions mobile/src/main/java/net/etuldan/sparss/adapter/DrawerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -35,6 +34,7 @@
import net.etuldan.sparss.R;
import net.etuldan.sparss.provider.FeedData;
import net.etuldan.sparss.provider.FeedData.EntryColumns;
import net.etuldan.sparss.utils.PrefUtils;
import net.etuldan.sparss.utils.StringUtils;
import net.etuldan.sparss.utils.UiUtils;

Expand All @@ -52,8 +52,8 @@ public class DrawerAdapter extends BaseAdapter {
private static final int POS_ERROR = 6;
private static final int POS_UNREAD = 7;

private static final int NORMAL_TEXT_COLOR = Color.parseColor("#EEEEEE");
private static final int GROUP_TEXT_COLOR = Color.parseColor("#BBBBBB");
//private static final int NORMAL_TEXT_COLOR = Color.parseColor("#EEEEEE");
//private static final int GROUP_TEXT_COLOR = Color.parseColor("#BBBBBB");

private static final String COLON = MainApplication.getContext().getString(R.string.colon);

Expand Down Expand Up @@ -102,7 +102,10 @@ public View getView(int position, View convertView, ViewGroup parent) {
// default init
holder.iconView.setImageDrawable(null);
holder.titleTxt.setText("");
holder.titleTxt.setTextColor(NORMAL_TEXT_COLOR);
holder.titleTxt.setTextColor(mContext.getResources().getColor(R.color.dark_text));
if (PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true)) {
holder.titleTxt.setTextColor(mContext.getResources().getColor(R.color.light_text));
}
holder.titleTxt.setAllCaps(false);
holder.stateTxt.setVisibility(View.GONE);
holder.unreadTxt.setText("");
Expand All @@ -112,6 +115,10 @@ public View getView(int position, View convertView, ViewGroup parent) {
if (position == 0 || position == 1) {
holder.titleTxt.setText(position == 0 ? R.string.all : R.string.favorites);
holder.iconView.setImageResource(position == 0 ? R.drawable.ic_statusbar_rss : R.drawable.rating_important);
holder.iconView.setColorFilter(mContext.getResources().getColor(R.color.dark_text));
if (PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true)) {
holder.iconView.setColorFilter(mContext.getResources().getColor(R.color.light_text));
}

int unread = position == 0 ? mAllUnreadNumber : mFavoritesNumber;
if (unread != 0) {
Expand All @@ -122,7 +129,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder.titleTxt.setText((mFeedsCursor.isNull(POS_NAME) ? mFeedsCursor.getString(POS_URL) : mFeedsCursor.getString(POS_NAME)));

if (mFeedsCursor.getInt(POS_IS_GROUP) == 1) {
holder.titleTxt.setTextColor(GROUP_TEXT_COLOR);
holder.titleTxt.setTextColor(mContext.getResources().getColor(R.color.group_text));
holder.titleTxt.setAllCaps(true);
holder.separator.setVisibility(View.VISIBLE);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ public void onListItemClick(ListView listView, View view, int position, long id)
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear(); // This is needed to remove a bug on Android 4.0.3

inflater.inflate(R.menu.entry_list, menu);
if (PrefUtils.getBoolean(PrefUtils.MARK_AS_READ, true)) {
inflater.inflate(R.menu.entry_list, menu);
} else {
inflater.inflate(R.menu.entry_list_without_markasread, menu);
}

if (EntryColumns.FAVORITES_CONTENT_URI.equals(mUri)) {
menu.findItem(R.id.menu_refresh).setVisible(false);
Expand Down
6 changes: 3 additions & 3 deletions mobile/src/main/java/net/etuldan/sparss/view/EntryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class EntryView extends WebView {

private static final String TEXT_HTML = "text/html";
private static final String HTML_IMG_REGEX = "(?i)<[/]?[ ]?img(.|\n)*?>";
private static final String BACKGROUND_COLOR = PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true) ? "#f6f6f6" : "#181b1f";
private static final String BACKGROUND_COLOR = PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true) ? "#f6f6f6" : "#000000";
private static final String QUOTE_BACKGROUND_COLOR = PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true) ? "#e6e6e6" : "#383b3f";
private static final String QUOTE_LEFT_COLOR = PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true) ? "#a6a6a6" : "#686b6f";
private static final String TEXT_COLOR = PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true) ? "#000000" : "#C0C0C0";
Expand All @@ -86,8 +86,8 @@ public class EntryView extends WebView {
+ "body {max-width: 100%; margin: 0.3cm; font-family: sans-serif-light; color: " + TEXT_COLOR + "; background-color:" + BACKGROUND_COLOR + "; line-height: 150%} "
+ "* {max-width: 100%; word-break: break-word}"
+ "h1, h2 {font-weight: normal; line-height: 130%} "
+ "h1 {font-size: 170%; margin-bottom: 0.1em} "
+ "h2 {font-size: 140%} "
+ "h1 {font-size: 140%; margin-bottom: 0.1em} "
+ "h2 {font-size: 120%} "
+ "a {color: #0099CC}"
+ "h1 a {color: inherit; text-decoration: none}"
+ "img {height: auto} "
Expand Down
Binary file added mobile/src/main/res/drawable-xhdpi/ic_refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions mobile/src/main/res/layout/item_drawer_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="#EEEEEE"
android:textIsSelectable="false"/>

<TextView
Expand All @@ -41,7 +40,6 @@
android:alpha="0.5"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#EEEEEE"
android:textIsSelectable="false"/>
</LinearLayout>

Expand All @@ -55,13 +53,12 @@
android:layout_marginRight="12dp"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="#EEEEEE"/>
android:textAppearance="?android:attr/textAppearanceListItemSmall"/>

<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="#515151"/>
android:background="@color/separator" />
</RelativeLayout>
1 change: 0 additions & 1 deletion mobile/src/main/res/layout/view_left_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
android:layout_width="290dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/dark_background"
tools:showIn="@layout/activity_home">

<include layout="@layout/view_drawer_content"/>
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/main/res/menu/entry_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<item
android:id="@+id/menu_refresh"
android:icon="@drawable/refresh"
android:icon="@drawable/ic_refresh"
android:title="@string/menu_refresh"
app:showAsAction="always"
tools:ignore="AlwaysShowAction"/>
Expand Down
7 changes: 6 additions & 1 deletion mobile/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<color name="light_theme_color_primary_dark">#175073</color>
<color name="dark_theme_color_primary">#175073</color>
<color name="dark_theme_color_primary_dark">#ff10364e</color>
<color name="dark_background">#FF202020</color>
<color name="dark_background">#FF000000</color>
<color name="light_background">#FFFFFFFF</color>
<color name="floating_action_button_disabled">#ff0b2535</color>
<color name="dark_text">#FFFFFFFF</color>
<color name="light_text">#FF000000</color>
<color name="group_text">#BBBBBB</color>
<color name="separator">#515151</color>
</resources>
6 changes: 5 additions & 1 deletion mobile/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<item name="colorPrimary">@color/light_theme_color_primary</item>
<item name="colorPrimaryDark">@color/light_theme_color_primary_dark</item>
<item name="colorAccent">@color/light_theme_color_primary</item>
<item name="android:colorBackground">@color/light_background</item>
<item name="android:windowBackground">@color/light_background</item>
</style>

<style name="Theme.Dark" parent="Theme.AppCompat">
Expand All @@ -16,6 +18,8 @@
<!-- customize the color palette -->
<item name="colorPrimary">@color/dark_theme_color_primary</item>
<item name="colorPrimaryDark">@color/dark_theme_color_primary_dark</item>
<item name="colorAccent">@color/light_theme_color_primary</item>
<item name="colorAccent">@color/dark_theme_color_primary</item>
<item name="android:colorBackground">@color/dark_background</item>
<item name="android:windowBackground">@color/dark_background</item>
</style>
</resources>

0 comments on commit ea027f7

Please sign in to comment.