Update Font support etc.
This commit is contained in:
parent
d005454cb5
commit
b1a10ef2ea
17 changed files with 260 additions and 91 deletions
|
@ -39,8 +39,7 @@
|
|||
android:id="@+id/cb_AllowAllSSLCertificates"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pref_title_AllowAllSSLCertificates"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:text="@string/pref_title_AllowAllSSLCertificates" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -51,16 +50,14 @@
|
|||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@android:string/cancel"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:text="@android:string/cancel" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoButton
|
||||
android:id="@+id/btn_signin"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@string/action_sign_in_short"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:text="@string/action_sign_in_short" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="@string/empty_view_header"
|
||||
android:textSize="15sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/summary"
|
||||
|
@ -35,7 +34,6 @@
|
|||
android:lines="1"
|
||||
android:text="@string/empty_view_content"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
|
@ -27,8 +27,7 @@
|
|||
android:singleLine="true"
|
||||
android:text="Hi"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_item_date"
|
||||
|
@ -39,8 +38,7 @@
|
|||
android:layout_gravity="right"
|
||||
android:text="Hi"
|
||||
android:singleLine="true"
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -66,8 +64,7 @@
|
|||
android:lines="2"
|
||||
android:textSize="17sp"
|
||||
android:text="Hi"
|
||||
android:textStyle="bold"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/body"
|
||||
|
@ -79,8 +76,7 @@
|
|||
android:text="Hi"
|
||||
android:textColor="#858585"
|
||||
android:textSize="14sp"
|
||||
android:autoLink="none"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:autoLink="none" />
|
||||
<!-- android:gravity="center_vertical" -->
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -99,8 +95,7 @@
|
|||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:button="@drawable/checkbox_background_empty"
|
||||
android:background="@drawable/checkbox_background"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:background="@drawable/checkbox_background" />
|
||||
<!-- android:layout_width="40dp"
|
||||
android:layout_height="40dp" -->
|
||||
|
||||
|
@ -111,8 +106,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:focusable="false" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -30,8 +30,7 @@
|
|||
android:layout_gravity="center_vertical|left"
|
||||
android:textSize="15sp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/tv_clickHereToOpenItem"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:text="@string/tv_clickHereToOpenItem" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_starred"
|
||||
|
@ -41,8 +40,7 @@
|
|||
android:background="@drawable/checkbox_background"
|
||||
android:button="@drawable/checkbox_background_empty"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:focusable="false" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||
android:id="@+id/cb_lv_item_read"
|
||||
|
@ -51,8 +49,7 @@
|
|||
android:layout_marginLeft="5dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:focusable="false" />
|
||||
</LinearLayout>
|
||||
|
||||
<WebView
|
||||
|
|
|
@ -46,8 +46,7 @@
|
|||
android:singleLine="true"
|
||||
android:text="Hi"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_item_date"
|
||||
|
@ -58,8 +57,7 @@
|
|||
android:layout_gravity="right"
|
||||
android:text="Hi"
|
||||
android:singleLine="true"
|
||||
android:textSize="14sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
|
@ -72,8 +70,7 @@
|
|||
android:textSize="17sp"
|
||||
android:text="hidsaf afdal fjdkas f fsadfdas fds asöjkdafdssö fjkök"
|
||||
android:layout_weight="1"
|
||||
android:textStyle="bold"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -84,7 +81,6 @@
|
|||
android:layout_marginRight="@dimen/listview_row_margin_right"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:gravity="center_vertical|center_horizontal" />
|
||||
|
||||
</LinearLayout>
|
|
@ -21,8 +21,7 @@
|
|||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"
|
||||
android:textIsSelectable="false"
|
||||
style="@style/RobotoFontStyle" />/
|
||||
android:textIsSelectable="false" />
|
||||
<!--app:typeface="roboto_thin" -->
|
||||
|
||||
|
||||
|
@ -33,7 +32,6 @@
|
|||
android:gravity="center_vertical|right"
|
||||
android:singleLine="true"
|
||||
android:textIsSelectable="false"
|
||||
android:layout_marginRight="20dp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:layout_marginRight="20dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -20,8 +20,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20sp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<com.devspark.robototextview.widget.RobotoTextView
|
||||
android:id="@+id/tv_unreadCount"
|
||||
|
@ -29,7 +28,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|right"
|
||||
android:singleLine="true"
|
||||
android:layout_marginRight="20dp"
|
||||
style="@style/RobotoFontStyle" />
|
||||
android:layout_marginRight="20dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -92,7 +92,8 @@
|
|||
|
||||
|
||||
<string name="calculating_cache_size">Calculating cache size.. Please wait.</string>
|
||||
|
||||
<string name="reset_cache_unsaved_changes">There are unsynchronized changes. Would you like to reset the cache anyway?</string>
|
||||
<string name="warning">Warning</string>
|
||||
|
||||
|
||||
<string name="pref_title_AutoSyncOnStart">Sync on startup</string>
|
||||
|
@ -107,6 +108,8 @@
|
|||
<string name="pref_header_display">Display</string>
|
||||
<string name="pref_title_app_theme">App theme (requires restart to apply)</string>
|
||||
<string name="pref_title_feed_list_layout">Feed list layout</string>
|
||||
<string name="pref_display_font_layout">Font (requires restart to apply)</string>
|
||||
|
||||
|
||||
<string-array name="pref_display_apptheme">
|
||||
<item>Dark</item>
|
||||
|
@ -128,6 +131,36 @@
|
|||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_display_font">
|
||||
<item>Roboto Thin</item>
|
||||
<item>Roboto Light</item>
|
||||
<item>Roboto Regular</item>
|
||||
<item>Roboto Medium</item>
|
||||
<item>Roboto Bold</item>
|
||||
<item>Roboto Black</item>
|
||||
<item>Roboto Condensed</item>
|
||||
<item>Roboto Condensed Bold</item>
|
||||
<item>Roboto Slab Thin</item>
|
||||
<item>Roboto Slab Light</item>
|
||||
<item>Roboto Slab Regular</item>
|
||||
<item>Roboto Slab Bold</item>
|
||||
</string-array>
|
||||
<string-array name="pref_display_font_values">
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>4</item>
|
||||
<item>6</item>
|
||||
<item>8</item>
|
||||
<item>10</item>
|
||||
<item>12</item>
|
||||
<item>14</item>
|
||||
<item>16</item>
|
||||
<item>17</item>
|
||||
<item>18</item>
|
||||
<item>19</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
<!-- Login Dialog -->
|
||||
<string name="login_dialog_title_error">Error</string>
|
||||
|
@ -164,9 +197,11 @@
|
|||
<item>2000</item>
|
||||
<item>5000</item>
|
||||
<item>10000</item>
|
||||
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
|
||||
|
|
|
@ -31,17 +31,18 @@
|
|||
</style>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<style name="RobotoFontStyle">
|
||||
<item name="typeface">robotoslab_regular</item>
|
||||
<!-- https://github.com/johnkil/Android-RobotoTextView#usage -->
|
||||
<item name="typeface">robotoslab_regular</item> -->
|
||||
<!-- https://github.com/johnkil/Android-RobotoTextView#usage --> <!--
|
||||
</style>
|
||||
|
||||
<style name="RobotoFontStyleBold">
|
||||
<item name="typeface">robotoslab_bold</item>
|
||||
</style>
|
||||
-->
|
||||
|
||||
|
||||
<style name="LoginDialogEditTextStyle" parent="@style/RobotoFontStyle" >
|
||||
<style name="LoginDialogEditTextStyle" >
|
||||
<item name="android:layout_marginTop">4dp</item>
|
||||
<item name="android:layout_marginLeft">4dp</item>
|
||||
<item name="android:layout_marginRight">4dp</item>
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
android:entries="@array/pref_display_apptheme"
|
||||
android:entryValues="@array/pref_display_apptheme_values"
|
||||
android:key="sp_app_theme"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_app_theme" />
|
||||
|
||||
|
||||
|
@ -21,10 +19,16 @@
|
|||
android:entries="@array/pref_display_feed_list_layout"
|
||||
android:entryValues="@array/pref_display_feed_list_layout_values"
|
||||
android:key="sp_feed_list_layout"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_feed_list_layout" />
|
||||
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="2"
|
||||
android:entries="@array/pref_display_font"
|
||||
android:entryValues="@array/pref_display_font_values"
|
||||
android:key="sp_font"
|
||||
android:title="@string/pref_display_font_layout" />
|
||||
|
||||
<!--
|
||||
This preference simply launches an intent when selected. Use this UI sparingly, per
|
||||
design guidelines.
|
||||
|
|
|
@ -14,26 +14,26 @@ public class RobotoTypefaceManager {
|
|||
/*
|
||||
* Available values for the "typeface" attribute.
|
||||
*/
|
||||
private final static int ROBOTO_THIN = 0;
|
||||
private final static int ROBOTO_THIN_ITALIC = 1;
|
||||
private final static int ROBOTO_LIGHT = 2;
|
||||
private final static int ROBOTO_LIGHT_ITALIC = 3;
|
||||
private final static int ROBOTO_REGULAR = 4;
|
||||
private final static int ROBOTO_ITALIC = 5;
|
||||
private final static int ROBOTO_MEDIUM = 6;
|
||||
private final static int ROBOTO_MEDIUM_ITALIC = 7;
|
||||
private final static int ROBOTO_BOLD = 8;
|
||||
private final static int ROBOTO_BOLD_ITALIC = 9;
|
||||
private final static int ROBOTO_BLACK = 10;
|
||||
private final static int ROBOTO_BLACK_ITALIC = 11;
|
||||
private final static int ROBOTO_CONDENSED = 12;
|
||||
private final static int ROBOTO_CONDENSED_ITALIC = 13;
|
||||
private final static int ROBOTO_CONDENSED_BOLD = 14;
|
||||
private final static int ROBOTO_CONDENSED_BOLD_ITALIC = 15;
|
||||
private final static int ROBOTOSLAB_THIN = 16;
|
||||
private final static int ROBOTOSLAB_LIGHT = 17;
|
||||
private final static int ROBOTOSLAB_REGULAR = 18;
|
||||
private final static int ROBOTOSLAB_BOLD = 19;
|
||||
public final static int ROBOTO_THIN = 0;
|
||||
public final static int ROBOTO_THIN_ITALIC = 1;
|
||||
public final static int ROBOTO_LIGHT = 2;
|
||||
public final static int ROBOTO_LIGHT_ITALIC = 3;
|
||||
public final static int ROBOTO_REGULAR = 4;
|
||||
public final static int ROBOTO_ITALIC = 5;
|
||||
public final static int ROBOTO_MEDIUM = 6;
|
||||
public final static int ROBOTO_MEDIUM_ITALIC = 7;
|
||||
public final static int ROBOTO_BOLD = 8;
|
||||
public final static int ROBOTO_BOLD_ITALIC = 9;
|
||||
public final static int ROBOTO_BLACK = 10;
|
||||
public final static int ROBOTO_BLACK_ITALIC = 11;
|
||||
public final static int ROBOTO_CONDENSED = 12;
|
||||
public final static int ROBOTO_CONDENSED_ITALIC = 13;
|
||||
public final static int ROBOTO_CONDENSED_BOLD = 14;
|
||||
public final static int ROBOTO_CONDENSED_BOLD_ITALIC = 15;
|
||||
public final static int ROBOTOSLAB_THIN = 16;
|
||||
public final static int ROBOTOSLAB_LIGHT = 17;
|
||||
public final static int ROBOTOSLAB_REGULAR = 18;
|
||||
public final static int ROBOTOSLAB_BOLD = 19;
|
||||
|
||||
/**
|
||||
* Array of created typefaces for later reused.
|
||||
|
|
|
@ -25,6 +25,7 @@ import de.luhmer.owncloudnewsreader.data.ConcreteFeedItem;
|
|||
import de.luhmer.owncloudnewsreader.data.FolderSubscribtionItem;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
import de.luhmer.owncloudnewsreader.interfaces.ExpListTextClicked;
|
||||
|
||||
|
@ -143,6 +144,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
vi.inflate(R.layout.subscription_list_sub_item, view, true);
|
||||
if(item != null)
|
||||
view.setTag(item.id_database);
|
||||
|
||||
FontHelper fHelper = new FontHelper(mContext);
|
||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||
} else {
|
||||
view = (LinearLayout) convertView;
|
||||
}
|
||||
|
@ -222,6 +226,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(inflater);
|
||||
vi.inflate(R.layout.subscription_list_item, view, true);
|
||||
|
||||
FontHelper fHelper = new FontHelper(mContext);
|
||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||
|
||||
ImageView indicatorImage = (ImageView) view.findViewById(R.id.img_View_expandable_indicator);
|
||||
TextView txt_Summary = (TextView) view.findViewById(R.id.summary);
|
||||
TextView textFeedCount = (TextView) view.findViewById(R.id.tV_feedsCount);
|
||||
|
|
|
@ -21,8 +21,8 @@ import android.widget.CheckBox;
|
|||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloudReaderMethods;
|
||||
|
||||
/**
|
||||
|
@ -76,6 +76,9 @@ public class LoginDialogFragment extends SherlockDialogFragment {
|
|||
})*/
|
||||
.setTitle(getString(R.string.action_sign_in_short));
|
||||
|
||||
FontHelper fHelper = new FontHelper(getActivity());
|
||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
mUsername = mPrefs.getString(SettingsActivity.EDT_USERNAME_STRING, null);
|
||||
mPassword = mPrefs.getString(SettingsActivity.EDT_PASSWORD_STRING, null);
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.devspark.robototextview.widget.RobotoCheckBox;
|
|||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||
import de.luhmer.owncloudnewsreader.cursor.NewsListCursorAdapter;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.MenuUtilsSherlockFragmentActivity;
|
||||
|
||||
/**
|
||||
|
@ -231,6 +232,8 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
|
||||
@Override
|
||||
public void onResume() {
|
||||
//setEmptyListView();
|
||||
|
||||
lastItemPosition = -1;
|
||||
super.onResume();
|
||||
}
|
||||
|
@ -300,16 +303,19 @@ public class NewsReaderDetailFragment extends SherlockListFragment {
|
|||
return rootView;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
private void setEmptyListView() {
|
||||
LayoutInflater inflator=getActivity().getLayoutInflater();
|
||||
View emptyView=inflator.inflate(R.layout.subscription_detail_list_item_empty, (ViewGroup)getView());
|
||||
View emptyView = inflator.inflate(R.layout.subscription_detail_list_item_empty, (ViewGroup)getView());
|
||||
|
||||
FontHelper fHelper = new FontHelper(getActivity());
|
||||
fHelper.setFontForAllChildren(emptyView, fHelper.getFont());
|
||||
|
||||
ListView lv = getListView();
|
||||
if(lv != null)
|
||||
lv.setEmptyView(emptyView);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
|
|
|
@ -7,7 +7,10 @@ import java.util.List;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
|
@ -27,6 +30,7 @@ import com.actionbarsherlock.view.MenuItem;
|
|||
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
|
||||
/**
|
||||
|
@ -65,8 +69,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
public static final String SP_APP_THEME = "sp_app_theme";
|
||||
public static final String SP_FEED_LIST_LAYOUT = "sp_feed_list_layout";
|
||||
public static final String SP_MAX_CACHE_SIZE = "sp_max_cache_size";
|
||||
|
||||
|
||||
public static final String SP_FONT = "sp_font";
|
||||
|
||||
static //public static final String PREF_SIGN_IN_DIALOG = "sPref_signInDialog";
|
||||
|
||||
|
@ -78,8 +81,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
ThemeChooser.chooseTheme(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -95,7 +97,7 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
|
||||
setupSimplePreferencesScreen();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shows the simplified settings UI if the device configuration if the
|
||||
* device configuration dictates that a simplified, single-pane UI should be
|
||||
|
@ -224,7 +226,6 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
preference
|
||||
.setSummary(index >= 0 ? listPreference.getEntries()[index]
|
||||
: null);
|
||||
|
||||
} /*else if (preference instanceof RingtonePreference) {
|
||||
// For ringtone preferences, look up the correct display value
|
||||
// using RingtoneManager.
|
||||
|
@ -409,11 +410,13 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
{
|
||||
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_APP_THEME));
|
||||
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_FEED_LIST_LAYOUT));
|
||||
bindPreferenceSummaryToValue(prefFrag.findPreference(SP_FONT));
|
||||
}
|
||||
else
|
||||
{
|
||||
bindPreferenceSummaryToValue(prefAct.findPreference(SP_APP_THEME));
|
||||
bindPreferenceSummaryToValue(prefAct.findPreference(SP_FEED_LIST_LAYOUT));
|
||||
bindPreferenceSummaryToValue(prefAct.findPreference(SP_FONT));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,17 +484,54 @@ public class SettingsActivity extends SherlockPreferenceActivity {
|
|||
((EditTextPreference) preference).getDialog().dismiss();
|
||||
|
||||
DatabaseConnection dbConn = new DatabaseConnection(_mActivity);
|
||||
dbConn.resetDatabase();
|
||||
dbConn.closeDatabase();
|
||||
boolean resetDatabase = true;
|
||||
if(dbConn.getAllNewReadItems().size() > 0)
|
||||
resetDatabase = false;
|
||||
else if(dbConn.getAllNewUnreadItems().size() > 0)
|
||||
resetDatabase = false;
|
||||
else if(dbConn.getAllNewStarredItems().size() > 0)
|
||||
resetDatabase = false;
|
||||
else if(dbConn.getAllNewUnstarredItems().size() > 0)
|
||||
resetDatabase = false;
|
||||
|
||||
ImageHandler.clearCache(_mActivity);
|
||||
LoginDialogFragment.ShowAlertDialog("Information" , "Cache is cleared!", _mActivity);
|
||||
new GetCacheSizeAsync().execute((Void)null);
|
||||
if(resetDatabase) {
|
||||
ResetDatabase();
|
||||
} else {
|
||||
new AlertDialog.Builder(_mActivity)
|
||||
.setTitle(_mActivity.getString(R.string.warning))
|
||||
.setMessage(_mActivity.getString(R.string.reset_cache_unsaved_changes))
|
||||
.setPositiveButton(_mActivity.getString(android.R.string.ok), new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PostDelayHandler pDelayHandler = new PostDelayHandler(_mActivity);
|
||||
pDelayHandler.stopRunningPostDelayHandler();
|
||||
|
||||
ResetDatabase();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(_mActivity.getString(android.R.string.no), null)
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
dbConn.closeDatabase();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void ResetDatabase() {
|
||||
DatabaseConnection dbConn = new DatabaseConnection(_mActivity);
|
||||
try {
|
||||
dbConn.resetDatabase();
|
||||
ImageHandler.clearCache(_mActivity);
|
||||
LoginDialogFragment.ShowAlertDialog("Information" , "Cache is cleared!", _mActivity);
|
||||
new GetCacheSizeAsync().execute((Void)null);
|
||||
} finally {
|
||||
dbConn.closeDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
public static class GetCacheSizeAsync extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
|||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
|
||||
import de.luhmer.owncloudnewsreader.reader.IReader;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
|
||||
|
@ -86,6 +87,9 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
break;
|
||||
}
|
||||
|
||||
FontHelper fHelper = new FontHelper(context);
|
||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||
|
||||
RobotoCheckBox cb = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_starred);
|
||||
cb.setOnCheckedChangeListener(null);
|
||||
|
||||
|
@ -112,6 +116,12 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
Boolean isChecked = dbConn.isFeedUnreadStarred(cursor.getString(0), true);
|
||||
//Log.d("ISREAD", "" + isChecked + " - Cursor: " + cursor.getString(0));
|
||||
cbRead.setChecked(isChecked);
|
||||
if(!isChecked) {
|
||||
RobotoTextView textView = (RobotoTextView) view.findViewById(R.id.summary);
|
||||
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
|
||||
}
|
||||
|
||||
|
||||
cbRead.setClickable(true);
|
||||
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
|
@ -125,10 +135,14 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
|||
RobotoTextView textView = (RobotoTextView) view.findViewById(R.id.summary);
|
||||
if(textView != null)
|
||||
{
|
||||
FontHelper fHelper = new FontHelper(context);
|
||||
if(isChecked)
|
||||
textView.setTextAppearance(mContext, R.style.RobotoFontStyle);
|
||||
fHelper.setFontStyleForSingleView(textView, fHelper.getFont());
|
||||
//textView.setTextAppearance(mContext, R.style.RobotoFontStyle);
|
||||
else
|
||||
textView.setTextAppearance(mContext, R.style.RobotoFontStyleBold);
|
||||
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
|
||||
//textView.setTextAppearance(mContext, R.style.RobotoFontStyleBold);
|
||||
|
||||
textView.invalidate();
|
||||
}
|
||||
}
|
||||
|
|
81
src/de/luhmer/owncloudnewsreader/helper/FontHelper.java
Normal file
81
src/de/luhmer/owncloudnewsreader/helper/FontHelper.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package de.luhmer.owncloudnewsreader.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Typeface;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.devspark.robototextview.RobotoTypefaceManager;
|
||||
import com.devspark.robototextview.widget.RobotoButton;
|
||||
import com.devspark.robototextview.widget.RobotoCheckBox;
|
||||
import com.devspark.robototextview.widget.RobotoTextView;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
|
||||
public class FontHelper {
|
||||
Context context;
|
||||
|
||||
public FontHelper(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setFontForAllChildren(View view, Typeface typeface) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
setForAllChildrenRekursiv(viewGroup, typeface);
|
||||
}
|
||||
|
||||
public void setFontStyleForSingleView(View view, Typeface typeface) {
|
||||
setFontForView(view, typeface);
|
||||
}
|
||||
|
||||
private void setForAllChildrenRekursiv(ViewGroup viewGroup, Typeface typeface) {
|
||||
for(int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
View view = viewGroup.getChildAt(i);
|
||||
setFontForView(view, typeface);
|
||||
}
|
||||
}
|
||||
|
||||
private void setFontForView(View view, Typeface typeface) {
|
||||
if(view instanceof ViewGroup)
|
||||
setFontForAllChildren(view, typeface);
|
||||
else if(view instanceof RobotoTextView)
|
||||
((RobotoTextView)view).setTypeface(typeface);
|
||||
else if(view instanceof RobotoButton)
|
||||
((RobotoButton)view).setTypeface(typeface);
|
||||
else if(view instanceof RobotoCheckBox)
|
||||
((RobotoCheckBox)view).setTypeface(typeface);
|
||||
}
|
||||
|
||||
public Typeface getFont() {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int font = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
|
||||
return RobotoTypefaceManager.obtaintTypeface(context, font);
|
||||
}
|
||||
|
||||
public Typeface getFontUnreadStyle() {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int font = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
|
||||
font = unreadFonts.get(font, font);
|
||||
return RobotoTypefaceManager.obtaintTypeface(context, font);
|
||||
}
|
||||
|
||||
private final SparseIntArray unreadFonts = new SparseIntArray() {
|
||||
{
|
||||
put(RobotoTypefaceManager.ROBOTO_THIN, RobotoTypefaceManager.ROBOTO_LIGHT);
|
||||
put(RobotoTypefaceManager.ROBOTO_LIGHT, RobotoTypefaceManager.ROBOTO_REGULAR);
|
||||
put(RobotoTypefaceManager.ROBOTO_REGULAR, RobotoTypefaceManager.ROBOTO_MEDIUM);
|
||||
put(RobotoTypefaceManager.ROBOTO_MEDIUM, RobotoTypefaceManager.ROBOTO_BOLD);
|
||||
put(RobotoTypefaceManager.ROBOTO_BOLD, RobotoTypefaceManager.ROBOTO_BLACK);
|
||||
put(RobotoTypefaceManager.ROBOTO_BLACK, RobotoTypefaceManager.ROBOTO_BLACK_ITALIC);
|
||||
put(RobotoTypefaceManager.ROBOTO_CONDENSED, RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD);
|
||||
put(RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD, RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD_ITALIC);
|
||||
put(RobotoTypefaceManager.ROBOTOSLAB_THIN, RobotoTypefaceManager.ROBOTOSLAB_LIGHT);
|
||||
put(RobotoTypefaceManager.ROBOTOSLAB_LIGHT, RobotoTypefaceManager.ROBOTOSLAB_REGULAR);
|
||||
put(RobotoTypefaceManager.ROBOTOSLAB_REGULAR, RobotoTypefaceManager.ROBOTOSLAB_BOLD);
|
||||
put(RobotoTypefaceManager.ROBOTOSLAB_BOLD, RobotoTypefaceManager.ROBOTOSLAB_BOLD);
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue