Update 0.4.1
This commit is contained in:
parent
776d1fcd8d
commit
0a2db6be10
9 changed files with 167 additions and 29 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.luhmer.owncloudnewsreader"
|
||||
android:versionCode="23"
|
||||
android:versionName="0.4.0" >
|
||||
android:versionCode="24"
|
||||
android:versionName="0.4.1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="7"
|
||||
|
|
|
@ -2,14 +2,69 @@
|
|||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-family: "ROBOTO_BLACK";
|
||||
src: url('file:///android_asset/fonts/Roboto-Black.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_BOLD";
|
||||
src: url('file:///android_asset/fonts/Roboto-Bold.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_CONDENSED_BOLD";
|
||||
src: url('file:///android_asset/fonts/Roboto-BoldCondensed.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_CONDENSED";
|
||||
src: url('file:///android_asset/fonts/Roboto-Condensed.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_LIGHT";
|
||||
src: url('file:///android_asset/fonts/Roboto-Light.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_MEDIUM";
|
||||
src: url('file:///android_asset/fonts/Roboto-Medium.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_REGULAR";
|
||||
src: url('file:///android_asset/fonts/Roboto-Regular.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTO_THIN";
|
||||
src: url('file:///android_asset/fonts/Roboto-Thin.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTOSLAB_BOLD";
|
||||
src: url('file:///android_asset/fonts/RobotoSlab-Bold.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTOSLAB_LIGHT";
|
||||
src: url('file:///android_asset/fonts/RobotoSlab-Light.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTOSLAB_REGULAR";
|
||||
src: url('file:///android_asset/fonts/RobotoSlab-Regular.ttf');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "ROBOTOSLAB_THIN";
|
||||
src: url('file:///android_asset/fonts/RobotoSlab-Thin.ttf');
|
||||
}
|
||||
|
||||
body#darkTheme {
|
||||
|
||||
/* font-family: 'Segoe UI', 'Segoe UI Light', 'Droid Sans', sans-serif ; */
|
||||
font-family: 'Roboto', 'Segoe UI', 'Segoe UI Light';
|
||||
font-family: 'ROBOTO_FONT_STYLE', 'Segoe UI', 'Segoe UI Light';
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
background-color: #222;
|
||||
|
@ -19,7 +74,7 @@
|
|||
}
|
||||
|
||||
body#lightTheme {
|
||||
font-family: 'Roboto', 'Segoe UI', 'Segoe UI Light';
|
||||
font-family: 'ROBOTO_FONT_STYLE', 'Segoe UI', 'Segoe UI Light';
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
background-color: #E1E1E1;
|
||||
|
|
|
@ -39,9 +39,10 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
private ArrayList<FolderSubscribtionItem> mCategoriesArrayList;
|
||||
private SparseArray<SparseArray<ConcreteFeedItem>> mItemsArrayList;
|
||||
private boolean showOnlyUnread = false;
|
||||
|
||||
|
||||
public static final String ALL_UNREAD_ITEMS = "-10";
|
||||
public static final String ALL_STARRED_ITEMS = "-11";
|
||||
public static final String ALL_ITEMS = "-12";
|
||||
public static final String ITEMS_WITHOUT_FOLDER = "-22";
|
||||
|
||||
|
||||
|
|
|
@ -9,10 +9,13 @@ import java.util.List;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -25,6 +28,7 @@ import android.widget.ProgressBar;
|
|||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
|
||||
|
@ -389,6 +393,11 @@ public class NewsDetailFragment extends SherlockFragment {
|
|||
if(ThemeChooser.isDarkTheme(context))
|
||||
web_template = web_template.replace("<body id=\"lightTheme\">", "<body id=\"darkTheme\">");
|
||||
|
||||
|
||||
FontHelper fHelper = new FontHelper(context);
|
||||
|
||||
web_template = web_template.replace("ROBOTO_FONT_STYLE", fHelper.getFontName());
|
||||
|
||||
/*
|
||||
DisplayMetrics displaymetrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
|
||||
|
|
|
@ -182,21 +182,9 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
|
|||
public void onAsyncTaskCompleted(int task_id, Object task_result) {
|
||||
if(isTwoPaneMode() || isAdded()) {
|
||||
if(!(task_result instanceof Exception))
|
||||
{
|
||||
API api = null;
|
||||
String appVersion = task_result.toString();
|
||||
int versionCode = 0;
|
||||
if(appVersion != null)
|
||||
{
|
||||
appVersion = appVersion.replace(".", "");
|
||||
versionCode = Integer.parseInt(appVersion);
|
||||
}
|
||||
if (versionCode >= 1101) {
|
||||
api = new APIv2(getActivity());
|
||||
} else {
|
||||
api = new APIv1(getActivity());
|
||||
}
|
||||
|
||||
{
|
||||
String appVersion = task_result.toString();
|
||||
API api = API.GetRightApiForVersion(appVersion, getActivity());
|
||||
((OwnCloud_Reader) _Reader).setApi(api);
|
||||
|
||||
_Reader.Start_AsyncTask_PerformItemStateChange(Constants.TaskID_PerformStateChange, getActivity(), onAsyncTask_PerformTagExecute);
|
||||
|
|
|
@ -594,7 +594,7 @@ public class DatabaseConnection {
|
|||
String buildSQL = getAllFeedsSelectStatement() +
|
||||
" FROM " + RSS_ITEM_TABLE;
|
||||
|
||||
if(!(ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS)))//Wenn nicht Alle Artikel ausgewaehlt wurde (-10) oder (-11) fuer Starred Feeds
|
||||
if(!(ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_STARRED_ITEMS) || ID_FOLDER.equals(SubscriptionExpandableListAdapter.ALL_ITEMS)))//Wenn nicht Alle Artikel ausgewaehlt wurde (-10) oder (-11) fuer Starred Feeds
|
||||
{
|
||||
buildSQL += " WHERE subscription_id_subscription IN " +
|
||||
"(SELECT sc.rowid " +
|
||||
|
|
|
@ -81,4 +81,50 @@ public class FontHelper {
|
|||
put(RobotoTypefaceManager.ROBOTOSLAB_BOLD, RobotoTypefaceManager.ROBOTOSLAB_BOLD);
|
||||
}
|
||||
};
|
||||
|
||||
public String getFontName() {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int typefaceValue = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FONT, "2"));
|
||||
|
||||
String typeFaceName = "";
|
||||
switch (typefaceValue) {
|
||||
case RobotoTypefaceManager.ROBOTO_THIN:
|
||||
typeFaceName = "ROBOTO_THIN";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_LIGHT:
|
||||
typeFaceName = "ROBOTO_LIGHT";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_REGULAR:
|
||||
typeFaceName = "ROBOTO_REGULAR";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_MEDIUM:
|
||||
typeFaceName = "ROBOTO_MEDIUM";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_BOLD:
|
||||
typeFaceName = "ROBOTO_BOLD";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_BLACK:
|
||||
typeFaceName = "ROBOTO_BLACK";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_CONDENSED:
|
||||
typeFaceName = "ROBOTO_CONDENSED";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTO_CONDENSED_BOLD:
|
||||
typeFaceName = "ROBOTO_CONDENSED_BOLD";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTOSLAB_THIN:
|
||||
typeFaceName = "ROBOTOSLAB_THIN";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTOSLAB_LIGHT:
|
||||
typeFaceName = "ROBOTOSLAB_LIGHT";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTOSLAB_REGULAR:
|
||||
typeFaceName = "ROBOTOSLAB_REGULAR";
|
||||
break;
|
||||
case RobotoTypefaceManager.ROBOTOSLAB_BOLD:
|
||||
typeFaceName = "ROBOTOSLAB_BOLD";
|
||||
break;
|
||||
}
|
||||
return typeFaceName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.annotation.TargetApi;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
@ -24,6 +25,7 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
|||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.reader.IReader;
|
||||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
|
||||
|
||||
public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity {
|
||||
|
@ -41,6 +43,8 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
|
|||
private static MenuItem menuItemMarkAllAsRead;
|
||||
private static MenuItem menuItemDownloadMoreItems;
|
||||
|
||||
static IReader _Reader;
|
||||
|
||||
/**
|
||||
* @return the menuItemUpdater
|
||||
*/
|
||||
|
@ -156,12 +160,10 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
|
|||
}
|
||||
|
||||
private static void DownloadMoreItems()
|
||||
{
|
||||
NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) activity.getSupportFragmentManager().findFragmentById(R.id.newsreader_detail_container));
|
||||
|
||||
{
|
||||
DatabaseConnection dbConn = new DatabaseConnection(activity);
|
||||
int count = dbConn.getCountFeedsForFolder(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS, true);
|
||||
if(count > Constants.maxItemsCount)
|
||||
int count = dbConn.getCountFeedsForFolder(SubscriptionExpandableListAdapter.ALL_ITEMS, false);
|
||||
if(count >= Constants.maxItemsCount)
|
||||
{
|
||||
String text = activity.getString(R.string.max_items_count_reached);
|
||||
text = text.replace("XX", "" + Constants.maxItemsCount);
|
||||
|
@ -179,13 +181,31 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
|
|||
}
|
||||
else
|
||||
{
|
||||
IReader _Reader = new OwnCloud_Reader();
|
||||
_Reader.Start_AsyncTask_GetOldItems(0, activity, onAsyncTaskComplete, ndf.getIdFeed(), ndf.getIdFolder());
|
||||
String username = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_username", "");
|
||||
String password = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_password", "");
|
||||
|
||||
_Reader = new OwnCloud_Reader();
|
||||
((OwnCloud_Reader)_Reader).Start_AsyncTask_GetVersion(Constants.TaskID_GetVersion, activity, onAsyncTaskGetVersionFinished, username, password);
|
||||
|
||||
Toast.makeText(activity, activity.getString(R.string.toast_GettingMoreItems), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
static OnAsyncTaskCompletedListener onAsyncTaskGetVersionFinished = new OnAsyncTaskCompletedListener() {
|
||||
|
||||
@Override
|
||||
public void onAsyncTaskCompleted(int task_id, Object task_result) {
|
||||
if(_Reader != null) {
|
||||
String appVersion = task_result.toString();
|
||||
API api = API.GetRightApiForVersion(appVersion, activity);
|
||||
((OwnCloud_Reader) _Reader).setApi(api);
|
||||
|
||||
NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) activity.getSupportFragmentManager().findFragmentById(R.id.newsreader_detail_container));
|
||||
_Reader.Start_AsyncTask_GetOldItems(Constants.TaskID_GetItems, activity, onAsyncTaskComplete, ndf.getIdFeed(), ndf.getIdFolder());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static OnAsyncTaskCompletedListener onAsyncTaskComplete = new OnAsyncTaskCompletedListener() {
|
||||
@Override
|
||||
public void onAsyncTaskCompleted(int task_id, Object task_result) {
|
||||
|
|
|
@ -3,12 +3,15 @@ package de.luhmer.owncloudnewsreader.reader.owncloud;
|
|||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
import de.luhmer.owncloudnewsreader.reader.FeedItemTags;
|
||||
import de.luhmer.owncloudnewsreader.reader.FeedItemTags.TAGS;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv1.APIv1;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
|
||||
|
||||
public abstract class API {
|
||||
protected SharedPreferences mPrefs;
|
||||
|
@ -18,6 +21,22 @@ public abstract class API {
|
|||
mPrefs = PreferenceManager.getDefaultSharedPreferences(cont);
|
||||
}
|
||||
|
||||
public static API GetRightApiForVersion(String appVersion, Activity activity) {
|
||||
API api = null;
|
||||
int versionCode = 0;
|
||||
if(appVersion != null)
|
||||
{
|
||||
appVersion = appVersion.replace(".", "");
|
||||
versionCode = Integer.parseInt(appVersion);
|
||||
}
|
||||
if (versionCode >= 1101) {
|
||||
api = new APIv2(activity);
|
||||
} else {
|
||||
api = new APIv1(activity);
|
||||
}
|
||||
return api;
|
||||
}
|
||||
|
||||
protected abstract String getItemUrl();
|
||||
protected abstract String getItemUpdatedUrl();
|
||||
protected abstract String getFeedUrl();
|
||||
|
|
Loading…
Reference in a new issue