Performance Update
This commit is contained in:
parent
a34806c6d7
commit
cc5a5695da
19 changed files with 566 additions and 390 deletions
|
@ -72,6 +72,7 @@
|
||||||
<orderEntry type="library" exported="" name="extra-abs-0.9.3" level="project" />
|
<orderEntry type="library" exported="" name="extra-abs-0.9.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="library-0.2.0" level="project" />
|
<orderEntry type="library" exported="" name="library-0.2.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="library-0.9.3" level="project" />
|
<orderEntry type="library" exported="" name="library-0.9.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="picasso-2.2.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
|
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
|
||||||
<orderEntry type="library" exported="" name="butterknife-4.0.1" level="project" />
|
<orderEntry type="library" exported="" name="butterknife-4.0.1" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
|
||||||
|
|
|
@ -35,9 +35,9 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:support-v4:19.0.+'
|
compile 'com.android.support:support-v4:19.0.+'
|
||||||
compile 'com.jakewharton:butterknife:4.0.+'
|
compile 'com.jakewharton:butterknife:4.0.+'
|
||||||
|
compile 'com.squareup.picasso:picasso:2.2.0@jar'
|
||||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||||
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+'
|
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+'
|
||||||
|
|
||||||
// You must install or update the Google Repository through the SDK manager to use this dependency.
|
// You must install or update the Google Repository through the SDK manager to use this dependency.
|
||||||
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
|
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
|
||||||
// compile 'com.google.android.gms:play-services:4.2.42'
|
// compile 'com.google.android.gms:play-services:4.2.42'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="de.luhmer.owncloudnewsreader"
|
package="de.luhmer.owncloudnewsreader"
|
||||||
android:versionCode="43"
|
android:versionCode="44"
|
||||||
android:versionName="0.5.8" >
|
android:versionName="0.5.9" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="7"
|
android:minSdkVersion="7"
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class DownloadImagesActivity extends Activity {
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(getString(android.R.string.yes) ,new DialogInterface.OnClickListener() {
|
.setPositiveButton(getString(android.R.string.yes) ,new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog,int id) {
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
AsyncTask_GetItems.StartDownloadingImages(DownloadImagesActivity.this, highestItemIdBeforeSync);
|
AsyncTask_GetItems.StartDownloadingImages(DownloadImagesActivity.this, highestItemIdBeforeSync, false);
|
||||||
DownloadImagesActivity.this.finish();
|
DownloadImagesActivity.this.finish();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -40,9 +40,13 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.squareup.picasso.Picasso;
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.InjectView;
|
||||||
import de.luhmer.owncloudnewsreader.R;
|
import de.luhmer.owncloudnewsreader.R;
|
||||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||||
import de.luhmer.owncloudnewsreader.async_tasks.FillTextForTextViewAsyncTask;
|
import de.luhmer.owncloudnewsreader.async_tasks.FillTextForTextViewAsyncTask;
|
||||||
|
@ -51,14 +55,14 @@ import de.luhmer.owncloudnewsreader.data.AbstractItem;
|
||||||
import de.luhmer.owncloudnewsreader.data.ConcreteFeedItem;
|
import de.luhmer.owncloudnewsreader.data.ConcreteFeedItem;
|
||||||
import de.luhmer.owncloudnewsreader.data.FolderSubscribtionItem;
|
import de.luhmer.owncloudnewsreader.data.FolderSubscribtionItem;
|
||||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||||
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
|
|
||||||
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
|
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
|
||||||
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
import de.luhmer.owncloudnewsreader.helper.FontHelper;
|
||||||
|
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||||
import de.luhmer.owncloudnewsreader.interfaces.ExpListTextClicked;
|
import de.luhmer.owncloudnewsreader.interfaces.ExpListTextClicked;
|
||||||
|
|
||||||
public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter {
|
public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter {
|
||||||
|
|
||||||
BitmapDrawableLruCache favIconCache = null;
|
//BitmapDrawableLruCache favIconCache = null;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private DatabaseConnection dbConn;
|
private DatabaseConnection dbConn;
|
||||||
|
@ -76,18 +80,22 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
public static final String ITEMS_WITHOUT_FOLDER = "-22";
|
public static final String ITEMS_WITHOUT_FOLDER = "-22";
|
||||||
//private static final String TAG = "SubscriptionExpandableListAdapter";
|
//private static final String TAG = "SubscriptionExpandableListAdapter";
|
||||||
|
|
||||||
|
LayoutInflater inflater;
|
||||||
|
private final String favIconPath;
|
||||||
|
|
||||||
public SubscriptionExpandableListAdapter(Context mContext, DatabaseConnection dbConn)
|
public SubscriptionExpandableListAdapter(Context mContext, DatabaseConnection dbConn)
|
||||||
{
|
{
|
||||||
|
//Picasso.with(mContext).setDebugging(true);
|
||||||
|
|
||||||
|
this.favIconPath = ImageHandler.getPathFavIcons(mContext);
|
||||||
|
this.inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
this.dbConn = dbConn;
|
this.dbConn = dbConn;
|
||||||
|
|
||||||
int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
|
//int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
|
||||||
//Use 1/8 of the available memory for this memory cache
|
//Use 1/8 of the available memory for this memory cache
|
||||||
int cachSize = maxMemory / 8;
|
//int cachSize = maxMemory / 8;
|
||||||
favIconCache = new BitmapDrawableLruCache(cachSize);
|
//favIconCache = new BitmapDrawableLruCache(cachSize);
|
||||||
|
|
||||||
fHelper = new FontHelper(mContext);
|
fHelper = new FontHelper(mContext);
|
||||||
|
|
||||||
|
@ -151,41 +159,38 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
@Override
|
@Override
|
||||||
public View getChildView(int groupPosition, int childPosition,
|
public View getChildView(int groupPosition, int childPosition,
|
||||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||||
LinearLayout view;
|
final ConcreteFeedItem item = (ConcreteFeedItem)getChild(groupPosition, childPosition);
|
||||||
ChildHolder viewHolder;
|
final ChildHolder viewHolder;
|
||||||
ConcreteFeedItem item = (ConcreteFeedItem)getChild(groupPosition, childPosition);
|
|
||||||
|
|
||||||
|
if (convertView != null) {
|
||||||
if (convertView == null) {
|
viewHolder = (ChildHolder) convertView.getTag();
|
||||||
view = new LinearLayout(mContext);
|
|
||||||
String inflater = Context.LAYOUT_INFLATER_SERVICE;
|
|
||||||
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(inflater);
|
|
||||||
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());
|
|
||||||
|
|
||||||
viewHolder = new ChildHolder();
|
|
||||||
viewHolder.tV_HeaderText = (TextView) view.findViewById(R.id.summary);
|
|
||||||
viewHolder.tV_UnreadCount = (TextView) view.findViewById(R.id.tv_unreadCount);
|
|
||||||
viewHolder.imgView_FavIcon = (ImageView) view.findViewById(R.id.iVFavicon);
|
|
||||||
|
|
||||||
view.setTag(viewHolder);
|
|
||||||
} else {
|
} else {
|
||||||
view = (LinearLayout) convertView;
|
LinearLayout view = new LinearLayout(mContext);
|
||||||
viewHolder = (ChildHolder) convertView.getTag();
|
convertView = inflater.inflate(R.layout.subscription_list_sub_item, view, true);
|
||||||
|
viewHolder = new ChildHolder(convertView, mContext);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(item != null)
|
||||||
|
convertView.setTag(item.id_database);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(item != null)
|
if(item != null)
|
||||||
{
|
{
|
||||||
String headerText = (item.header != null) ? item.header : "";
|
String headerText = (item.header != null) ? item.header : "";
|
||||||
viewHolder.tV_HeaderText.setText(headerText);
|
viewHolder.tV_HeaderText.setText(headerText);
|
||||||
|
|
||||||
boolean execludeStarredItems = (item.folder_id.equals(ALL_STARRED_ITEMS)) ? false : true;
|
String unreadCount = unreadCountFeeds.get((int) item.id_database);
|
||||||
SetUnreadCountForFeed(viewHolder.tV_UnreadCount, String.valueOf(item.id_database), execludeStarredItems);
|
if(unreadCount != null)
|
||||||
GetFavIconForFeed(item.favIcon, viewHolder.imgView_FavIcon, String.valueOf(item.id_database));
|
viewHolder.tV_UnreadCount.setText(unreadCount);
|
||||||
|
else {
|
||||||
|
boolean execludeStarredItems = (item.folder_id.equals(ALL_STARRED_ITEMS)) ? false : true;
|
||||||
|
SetUnreadCountForFeed(viewHolder.tV_UnreadCount, String.valueOf(item.id_database), execludeStarredItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadFavIconForFeed(item.favIcon, viewHolder.imgView_FavIcon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -194,13 +199,20 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
viewHolder.imgView_FavIcon.setImageDrawable(null);
|
viewHolder.imgView_FavIcon.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ChildHolder {
|
static class ChildHolder {
|
||||||
public TextView tV_HeaderText;
|
@InjectView(R.id.summary) TextView tV_HeaderText;
|
||||||
public TextView tV_UnreadCount;
|
@InjectView(R.id.tv_unreadCount) TextView tV_UnreadCount;
|
||||||
public ImageView imgView_FavIcon;
|
@InjectView(R.id.iVFavicon) ImageView imgView_FavIcon;
|
||||||
|
|
||||||
|
public ChildHolder(View view, Context mContext) {
|
||||||
|
ButterKnife.inject(this, view);
|
||||||
|
|
||||||
|
FontHelper fHelper = new FontHelper(mContext);
|
||||||
|
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,30 +248,17 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
@Override
|
@Override
|
||||||
public View getGroupView(int groupPosition, boolean isExpanded,
|
public View getGroupView(int groupPosition, boolean isExpanded,
|
||||||
View convertView, ViewGroup parent) {
|
View convertView, ViewGroup parent) {
|
||||||
LinearLayout view;
|
|
||||||
GroupHolder viewHolder;
|
|
||||||
|
|
||||||
|
GroupHolder viewHolder;
|
||||||
final FolderSubscribtionItem group = (FolderSubscribtionItem)getGroup(groupPosition);
|
final FolderSubscribtionItem group = (FolderSubscribtionItem)getGroup(groupPosition);
|
||||||
|
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
view = new LinearLayout(mContext);
|
LinearLayout view = new LinearLayout(mContext);
|
||||||
String inflater = Context.LAYOUT_INFLATER_SERVICE;
|
convertView = inflater.inflate(R.layout.subscription_list_item, view, true);
|
||||||
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(inflater);
|
viewHolder = new GroupHolder(convertView, mContext);
|
||||||
vi.inflate(R.layout.subscription_list_item, view, true);
|
|
||||||
|
|
||||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
|
||||||
|
|
||||||
viewHolder = new GroupHolder();
|
|
||||||
viewHolder.imgView = (ImageView) view.findViewById(R.id.img_View_expandable_indicator);
|
|
||||||
viewHolder.txt_Summary = (TextView) view.findViewById(R.id.summary);
|
|
||||||
viewHolder.txt_UnreadCount = (TextView) view.findViewById(R.id.tV_feedsCount);
|
|
||||||
|
|
||||||
viewHolder.txt_Summary.setClickable(true);
|
|
||||||
|
|
||||||
view.setTag(viewHolder);
|
view.setTag(viewHolder);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
view = (LinearLayout) convertView;
|
|
||||||
viewHolder = (GroupHolder) convertView.getTag();
|
viewHolder = (GroupHolder) convertView.getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +296,8 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
|
|
||||||
if(unreadCount != null)
|
if(unreadCount != null)
|
||||||
viewHolder.txt_UnreadCount.setText(unreadCount);
|
viewHolder.txt_UnreadCount.setText(unreadCount);
|
||||||
//else
|
else
|
||||||
//SetUnreadCountForFeed(viewHolder.txt_UnreadCount, String.valueOf(group.id_database), true);
|
SetUnreadCountForFeed(viewHolder.txt_UnreadCount, String.valueOf(group.id_database), true);
|
||||||
|
|
||||||
skipGetUnread = true;
|
skipGetUnread = true;
|
||||||
}
|
}
|
||||||
|
@ -326,17 +325,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
{
|
{
|
||||||
String favIconURL = urlsToFavIcons.get((int) group.id_database);
|
String favIconURL = urlsToFavIcons.get((int) group.id_database);
|
||||||
|
|
||||||
viewHolder.imgView.setImageDrawable(null);
|
loadFavIconForFeed(favIconURL, viewHolder.imgView);
|
||||||
|
|
||||||
String feedID = String.valueOf(group.id_database);
|
|
||||||
|
|
||||||
if(favIconURL != null) {
|
|
||||||
if(favIconCache != null && favIconCache.get(feedID) != null) {
|
|
||||||
viewHolder.imgView.setImageDrawable(favIconCache.get(feedID));
|
|
||||||
} else {
|
|
||||||
GetFavIconForFeed(favIconURL, viewHolder.imgView, String.valueOf(group.id_database));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(String.valueOf(group.id_database).equals(ALL_STARRED_ITEMS)) {
|
if(String.valueOf(group.id_database).equals(ALL_STARRED_ITEMS)) {
|
||||||
|
@ -360,9 +349,26 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadFavIconForFeed(String favIconUrl, ImageView imgView) {
|
||||||
|
File cacheFile = ImageHandler.getFullPathOfCacheFileSafe(favIconUrl, favIconPath);
|
||||||
|
if(cacheFile != null && cacheFile.exists()) {
|
||||||
|
Picasso.with(mContext)
|
||||||
|
.load(cacheFile)
|
||||||
|
.placeholder(FavIconHandler.getResourceIdForRightDefaultFeedIcon(mContext))
|
||||||
|
.into(imgView, null);
|
||||||
|
} else {
|
||||||
|
Picasso.with(mContext)
|
||||||
|
.load(favIconUrl)
|
||||||
|
.placeholder(FavIconHandler.getResourceIdForRightDefaultFeedIcon(mContext))
|
||||||
|
.into(imgView, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Drawable ic_find_next_holo_dark;
|
Drawable ic_find_next_holo_dark;
|
||||||
Drawable ic_find_previous_holo_dark;
|
Drawable ic_find_previous_holo_dark;
|
||||||
Drawable btn_rating_star_off_normal_holo_light;
|
Drawable btn_rating_star_off_normal_holo_light;
|
||||||
|
@ -386,6 +392,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
private void SetUnreadCountForFeed(TextView textView, String idDatabase, boolean execludeStarredItems)
|
private void SetUnreadCountForFeed(TextView textView, String idDatabase, boolean execludeStarredItems)
|
||||||
{
|
{
|
||||||
|
@ -410,31 +417,23 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetFavIconForFeed(String favIconURL, ImageView imgView, String feedID)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(favIconURL != null)
|
|
||||||
{
|
|
||||||
if(favIconURL.trim().length() > 0)
|
|
||||||
new FavIconHandler().GetImageAsync(imgView, favIconURL, mContext, feedID, favIconCache);
|
|
||||||
else
|
|
||||||
imgView.setImageResource(FavIconHandler.getResourceIdForRightDefaultFeedIcon(mContext));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
imgView.setImageResource(FavIconHandler.getResourceIdForRightDefaultFeedIcon(mContext));
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static class GroupHolder
|
static class GroupHolder
|
||||||
{
|
{
|
||||||
TextView txt_Summary;
|
@InjectView(R.id.summary) TextView txt_Summary;
|
||||||
TextView txt_UnreadCount;
|
@InjectView(R.id.tV_feedsCount) TextView txt_UnreadCount;
|
||||||
ImageView imgView;
|
@InjectView(R.id.img_View_expandable_indicator) ImageView imgView;
|
||||||
|
|
||||||
|
public GroupHolder(View view, Context mContext) {
|
||||||
|
ButterKnife.inject(this, view);
|
||||||
|
|
||||||
|
txt_Summary.setClickable(true);
|
||||||
|
|
||||||
|
FontHelper fHelper = new FontHelper(mContext);
|
||||||
|
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,47 +3,30 @@ package de.luhmer.owncloudnewsreader;
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.LoaderManager.LoaderCallbacks;
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.CursorLoader;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Loader;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build.VERSION;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.ContactsContract;
|
|
||||||
import android.support.v4.app.NavUtils;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockActivity;
|
import com.actionbarsherlock.app.SherlockActivity;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.InjectView;
|
import butterknife.InjectView;
|
||||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||||
import de.luhmer.owncloudnewsreader.reader.GoogleReaderApi.HttpHelper;
|
|
||||||
import de.luhmer.owncloudnewsreader.reader.HttpJsonRequest;
|
import de.luhmer.owncloudnewsreader.reader.HttpJsonRequest;
|
||||||
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
||||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
|
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
|
||||||
|
|
|
@ -45,7 +45,6 @@ import com.devspark.robototextview.widget.RobotoCheckBox;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import de.luhmer.owncloudnewsreader.ListView.BlockingExpandableListView;
|
|
||||||
import de.luhmer.owncloudnewsreader.ListView.BlockingListView;
|
import de.luhmer.owncloudnewsreader.ListView.BlockingListView;
|
||||||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||||
import de.luhmer.owncloudnewsreader.cursor.IOnStayUnread;
|
import de.luhmer.owncloudnewsreader.cursor.IOnStayUnread;
|
||||||
|
@ -70,12 +69,12 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
protected static final String TAG = "NewsReaderDetailFragment";
|
protected static final String TAG = "NewsReaderDetailFragment";
|
||||||
|
|
||||||
//private DatabaseConnection dbConn;
|
//private DatabaseConnection dbConn;
|
||||||
|
|
||||||
//private boolean DialogShowedToMarkLastItemsAsRead = false;
|
//private boolean DialogShowedToMarkLastItemsAsRead = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private NewsListCursorAdapter lvAdapter;
|
private NewsListCursorAdapter lvAdapter;
|
||||||
|
|
||||||
public NewsListCursorAdapter getLvAdapter() {
|
public NewsListCursorAdapter getLvAdapter() {
|
||||||
return lvAdapter;
|
return lvAdapter;
|
||||||
}*/
|
}*/
|
||||||
|
@ -97,7 +96,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
}
|
}
|
||||||
|
|
||||||
String titel;
|
String titel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the titel
|
* @return the titel
|
||||||
*/
|
*/
|
||||||
|
@ -115,11 +114,11 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
|
|
||||||
//private static ArrayList<Integer> databaseIdsOfItems;
|
//private static ArrayList<Integer> databaseIdsOfItems;
|
||||||
ArrayList<RobotoCheckBox> stayUnreadCheckboxes;
|
ArrayList<RobotoCheckBox> stayUnreadCheckboxes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
* fragment (e.g. upon screen orientation changes).
|
* fragment (e.g. upon screen orientation changes).
|
||||||
*/
|
*/
|
||||||
public NewsReaderDetailFragment() {
|
public NewsReaderDetailFragment() {
|
||||||
//databaseIdsOfItems = new ArrayList<Integer>();
|
//databaseIdsOfItems = new ArrayList<Integer>();
|
||||||
stayUnreadCheckboxes = new ArrayList<RobotoCheckBox>();
|
stayUnreadCheckboxes = new ArrayList<RobotoCheckBox>();
|
||||||
|
@ -128,23 +127,23 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
public void setUpdateListViewOnStartUp(boolean reloadCursorOnStartUp) {
|
public void setUpdateListViewOnStartUp(boolean reloadCursorOnStartUp) {
|
||||||
this.reloadCursorOnStartUp = reloadCursorOnStartUp;
|
this.reloadCursorOnStartUp = reloadCursorOnStartUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActivatedPosition(int position) {
|
public void setActivatedPosition(int position) {
|
||||||
mActivatedPosition = position;
|
mActivatedPosition = position;
|
||||||
}
|
}
|
||||||
public void setMarginFromTop(int margin) {
|
public void setMarginFromTop(int margin) {
|
||||||
marginFromTop = margin;
|
marginFromTop = margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
//setRetainInstance(true);
|
//setRetainInstance(true);
|
||||||
|
|
||||||
//dbConn = new DatabaseConnection(getActivity());
|
//dbConn = new DatabaseConnection(getActivity());
|
||||||
|
|
||||||
if(getArguments() != null) {
|
if(getArguments() != null) {
|
||||||
if (getArguments().containsKey(NewsReaderListActivity.SUBSCRIPTION_ID)) {
|
if (getArguments().containsKey(NewsReaderListActivity.SUBSCRIPTION_ID)) {
|
||||||
idFeed = getArguments().getString(NewsReaderListActivity.SUBSCRIPTION_ID);
|
idFeed = getArguments().getString(NewsReaderListActivity.SUBSCRIPTION_ID);
|
||||||
|
@ -155,13 +154,13 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
if (getArguments().containsKey(NewsReaderListActivity.FOLDER_ID)) {
|
if (getArguments().containsKey(NewsReaderListActivity.FOLDER_ID)) {
|
||||||
idFolder = getArguments().getString(NewsReaderListActivity.FOLDER_ID);
|
idFolder = getArguments().getString(NewsReaderListActivity.FOLDER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
((SherlockFragmentActivity) getActivity()).getSupportActionBar().setTitle(titel);
|
((SherlockFragmentActivity) getActivity()).getSupportActionBar().setTitle(titel);
|
||||||
|
|
||||||
UpdateMenuItemsState();//Is called on Tablets and Smartphones but on Smartphones the menuItemDownloadMoreItems is null. So it will be ignored
|
UpdateMenuItemsState();//Is called on Tablets and Smartphones but on Smartphones the menuItemDownloadMoreItems is null. So it will be ignored
|
||||||
|
|
||||||
//getListView().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
//getListView().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
|
|
||||||
//lvAdapter = null;
|
//lvAdapter = null;
|
||||||
|
|
||||||
getActivity().getSupportLoaderManager().destroyLoader(0);
|
getActivity().getSupportLoaderManager().destroyLoader(0);
|
||||||
|
@ -172,10 +171,10 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
UpdateCursor();
|
UpdateCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateMenuItemsState()
|
public void UpdateMenuItemsState()
|
||||||
{
|
{
|
||||||
if(MenuUtilsSherlockFragmentActivity.getMenuItemDownloadMoreItems() != null)
|
if(MenuUtilsSherlockFragmentActivity.getMenuItemDownloadMoreItems() != null)
|
||||||
{
|
{
|
||||||
if(idFolder != null) {
|
if(idFolder != null) {
|
||||||
|
@ -187,45 +186,45 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
MenuUtilsSherlockFragmentActivity.getMenuItemDownloadMoreItems().setEnabled(false);
|
MenuUtilsSherlockFragmentActivity.getMenuItemDownloadMoreItems().setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see android.support.v4.app.ListFragment#onViewCreated(android.view.View, android.os.Bundle)
|
* @see android.support.v4.app.ListFragment#onViewCreated(android.view.View, android.os.Bundle)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
|
||||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
if(mPrefs.getBoolean(SettingsActivity.CB_MARK_AS_READ_WHILE_SCROLLING_STRING, false))
|
if(mPrefs.getBoolean(SettingsActivity.CB_MARK_AS_READ_WHILE_SCROLLING_STRING, false))
|
||||||
{
|
{
|
||||||
getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
|
getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||||
|
|
||||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RobotoCheckBox lastViewedArticleCheckbox = null;
|
RobotoCheckBox lastViewedArticleCheckbox = null;
|
||||||
public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, int totalItemCount) {
|
public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, int totalItemCount) {
|
||||||
|
|
||||||
if(lastViewedArticleCheckbox == null)
|
if(lastViewedArticleCheckbox == null)
|
||||||
lastViewedArticleCheckbox = getCheckBoxAtPosition(0, view);
|
lastViewedArticleCheckbox = getCheckBoxAtPosition(0, view);
|
||||||
|
|
||||||
RobotoCheckBox cb = getCheckBoxAtPosition(0, view);
|
RobotoCheckBox cb = getCheckBoxAtPosition(0, view);
|
||||||
if(lastViewedArticleCheckbox != cb) {
|
if(lastViewedArticleCheckbox != cb) {
|
||||||
if(! (lastViewedArticleCheckbox.isChecked() && stayUnreadCheckboxes.contains(lastViewedArticleCheckbox)));
|
if(! (lastViewedArticleCheckbox.isChecked() && stayUnreadCheckboxes.contains(lastViewedArticleCheckbox)));
|
||||||
NewsListCursorAdapter.ChangeCheckBoxState(lastViewedArticleCheckbox, true, getActivity());
|
NewsListCursorAdapter.ChangeCheckBoxState(lastViewedArticleCheckbox, true, getActivity());
|
||||||
|
|
||||||
lastViewedArticleCheckbox = cb;
|
lastViewedArticleCheckbox = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private RobotoCheckBox getCheckBoxAtPosition(int pos, AbsListView viewLV)
|
private RobotoCheckBox getCheckBoxAtPosition(int pos, AbsListView viewLV)
|
||||||
{
|
{
|
||||||
ListView lv = (ListView) viewLV;
|
ListView lv = (ListView) viewLV;
|
||||||
|
@ -250,7 +249,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
public void UpdateCursor()
|
public void UpdateCursor()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LoaderManager loader = getActivity().getSupportLoaderManager();
|
LoaderManager loader = getActivity().getSupportLoaderManager();
|
||||||
loader.initLoader(0, null, loaderCallbacks);
|
loader.initLoader(0, null, loaderCallbacks);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +269,6 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||||
NewsListCursorAdapter nca = (NewsListCursorAdapter) getListAdapter();
|
NewsListCursorAdapter nca = (NewsListCursorAdapter) getListAdapter();
|
||||||
|
|
||||||
|
|
||||||
// Block children layout for now
|
// Block children layout for now
|
||||||
BlockingListView bView = ((BlockingListView) getListView());
|
BlockingListView bView = ((BlockingListView) getListView());
|
||||||
|
|
||||||
|
@ -360,7 +358,7 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
DatabaseConnection dbConn = new DatabaseConnection(context);
|
DatabaseConnection dbConn = new DatabaseConnection(context);
|
||||||
return dbConn.getCurrentSelectedRssItems(getSortDirection(context));
|
return dbConn.getCurrentSelectedRssItems(getSortDirection(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -369,23 +367,23 @@ public class NewsReaderDetailFragment extends SherlockListFragment implements IO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class NewsDetailCursorLoader extends SimpleCursorLoader {
|
public static class NewsDetailCursorLoader extends SimpleCursorLoader {
|
||||||
String idFolder;
|
String idFolder;
|
||||||
String idFeed;
|
String idFeed;
|
||||||
|
|
||||||
public NewsDetailCursorLoader(Context context, String idFolder, String idFeed) {
|
public NewsDetailCursorLoader(Context context, String idFolder, String idFeed) {
|
||||||
super(context);
|
super(context);
|
||||||
this.idFolder = idFolder;
|
this.idFolder = idFolder;
|
||||||
this.idFeed = idFeed;
|
this.idFeed = idFeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cursor loadInBackground() {
|
public Cursor loadInBackground() {
|
||||||
return getRightCusor(getContext() /*, idFolder, idFeed */);
|
return getRightCusor(getContext() /*, idFolder, idFeed */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,6 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
@ -508,6 +505,7 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
|
||||||
long highestItemId = dbConn.getLowestItemIdUnread();
|
long highestItemId = dbConn.getLowestItemIdUnread();
|
||||||
Intent service = new Intent(this, DownloadImagesService.class);
|
Intent service = new Intent(this, DownloadImagesService.class);
|
||||||
service.putExtra(DownloadImagesService.LAST_ITEM_ID, highestItemId);
|
service.putExtra(DownloadImagesService.LAST_ITEM_ID, highestItemId);
|
||||||
|
//service.putExtra(DownloadImagesService.DOWNLOAD_FAVICONS_EXCLUSIVE, true);
|
||||||
startService(service);
|
startService(service);
|
||||||
} finally {
|
} finally {
|
||||||
dbConn.closeDatabase();
|
dbConn.closeDatabase();
|
||||||
|
|
|
@ -14,7 +14,6 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.widget.CursorAdapter;
|
import android.support.v4.widget.CursorAdapter;
|
||||||
|
@ -37,6 +38,9 @@ import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
|
import android.view.animation.AlphaAnimation;
|
||||||
|
import android.view.animation.Animation;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
@ -47,6 +51,10 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import com.devspark.robototextview.widget.RobotoCheckBox;
|
import com.devspark.robototextview.widget.RobotoCheckBox;
|
||||||
import com.devspark.robototextview.widget.RobotoTextView;
|
import com.devspark.robototextview.widget.RobotoTextView;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.InjectView;
|
||||||
import de.luhmer.owncloudnewsreader.NewsDetailFragment;
|
import de.luhmer.owncloudnewsreader.NewsDetailFragment;
|
||||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||||
import de.luhmer.owncloudnewsreader.R;
|
import de.luhmer.owncloudnewsreader.R;
|
||||||
|
@ -66,26 +74,26 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
final int LengthBody = 300;
|
final int LengthBody = 300;
|
||||||
ForegroundColorSpan bodyForegroundColor;
|
ForegroundColorSpan bodyForegroundColor;
|
||||||
IOnStayUnread onStayUnread;
|
IOnStayUnread onStayUnread;
|
||||||
|
|
||||||
PostDelayHandler pDelayHandler;
|
PostDelayHandler pDelayHandler;
|
||||||
|
|
||||||
int selectedDesign = 0;
|
int selectedDesign = 0;
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public NewsListCursorAdapter(Context context, Cursor c, IOnStayUnread onStayUnread) {
|
public NewsListCursorAdapter(Context context, Cursor c, IOnStayUnread onStayUnread) {
|
||||||
super(context, c);
|
super(context, c);
|
||||||
|
|
||||||
this.onStayUnread = onStayUnread;
|
this.onStayUnread = onStayUnread;
|
||||||
|
|
||||||
pDelayHandler = new PostDelayHandler(context);
|
pDelayHandler = new PostDelayHandler(context);
|
||||||
|
|
||||||
//simpleDateFormat = new SimpleDateFormat("EEE, d. MMM HH:mm:ss");
|
//simpleDateFormat = new SimpleDateFormat("EEE, d. MMM HH:mm:ss");
|
||||||
bodyForegroundColor = new ForegroundColorSpan(context.getResources().getColor(android.R.color.secondary_text_dark));
|
bodyForegroundColor = new ForegroundColorSpan(context.getResources().getColor(android.R.color.secondary_text_dark));
|
||||||
|
|
||||||
_Reader = new OwnCloud_Reader();
|
_Reader = new OwnCloud_Reader();
|
||||||
dbConn = new DatabaseConnection(context);
|
dbConn = new DatabaseConnection(context);
|
||||||
|
|
||||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
selectedDesign = Integer.valueOf(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0"));
|
selectedDesign = Integer.valueOf(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0"));
|
||||||
}
|
}
|
||||||
|
@ -93,27 +101,27 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void bindView(final View view, final Context context, Cursor cursor) {
|
public void bindView(final View view, final Context context, Cursor cursor) {
|
||||||
final String idItemDb = cursor.getString(0);
|
final String idItemDb = cursor.getString(0);
|
||||||
|
|
||||||
switch (selectedDesign) {
|
switch (selectedDesign) {
|
||||||
case 0:
|
case 0:
|
||||||
setSimpleLayout(view, cursor);
|
setSimpleLayout(view, cursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
setExtendedLayout(view, cursor);
|
setExtendedLayout(view, cursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
setExtendedLayoutWebView(view, cursor);
|
setExtendedLayoutWebView(view, cursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FontHelper fHelper = new FontHelper(context);
|
FontHelper fHelper = new FontHelper(context);
|
||||||
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
fHelper.setFontForAllChildren(view, fHelper.getFont());
|
||||||
|
|
||||||
RobotoCheckBox cbStarred = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_starred);
|
RobotoCheckBox cbStarred = (RobotoCheckBox) view.findViewById(R.id.cb_lv_item_starred);
|
||||||
if(ThemeChooser.isDarkTheme(mContext))
|
if(ThemeChooser.isDarkTheme(mContext))
|
||||||
cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_dark);
|
cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_dark);
|
||||||
|
@ -129,14 +137,14 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
cbStarred.setChecked(isStarred);
|
cbStarred.setChecked(isStarred);
|
||||||
cbStarred.setClickable(true);
|
cbStarred.setClickable(true);
|
||||||
cbStarred.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
cbStarred.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
dbConn.updateIsStarredOfItem(idItemDb, isChecked);
|
dbConn.updateIsStarredOfItem(idItemDb, isChecked);
|
||||||
|
|
||||||
if(isChecked)
|
if(isChecked)
|
||||||
UpdateIsReadCheckBox(buttonView, idItemDb);
|
UpdateIsReadCheckBox(buttonView, idItemDb);
|
||||||
|
|
||||||
pDelayHandler.DelayTimer();
|
pDelayHandler.DelayTimer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -163,17 +171,17 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
|
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cbRead.setClickable(true);
|
cbRead.setClickable(true);
|
||||||
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
ChangeReadStateOfItem((RobotoCheckBox) buttonView, view, isChecked, context);
|
ChangeReadStateOfItem((RobotoCheckBox) buttonView, view, isChecked, context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
String colorString = dbConn.getAvgColourOfFeedByDbId(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID)));
|
String colorString = dbConn.getAvgColourOfFeedByDbId(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID)));
|
||||||
View viewColor = view.findViewById(R.id.color_line_feed);
|
View viewColor = view.findViewById(R.id.color_line_feed);
|
||||||
if(colorString != null)
|
if(colorString != null)
|
||||||
|
@ -207,58 +215,80 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
|
|
||||||
public void setSimpleLayout(View view, Cursor cursor)
|
public void setSimpleLayout(View view, Cursor cursor)
|
||||||
{
|
{
|
||||||
TextView textViewSummary = (TextView) view.findViewById(R.id.summary);
|
SimpleLayout simpleLayout = new SimpleLayout(view);
|
||||||
textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
|
|
||||||
|
simpleLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
|
||||||
|
|
||||||
TextView textViewItemDate = (TextView) view.findViewById(R.id.tv_item_date);
|
|
||||||
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
|
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
|
||||||
//textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
|
|
||||||
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
|
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
|
||||||
textViewItemDate.setText(dateString);
|
simpleLayout.textViewItemDate.setText(dateString);
|
||||||
|
|
||||||
TextView textViewTitle = (TextView) view.findViewById(R.id.tv_subscription);
|
simpleLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
|
||||||
textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
|
simpleLayout.textViewSummary.setTag(cursor.getString(0));
|
||||||
textViewSummary.setTag(cursor.getString(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class SimpleLayout {
|
||||||
|
@InjectView(R.id.summary) TextView textViewSummary;
|
||||||
|
@InjectView(R.id.tv_item_date) TextView textViewItemDate;
|
||||||
|
@InjectView(R.id.tv_subscription) TextView textViewTitle;
|
||||||
|
|
||||||
|
SimpleLayout(View view) {
|
||||||
|
ButterKnife.inject(this, view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setExtendedLayout(View view, Cursor cursor)
|
public void setExtendedLayout(View view, Cursor cursor)
|
||||||
{
|
{
|
||||||
TextView textViewSummary = (TextView) view.findViewById(R.id.summary);
|
ExtendedLayout extendedLayout = new ExtendedLayout(view);
|
||||||
textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
|
|
||||||
|
extendedLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
|
||||||
|
|
||||||
TextView textViewItemDate = (TextView) view.findViewById(R.id.tv_item_date);
|
|
||||||
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
|
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
|
||||||
//textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
|
//textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
|
||||||
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
|
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
|
||||||
textViewItemDate.setText(dateString);
|
extendedLayout.textViewItemDate.setText(dateString);
|
||||||
|
|
||||||
TextView textViewItemBody = (TextView) view.findViewById(R.id.body);
|
extendedLayout.textViewItemBody.setVisibility(View.INVISIBLE);
|
||||||
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
|
String idItemDb = cursor.getString(0);
|
||||||
textViewItemBody.setText(getBodyText(body));
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
// Execute in parallel
|
||||||
|
new DescriptionTextLoaderTask(extendedLayout.textViewItemBody, idItemDb).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ((Void) null));
|
||||||
|
else
|
||||||
|
new DescriptionTextLoaderTask(extendedLayout.textViewItemBody, idItemDb).execute((Void) null);
|
||||||
|
|
||||||
TextView textViewTitle = (TextView) view.findViewById(R.id.tv_subscription);
|
extendedLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
|
||||||
textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
|
extendedLayout.textViewSummary.setTag(cursor.getString(0));
|
||||||
textViewSummary.setTag(cursor.getString(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class ExtendedLayout {
|
||||||
|
@InjectView(R.id.summary) TextView textViewSummary;
|
||||||
|
@InjectView(R.id.tv_item_date) TextView textViewItemDate;
|
||||||
|
@InjectView(R.id.body) TextView textViewItemBody;
|
||||||
|
@InjectView(R.id.tv_subscription) TextView textViewTitle;
|
||||||
|
|
||||||
|
ExtendedLayout(View view) {
|
||||||
|
ButterKnife.inject(this, view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public void setExtendedLayoutWebView(View view, Cursor cursor)
|
public void setExtendedLayoutWebView(View view, Cursor cursor)
|
||||||
{
|
{
|
||||||
WebView webViewContent = (WebView) view.findViewById(R.id.webView_body);
|
WebView webViewContent = (WebView) view.findViewById(R.id.webView_body);
|
||||||
webViewContent.setClickable(false);
|
webViewContent.setClickable(false);
|
||||||
webViewContent.setFocusable(false);
|
webViewContent.setFocusable(false);
|
||||||
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
// webViewContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
// webViewContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
|
|
||||||
webViewContent.loadDataWithBaseURL("", NewsDetailFragment.getHtmlPage(mContext, dbConn , cursor.getInt(0)), "text/html", "UTF-8", "");
|
webViewContent.loadDataWithBaseURL("", NewsDetailFragment.getHtmlPage(mContext, dbConn , cursor.getInt(0)), "text/html", "UTF-8", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseDatabaseConnection()
|
public void CloseDatabaseConnection()
|
||||||
{
|
{
|
||||||
if(dbConn != null)
|
if(dbConn != null)
|
||||||
dbConn.closeDatabase();
|
dbConn.closeDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateIsReadCheckBox(View view, String idItemDb)
|
private void UpdateIsReadCheckBox(View view, String idItemDb)
|
||||||
{
|
{
|
||||||
LinearLayout lLayout = (LinearLayout) view.getParent();
|
LinearLayout lLayout = (LinearLayout) view.getParent();
|
||||||
|
@ -270,13 +300,13 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
}
|
}
|
||||||
cbRead.setChecked(isChecked);
|
cbRead.setChecked(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChangeCheckBoxState(RobotoCheckBox cb, boolean state, Context context)
|
public static void ChangeCheckBoxState(RobotoCheckBox cb, boolean state, Context context)
|
||||||
{
|
{
|
||||||
if(cb != null && cb.isChecked() != state)
|
if(cb != null && cb.isChecked() != state)
|
||||||
cb.setChecked(state);
|
cb.setChecked(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateListCursor(Context context)
|
public static void UpdateListCursor(Context context)
|
||||||
{
|
{
|
||||||
SherlockFragmentActivity sfa = (SherlockFragmentActivity) context;
|
SherlockFragmentActivity sfa = (SherlockFragmentActivity) context;
|
||||||
|
@ -284,7 +314,7 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
if(sfa instanceof NewsReaderListActivity && ((NewsReaderListActivity) sfa).isSlidingPaneOpen())
|
if(sfa instanceof NewsReaderListActivity && ((NewsReaderListActivity) sfa).isSlidingPaneOpen())
|
||||||
((NewsReaderListActivity) sfa).updateAdapter();
|
((NewsReaderListActivity) sfa).updateAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getBodyText(String body)
|
private String getBodyText(String body)
|
||||||
{
|
{
|
||||||
|
@ -292,13 +322,13 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
// body = body.substring(0, LengthBody);
|
// body = body.substring(0, LengthBody);
|
||||||
|
|
||||||
body = body.replaceAll("<img[^>]*>", "");
|
body = body.replaceAll("<img[^>]*>", "");
|
||||||
body = body.replaceAll("<video[^>]*>", "");
|
body = body.replaceAll("<video[^>]*>", "");
|
||||||
|
|
||||||
SpannableString bodyStringSpannable = new SpannableString(Html.fromHtml(body));
|
SpannableString bodyStringSpannable = new SpannableString(Html.fromHtml(body));
|
||||||
bodyStringSpannable.setSpan(bodyForegroundColor, 0, bodyStringSpannable.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
bodyStringSpannable.setSpan(bodyForegroundColor, 0, bodyStringSpannable.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||||
|
|
||||||
String bodyString = bodyStringSpannable.toString().trim();
|
String bodyString = bodyStringSpannable.toString().trim();
|
||||||
|
|
||||||
if(bodyString.length() > LengthBody)
|
if(bodyString.length() > LengthBody)
|
||||||
bodyString = bodyString.substring(0, LengthBody);
|
bodyString = bodyString.substring(0, LengthBody);
|
||||||
|
|
||||||
|
@ -309,9 +339,9 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
public View newView(Context cont, Cursor cursor, ViewGroup parent) {
|
public View newView(Context cont, Cursor cursor, ViewGroup parent) {
|
||||||
// when the view will be created for first time,
|
// when the view will be created for first time,
|
||||||
// we need to tell the adapters, how each item will look
|
// we need to tell the adapters, how each item will look
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||||
View retView = null;
|
View retView = null;
|
||||||
|
|
||||||
switch (selectedDesign) {
|
switch (selectedDesign) {
|
||||||
case 0:
|
case 0:
|
||||||
retView = inflater.inflate(R.layout.subscription_detail_list_item_simple, parent, false);
|
retView = inflater.inflate(R.layout.subscription_detail_list_item_simple, parent, false);
|
||||||
|
@ -321,13 +351,85 @@ public class NewsListCursorAdapter extends CursorAdapter {
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
retView = inflater.inflate(R.layout.subscription_detail_list_item_extended_webview, parent, false);
|
retView = inflater.inflate(R.layout.subscription_detail_list_item_extended_webview, parent, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(retView != null)
|
if(retView != null)
|
||||||
retView.setTag(cursor.getString(0));
|
retView.setTag(cursor.getString(0));
|
||||||
|
|
||||||
return retView;
|
return retView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DescriptionTextLoaderTask extends AsyncTask<Void, Void, String> {
|
||||||
|
private String idItemDb;
|
||||||
|
private final WeakReference<TextView> textViewWeakReference;
|
||||||
|
|
||||||
|
public DescriptionTextLoaderTask(TextView textView, String idItemDb) {
|
||||||
|
textViewWeakReference = new WeakReference<TextView>(textView);
|
||||||
|
this.idItemDb = idItemDb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
// Actual download method, run in the task thread
|
||||||
|
protected String doInBackground(Void... params) {
|
||||||
|
|
||||||
|
DatabaseConnection dbConn = new DatabaseConnection(mContext);
|
||||||
|
|
||||||
|
Cursor cursor = dbConn.getItemByDbID(idItemDb);
|
||||||
|
cursor.moveToFirst();
|
||||||
|
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
|
||||||
|
String result = getBodyText(body);
|
||||||
|
cursor.close();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
// Once the image is downloaded, associates it to the imageView
|
||||||
|
protected void onPostExecute(String text) {
|
||||||
|
if (isCancelled()) {
|
||||||
|
text = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textViewWeakReference != null) {
|
||||||
|
TextView textView = textViewWeakReference.get();
|
||||||
|
if (textView != null) {
|
||||||
|
textView.setText(text);
|
||||||
|
|
||||||
|
fadeInTextView(textView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void fadeInTextView(final TextView textView)
|
||||||
|
{
|
||||||
|
Animation fadeOut = new AlphaAnimation(0, 1);
|
||||||
|
fadeOut.setInterpolator(new AccelerateInterpolator());
|
||||||
|
fadeOut.setDuration(300);
|
||||||
|
|
||||||
|
fadeOut.setAnimationListener(new Animation.AnimationListener()
|
||||||
|
{
|
||||||
|
public void onAnimationEnd(Animation animation)
|
||||||
|
{
|
||||||
|
textView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
public void onAnimationRepeat(Animation animation) {}
|
||||||
|
public void onAnimationStart(Animation animation) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
textView.startAnimation(fadeOut);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class DatabaseConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SparseArray<String> getUnreadItemCountForFeed() {
|
public SparseArray<String> getUnreadItemCountForFeed() {
|
||||||
String buildSQL = "SELECT " + RSS_ITEM_SUBSCRIPTION_ID + ", COUNT(" + RSS_ITEM_RSSITEM_ID + ")" +
|
String buildSQL = "SELECT " + RSS_ITEM_SUBSCRIPTION_ID + ", COUNT(" + RSS_ITEM_RSSITEM_ID + ")" + // rowid as _id,
|
||||||
" FROM " + RSS_ITEM_TABLE +
|
" FROM " + RSS_ITEM_TABLE +
|
||||||
" GROUP BY " + RSS_ITEM_SUBSCRIPTION_ID;
|
" GROUP BY " + RSS_ITEM_SUBSCRIPTION_ID;
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ public class DatabaseConnection {
|
||||||
|
|
||||||
public long getLowestItemIdStarred()
|
public long getLowestItemIdStarred()
|
||||||
{
|
{
|
||||||
String buildSQL = "SELECT MIN(" + RSS_ITEM_RSSITEM_ID + ") FROM " + RSS_ITEM_TABLE + " WHERE " + RSS_ITEM_STARRED_TEMP + " == 1";
|
String buildSQL = "SELECT MIN(" + RSS_ITEM_RSSITEM_ID + ") FROM " + RSS_ITEM_TABLE + " WHERE " + RSS_ITEM_STARRED_TEMP + " = 1";
|
||||||
return getLongValueBySQL(buildSQL);
|
return getLongValueBySQL(buildSQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +351,24 @@ public class DatabaseConnection {
|
||||||
return database.delete(RSS_ITEM_TABLE, "rowid < ?", new String[] { id_db });
|
return database.delete(RSS_ITEM_TABLE, "rowid < ?", new String[] { id_db });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeXLatestItems(int limit, String execludeFeed) {
|
||||||
|
String sql = "DELETE FROM " + RSS_ITEM_TABLE + " WHERE rowid IN (SELECT rowid FROM " + RSS_ITEM_TABLE + " WHERE " + RSS_ITEM_READ + " != 0 " +
|
||||||
|
" AND " + RSS_ITEM_READ_TEMP + " != 0 XX ORDER BY " + RSS_ITEM_PUBDATE + " desc LIMIT " + limit + ")";
|
||||||
|
|
||||||
|
if(execludeFeed != null)
|
||||||
|
sql = sql.replace("XX", "AND " + RSS_ITEM_SUBSCRIPTION_ID +" != " + execludeFeed);
|
||||||
|
else
|
||||||
|
sql = sql.replace("XX", "");
|
||||||
|
|
||||||
|
database.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeReadItems(int limit) {
|
||||||
|
String sql = "DELETE FROM " + RSS_ITEM_TABLE + " WHERE rowid IN (SELECT rowid FROM " + RSS_ITEM_TABLE + " WHERE " + RSS_ITEM_READ_TEMP + " = 1 " +
|
||||||
|
" AND " + RSS_ITEM_READ + " = 1 ORDER BY " + RSS_ITEM_PUBDATE + " desc LIMIT " + limit + ")";
|
||||||
|
database.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public Cursor getAllData(String TABLE_NAME) {
|
public Cursor getAllData(String TABLE_NAME) {
|
||||||
String buildSQL = "SELECT rowid as _id, * FROM " + TABLE_NAME;
|
String buildSQL = "SELECT rowid as _id, * FROM " + TABLE_NAME;
|
||||||
|
@ -429,6 +447,14 @@ public class DatabaseConnection {
|
||||||
return database.rawQuery(buildSQL, null);
|
return database.rawQuery(buildSQL, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Cursor getItemByDbID(String ID_ITEM_DB) {//Feeds
|
||||||
|
String buildSQL = "SELECT rowid as _id, * FROM " + RSS_ITEM_TABLE + " WHERE rowid = '" + ID_ITEM_DB + "'";
|
||||||
|
|
||||||
|
if(DATABASE_DEBUG_MODE)
|
||||||
|
Log.d("DB_HELPER", "getSubSubscriptionsByID SQL: " + buildSQL);
|
||||||
|
return database.rawQuery(buildSQL, null);
|
||||||
|
}
|
||||||
|
|
||||||
public Cursor getFeedByDbID(String ID_FEED_DB) {//Feeds
|
public Cursor getFeedByDbID(String ID_FEED_DB) {//Feeds
|
||||||
String buildSQL = "SELECT rowid as _id, * FROM " + SUBSCRIPTION_TABLE + " WHERE rowid = '" + ID_FEED_DB + "'";
|
String buildSQL = "SELECT rowid as _id, * FROM " + SUBSCRIPTION_TABLE + " WHERE rowid = '" + ID_FEED_DB + "'";
|
||||||
|
|
||||||
|
|
|
@ -43,20 +43,20 @@ public class FavIconHandler {
|
||||||
public static Drawable GetFavIconFromCache(String URL_TO_PAGE, Context context, String feedID)
|
public static Drawable GetFavIconFromCache(String URL_TO_PAGE, Context context, String feedID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File favIconFile = ImageHandler.getFullPathOfCacheFile(URL_TO_PAGE, ImageHandler.getPathFavIcons(context));
|
File favIconFile = ImageHandler.getFullPathOfCacheFile(URL_TO_PAGE, ImageHandler.getPathFavIcons(context));
|
||||||
if(favIconFile.isFile() && favIconFile.length() > 0)
|
if(favIconFile.isFile() && favIconFile.length() > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
InputStream fs = new FileInputStream(favIconFile);
|
InputStream fs = new FileInputStream(favIconFile);
|
||||||
BufferedInputStream is = new BufferedInputStream(fs, 32*1024);
|
BufferedInputStream is = new BufferedInputStream(fs, 32*1024);
|
||||||
Bitmap bitmap = GetScaledImage(is, 50, 50);
|
Bitmap bitmap = GetScaledImage(is, 50, 50);
|
||||||
if(bitmap != null)
|
if(bitmap != null)
|
||||||
return new BitmapDrawable(context.getResources(), bitmap);
|
return new BitmapDrawable(context.getResources(), bitmap);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(feedID != null) {
|
if(feedID != null) {
|
||||||
DatabaseConnection dbConn = new DatabaseConnection(context);
|
DatabaseConnection dbConn = new DatabaseConnection(context);
|
||||||
try {
|
try {
|
||||||
|
@ -69,7 +69,7 @@ public class FavIconHandler {
|
||||||
dbConn.closeDatabase();
|
dbConn.closeDatabase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Drawable.createFromPath(favIconFile.getPath());
|
return Drawable.createFromPath(favIconFile.getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,16 +79,16 @@ public class FavIconHandler {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getResourceIdForRightDefaultFeedIcon(Context context)
|
public static int getResourceIdForRightDefaultFeedIcon(Context context)
|
||||||
{
|
{
|
||||||
if(ThemeChooser.isDarkTheme(context))
|
if(ThemeChooser.isDarkTheme(context))
|
||||||
return R.drawable.default_feed_icon_light;
|
return R.drawable.default_feed_icon_light;
|
||||||
else
|
else
|
||||||
return R.drawable.default_feed_icon_dark;
|
return R.drawable.default_feed_icon_dark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private static Bitmap GetScaledImage(BufferedInputStream is, int minimumDesiredBitmapWidth, int minimumDesiredBitmapHeight)
|
private static Bitmap GetScaledImage(BufferedInputStream is, int minimumDesiredBitmapWidth, int minimumDesiredBitmapHeight)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ public class FavIconHandler {
|
||||||
// inSampleSize prefers multiples of 2, but we prefer to prioritize memory savings
|
// inSampleSize prefers multiples of 2, but we prefer to prioritize memory savings
|
||||||
decodeBitmapOptions.inSampleSize= Math.max(1,Math.min(originalWidth / minimumDesiredBitmapWidth, originalHeight / minimumDesiredBitmapHeight));
|
decodeBitmapOptions.inSampleSize= Math.max(1,Math.min(originalWidth / minimumDesiredBitmapWidth, originalHeight / minimumDesiredBitmapHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
return BitmapFactory.decodeStream(is,null,decodeBitmapOptions);
|
return BitmapFactory.decodeStream(is,null,decodeBitmapOptions);
|
||||||
|
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
|
@ -121,16 +121,50 @@ public class FavIconHandler {
|
||||||
} catch( IOException ignored ) {}
|
} catch( IOException ignored ) {}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
static SparseArray<FavIconCache> imageViewReferences = new SparseArray<FavIconCache>();
|
static SparseArray<FavIconCache> imageViewReferences = new SparseArray<FavIconCache>();
|
||||||
String feedID;
|
String feedID;
|
||||||
|
|
||||||
|
|
||||||
|
static SparseArray<FavIconCache> favIconToFeedId = new SparseArray<FavIconCache>();
|
||||||
|
public static void PreCacheFavIcon(String WEB_URL_TO_FILE, Context context, String feedID) {
|
||||||
|
|
||||||
|
FavIconCache favIconCache = new FavIconCache();
|
||||||
|
favIconCache.context = context;
|
||||||
|
favIconCache.WEB_URL_TO_FILE = WEB_URL_TO_FILE;
|
||||||
|
|
||||||
|
int key = Integer.parseInt(feedID);
|
||||||
|
favIconToFeedId.put(key, favIconCache);
|
||||||
|
GetImageAsyncTask giAsync = new GetImageAsyncTask(WEB_URL_TO_FILE, favIconDownloadFinished, key, ImageHandler.getPathFavIcons(context), context, null);
|
||||||
|
giAsync.scaleImage = true;
|
||||||
|
giAsync.dstHeight = 2*32;
|
||||||
|
giAsync.dstWidth = 2*32;
|
||||||
|
giAsync.feedID = feedID;
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
// Execute in parallel
|
||||||
|
giAsync.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ((Void)null));
|
||||||
|
else
|
||||||
|
giAsync.execute((Void)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ImageDownloadFinished favIconDownloadFinished = new ImageDownloadFinished() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
||||||
|
FavIconCache favIconCache = favIconToFeedId.get(AsynkTaskId);
|
||||||
|
FavIconHandler.GetFavIconFromCache(favIconCache.WEB_URL_TO_FILE, favIconCache.context, String.valueOf(AsynkTaskId));
|
||||||
|
imageViewReferences.remove(AsynkTaskId);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public void GetImageAsync(ImageView imageView, String WEB_URL_TO_FILE, Context context, String feedID, BitmapDrawableLruCache lruCache)
|
public void GetImageAsync(ImageView imageView, String WEB_URL_TO_FILE, Context context, String feedID, BitmapDrawableLruCache lruCache)
|
||||||
{
|
{
|
||||||
this.feedID = feedID;
|
this.feedID = feedID;
|
||||||
|
|
||||||
boolean setImageAlready = false;
|
boolean setImageAlready = false;
|
||||||
if(lruCache != null) {
|
if(lruCache != null) {
|
||||||
if(lruCache.get(feedID) != null) {
|
if(lruCache.get(feedID) != null) {
|
||||||
|
@ -146,13 +180,13 @@ public class FavIconHandler {
|
||||||
favIconCache.context = context;
|
favIconCache.context = context;
|
||||||
favIconCache.WEB_URL_TO_FILE = WEB_URL_TO_FILE;
|
favIconCache.WEB_URL_TO_FILE = WEB_URL_TO_FILE;
|
||||||
favIconCache.imageViewReference = imageViewReference;
|
favIconCache.imageViewReference = imageViewReference;
|
||||||
|
|
||||||
int key = 0;
|
int key = 0;
|
||||||
if(imageViewReferences.size() > 0)
|
if(imageViewReferences.size() > 0)
|
||||||
key = imageViewReferences.keyAt(imageViewReferences.size() -1) + 1;
|
key = imageViewReferences.keyAt(imageViewReferences.size() -1) + 1;
|
||||||
imageViewReferences.append(key, favIconCache);
|
imageViewReferences.append(key, favIconCache);
|
||||||
|
|
||||||
|
|
||||||
imageView.setImageDrawable(null);
|
imageView.setImageDrawable(null);
|
||||||
GetImageAsyncTask giAsync = new GetImageAsyncTask(WEB_URL_TO_FILE, imgDownloadFinished, key, ImageHandler.getPathFavIcons(context), context/*, imageView*/, lruCache);
|
GetImageAsyncTask giAsync = new GetImageAsyncTask(WEB_URL_TO_FILE, imgDownloadFinished, key, ImageHandler.getPathFavIcons(context), context/*, imageView*/, lruCache);
|
||||||
giAsync.scaleImage = true;
|
giAsync.scaleImage = true;
|
||||||
|
@ -168,30 +202,30 @@ public class FavIconHandler {
|
||||||
giAsync.execute((Void)null);
|
giAsync.execute((Void)null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
||||||
//WeakReference<ImageView> imageViewRef = imageViewReferences.get(AsynkTaskId);
|
//WeakReference<ImageView> imageViewRef = imageViewReferences.get(AsynkTaskId);
|
||||||
FavIconCache favIconCache = imageViewReferences.get(AsynkTaskId);
|
FavIconCache favIconCache = imageViewReferences.get(AsynkTaskId);
|
||||||
WeakReference<ImageView> imageViewRef = favIconCache.imageViewReference;
|
WeakReference<ImageView> imageViewRef = favIconCache.imageViewReference;
|
||||||
|
|
||||||
if(imageViewRef != null)
|
if(imageViewRef != null)
|
||||||
{
|
{
|
||||||
ImageView imageView = imageViewRef.get();
|
ImageView imageView = imageViewRef.get();
|
||||||
if (imageView != null) {
|
if (imageView != null) {
|
||||||
BitmapDrawable bd = (BitmapDrawable) FavIconHandler.GetFavIconFromCache(favIconCache.WEB_URL_TO_FILE, favIconCache.context, feedID);
|
BitmapDrawable bd = (BitmapDrawable) FavIconHandler.GetFavIconFromCache(favIconCache.WEB_URL_TO_FILE, favIconCache.context, feedID);
|
||||||
if(lruCache != null && feedID != null && bd != null)
|
if(lruCache != null && feedID != null && bd != null)
|
||||||
lruCache.put(feedID, bd);
|
lruCache.put(feedID, bd);
|
||||||
imageView.setImageDrawable(bd);
|
imageView.setImageDrawable(bd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
imageViewReferences.remove(AsynkTaskId);
|
imageViewReferences.remove(AsynkTaskId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static class FavIconCache
|
static class FavIconCache
|
||||||
{
|
{
|
||||||
public WeakReference<ImageView> imageViewReference;
|
public WeakReference<ImageView> imageViewReference;
|
||||||
|
|
|
@ -39,9 +39,9 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ImageHandler {
|
public class ImageHandler {
|
||||||
//private static final String TAG = "DownloadImagesFromWeb";
|
//private static final String TAG = "DownloadImagesFromWeb";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Drawable LoadImageFromWebOperations(String url) {
|
public static Drawable LoadImageFromWebOperations(String url) {
|
||||||
try {
|
try {
|
||||||
InputStream is = (InputStream) new URL(url).getContent();
|
InputStream is = (InputStream) new URL(url).getContent();
|
||||||
|
@ -52,19 +52,19 @@ public class ImageHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static List<File> getFilesFromDir(File dir) {
|
public static List<File> getFilesFromDir(File dir) {
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
if(dir.isDirectory())
|
if(dir.isDirectory())
|
||||||
for (File file : dir.listFiles())
|
for (File file : dir.listFiles())
|
||||||
if (file.isFile())
|
if (file.isFile())
|
||||||
files.add(file);
|
files.add(file);
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getFolderSize(File dir) {
|
public static long getFolderSize(File dir) {
|
||||||
long size = 0;
|
long size = 0;
|
||||||
if(dir.isDirectory())
|
if(dir.isDirectory())
|
||||||
|
@ -79,18 +79,26 @@ public class ImageHandler {
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getFullPathOfCacheFileSafe(String WEB_URL_TO_FILE, String rootPath) {
|
||||||
|
try {
|
||||||
|
return getFullPathOfCacheFile(WEB_URL_TO_FILE, rootPath);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static File getFullPathOfCacheFile(String WEB_URL_TO_FILE, String rootPath) throws Exception
|
public static File getFullPathOfCacheFile(String WEB_URL_TO_FILE, String rootPath) throws Exception
|
||||||
{
|
{
|
||||||
URL url = new URL(WEB_URL_TO_FILE.trim());
|
URL url = new URL(WEB_URL_TO_FILE.trim());
|
||||||
|
|
||||||
MessageDigest m = MessageDigest.getInstance("MD5");
|
MessageDigest m = MessageDigest.getInstance("MD5");
|
||||||
m.reset();
|
m.reset();
|
||||||
m.update(url.toString().getBytes());
|
m.update(url.toString().getBytes());
|
||||||
byte[] digest = m.digest();
|
byte[] digest = m.digest();
|
||||||
BigInteger bigInt = new BigInteger(1,digest);
|
BigInteger bigInt = new BigInteger(1,digest);
|
||||||
String hashtext = bigInt.toString(16);
|
String hashtext = bigInt.toString(16);
|
||||||
|
|
||||||
String fileEnding = "";
|
String fileEnding = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -102,22 +110,22 @@ public class ImageHandler {
|
||||||
fileEnding = ".png";
|
fileEnding = ".png";
|
||||||
//ex.printStackTrace();
|
//ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File(rootPath + "/" + hashtext + fileEnding);
|
return new File(rootPath + "/" + hashtext + fileEnding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getPathFavIcons(Context context)
|
public static String getPathFavIcons(Context context)
|
||||||
{
|
{
|
||||||
return getPath(context) + "/favIcons";
|
return getPath(context) + "/favIcons";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPathImageCache(Context context)
|
public static String getPathImageCache(Context context)
|
||||||
{
|
{
|
||||||
return getPath(context) + "/imgCache";
|
return getPath(context) + "/imgCache";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPath(Context context) {
|
public static String getPath(Context context) {
|
||||||
String url;
|
String url;
|
||||||
Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
|
Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
|
||||||
|
@ -132,11 +140,11 @@ public class ImageHandler {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
url = context.getCacheDir().getAbsolutePath();
|
url = context.getCacheDir().getAbsolutePath();
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<String> getImageLinksFromText(String text)
|
public static List<String> getImageLinksFromText(String text)
|
||||||
{
|
{
|
||||||
List<String> links = new ArrayList<String>();
|
List<String> links = new ArrayList<String>();
|
||||||
|
@ -148,16 +156,16 @@ public class ImageHandler {
|
||||||
//System.out.print("Start index: " + matcher.start());
|
//System.out.print("Start index: " + matcher.start());
|
||||||
//System.out.print(" End index: " + matcher.end() + " ");
|
//System.out.print(" End index: " + matcher.end() + " ");
|
||||||
//System.out.println(matcher.group());
|
//System.out.println(matcher.group());
|
||||||
|
|
||||||
Matcher matcherSrcLink = patternSrcLink.matcher(matcher.group());
|
Matcher matcherSrcLink = patternSrcLink.matcher(matcher.group());
|
||||||
if(matcherSrcLink.find()) {
|
if(matcherSrcLink.find()) {
|
||||||
links.add(matcherSrcLink.group(1));
|
links.add(matcherSrcLink.group(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean clearCache(Context context)
|
public static boolean clearCache(Context context)
|
||||||
{
|
{
|
||||||
String path = getPath(context);
|
String path = getPath(context);
|
||||||
|
@ -180,7 +188,7 @@ public class ImageHandler {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes all files and subdirectories under dir.
|
// Deletes all files and subdirectories under dir.
|
||||||
// Returns true if all deletions were successful.
|
// Returns true if all deletions were successful.
|
||||||
// If a deletion fails, the method stops attempting to delete and returns
|
// If a deletion fails, the method stops attempting to delete and returns
|
||||||
|
@ -199,11 +207,11 @@ public class ImageHandler {
|
||||||
// The directory is now empty so delete it
|
// The directory is now empty so delete it
|
||||||
return dir.delete();
|
return dir.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static Bitmap loadBitmap(String url) {
|
public static Bitmap loadBitmap(String url) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import de.luhmer.owncloudnewsreader.async_tasks.FillTextForTextViewAsyncTask;
|
|
||||||
import de.luhmer.owncloudnewsreader.async_tasks.GetImageAsyncTask;
|
import de.luhmer.owncloudnewsreader.async_tasks.GetImageAsyncTask;
|
||||||
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
|
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
|
||||||
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
||||||
|
@ -35,32 +34,32 @@ import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||||
public class DownloadItemsToCache {
|
public class DownloadItemsToCache {
|
||||||
SparseArray<String> URLs;
|
SparseArray<String> URLs;
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
public DownloadItemsToCache(Context context) {
|
public DownloadItemsToCache(Context context) {
|
||||||
URLs = new SparseArray<String>();
|
URLs = new SparseArray<String>();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartDownloadOfImage(String URL_TO_IMAGE)
|
public void StartDownloadOfImage(String URL_TO_IMAGE)
|
||||||
{
|
{
|
||||||
int key = 0;
|
int key = 0;
|
||||||
if(URLs.size() > 0)
|
if(URLs.size() > 0)
|
||||||
key = URLs.keyAt(URLs.size() -1) + 1;
|
key = URLs.keyAt(URLs.size() -1) + 1;
|
||||||
URLs.append(key, URL_TO_IMAGE);
|
URLs.append(key, URL_TO_IMAGE);
|
||||||
|
|
||||||
GetImageAsyncTask getImageAsync = new GetImageAsyncTask(URL_TO_IMAGE, imgDownloadFinished, key, ImageHandler.getPathImageCache(context), context, null);
|
GetImageAsyncTask getImageAsync = new GetImageAsyncTask(URL_TO_IMAGE, imgDownloadFinished, key, ImageHandler.getPathImageCache(context), context, null);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
getImageAsync.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ((Void) null));// Execute in parallel
|
getImageAsync.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ((Void) null));// Execute in parallel
|
||||||
else
|
else
|
||||||
getImageAsync.execute((Void)null);
|
getImageAsync.execute((Void)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -47,31 +48,33 @@ import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||||
import de.luhmer.owncloudnewsreader.async_tasks.GetImageAsyncTask;
|
import de.luhmer.owncloudnewsreader.async_tasks.GetImageAsyncTask;
|
||||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||||
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
|
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
|
||||||
|
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
|
||||||
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
||||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||||
|
|
||||||
public class DownloadImagesService extends IntentService {
|
public class DownloadImagesService extends IntentService {
|
||||||
|
|
||||||
public static final String LAST_ITEM_ID = "LAST_ITEM_ID";
|
public static final String LAST_ITEM_ID = "LAST_ITEM_ID";
|
||||||
|
public static final String DOWNLOAD_FAVICONS_EXCLUSIVE = "DOWNLOAD_FAVICONS_EXCLUSIVE";
|
||||||
private static Random random;
|
private static Random random;
|
||||||
|
|
||||||
private int NOTIFICATION_ID = 1;
|
private int NOTIFICATION_ID = 1;
|
||||||
private NotificationManager notificationManager;
|
private NotificationManager notificationManager;
|
||||||
private NotificationCompat.Builder NotificationDownloadImages;
|
private NotificationCompat.Builder NotificationDownloadImages;
|
||||||
private int count;
|
private int count;
|
||||||
private int maxCount;
|
private int maxCount;
|
||||||
//private int total_size = 0;
|
//private int total_size = 0;
|
||||||
|
|
||||||
public DownloadImagesService() {
|
public DownloadImagesService() {
|
||||||
super(null);
|
super(null);
|
||||||
initService();
|
initService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DownloadImagesService(String name) {
|
public DownloadImagesService(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
initService();
|
initService();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initService()
|
private void initService()
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -100,50 +103,70 @@ public class DownloadImagesService extends IntentService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(Intent intent) {
|
protected void onHandleIntent(Intent intent) {
|
||||||
String lastId = String.valueOf(intent.getLongExtra(LAST_ITEM_ID, 0));
|
boolean downloadFavIconsExclusive = intent.getBooleanExtra(DOWNLOAD_FAVICONS_EXCLUSIVE, false);
|
||||||
DatabaseConnection dbConn = new DatabaseConnection(this);
|
|
||||||
Cursor cursor = dbConn.getAllItemsWithIdHigher(lastId);
|
DatabaseConnection dbConn = new DatabaseConnection(this);
|
||||||
List<String> links = new ArrayList<String>();
|
Notification notify = BuildNotification();
|
||||||
try
|
SparseArray<String> linksFavIcons = dbConn.getUrlsToFavIcons();
|
||||||
{
|
|
||||||
if(cursor != null)
|
if(linksFavIcons.size() > 0)
|
||||||
{
|
notificationManager.notify(NOTIFICATION_ID, notify);
|
||||||
while(cursor.moveToNext())
|
|
||||||
{
|
for(int i = 0; i < linksFavIcons.size(); i++) {
|
||||||
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
|
int key = linksFavIcons.keyAt(i);
|
||||||
links.addAll(ImageHandler.getImageLinksFromText(body));
|
String link = linksFavIcons.get(i);
|
||||||
}
|
FavIconHandler.PreCacheFavIcon(link, this, String.valueOf(key));
|
||||||
}
|
}
|
||||||
} catch(Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
cursor.close();
|
|
||||||
dbConn.closeDatabase();
|
if(!downloadFavIconsExclusive) {
|
||||||
}
|
String lastId = String.valueOf(intent.getLongExtra(LAST_ITEM_ID, 0));
|
||||||
maxCount = links.size();
|
Cursor cursor = dbConn.getAllItemsWithIdHigher(lastId);
|
||||||
|
List<String> links = new ArrayList<String>();
|
||||||
Intent intentNewsReader = new Intent(this, NewsReaderListActivity.class);
|
try {
|
||||||
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intentNewsReader, 0);
|
if (cursor != null) {
|
||||||
notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
while (cursor.moveToNext()) {
|
||||||
NotificationDownloadImages = new NotificationCompat.Builder(this)
|
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
|
||||||
.setContentTitle("ownCloud News Reader")
|
links.addAll(ImageHandler.getImageLinksFromText(body));
|
||||||
.setContentText("Downloading Images for offline usage")
|
}
|
||||||
.setSmallIcon(R.drawable.ic_launcher)
|
}
|
||||||
.setContentIntent(pIntent);
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
Notification notify = NotificationDownloadImages.build();
|
} finally {
|
||||||
|
cursor.close();
|
||||||
//Hide the notification after its selected
|
dbConn.closeDatabase();
|
||||||
notify.flags |= Notification.FLAG_AUTO_CANCEL;
|
}
|
||||||
//notify.flags |= Notification.FLAG_NO_CLEAR;
|
maxCount = links.size();
|
||||||
|
|
||||||
if(maxCount > 0)
|
if (maxCount > 0)
|
||||||
notificationManager.notify(NOTIFICATION_ID, notify);
|
notificationManager.notify(NOTIFICATION_ID, notify);
|
||||||
|
|
||||||
for(String link : links)
|
for (String link : links)
|
||||||
new GetImageAsyncTask(link, imgDownloadFinished, 999, ImageHandler.getPathImageCache(this), this, null).execute();
|
new GetImageAsyncTask(link, imgDownloadFinished, 999, ImageHandler.getPathImageCache(this), this, null).execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Notification BuildNotification() {
|
||||||
|
Intent intentNewsReader = new Intent(this, NewsReaderListActivity.class);
|
||||||
|
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intentNewsReader, 0);
|
||||||
|
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationDownloadImages = new NotificationCompat.Builder(this)
|
||||||
|
.setContentTitle("ownCloud News Reader")
|
||||||
|
.setContentText("Downloading Images for offline usage")
|
||||||
|
.setSmallIcon(R.drawable.ic_launcher)
|
||||||
|
.setContentIntent(pIntent);
|
||||||
|
|
||||||
|
Notification notify = NotificationDownloadImages.build();
|
||||||
|
|
||||||
|
//Hide the notification after its selected
|
||||||
|
notify.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||||
|
//notify.flags |= Notification.FLAG_NO_CLEAR;
|
||||||
|
|
||||||
|
return notify;
|
||||||
|
}
|
||||||
|
|
||||||
private void RemoveOldImages(Context context) {
|
private void RemoveOldImages(Context context) {
|
||||||
HashMap<File, Long> files;
|
HashMap<File, Long> files;
|
||||||
long size = ImageHandler.getFolderSize(new File(ImageHandler.getPath(context)));
|
long size = ImageHandler.getFolderSize(new File(ImageHandler.getPath(context)));
|
||||||
|
@ -199,9 +222,9 @@ public class DownloadImagesService extends IntentService {
|
||||||
}
|
}
|
||||||
return sortedMap;
|
return sortedMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
public void DownloadFinished(int AsynkTaskId, String fileCachePath, BitmapDrawableLruCache lruCache) {
|
||||||
|
|
||||||
|
@ -222,7 +245,7 @@ public class DownloadImagesService extends IntentService {
|
||||||
NotificationDownloadImages.setContentText("Downloading Images for offline usage - " + count + "/" + maxCount);
|
NotificationDownloadImages.setContentText("Downloading Images for offline usage - " + count + "/" + maxCount);
|
||||||
// Displays the progress bar for the first time.
|
// Displays the progress bar for the first time.
|
||||||
notificationManager.notify(NOTIFICATION_ID, NotificationDownloadImages.build());
|
notificationManager.notify(NOTIFICATION_ID, NotificationDownloadImages.build());
|
||||||
|
|
||||||
if(maxCount == count) {
|
if(maxCount == count) {
|
||||||
notificationManager.cancel(NOTIFICATION_ID);
|
notificationManager.cancel(NOTIFICATION_ID);
|
||||||
if(DownloadImagesService.this != null)
|
if(DownloadImagesService.this != null)
|
||||||
|
|
|
@ -6,22 +6,22 @@
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
android:background="@drawable/checkbox_background"
|
android:background="@drawable/checkbox_background"
|
||||||
android:button="@drawable/checkbox"
|
android:button="@drawable/checkbox"
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/color_line_feed"
|
android:id="@+id/color_line_feed"
|
||||||
android:layout_width="@dimen/color_bar_of_feeds"
|
android:layout_width="@dimen/color_bar_of_feeds"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/abs__background_holo_dark"/>
|
android:background="@color/abs__background_holo_dark"/>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
android:layout_marginRight="@dimen/listview_row_margin_right"
|
android:layout_marginRight="@dimen/listview_row_margin_right"
|
||||||
android:layout_marginTop="@dimen/listview_row_margin_top"
|
android:layout_marginTop="@dimen/listview_row_margin_top"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/tv_subscription"
|
android:id="@+id/tv_subscription"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
android:text="Hdfsa"
|
android:text="Hdfsa"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/tv_item_date"
|
android:id="@+id/tv_item_date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -52,21 +52,21 @@
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="@dimen/listview_row_margin_left"
|
android:layout_marginLeft="@dimen/listview_row_margin_left"
|
||||||
android:layout_marginBottom="@dimen/listview_row_margin_bottom"
|
android:layout_marginBottom="@dimen/listview_row_margin_bottom"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dip"
|
android:layout_width="0dip"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_marginRight="@dimen/listview_row_margin_right"
|
android:layout_marginRight="@dimen/listview_row_margin_right"
|
||||||
android:layout_weight="1" >
|
android:layout_weight="1" >
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/summary"
|
android:id="@+id/summary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:text="Hi\nfds"
|
android:text="Hi\nfds"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/body"
|
android:id="@+id/body"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
@ -85,14 +85,14 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lines="4"
|
android:lines="4"
|
||||||
android:text="Hi\nfsddfs\nfdsfs\nfsfdsds"
|
android:text="Test"
|
||||||
android:textColor="#858585"
|
android:textColor="@color/extended_listview_body_text_color"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:autoLink="none" />
|
android:autoLink="none" />
|
||||||
<!-- android:gravity="center_vertical" -->
|
<!-- android:gravity="center_vertical" -->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -109,16 +109,23 @@
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:button="@drawable/checkbox_background_empty"
|
android:button="@drawable/checkbox_background_empty"
|
||||||
android:background="@drawable/checkbox_background_holo_light" />
|
android:background="@drawable/checkbox_background_holo_light" />
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||||
android:id="@+id/cb_lv_item_read"
|
android:id="@+id/cb_lv_item_read"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:layout_gravity="center_horizontal" />
|
android:layout_gravity="center_horizontal" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1.5dp"
|
||||||
|
android:layout_marginTop="-2.0dp"
|
||||||
|
android:background="@color/divider_row_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -3,27 +3,26 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="65dp"
|
android:layout_height="72dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal" >
|
||||||
android:background="@drawable/row_divider_line" >
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/color_line_feed"
|
android:id="@+id/color_line_feed"
|
||||||
android:layout_width="@dimen/color_bar_of_feeds"
|
android:layout_width="@dimen/color_bar_of_feeds"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/abs__background_holo_dark"/>
|
android:background="@color/abs__background_holo_dark"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="65dp"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_cb_starred_wrapper"
|
android:id="@+id/ll_cb_starred_wrapper"
|
||||||
|
@ -48,28 +47,28 @@
|
||||||
android:layout_marginTop="@dimen/listview_row_margin_top"
|
android:layout_marginTop="@dimen/listview_row_margin_top"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
android:background="@drawable/checkbox_background"
|
android:background="@drawable/checkbox_background"
|
||||||
android:button="@drawable/checkbox"
|
android:button="@drawable/checkbox"
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/summary"
|
android:id="@+id/summary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lines="2"
|
android:lines="2"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:text="hidsaf afdaljkök"
|
android:text="Test"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/tv_subscription"
|
android:id="@+id/tv_subscription"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -78,10 +77,10 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="Hif dsajfdjasklfds"
|
android:text="Test"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/tv_item_date"
|
android:id="@+id/tv_item_date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -92,25 +91,23 @@
|
||||||
android:text="Hi"
|
android:text="Hi"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoCheckBox
|
<com.devspark.robototextview.widget.RobotoCheckBox
|
||||||
android:id="@+id/cb_lv_item_read"
|
android:id="@+id/cb_lv_item_read"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="@dimen/listview_row_margin_left"
|
android:layout_marginLeft="@dimen/listview_row_margin_left"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false" />
|
android:focusable="false" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0.5dp"
|
android:layout_height="1.5dp"
|
||||||
android:background="@color/divider_row_color" />
|
android:layout_marginTop="5.5dp"
|
||||||
|
android:background="@color/divider_row_color" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="@dimen/exp_listview_row_height"
|
android:layout_height="@dimen/exp_listview_row_height"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
|
@ -8,11 +8,11 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_View_expandable_indicator"
|
android:id="@+id/img_View_expandable_indicator"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_gravity="center_vertical|center_horizontal"
|
android:layout_gravity="center_vertical|center_horizontal"
|
||||||
android:src="@drawable/ic_find_next_holo_dark" />
|
android:src="@drawable/ic_find_next_holo_dark" />
|
||||||
|
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/summary"
|
android:id="@+id/summary"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -22,20 +22,20 @@
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:textColor="@color/slider_listview_text_color" />
|
android:textColor="@color/slider_listview_text_color" />
|
||||||
<!--app:typeface="roboto_thin" -->
|
<!--app:typeface="roboto_thin" -->
|
||||||
|
|
||||||
|
|
||||||
<com.devspark.robototextview.widget.RobotoTextView
|
<com.devspark.robototextview.widget.RobotoTextView
|
||||||
android:id="@+id/tV_feedsCount"
|
android:id="@+id/tV_feedsCount"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical|right"
|
android:gravity="center_vertical|right"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginRight="20dp"
|
||||||
android:textColor="@color/slider_listview_text_color" />
|
android:textColor="@color/slider_listview_text_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -2,6 +2,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<!-- <color name="slider_listview_background_color">#525252</color> -->
|
<!-- <color name="slider_listview_background_color">#525252</color> -->
|
||||||
<color name="slider_listview_background_color">#383d43</color>
|
<color name="slider_listview_background_color">#383d43</color>
|
||||||
<color name="slider_listview_text_color">#F0F0F0</color>
|
<color name="slider_listview_text_color">#F0F0F0</color>
|
||||||
<color name="divider_row_color">#292929</color>
|
<color name="divider_row_color">#292929</color>
|
||||||
|
|
||||||
|
<color name="extended_listview_body_text_color">#ff9e9e9e</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue