Fix android lint issues/hints
This commit is contained in:
parent
7d9606e47b
commit
65d6c1d24a
50 changed files with 172 additions and 299 deletions
|
@ -294,8 +294,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
|
||||
int rotation = 0;
|
||||
|
||||
//viewHolder.txt_UnreadCount.setText(group.unreadCount);
|
||||
|
||||
|
||||
if(group.idFolder != null)
|
||||
{
|
||||
|
@ -310,14 +308,14 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
viewHolder.imgView.setVisibility(View.GONE);
|
||||
viewHolder.faviconView.setVisibility(View.VISIBLE);
|
||||
rotation = 0;
|
||||
viewHolder.faviconView.setImageDrawable(getBtn_rating_star_off_normal_holo_light(mContext));
|
||||
viewHolder.faviconView.setImageResource(getBtn_rating_star_off_normal_holo_light());
|
||||
} else if (getChildrenCount( groupPosition ) == 0 ) {
|
||||
viewHolder.imgView.setVisibility(View.GONE);
|
||||
viewHolder.faviconView.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
viewHolder.imgView.setVisibility(View.VISIBLE);
|
||||
viewHolder.faviconView.setVisibility(View.INVISIBLE);
|
||||
viewHolder.imgView.setImageDrawable(getFolderIndicatorIcon(mContext));
|
||||
viewHolder.imgView.setImageResource(getFolderIndicatorIcon());
|
||||
|
||||
if(isExpanded) {
|
||||
rotation = 90;
|
||||
|
@ -335,9 +333,23 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
//On API LEVEL < 11 we can't use the rotate method.. so we have to set different bitmaps.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
if(group.id_database != ALL_STARRED_ITEMS.getValue()) {
|
||||
if (rotation == 90) {
|
||||
viewHolder.imgView.setImageResource(getFolderIndicatorIcon());
|
||||
} else {
|
||||
viewHolder.imgView.setImageResource(getFolderIndicatorIconDown());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewHolder.imgView.setRotation(rotation);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
viewHolder.imgView.setRotation(rotation);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -346,30 +358,40 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
|
||||
|
||||
|
||||
Drawable folder_indicator_icon;
|
||||
Drawable btn_rating_star_off_normal_holo_light;
|
||||
private Integer folder_indicator_icon;
|
||||
private Integer folder_indicator_icon_old_android; //Only used on Android API LEVEL < 11
|
||||
private Integer btn_rating_star_off_normal_holo_light;
|
||||
|
||||
private Drawable getBtn_rating_star_off_normal_holo_light(Context context) {
|
||||
private int getBtn_rating_star_off_normal_holo_light() {
|
||||
if(btn_rating_star_off_normal_holo_light == null) {
|
||||
if(ThemeChooser.isDarkTheme(mContext)) {
|
||||
btn_rating_star_off_normal_holo_light = context.getResources().getDrawable(R.drawable.ic_action_star_border_dark);
|
||||
btn_rating_star_off_normal_holo_light = R.drawable.ic_action_star_border_dark;
|
||||
} else {
|
||||
btn_rating_star_off_normal_holo_light = context.getResources().getDrawable(R.drawable.ic_action_star_border_light);
|
||||
btn_rating_star_off_normal_holo_light = R.drawable.ic_action_star_border_light;
|
||||
}
|
||||
}
|
||||
return btn_rating_star_off_normal_holo_light;
|
||||
}
|
||||
|
||||
private Drawable getFolderIndicatorIcon(Context context) {
|
||||
private int getFolderIndicatorIcon() {
|
||||
if(folder_indicator_icon == null) {
|
||||
if(ThemeChooser.isDarkTheme(mContext))
|
||||
folder_indicator_icon = context.getResources().getDrawable(R.drawable.ic_action_expand_less_dark);
|
||||
folder_indicator_icon = R.drawable.ic_action_expand_less_dark;
|
||||
else
|
||||
folder_indicator_icon = context.getResources().getDrawable(R.drawable.ic_action_expand_less_light);
|
||||
folder_indicator_icon = R.drawable.ic_action_expand_less_light;
|
||||
}
|
||||
return folder_indicator_icon;
|
||||
}
|
||||
|
||||
private int getFolderIndicatorIconDown() {
|
||||
if(folder_indicator_icon_old_android == null) {
|
||||
if(ThemeChooser.isDarkTheme(mContext))
|
||||
folder_indicator_icon_old_android = R.drawable.ic_action_expand_more_dark;
|
||||
else
|
||||
folder_indicator_icon_old_android = R.drawable.ic_action_expand_more_light;
|
||||
}
|
||||
return folder_indicator_icon_old_android;
|
||||
}
|
||||
|
||||
static class GroupHolder
|
||||
{
|
||||
|
|
|
@ -2,12 +2,9 @@ package de.luhmer.owncloudnewsreader;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -76,7 +73,7 @@ public class NewFeedActivity extends AppCompatActivity {
|
|||
folderNames[i] = folders.get(i).getLabel();
|
||||
}
|
||||
|
||||
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, folderNames);
|
||||
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, folderNames);
|
||||
mFolderView.setAdapter(spinnerArrayAdapter);
|
||||
|
||||
mAddFeedButton.setOnClickListener(new OnClickListener() {
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -96,7 +95,6 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
private MenuItem menuItem_Starred;
|
||||
private MenuItem menuItem_Read;
|
||||
|
||||
private IReader _Reader;
|
||||
private DatabaseConnectionOrm dbConn;
|
||||
public LazyList<RssItem> rssItems;
|
||||
|
||||
|
@ -121,7 +119,6 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
|
||||
pDelayHandler = new PostDelayHandler(this);
|
||||
|
||||
_Reader = new OwnCloud_Reader();
|
||||
dbConn = new DatabaseConnectionOrm(this);
|
||||
Intent intent = getIntent();
|
||||
|
||||
|
@ -397,7 +394,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
|
||||
case R.id.action_openInBrowser:
|
||||
NewsDetailFragment newsDetailFragment = getNewsDetailFragmentAtPosition(currentPosition);
|
||||
String link = newsDetailFragment.mWebView.getUrl().toString();
|
||||
String link = newsDetailFragment.mWebView.getUrl();
|
||||
|
||||
if(link.equals("about:blank"))
|
||||
link = rssItem.getLink();
|
||||
|
@ -497,8 +494,9 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
String packageName = CustomTabActivityManager.getInstance().getPackageNameToUse(this);
|
||||
if (packageName == null)
|
||||
return false;
|
||||
boolean ok = CustomTabsClient.bindCustomTabsService(
|
||||
this, packageName, new CustomTabsServiceConnection() {
|
||||
|
||||
return CustomTabsClient.bindCustomTabsService(
|
||||
this, packageName, new CustomTabsServiceConnection() {
|
||||
@Override
|
||||
public void onCustomTabsServiceConnected(ComponentName name, CustomTabsClient client) {
|
||||
mCustomTabsClient = client;
|
||||
|
@ -509,8 +507,6 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
mCustomTabsClient = null;
|
||||
}
|
||||
});
|
||||
//if (ok) {};
|
||||
return ok;
|
||||
}
|
||||
|
||||
private CustomTabsSession getSession() {
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
package de.luhmer.owncloudnewsreader;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -172,7 +172,12 @@ public class NewsDetailFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static void SetSoftwareRenderModeForWebView(String htmlPage, WebView webView) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(htmlPage.contains(".gif")) {
|
||||
webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
|
||||
Log.v("NewsDetailFragment", "Using LAYER_TYPE_SOFTWARE");
|
||||
|
|
|
@ -33,7 +33,6 @@ import android.os.Bundle;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
|
|
@ -72,10 +72,10 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
|
||||
public void setRefreshing(boolean isRefreshing) {
|
||||
if(isRefreshing) {
|
||||
headerLogo.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher_background));
|
||||
headerLogo.setImageResource(R.drawable.ic_launcher_background);
|
||||
headerLogoProgress.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
headerLogo.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
|
||||
headerLogo.setImageResource(R.drawable.ic_launcher);
|
||||
headerLogoProgress.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,8 @@ package de.luhmer.owncloudnewsreader;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
@ -28,8 +25,6 @@ import android.widget.ViewSwitcher;
|
|||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
|
@ -37,11 +32,6 @@ import butterknife.OnClick;
|
|||
import de.greenrobot.event.EventBus;
|
||||
import de.luhmer.owncloudnewsreader.ListView.PodcastArrayAdapter;
|
||||
import de.luhmer.owncloudnewsreader.ListView.PodcastFeedArrayAdapter;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.AudioPodcastClicked;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.FeedPanelSlideEvent;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.PodcastFeedClicked;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.StartDownloadPodcast;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.TogglePlayerStateEvent;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.UpdatePodcastStatusEvent;
|
||||
|
@ -49,7 +39,6 @@ import de.luhmer.owncloudnewsreader.events.podcast.WindPodcast;
|
|||
import de.luhmer.owncloudnewsreader.model.PodcastFeedItem;
|
||||
import de.luhmer.owncloudnewsreader.model.PodcastItem;
|
||||
import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
|
||||
import de.luhmer.owncloudnewsreader.services.PodcastPlaybackService;
|
||||
import de.luhmer.owncloudnewsreader.view.PodcastSlidingUpPanelLayout;
|
||||
|
||||
|
||||
|
@ -78,8 +67,7 @@ public class PodcastFragment extends Fragment {
|
|||
* @return A new instance of fragment PodcastFragment.
|
||||
*/
|
||||
public static PodcastFragment newInstance() {
|
||||
PodcastFragment fragment = new PodcastFragment();
|
||||
return fragment;
|
||||
return new PodcastFragment();
|
||||
}
|
||||
public PodcastFragment() {
|
||||
// Required empty public constructor
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.support.v4.view.GravityCompat;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
@ -33,14 +32,11 @@ import java.io.File;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.InjectView;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.RegisterVideoOutput;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.UpdatePodcastStatusEvent;
|
||||
import de.luhmer.owncloudnewsreader.events.podcast.VideoDoubleClicked;
|
||||
import de.luhmer.owncloudnewsreader.helper.FileUtils;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.SizeAnimator;
|
||||
import de.luhmer.owncloudnewsreader.interfaces.IPlayPausePodcastClicked;
|
||||
import de.luhmer.owncloudnewsreader.model.PodcastItem;
|
||||
|
@ -480,7 +476,10 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
|
||||
//int animationpos = 500;
|
||||
float xPosition = rlVideoPodcastSurfaceWrapper.getVideoXPosition();
|
||||
view.animate().x(xPosition).y(absoluteYPosition).setDuration(animationTime);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {//TODO podcast video is only working for newer android versions
|
||||
view.animate().x(xPosition).y(absoluteYPosition).setDuration(animationTime);
|
||||
}
|
||||
//scaleX(scaleFactor).scaleY(scaleFactor)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.accounts.AccountManager;
|
|||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -141,7 +140,7 @@ public class SyncIntervalSelectorActivity extends AppCompatActivity {
|
|||
lvItems.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
|
||||
android.R.layout.simple_list_item_single_choice, android.R.id.text1, items);
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.graphics.Rect;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
package de.luhmer.owncloudnewsreader.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.pascalwelsch.holocircularprogressbar.HoloCircularProgressBar;
|
||||
|
||||
|
@ -41,7 +36,7 @@ import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
|
|||
public class NewsListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
private static final String TAG = "NewsListRecyclerAdapter";
|
||||
|
||||
public static SparseArray<Integer> downloadProgressList = new SparseArray<Integer>();
|
||||
public static SparseArray<Integer> downloadProgressList = new SparseArray<>();
|
||||
private long idOfCurrentlyPlayedPodcast = -1;
|
||||
|
||||
private LazyList<RssItem> lazyList;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package de.luhmer.owncloudnewsreader.adapter;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by daniel on 28.06.15.
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.luhmer.owncloudnewsreader.adapter;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
|
@ -11,8 +12,6 @@ import android.text.style.ForegroundColorSpan;
|
|||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -104,12 +103,16 @@ public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickL
|
|||
|
||||
public void setReadState(boolean isRead) {
|
||||
if(textViewSummary != null) {
|
||||
float alpha = 1f;
|
||||
if (isRead) {
|
||||
textViewSummary.setTypeface(Typeface.DEFAULT);
|
||||
((View)textViewSummary.getParent()).setAlpha(0.7f);
|
||||
alpha = 0.7f;
|
||||
} else {
|
||||
textViewSummary.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
((View)textViewSummary.getParent()).setAlpha(1f);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
((View) textViewSummary.getParent()).setAlpha(alpha);
|
||||
}
|
||||
//itemView.invalidate();
|
||||
//textViewSummary.invalidate();
|
||||
|
|
|
@ -99,7 +99,7 @@ public class MapUtils
|
|||
public static Map<String, String> listToMap(
|
||||
final List<? extends IKeyValuePair> list, final ListToMapMode mode)
|
||||
{
|
||||
final Map<String, String> retval = new HashMap<String, String>();
|
||||
final Map<String, String> retval = new HashMap<>();
|
||||
listToMap(list, retval, mode);
|
||||
return retval;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class MapUtils
|
|||
*/
|
||||
public static List<IKeyValuePair> mapToList(final Map<String, String> map)
|
||||
{
|
||||
final List<IKeyValuePair> retval = new ArrayList<IKeyValuePair>();
|
||||
final List<IKeyValuePair> retval = new ArrayList<>();
|
||||
mapToList(map, retval);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class URLParams
|
|||
*/
|
||||
public static List<KeyValuePair> parseQueryString(final String queryString)
|
||||
{
|
||||
final List<KeyValuePair> retval = new ArrayList<KeyValuePair>();
|
||||
final List<KeyValuePair> retval = new ArrayList<>();
|
||||
parseQueryString(queryString, retval);
|
||||
return retval;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class URLParams
|
|||
public static List<KeyValuePair> parseQueryString(final String queryString,
|
||||
final String encoding) throws UnsupportedEncodingException
|
||||
{
|
||||
final List<KeyValuePair> retval = new ArrayList<KeyValuePair>();
|
||||
final List<KeyValuePair> retval = new ArrayList<>();
|
||||
parseQueryString(queryString, retval, encoding);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
import de.greenrobot.dao.query.LazyList;
|
||||
import de.greenrobot.dao.query.WhereCondition;
|
||||
import de.luhmer.owncloudnewsreader.Constants;
|
||||
import de.luhmer.owncloudnewsreader.database.model.CurrentRssItemView;
|
||||
import de.luhmer.owncloudnewsreader.database.model.CurrentRssItemViewDao;
|
||||
import de.luhmer.owncloudnewsreader.database.model.DaoSession;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||
|
@ -110,7 +109,7 @@ public class DatabaseConnectionOrm {
|
|||
}
|
||||
|
||||
public List<Feed> getListOfFeedsWithUnreadItems() {
|
||||
List<Feed> feedsWithUnreadItems = new ArrayList<Feed>();
|
||||
List<Feed> feedsWithUnreadItems = new ArrayList<>();
|
||||
|
||||
for(Feed feed : getListOfFeeds()) {
|
||||
for(RssItem rssItem : feed.getRssItemList()) {
|
||||
|
@ -168,7 +167,7 @@ public class DatabaseConnectionOrm {
|
|||
WhereCondition whereCondition = new WhereCondition.StringCondition(FeedDao.Properties.Id.columnName + " IN " + "(SELECT " + RssItemDao.Properties.FeedId.columnName + " FROM " + RssItemDao.TABLENAME + " WHERE " + RssItemDao.Properties.EnclosureMime.columnName + " IN(\"" + join(ALLOWED_PODCASTS_TYPES, "\",\"") + "\"))");
|
||||
List<Feed> feedsWithPodcast = daoSession.getFeedDao().queryBuilder().where(whereCondition).list();
|
||||
|
||||
List<PodcastFeedItem> podcastFeedItemsList = new ArrayList<PodcastFeedItem>(feedsWithPodcast.size());
|
||||
List<PodcastFeedItem> podcastFeedItemsList = new ArrayList<>(feedsWithPodcast.size());
|
||||
for(Feed feed : feedsWithPodcast) {
|
||||
int podcastCount = 0;
|
||||
for(RssItem rssItem : feed.getRssItemList()) {
|
||||
|
@ -182,7 +181,7 @@ public class DatabaseConnectionOrm {
|
|||
}
|
||||
|
||||
public List<PodcastItem> getListOfAudioPodcastsForFeed(Context context, long feedId) {
|
||||
List<PodcastItem> result = new ArrayList<PodcastItem>();
|
||||
List<PodcastItem> result = new ArrayList<>();
|
||||
|
||||
for(RssItem rssItem : daoSession.getRssItemDao().queryBuilder()
|
||||
.where(RssItemDao.Properties.EnclosureMime.in(ALLOWED_PODCASTS_TYPES), RssItemDao.Properties.FeedId.eq(feedId))
|
||||
|
@ -198,7 +197,7 @@ public class DatabaseConnectionOrm {
|
|||
long countUnreadRead = daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Read_temp.notEq(RssItemDao.Properties.Read)).count();
|
||||
long countStarredUnstarred = daoSession.getRssItemDao().queryBuilder().where(RssItemDao.Properties.Starred_temp.notEq(RssItemDao.Properties.Starred)).count();
|
||||
|
||||
return (countUnreadRead + countStarredUnstarred) > 0 ? true : false;
|
||||
return (countUnreadRead + countStarredUnstarred) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -294,7 +293,7 @@ public class DatabaseConnectionOrm {
|
|||
|
||||
|
||||
public List<String> getRssItemsIdsFromList(List<RssItem> rssItemList) {
|
||||
List<String> itemIds = new ArrayList<String>();
|
||||
List<String> itemIds = new ArrayList<>();
|
||||
for(RssItem rssItem : rssItemList) {
|
||||
itemIds.add(String.valueOf(rssItem.getId()));
|
||||
}
|
||||
|
@ -343,7 +342,7 @@ public class DatabaseConnectionOrm {
|
|||
|
||||
|
||||
public SparseArray<String> getUrlsToFavIcons() {
|
||||
SparseArray<String> favIconUrls = new SparseArray<String>();
|
||||
SparseArray<String> favIconUrls = new SparseArray<>();
|
||||
|
||||
for(Feed feed : getListOfFeeds())
|
||||
favIconUrls.put((int) feed.getId(), feed.getFaviconUrl());
|
||||
|
@ -606,7 +605,7 @@ public class DatabaseConnectionOrm {
|
|||
}
|
||||
|
||||
public SparseArray<Integer> getIntegerSparseArrayFromSQL(String buildSQL, int indexKey, int indexValue) {
|
||||
SparseArray<Integer> result = new SparseArray<Integer>();
|
||||
SparseArray<Integer> result = new SparseArray<>();
|
||||
|
||||
Cursor cursor = daoSession.getDatabase().rawQuery(buildSQL, null);
|
||||
try
|
||||
|
@ -631,7 +630,7 @@ public class DatabaseConnectionOrm {
|
|||
}
|
||||
|
||||
public SparseArray<String> getStringSparseArrayFromSQL(String buildSQL, int indexKey, int indexValue) {
|
||||
SparseArray<String> result = new SparseArray<String>();
|
||||
SparseArray<String> result = new SparseArray<>();
|
||||
|
||||
Cursor cursor = daoSession.getDatabase().rawQuery(buildSQL, null);
|
||||
try
|
||||
|
|
|
@ -27,7 +27,7 @@ public class DatabaseOrmGenerator {
|
|||
* @throws IOException
|
||||
*/
|
||||
public static void main(String[] args) throws IOException, Exception {
|
||||
List<SchemaVersion> versions = new ArrayList<SchemaVersion>();
|
||||
List<SchemaVersion> versions = new ArrayList<>();
|
||||
|
||||
versions.add(new Version4(true));
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class DatabaseOrmGenerator {
|
|||
public static void validateSchemas(List<SchemaVersion> versions)
|
||||
throws IllegalArgumentException {
|
||||
int numCurrent = 0;
|
||||
Set<Integer> versionNumbers = new HashSet<Integer>();
|
||||
Set<Integer> versionNumbers = new HashSet<>();
|
||||
|
||||
for (SchemaVersion version : versions) {
|
||||
if (version.isCurrent()) {
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.helper;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
|
||||
/**
|
||||
* Created by David on 02.07.2014.
|
||||
*/
|
||||
public class AlphaAnimator {
|
||||
|
||||
public static void AnimateVisibilityChange(final View view, final int visibilityTo) {
|
||||
|
||||
|
||||
Animation animation;
|
||||
if(visibilityTo == View.GONE) {
|
||||
animation = new AlphaAnimation(1f, 0f);
|
||||
} else {
|
||||
view.setAlpha(0.1f);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
animation = new AlphaAnimation(0f, 1f);
|
||||
}
|
||||
|
||||
|
||||
animation.setFillAfter(true);
|
||||
animation.setDuration(1000);
|
||||
animation.setStartOffset(1000);
|
||||
//animation.setStartOffset(5000);
|
||||
|
||||
/*
|
||||
animation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
view.setVisibility(visibilityTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
animation.start();
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ public class AsyncTaskHelper {
|
|||
asyncTask.execute(params);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> void StartAsyncTask(AsyncTask asyncTask, Void... params) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.Color;
|
|||
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
|
||||
/**
|
||||
* Created by daniel on 11.07.15.
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
package de.luhmer.owncloudnewsreader.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.nostra13.universalimageloader.utils.StorageUtils;
|
||||
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
package de.luhmer.owncloudnewsreader.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Typeface;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
@ -33,8 +30,6 @@ import android.widget.CheckBox;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
|
||||
public class FontHelper {
|
||||
Context context;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ImageHandler {
|
|||
|
||||
public static List<String> getImageLinksFromText(String text)
|
||||
{
|
||||
List<String> links = new ArrayList<String>();
|
||||
List<String> links = new ArrayList<>();
|
||||
|
||||
Matcher matcher = patternImg.matcher(text);
|
||||
// Check all occurrences
|
||||
|
|
|
@ -119,7 +119,7 @@ public class JavaYoutubeDownloader {
|
|||
|
||||
public String getDownloadUrl(String videoId, String encoding, String userAgent) throws Throwable {
|
||||
//Utils.log.fine("Retrieving " + videoId);
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
List<NameValuePair> qparams = new ArrayList<>();
|
||||
qparams.add(new BasicNameValuePair("video_id", videoId));
|
||||
URI uri = getUri("get_video_info", qparams);
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class JavaYoutubeDownloader {
|
|||
InputStream instream = entity.getContent();
|
||||
String videoInfo = getStringFromInputStream(encoding, instream);
|
||||
if (videoInfo != null && videoInfo.length() > 0) {
|
||||
List<NameValuePair> infoMap = new ArrayList<NameValuePair>();
|
||||
List<NameValuePair> infoMap = new ArrayList<>();
|
||||
URLEncodedUtils.parse(infoMap, new Scanner(videoInfo), encoding);
|
||||
String downloadUrl = null;
|
||||
String filename = videoId;
|
||||
|
@ -313,7 +313,7 @@ public class JavaYoutubeDownloader {
|
|||
*/
|
||||
public static Map<String, String> getVideoInfo(String youTubeId) throws IOException
|
||||
{
|
||||
final Map<String, String> retval = new HashMap<String, String>();
|
||||
final Map<String, String> retval = new HashMap<>();
|
||||
getVideoInfo(youTubeId, retval);
|
||||
return retval;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ public class JavaYoutubeDownloader {
|
|||
public static void getVideoInfo(String youTubeId, Map<String, String> map) throws IOException
|
||||
{
|
||||
final String host = "http://www.youtube.com";
|
||||
final List<IKeyValuePair> params = new ArrayList<IKeyValuePair>();
|
||||
final List<IKeyValuePair> params = new ArrayList<>();
|
||||
params.add(new KeyValuePair("video_id", youTubeId));
|
||||
final String urlString = host + "/get_video_info?&"+ URLParams.generateQueryString(params);
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ package de.luhmer.owncloudnewsreader.helper;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
|
@ -35,39 +33,16 @@ public class ThemeChooser {
|
|||
|
||||
public static void chooseTheme(Activity act)
|
||||
{
|
||||
|
||||
if(isDarkTheme(act))
|
||||
{
|
||||
if(isDarkTheme(act)) {
|
||||
act.setTheme(R.style.AppTheme);
|
||||
} else {
|
||||
act.setTheme(R.style.AppThemeLight);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(isDarkTheme(act))
|
||||
{
|
||||
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||
// act.setTheme(android.R.style.Theme_Holo);
|
||||
//else
|
||||
//act.setTheme(R.style.Sherlock___Theme);
|
||||
act.setTheme(R.style.Theme_AppCompat);
|
||||
} else {
|
||||
//if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
// act.setTheme(android.R.style.Theme_Holo_Light_DarkActionBar);
|
||||
//else
|
||||
//act.setTheme(R.style.Sherlock___Theme_DarkActionBar);
|
||||
act.setTheme(R.style.Theme_AppCompat_Light_DarkActionBar);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public static boolean ThemeRequiresRestartOfUI(Context context) {
|
||||
if(mIsDarkTheme != null && mIsDarkTheme != isDarkTheme(context, true)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return mIsDarkTheme != null && mIsDarkTheme != isDarkTheme(context, true);
|
||||
}
|
||||
|
||||
static Boolean mIsDarkTheme;
|
||||
|
@ -80,7 +55,7 @@ public class ThemeChooser {
|
|||
if(mIsDarkTheme == null || forceReloadCache) {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String value = mPrefs.getString(SettingsActivity.SP_APP_THEME, "0");
|
||||
mIsDarkTheme = value.equals("0") ? true : false;
|
||||
mIsDarkTheme = value.equals("0");
|
||||
}
|
||||
return mIsDarkTheme;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package de.luhmer.owncloudnewsreader.interfaces;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.widget.Toast;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
|
||||
|
||||
/**
|
||||
* Created by David on 25.03.2014.
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package de.luhmer.owncloudnewsreader.model;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Created by David on 27.03.2015.
|
||||
*/
|
||||
|
|
|
@ -20,11 +20,11 @@ public class OwnCloudSyncProvider extends ContentProvider {
|
|||
*/
|
||||
|
||||
public String getType() {
|
||||
return new String();
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getType(Uri uri) {
|
||||
return new String();
|
||||
return "";
|
||||
}
|
||||
/*
|
||||
* query() always returns no results
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
package de.luhmer.owncloudnewsreader.reader;
|
||||
|
||||
public class FeedItemTags {
|
||||
public static enum TAGS { MARK_ITEM_AS_READ, MARK_ITEM_AS_UNREAD, MARK_ITEM_AS_STARRED, MARK_ITEM_AS_UNSTARRED, ALL_STARRED, ALL };
|
||||
public enum TAGS { MARK_ITEM_AS_READ, MARK_ITEM_AS_UNREAD, MARK_ITEM_AS_STARRED, MARK_ITEM_AS_UNSTARRED, ALL_STARRED, ALL };
|
||||
|
||||
}
|
||||
|
|
|
@ -36,11 +36,7 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -48,8 +44,6 @@ import javax.net.ssl.HostnameVerifier;
|
|||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
package de.luhmer.owncloudnewsreader.reader;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,7 +29,6 @@ import java.util.List;
|
|||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Folder;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
|
||||
/**
|
||||
* Created by David on 24.05.13.
|
||||
|
|
|
@ -34,68 +34,61 @@ import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
|||
public class AsyncTask_PerformItemStateChange extends AsyncTask_Reader
|
||||
{
|
||||
private API api;
|
||||
|
||||
|
||||
public AsyncTask_PerformItemStateChange(final int task_id, final Context context, final OnAsyncTaskCompletedListener[] listener, API api) {
|
||||
super(task_id, context, listener);
|
||||
super(task_id, context, listener);
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Object... params) {
|
||||
List<Boolean> succeeded = new ArrayList<>();
|
||||
|
||||
List<Boolean> succeeded = new ArrayList<Boolean>();
|
||||
|
||||
try {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(context);
|
||||
try {
|
||||
//Mark as READ
|
||||
List<String> itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewReadRssItems());
|
||||
boolean result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_READ, context, api);
|
||||
if(result)
|
||||
dbConn.change_readUnreadStateOfItem(itemIds, true);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as UNREAD
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewUnreadRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_UNREAD, context, api);
|
||||
if(result)
|
||||
dbConn.change_readUnreadStateOfItem(itemIds, false);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as STARRED
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewStarredRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_STARRED, context, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, true);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as UNSTARRED
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewUnstarredRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_UNSTARRED, context, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, false);
|
||||
succeeded.add(result);
|
||||
} finally {
|
||||
//dbConn.closeDatabase();
|
||||
}
|
||||
|
||||
//Mark as READ
|
||||
List<String> itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewReadRssItems());
|
||||
boolean result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_READ, context, api);
|
||||
if(result)
|
||||
dbConn.change_readUnreadStateOfItem(itemIds, true);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as UNREAD
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewUnreadRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_UNREAD, context, api);
|
||||
if(result)
|
||||
dbConn.change_readUnreadStateOfItem(itemIds, false);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as STARRED
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewStarredRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_STARRED, context, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, true);
|
||||
succeeded.add(result);
|
||||
|
||||
//Mark as UNSTARRED
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewUnstarredRssItems());
|
||||
result = api.PerformTagExecution(itemIds, TAGS.MARK_ITEM_AS_UNSTARRED, context, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, false);
|
||||
succeeded.add(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
succeeded.add(false);
|
||||
}
|
||||
|
||||
if(succeeded.contains(false))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
return !succeeded.contains(false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Object values) {
|
||||
protected void onPostExecute(Object values) {
|
||||
for (OnAsyncTaskCompletedListener listenerInstance : listener) {
|
||||
if(listenerInstance != null)
|
||||
listenerInstance.onAsyncTaskCompleted(task_id, values);
|
||||
}
|
||||
|
||||
|
||||
detach();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import de.luhmer.owncloudnewsreader.reader.InsertIntoDatabase;
|
|||
public class InsertFeedIntoDatabase implements IHandleJsonObject{
|
||||
|
||||
DatabaseConnectionOrm dbConn;
|
||||
ArrayList<Feed> feeds = new ArrayList<Feed>();
|
||||
ArrayList<Feed> feeds = new ArrayList<>();
|
||||
|
||||
public InsertFeedIntoDatabase(DatabaseConnectionOrm dbConn) {
|
||||
this.dbConn = dbConn;
|
||||
|
|
|
@ -32,7 +32,7 @@ import de.luhmer.owncloudnewsreader.reader.InsertIntoDatabase;
|
|||
public class InsertFolderIntoDatabase implements IHandleJsonObject{
|
||||
|
||||
DatabaseConnectionOrm dbConn;
|
||||
ArrayList<Folder> folders = new ArrayList<Folder>();
|
||||
ArrayList<Folder> folders = new ArrayList<>();
|
||||
|
||||
public InsertFolderIntoDatabase(DatabaseConnectionOrm dbConn) {
|
||||
this.dbConn = dbConn;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class InsertItemIntoDatabase implements IHandleJsonObject {
|
|||
public InsertItemIntoDatabase(DatabaseConnectionOrm dbConn) {
|
||||
this.dbConn = dbConn;
|
||||
//buffer = new RssItem[bufferSize];
|
||||
buffer = new ArrayList<RssItem>(bufferSize);
|
||||
buffer = new ArrayList<>(bufferSize);
|
||||
|
||||
//feeds = dbConn.getListOfFeeds();
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ public class OwnCloudReaderMethods {
|
|||
* @throws JSONException
|
||||
*/
|
||||
public static int[] readJsonStreamV2(InputStream in, IHandleJsonObject iJoBj) throws IOException, JSONException {
|
||||
List<String> allowedArrays = Arrays.asList(new String[] { "feeds", "folders", "items" });
|
||||
List<String> allowedArrays = Arrays.asList("feeds", "folders", "items");
|
||||
|
||||
int count = 0;
|
||||
int newItemsCount = 0;
|
||||
|
@ -354,7 +354,7 @@ public class OwnCloudReaderMethods {
|
|||
} else {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(context);
|
||||
|
||||
HashMap<String, String> items = new HashMap<String, String>();
|
||||
HashMap<String, String> items = new HashMap<>();
|
||||
for(String idItem : itemIds)
|
||||
{
|
||||
RssItem rssItem = dbConn.getRssItemById(Long.parseLong(idItem));
|
||||
|
@ -389,10 +389,7 @@ public class OwnCloudReaderMethods {
|
|||
{
|
||||
int result = HttpJsonRequest.performTagChangeRequest(url, api.getUsername(), api.getPassword(), context, jsonIds);
|
||||
//if(result != -1 || result != 405)
|
||||
if(result == 200)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (result == 200);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -427,10 +424,7 @@ public class OwnCloudReaderMethods {
|
|||
try
|
||||
{
|
||||
int result = HttpJsonRequest.performTagChangeRequest(url, api.getUsername(), api.getPassword(), context, null);
|
||||
if(result == 200)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (result == 200);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class OwnCloud_Reader implements IReader {
|
|||
SparseArray<AsyncTask_Reader> AsyncTasksRunning;
|
||||
|
||||
public OwnCloud_Reader() {
|
||||
AsyncTasksRunning = new SparseArray<AsyncTask_Reader>();
|
||||
AsyncTasksRunning = new SparseArray<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,14 +66,11 @@ public class APIv1 extends API {
|
|||
public boolean PerformTagExecution(List<String> itemIds, TAGS tag,
|
||||
Context context, API api) {
|
||||
|
||||
List<Boolean> succeeded = new ArrayList<Boolean>();
|
||||
List<Boolean> succeeded = new ArrayList<>();
|
||||
for(String item : itemIds) {
|
||||
succeeded.add(OwnCloudReaderMethods.PerformTagExecutionAPIv1(item, tag, context, api));
|
||||
}
|
||||
|
||||
if(succeeded.contains(false))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
return !succeeded.contains(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,33 +27,24 @@ import android.app.NotificationManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
import de.luhmer.owncloudnewsreader.async_tasks.GetImageThreaded;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.FileUtils;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
|
||||
|
@ -70,7 +61,7 @@ public class DownloadImagesService extends IntentService {
|
|||
private int maxCount;
|
||||
//private int total_size = 0;
|
||||
|
||||
List<String> linksToImages = new LinkedList<String>();
|
||||
List<String> linksToImages = new LinkedList<>();
|
||||
|
||||
public DownloadImagesService() {
|
||||
super(null);
|
||||
|
@ -123,7 +114,7 @@ public class DownloadImagesService extends IntentService {
|
|||
if(!downloadFavIconsExclusive) {
|
||||
long lastId = intent.getLongExtra(LAST_ITEM_ID, 0);
|
||||
List<RssItem> rssItemList = dbConn.getAllItemsWithIdHigher(lastId);
|
||||
List<String> links = new ArrayList<String>();
|
||||
List<String> links = new ArrayList<>();
|
||||
for(RssItem rssItem : rssItemList) {
|
||||
String body = rssItem.getBody();
|
||||
links.addAll(ImageHandler.getImageLinksFromText(body));
|
||||
|
|
|
@ -55,7 +55,7 @@ public class OwnCloudSyncService extends Service {
|
|||
|
||||
protected static final String TAG = "OwnCloudSyncService";
|
||||
|
||||
private RemoteCallbackList<IOwnCloudSyncServiceCallback> callbacks = new RemoteCallbackList<IOwnCloudSyncServiceCallback>();
|
||||
private RemoteCallbackList<IOwnCloudSyncServiceCallback> callbacks = new RemoteCallbackList<>();
|
||||
|
||||
private Stub mBinder = new IOwnCloudSyncService.Stub() {
|
||||
|
||||
|
@ -284,10 +284,10 @@ public class OwnCloudSyncService extends Service {
|
|||
|
||||
private List<IOwnCloudSyncServiceCallback> getCallBackItemsAndBeginBroadcast() {
|
||||
// Broadcast to all clients the new value.
|
||||
List<IOwnCloudSyncServiceCallback> callbackList = new ArrayList<IOwnCloudSyncServiceCallback>();
|
||||
List<IOwnCloudSyncServiceCallback> callbackList = new ArrayList<>();
|
||||
final int N = callbacks.beginBroadcast();
|
||||
for (int i=0; i < N; i++) {
|
||||
callbackList.add((IOwnCloudSyncServiceCallback) callbacks.getBroadcastItem(i));
|
||||
callbackList.add(callbacks.getBroadcastItem(i));
|
||||
}
|
||||
return callbackList;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class PodcastDownloadService extends IntentService {
|
|||
if (intent != null) {
|
||||
final String action = intent.getAction();
|
||||
if (ACTION_DOWNLOAD.equals(action)) {
|
||||
ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra(EXTRA_RECEIVER);
|
||||
//ResultReceiver receiver = intent.getParcelableExtra(EXTRA_RECEIVER);
|
||||
PodcastItem podcast = (PodcastItem) intent.getSerializableExtra(EXTRA_URL);
|
||||
//final String param2 = intent.getStringExtra(EXTRA_PARAM2);
|
||||
//handleActionDownload(podcast);
|
||||
|
@ -134,9 +134,8 @@ public class PodcastDownloadService extends IntentService {
|
|||
m.update(WEB_URL_TO_FILE.trim().getBytes());
|
||||
byte[] digest = m.digest();
|
||||
BigInteger bigInt = new BigInteger(1,digest);
|
||||
String hashtext = bigInt.toString(16);
|
||||
|
||||
return hashtext;
|
||||
return bigInt.toString(16);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -182,8 +181,7 @@ public class PodcastDownloadService extends IntentService {
|
|||
while ((count = input.read(data)) != -1) {
|
||||
total += count;
|
||||
|
||||
int progress = (int) (total * 100 / fileLength);
|
||||
podcast.downloadProgress = progress;
|
||||
podcast.downloadProgress = (int) (total * 100 / fileLength);
|
||||
eventBus.post(new DownloadProgressUpdate(podcast));
|
||||
|
||||
output.write(data, 0, count);
|
||||
|
|
|
@ -15,7 +15,6 @@ import android.view.View;
|
|||
import android.widget.Toast;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
|
|
|
@ -35,8 +35,6 @@ import de.luhmer.owncloudnewsreader.reader.IReader;
|
|||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv1.APIv1;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
|
||||
|
||||
public class SyncItemStateService extends IntentService {
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.NotificationManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.RemoteViews;
|
||||
|
@ -67,10 +66,10 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||
|
||||
Log.v(TAG, "onRecieve - WidgetID: " + appWidgetId + " - " + action);
|
||||
|
||||
for(int i = 0; i < appWidgetId.length; i++) {
|
||||
for (int anAppWidgetId : appWidgetId) {
|
||||
if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
|
||||
if (appWidgetId[i] != AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||
this.onDeleted(context, new int[] { appWidgetId[i] });
|
||||
if (anAppWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||
this.onDeleted(context, new int[]{anAppWidgetId});
|
||||
}
|
||||
} /*else if (intent.getAction().equals(ACTION_WIDGET_RECEIVER)) {
|
||||
|
||||
|
@ -81,13 +80,12 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||
intentRefresh.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { appWidgetId[i] });
|
||||
context.sendBroadcast(intentRefresh);
|
||||
|
||||
} */else if (action.equals(ACTION_LIST_CLICK)) {
|
||||
try
|
||||
{
|
||||
} */ else if (action.equals(ACTION_LIST_CLICK)) {
|
||||
try {
|
||||
Long rssItemId = intent.getExtras().getLong(RSS_ITEM_ID);
|
||||
|
||||
|
||||
if(intent.hasExtra(ACTION_CHECKED_CLICK)) {
|
||||
if (intent.hasExtra(ACTION_CHECKED_CLICK)) {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(context);
|
||||
RssItem rssItem = dbConn.getRssItemById(rssItemId);
|
||||
rssItem.setRead_temp(!rssItem.getRead_temp());
|
||||
|
@ -95,7 +93,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||
|
||||
|
||||
AppWidgetManager.getInstance(context)
|
||||
.notifyAppWidgetViewDataChanged(appWidgetId[i], R.id.list_view);
|
||||
.notifyAppWidgetViewDataChanged(anAppWidgetId, R.id.list_view);
|
||||
|
||||
Log.v(TAG, "I'm here!!! Widget update works!");
|
||||
} else {
|
||||
|
@ -107,9 +105,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||
}
|
||||
|
||||
Log.v(TAG, "ListItem Clicked Starting Activity for Item: " + rssItemId);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} /*else if(action.equals("android.appwidget.action.APPWIDGET_UPDATE") || action.equals(ACTION_WIDGET_RECEIVER)) {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
package de.luhmer.owncloudnewsreader.widget;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.widget.RemoteViewsService;
|
||||
|
||||
public class WidgetService extends RemoteViewsService {
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.annotation.SuppressLint;
|
|||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.widget.RemoteViews;
|
||||
|
@ -36,9 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.Constants;
|
||||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_width="4dp"
|
||||
android:background="?attr/dividerLineColor"
|
||||
android:layout_marginEnd="@dimen/listview_row_margin_left"/>
|
||||
android:layout_marginEnd="@dimen/listview_row_margin_left"
|
||||
android:layout_marginRight="@dimen/listview_row_margin_left"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -21,6 +22,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_action_star_light"
|
||||
android:layout_marginEnd="@dimen/listview_row_margin_left"
|
||||
android:layout_marginRight="@dimen/listview_row_margin_left"
|
||||
android:tint="?attr/starredColor" />
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -28,6 +30,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:layout_marginEnd="@dimen/listview_row_margin_right"
|
||||
android:layout_marginRight="@dimen/listview_row_margin_left"
|
||||
android:layout_marginTop="@dimen/listview_row_margin_top"
|
||||
android:layout_marginBottom="@dimen/listview_row_margin_bottom"
|
||||
android:id="@+id/list_item_header">
|
||||
|
@ -44,9 +47,12 @@
|
|||
android:id="@+id/imgViewFavIcon"
|
||||
tools:src="@drawable/default_feed_icon_light"
|
||||
android:layout_alignStart="@+id/summary"
|
||||
android:layout_alignLeft="@+id/summary"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_alignParentStart="true" />
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subscription"
|
||||
|
@ -73,7 +79,8 @@
|
|||
android:singleLine="true"
|
||||
android:textSize="15sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
|
@ -89,6 +96,7 @@
|
|||
android:maxLines="4"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/podcast_wrapper"/>
|
||||
|
||||
<TextView
|
||||
|
@ -104,6 +112,7 @@
|
|||
android:layout_marginTop="5dp"
|
||||
android:paddingBottom="@dimen/listview_row_margin_bottom"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/podcast_wrapper"
|
||||
android:layout_toStartOf="@+id/podcast_wrapper"/>
|
||||
|
||||
|
@ -113,6 +122,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:id="@+id/podcast_wrapper"
|
||||
android:layout_margin="5dp"/>
|
||||
|
||||
|
|
|
@ -68,7 +68,9 @@
|
|||
tools:text="PortableApps.com"
|
||||
android:layout_below="@+id/summary"
|
||||
android:layout_toStartOf="@+id/tv_item_date"
|
||||
android:layout_toEndOf="@+id/imgViewFavIcon" />
|
||||
android:layout_toEndOf="@+id/imgViewFavIcon"
|
||||
android:layout_toLeftOf="@+id/tv_item_date"
|
||||
android:layout_toRightOf="@+id/imgViewFavIcon"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_item_date"
|
||||
|
@ -80,6 +82,8 @@
|
|||
tools:text="vor 13 Stunden"
|
||||
android:layout_toStartOf="@+id/podcast_wrapper"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_toLeftOf="@+id/podcast_wrapper"
|
||||
android:layout_alignBaseline="@id/tv_subscription"/>
|
||||
|
||||
<include
|
||||
|
@ -87,6 +91,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/podcast_wrapper" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue