Merge pull request #358 from schaal/materialize
Use more material design elements and some cleanups
3
.gitmodules
vendored
|
@ -1,9 +1,6 @@
|
|||
[submodule "Changeloglib"]
|
||||
path = Changeloglib
|
||||
url = https://github.com/David-Development/changeloglib.git
|
||||
[submodule "MessageBar"]
|
||||
path = MessageBar
|
||||
url = https://github.com/David-Development/MessageBar.git
|
||||
[submodule "ownCloud-Account-Importer"]
|
||||
path = ownCloud-Account-Importer
|
||||
url = https://github.com/David-Development/ownCloud-Account-Importer.git
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 9cc21c50997678d6e4056bf1f1467040d6244d65
|
|
@ -49,12 +49,12 @@ dependencies {
|
|||
compile files('src/main/libs/gson-2.2.4.jar')
|
||||
compile files('src/main/libs/jsoup-1.7.2.jar')
|
||||
compile project(':Changeloglib:ChangeLogLibrary')
|
||||
compile project(':MessageBar')
|
||||
compile project(':ownCloud-Account-Importer')
|
||||
compile project(':ShowcaseView:library')
|
||||
compile project(':android-HoloCircularProgressBar:library')
|
||||
compile 'com.android.support:support-v4:22.2.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile 'com.android.support:design:22.2.0'
|
||||
compile 'com.jakewharton:butterknife:5.1.+'
|
||||
compile 'com.squareup.picasso:picasso:2.3.1@jar'
|
||||
compile 'com.sothree.slidinguppanel:library:+'
|
||||
|
|
|
@ -3,10 +3,6 @@ package de.luhmer.owncloudnewsreader;
|
|||
public class Constants {
|
||||
public static final Boolean debugModeWidget = false;
|
||||
|
||||
|
||||
public static final String _TAG_LABEL_UNREAD = "stream/contents/user/-/state/com.google/reading-list?n=1000&r=n&xt=user/-/state/com.google/read";
|
||||
public static final String _TAG_LABEL_STARRED = "stream/contents/user/-/state/com.google/starred?n=20";
|
||||
|
||||
//public static final String LAST_SYNC = "LAST_SYNC";
|
||||
|
||||
public static final int maxItemsCount = 1500;
|
||||
|
|
|
@ -353,17 +353,22 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
Drawable btn_rating_star_off_normal_holo_light;
|
||||
|
||||
private Drawable getBtn_rating_star_off_normal_holo_light(Context context) {
|
||||
if(btn_rating_star_off_normal_holo_light == null)
|
||||
btn_rating_star_off_normal_holo_light = context.getResources().getDrawable(R.drawable.btn_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);
|
||||
} else {
|
||||
btn_rating_star_off_normal_holo_light = context.getResources().getDrawable(R.drawable.ic_action_star_border_light);
|
||||
}
|
||||
}
|
||||
return btn_rating_star_off_normal_holo_light;
|
||||
}
|
||||
|
||||
private Drawable getic_find_next_holo(Context context) {
|
||||
if(ic_find_next_holo == null) {
|
||||
if(ThemeChooser.isDarkTheme(mContext))
|
||||
ic_find_next_holo = context.getResources().getDrawable(R.drawable.ic_find_next_holo_dark);
|
||||
ic_find_next_holo = context.getResources().getDrawable(R.drawable.ic_action_expand_less_dark);
|
||||
else
|
||||
ic_find_next_holo = context.getResources().getDrawable(R.drawable.ic_find_next_holo_light);
|
||||
ic_find_next_holo = context.getResources().getDrawable(R.drawable.ic_action_expand_less_light);
|
||||
}
|
||||
return ic_find_next_holo;
|
||||
}
|
||||
|
@ -371,9 +376,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
private Drawable getic_find_previous_holo(Context context) {
|
||||
if(ic_find_previous_holo == null) {
|
||||
if(ThemeChooser.isDarkTheme(mContext))
|
||||
ic_find_previous_holo = context.getResources().getDrawable(R.drawable.ic_find_previous_holo_dark);
|
||||
ic_find_previous_holo = context.getResources().getDrawable(R.drawable.ic_action_expand_more_dark);
|
||||
else
|
||||
ic_find_previous_holo = context.getResources().getDrawable(R.drawable.ic_find_previous_holo_light);
|
||||
ic_find_previous_holo = context.getResources().getDrawable(R.drawable.ic_action_expand_more_light);
|
||||
}
|
||||
return ic_find_previous_holo;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.net.Uri;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -36,7 +36,7 @@ import de.luhmer.owncloudnewsreader.reader.HttpJsonRequest;
|
|||
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
|
||||
import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
|
||||
|
||||
public class NewFeedActivity extends ActionBarActivity {
|
||||
public class NewFeedActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* Keep track of the login task to ensure we can cancel it if requested.
|
||||
|
|
|
@ -330,20 +330,20 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
|
||||
//if(rssFiles.get(currentPosition).getStarred() && menuItem_Starred != null)
|
||||
if(isStarred && menuItem_Starred != null)
|
||||
menuItem_Starred.setIcon(getSmallVersionOfActionbarIcon(R.drawable.btn_rating_star_on_normal_holo_dark));
|
||||
menuItem_Starred.setIcon(getSmallVersionOfActionbarIcon(R.drawable.ic_action_star_dark));
|
||||
//menuItem_Starred.setIcon(R.drawable.btn_rating_star_on_normal_holo_light);
|
||||
else if(menuItem_Starred != null)
|
||||
menuItem_Starred.setIcon(getSmallVersionOfActionbarIcon(R.drawable.btn_rating_star_off_normal_holo_dark));
|
||||
menuItem_Starred.setIcon(getSmallVersionOfActionbarIcon(R.drawable.ic_action_star_border_dark));
|
||||
//menuItem_Starred.setIcon(R.drawable.btn_rating_star_off_normal_holo_light);
|
||||
|
||||
|
||||
|
||||
if(isRead && menuItem_Read != null) {
|
||||
menuItem_Read.setIcon(R.drawable.btn_check_on_holo_dark);
|
||||
menuItem_Read.setIcon(R.drawable.ic_check_box_white);
|
||||
menuItem_Read.setChecked(true);
|
||||
}
|
||||
else if(menuItem_Read != null) {
|
||||
menuItem_Read.setIcon(R.drawable.btn_check_off_holo_dark);
|
||||
menuItem_Read.setIcon(R.drawable.ic_check_box_outline_blank_white);
|
||||
menuItem_Read.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -256,7 +256,7 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
|
|||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
((ActionBarActivity)getActivity()).getSupportActionBar().setTitle(titel);
|
||||
((AppCompatActivity)getActivity()).getSupportActionBar().setTitle(titel);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
|
@ -38,6 +39,7 @@ import android.os.Looper;
|
|||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
|
@ -49,12 +51,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.OnChildClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.michaelflisar.messagebar.MessageBar;
|
||||
import com.michaelflisar.messagebar.messages.BaseMessage;
|
||||
import com.michaelflisar.messagebar.messages.TextMessage;
|
||||
|
||||
import org.apache.http.client.HttpResponseException;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
|
||||
|
@ -142,10 +141,15 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
int newItemsCount = mPrefs.getInt(Constants.LAST_UPDATE_NEW_ITEMS_COUNT_STRING, 0);
|
||||
if(newItemsCount > 0) {
|
||||
MessageBar messageBar = new MessageBar(getActivity(), true);
|
||||
TextMessage textMessage = new TextMessage(newItemsCount + " " + getString(R.string.message_bar_new_articles_available), getString(R.string.message_bar_reload), R.drawable.ic_menu_refresh);
|
||||
textMessage.setClickListener(mListener);
|
||||
messageBar.show(textMessage);
|
||||
Snackbar snackbar = Snackbar.make(eListView, getResources().getQuantityString(R.plurals.message_bar_new_articles_available,newItemsCount,newItemsCount), Snackbar.LENGTH_LONG);
|
||||
snackbar.setAction(getString(R.string.message_bar_reload), mListener);
|
||||
snackbar.setActionTextColor(getResources().getColor(R.color.accent_material_dark));
|
||||
// Setting android:TextColor to #000 in the light theme results in black on black
|
||||
// text on the Snackbar, set the text back to white,
|
||||
// TODO: find a cleaner way to do this
|
||||
TextView textView = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
|
||||
textView.setTextColor(Color.WHITE);
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -224,7 +228,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
//AsyncUpdateFinished asyncUpdateFinished;
|
||||
ServiceConnection mConnection = null;
|
||||
|
||||
private BaseMessage.OnMessageClickListener mListener = null;
|
||||
private View.OnClickListener mListener = null;
|
||||
|
||||
/**
|
||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||
|
@ -239,15 +243,10 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
|
||||
try
|
||||
{
|
||||
mListener = new BaseMessage.OnMessageClickListener()
|
||||
mListener = new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onButton2Click(Parcelable data)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onButton1Click(Parcelable data)
|
||||
public void onClick(View view)
|
||||
{
|
||||
//Toast.makeText(getActivity(), "button 1 pressed", 3000).show();
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ public class PodcastFragment extends Fragment {
|
|||
hasTitleInCache = true;
|
||||
|
||||
int drawableId = podcast.isPlaying() ? android.R.drawable.ic_media_pause : android.R.drawable.ic_media_play;
|
||||
int drawableIdDarkDesign = podcast.isPlaying() ? R.drawable.av_pause : R.drawable.av_play;
|
||||
int drawableIdDarkDesign = podcast.isPlaying() ? R.drawable.ic_action_pause : R.drawable.ic_action_play_arrow;
|
||||
|
||||
if(lastDrawableId != drawableId) {
|
||||
lastDrawableId = drawableId;
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.content.res.Resources;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
|
@ -52,7 +52,7 @@ import de.luhmer.owncloudnewsreader.view.ZoomableRelativeLayout;
|
|||
/**
|
||||
* Created by David on 29.06.2014.
|
||||
*/
|
||||
public class PodcastFragmentActivity extends ActionBarActivity implements IPlayPausePodcastClicked {
|
||||
public class PodcastFragmentActivity extends AppCompatActivity implements IPlayPausePodcastClicked {
|
||||
|
||||
PodcastPlaybackService mPodcastPlaybackService;
|
||||
boolean mBound = false;
|
||||
|
|
|
@ -10,8 +10,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -27,7 +26,7 @@ import butterknife.InjectView;
|
|||
import de.luhmer.owncloudnewsreader.authentication.AccountGeneral;
|
||||
|
||||
|
||||
public class SyncIntervalSelectorActivity extends ActionBarActivity {
|
||||
public class SyncIntervalSelectorActivity extends AppCompatActivity {
|
||||
|
||||
SharedPreferences mPrefs;
|
||||
PlaceholderFragment mFragment;
|
||||
|
|
|
@ -306,7 +306,7 @@ public class NewsListArrayAdapter extends GreenDaoListAdapter<RssItem> {
|
|||
if (ThemeChooser.isDarkTheme(mActivity)) {
|
||||
drawableResource = isPlaying ? android.R.drawable.ic_media_pause : android.R.drawable.ic_media_play;
|
||||
} else {
|
||||
drawableResource = isPlaying ? R.drawable.av_pause : R.drawable.av_play;
|
||||
drawableResource = isPlaying ? R.drawable.ic_action_pause : R.drawable.ic_action_play_arrow;
|
||||
}
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) simpleLayout.btnPlayPausePodcast.getLayoutParams();
|
||||
params.setMargins(DpToPx(mActivity, isPlaying ? 0 : 2), 0, 0, 0);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package de.luhmer.owncloudnewsreader.authentication;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
|
||||
public class AuthenticatorActivity extends ActionBarActivity {
|
||||
public class AuthenticatorActivity extends AppCompatActivity {
|
||||
|
||||
public final static String ARG_ACCOUNT_TYPE = "ACCOUNT_TYPE";
|
||||
public final static String ARG_AUTH_TYPE = "AUTH_TYPE";
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.model.RssFile;
|
||||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
|
||||
public class AsyncTask_GetFeeds extends AsyncTask<Object, Void, ArrayList<RssFile>> {
|
||||
|
||||
private Activity context;
|
||||
private int task_id;
|
||||
private OnAsyncTaskCompletedListener listener;
|
||||
|
||||
public AsyncTask_GetFeeds(final int task_id, final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
super();
|
||||
|
||||
this.context = context;
|
||||
this.task_id = task_id;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich zurueck nach OrientationChange
|
||||
public void attach(final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich ab
|
||||
public void detach() {
|
||||
if (context != null) {
|
||||
context = null;
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ArrayList<RssFile> doInBackground(Object... params) {
|
||||
String username = (String) params[0];
|
||||
String password = (String) params[1];
|
||||
String _TAG_LABEL = (String) params[2];
|
||||
|
||||
try {
|
||||
//String authKey = AuthenticationManager.getGoogleAuthKey(username, password);
|
||||
return GoogleReaderMethods.getFeeds(username, password, _TAG_LABEL);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<RssFile> values) {
|
||||
|
||||
listener.onAsyncTaskCompleted(task_id, values);
|
||||
|
||||
detach();
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
|
||||
public class AsyncTask_GetGReaderTags extends AsyncTask<Object, Void, ArrayList<String[]>> {
|
||||
|
||||
private Activity context;
|
||||
private int task_id;
|
||||
private OnAsyncTaskCompletedListener listener;
|
||||
|
||||
public AsyncTask_GetGReaderTags(final int task_id, final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
super();
|
||||
|
||||
this.context = context;
|
||||
this.task_id = task_id;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich zurueck nach OrientationChange
|
||||
public void attach(final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich ab
|
||||
public void detach() {
|
||||
if (context != null) {
|
||||
context = null;
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ArrayList<String[]> doInBackground(Object... params) {
|
||||
String username = (String) params[0];
|
||||
String password = (String) params[1];
|
||||
|
||||
try {
|
||||
//String authKey = AuthenticationManager.getGoogleAuthKey(username, password);
|
||||
return GoogleReaderMethods.getTagList(username, password);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<String[]> values) {
|
||||
|
||||
listener.onAsyncTaskCompleted(task_id, values);
|
||||
|
||||
detach();
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.model.FolderSubscribtionItem;
|
||||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
|
||||
public class AsyncTask_GetSubReaderTags extends AsyncTask<Object, Void, ArrayList<FolderSubscribtionItem>> {
|
||||
|
||||
private Activity context;
|
||||
private int task_id;
|
||||
private OnAsyncTaskCompletedListener listener;
|
||||
|
||||
public AsyncTask_GetSubReaderTags(final int task_id, final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
super();
|
||||
|
||||
this.context = context;
|
||||
this.task_id = task_id;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich zurueck nach OrientationChange
|
||||
public void attach(final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich ab
|
||||
public void detach() {
|
||||
if (context != null) {
|
||||
context = null;
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ArrayList<FolderSubscribtionItem> doInBackground(Object... params) {
|
||||
String username = (String) params[0];
|
||||
String password = (String) params[1];
|
||||
|
||||
try {
|
||||
//String authKey = AuthenticationManager.getGoogleAuthKey(username, password);
|
||||
return GoogleReaderMethods.getSubList(username, password);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<FolderSubscribtionItem> values) {
|
||||
|
||||
listener.onAsyncTaskCompleted(task_id, values);
|
||||
|
||||
detach();
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import org.apache.http.NameValuePair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
|
||||
|
||||
public class AsyncTask_PerformTagAction extends AsyncTask<Object, Void, Boolean> {
|
||||
|
||||
private Context context;
|
||||
private int task_id;
|
||||
private OnAsyncTaskCompletedListener listener;
|
||||
|
||||
public AsyncTask_PerformTagAction(final int task_id, final Context context2, final OnAsyncTaskCompletedListener listener) {
|
||||
super();
|
||||
|
||||
this.context = context2;
|
||||
this.task_id = task_id;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich zurueck nach OrientationChange
|
||||
public void attach(final Activity context, final OnAsyncTaskCompletedListener listener) {
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
//Activity meldet sich ab
|
||||
public void detach() {
|
||||
if (context != null) {
|
||||
context = null;
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Boolean doInBackground(Object... params) {
|
||||
String username = (String) params[0];
|
||||
String password = (String) params[1];
|
||||
List<NameValuePair> valuepairs = (List<NameValuePair>) params[2];
|
||||
|
||||
try {
|
||||
//String authKey = AuthenticationManager.getGoogleAuthKey(username, password);
|
||||
return GoogleReaderMethods.performTagExecute(username, password, valuepairs);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean values) {
|
||||
listener.onAsyncTaskCompleted(task_id, values);
|
||||
detach();
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class AuthenticationManager {
|
||||
|
||||
|
||||
public static String getGoogleAuthKey(String _USERNAME, String _PASSWORD) throws UnsupportedEncodingException, IOException {
|
||||
Document doc = Jsoup.connect(GoogleReaderConstants._GOOGLE_LOGIN_URL)
|
||||
.data("accountType", "GOOGLE",
|
||||
"Email", _USERNAME,
|
||||
"Passwd", _PASSWORD,
|
||||
"service", "reader",
|
||||
"source", GoogleReaderConstants.APP_NAME)
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(4000)
|
||||
.post();
|
||||
|
||||
// RETRIEVES THE RESPONSE TEXT inc SID and AUTH. We only want the AUTH key.
|
||||
String _AUTHKEY = doc.body().text().substring(doc.body().text().indexOf("Auth="), doc.body().text().length());
|
||||
_AUTHKEY = _AUTHKEY.replace( "Auth=","" );
|
||||
return _AUTHKEY;
|
||||
}
|
||||
|
||||
public static String getGoogleToken(String _USERNAME, String _PASSWORD) throws UnsupportedEncodingException, IOException {
|
||||
Document doc = Jsoup.connect(GoogleReaderConstants._TOKEN_URL)
|
||||
.header("Authorization", GoogleReaderConstants._AUTHPARAMS + getGoogleAuthKey(_USERNAME,_PASSWORD))
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(4000)
|
||||
.get();
|
||||
|
||||
// RETRIEVES THE RESPONSE TOKEN
|
||||
String _TOKEN = doc.body().text();
|
||||
return _TOKEN;
|
||||
}
|
||||
|
||||
public static String getUserInfo(String _USERNAME, String _PASSWORD) throws UnsupportedEncodingException, IOException {
|
||||
Document doc = Jsoup.connect(GoogleReaderConstants._USER_INFO_URL)
|
||||
.header("Authorization", GoogleReaderConstants._AUTHPARAMS + getGoogleAuthKey(_USERNAME,_PASSWORD))
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(4000)
|
||||
.get();
|
||||
|
||||
// RETRIEVES THE RESPONSE USERINFO
|
||||
String _USERINFO = doc.body().text();
|
||||
return _USERINFO;
|
||||
}
|
||||
|
||||
public static String getGoogleUserID(String _USERNAME, String _PASSWORD) throws UnsupportedEncodingException, IOException {
|
||||
/* USERINFO RETURNED LOOKS LIKE
|
||||
* {"userId":"14577161871823252783",
|
||||
* "userName":"<username>","userProfileId":"<21 numeric numbers",
|
||||
* "userEmail":"<username>@gmail.com",
|
||||
* "isBloggerUser":true,
|
||||
* "signupTimeSec":1159535065}
|
||||
*/
|
||||
String _USERINFO = getUserInfo(_USERNAME, _PASSWORD);
|
||||
String _USERID = (String) _USERINFO.subSequence(11, 31);
|
||||
return _USERID;
|
||||
}
|
||||
|
||||
/*
|
||||
//Get google Auth key
|
||||
public static String getGoogleAuthKey(String email,String password)
|
||||
{
|
||||
try{
|
||||
Document doc = Jsoup.connect(Constants.GOOGLE_LOGIN_URL)
|
||||
.data("accountType","GOOGLE",
|
||||
"Email",email,
|
||||
"Passwd",password,
|
||||
"service","reader",
|
||||
"source", "MyApp")
|
||||
.timeout(4000)
|
||||
.post();
|
||||
return doc.body().text();
|
||||
}catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return "NULL";
|
||||
}
|
||||
}
|
||||
|
||||
//Get token
|
||||
public static String getGoogleToken(String authkey)
|
||||
{
|
||||
try
|
||||
{
|
||||
Document doc = Jsoup.connect(Constants.TOKEN_URL)
|
||||
.header("Authorization",Constants.AUTHPARAMS + authkey)
|
||||
.timeout(4000)
|
||||
.get();
|
||||
|
||||
// Retrieve the response token
|
||||
String _TOKEN = doc.body().text();
|
||||
return _TOKEN;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
Copyright 2011 Christian Dadswell
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public class Func_Strings {
|
||||
|
||||
// ARRAY TO STRING
|
||||
public static String arrayToString(String[] a, String separator) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
if (a.length > 0) {
|
||||
result.append(a[0]);
|
||||
for (int i=1; i<a.length; i++) {
|
||||
result.append(separator);
|
||||
result.append(a[i]);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
// FIND WORD IN STRING
|
||||
public static boolean FindWordInString(String StringToSearch, String WordToFind) {
|
||||
|
||||
int intIndex = StringToSearch.toLowerCase().indexOf(WordToFind.toLowerCase());
|
||||
if(intIndex == - 1){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//STRING REPLACE
|
||||
public static String StringToReplace(String string, String stringToReplace) {
|
||||
String str = string;
|
||||
String strreplace = string;
|
||||
String resultantString = str.replaceAll(stringToReplace, strreplace);
|
||||
return resultantString;
|
||||
}
|
||||
|
||||
public static boolean compareStr(String str1, String str2){
|
||||
if(str1.equals(str2)) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String[] arraySplit(String a, String splitter) {
|
||||
String[] x = Pattern.compile(splitter).split(a);
|
||||
for (int i=0; i<x.length; i++) {
|
||||
System.out.println(" \"" + x[i] + "\"");
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static String[] stringToArray( String s, String sep ) {
|
||||
// convert a String s to an Array, the elements
|
||||
// are delimited by sep
|
||||
// NOTE : for old JDK only (<1.4).
|
||||
// for JDK 1.4 +, use String.split() instead
|
||||
StringBuffer buf = new StringBuffer(s);
|
||||
int arraysize = 1;
|
||||
for ( int i = 0; i < buf.length(); i++ ) {
|
||||
if ( sep.indexOf(buf.charAt(i) ) != -1 )
|
||||
arraysize++;
|
||||
}
|
||||
String [] elements = new String [arraysize];
|
||||
int y,z = 0;
|
||||
if ( buf.toString().indexOf(sep) != -1 ) {
|
||||
while ( buf.length() > 0 ) {
|
||||
if ( buf.toString().indexOf(sep) != -1 ) {
|
||||
y = buf.toString().indexOf(sep);
|
||||
if ( y != buf.toString().lastIndexOf(sep) ) {
|
||||
elements[z] = buf.toString().substring(0, y );
|
||||
z++;
|
||||
buf.delete(0, y + 1);
|
||||
}
|
||||
else if ( buf.toString().lastIndexOf(sep) == y ) {
|
||||
elements[z] = buf.toString().substring
|
||||
(0, buf.toString().indexOf(sep));
|
||||
z++;
|
||||
buf.delete(0, buf.toString().indexOf(sep) + 1);
|
||||
elements[z] = buf.toString();z++;
|
||||
buf.delete(0, buf.length() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
elements[0] = buf.toString();
|
||||
}
|
||||
buf = null;
|
||||
return elements;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
public class GoogleReaderConstants {
|
||||
public static final String _AUTHPARAMS = "GoogleLogin auth=";
|
||||
public static final String _GOOGLE_LOGIN_URL = "https://www.google.com/accounts/ClientLogin";
|
||||
public static final String _READER_BASE_URL = "http://www.google.com/reader/";
|
||||
public static final String _API_URL = _READER_BASE_URL + "api/0/";
|
||||
public static final String _TOKEN_URL = _API_URL + "token";
|
||||
public static final String _USER_INFO_URL = _API_URL + "user-info";
|
||||
public static final String _USER_LABEL = "user/-/label/";
|
||||
public static final String _TAG_LIST_URL = _API_URL + "tag/list";
|
||||
//public static final String _EDIT_TAG_URL = _API_URL + "tag/edit";
|
||||
public static final String _EDIT_TAG_URL = _API_URL + "edit-tag";
|
||||
public static final String _RENAME_TAG_URL = _API_URL + "rename-tag";
|
||||
public static final String _DISABLE_TAG_URL = _API_URL + "disable-tag";
|
||||
public static final String _SUBSCRIPTION_URL = _API_URL + "subscription/edit";
|
||||
public static final String _SUBSCRIPTION_LIST_URL = _API_URL + "subscription/list";
|
||||
|
||||
public static final String _STATE_READ = "user/-/state/com.google/read";
|
||||
public static final String _STATE_STARRED= "user/-/state/com.google/starred";
|
||||
public static final String _STATE_BROADCAST = "user/-/state/com.google/broadcast";
|
||||
public static final String _STATE_LIKE = "user/-/state/com.google/like";
|
||||
|
||||
|
||||
|
||||
public static final String APP_NAME = "Owncloud News Reader";
|
||||
}
|
|
@ -1,316 +0,0 @@
|
|||
/**
|
||||
* Android ownCloud News
|
||||
*
|
||||
* @author David Luhmer
|
||||
* @copyright 2013 David Luhmer david-dev@live.de
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.nodes.Node;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.Constants;
|
||||
import de.luhmer.owncloudnewsreader.model.FolderSubscribtionItem;
|
||||
import de.luhmer.owncloudnewsreader.model.RssFile;
|
||||
|
||||
public class GoogleReaderMethods {
|
||||
|
||||
public static ArrayList<String[]> getTagList(String _USERNAME, String _PASSWORD) {
|
||||
Log.d(GoogleReaderConstants.APP_NAME, "METHOD: getTagList()");
|
||||
ArrayList<String[]> _TAGTITLE_ARRAYLIST = new ArrayList<String[]>();
|
||||
String _TAG_LABEL = null;
|
||||
try {
|
||||
_TAG_LABEL = "user/" + AuthenticationManager.getGoogleUserID(_USERNAME,_PASSWORD) + "/label/";
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Document doc = null;
|
||||
try {
|
||||
doc = Jsoup.connect(GoogleReaderConstants._TAG_LIST_URL)
|
||||
.header("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME,_PASSWORD))
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(6000)
|
||||
.get();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Elements links = doc.select("string");
|
||||
for (Element link : links) {
|
||||
//String tagAttrib = link.attr("name");
|
||||
String tagText = link.text();
|
||||
if(Func_Strings.FindWordInString(tagText, _TAG_LABEL)) {
|
||||
_TAGTITLE_ARRAYLIST.add(new String[] { tagText.substring(32), tagText });
|
||||
}
|
||||
}
|
||||
|
||||
//String[] _TAGTITLE_ARRAY = new String[_TAGTITLE_ARRAYLIST.size()];
|
||||
//_TAGTITLE_ARRAYLIST.toArray(_TAGTITLE_ARRAY);
|
||||
//return _TAGTITLE_ARRAY;
|
||||
return _TAGTITLE_ARRAYLIST;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static ArrayList<FolderSubscribtionItem> getSubList(String _USERNAME, String _PASSWORD) throws UnsupportedEncodingException, IOException {
|
||||
ArrayList<FolderSubscribtionItem> _SUBTITLE_ARRAYLIST = new ArrayList<FolderSubscribtionItem>();
|
||||
|
||||
Document doc = Jsoup.connect(GoogleReaderConstants._SUBSCRIPTION_LIST_URL)
|
||||
.header("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME,_PASSWORD))
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(5000)
|
||||
.get();
|
||||
|
||||
|
||||
|
||||
Elements objects = doc.select("object");
|
||||
Element element = objects.get(0);
|
||||
Node childTemp = element.childNodes().get(0);
|
||||
List<Node> childs = childTemp.childNodes();
|
||||
|
||||
for (Node node : childs) {
|
||||
Elements links = ((Element) node).select("string");
|
||||
String idFeed = null;
|
||||
String feedName;
|
||||
String parentSubscriptionName;
|
||||
|
||||
for (Element link : links) {
|
||||
String tagAttrib = link.attr("name");
|
||||
String tagText = link.text();
|
||||
if(tagAttrib.equals("id") && idFeed == null)
|
||||
idFeed = tagText;
|
||||
else if(tagAttrib.equals("title"))
|
||||
feedName = tagText;
|
||||
else if(tagAttrib.equals("label"))
|
||||
parentSubscriptionName = tagText;
|
||||
}
|
||||
|
||||
//String idFeed = node.attr("id");
|
||||
//String name = node.attr("title");
|
||||
|
||||
//_SUBTITLE_ARRAYLIST.add(new FolderSubscribtionItem(feedName, -1, idFeed, parentSubscriptionName));//TODO implements this again... ? Update FolderSubscribtionItem
|
||||
}
|
||||
|
||||
|
||||
//String[] _SUBTITLE_ARRAY = new String[_SUBTITLE_ARRAYLIST.size()];
|
||||
//_SUBTITLE_ARRAYLIST.toArray(_SUBTITLE_ARRAY);
|
||||
return _SUBTITLE_ARRAYLIST;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static ArrayList<RssFile> getFeeds(String _USERNAME, String _PASSWORD, String _TAG_LABEL) {
|
||||
Log.d("mygr","METHOD: getUnreadFeeds()");
|
||||
|
||||
ArrayList<RssFile> items = new ArrayList<RssFile>();
|
||||
|
||||
String returnString = null;
|
||||
|
||||
/*
|
||||
String _TAG_LABEL = null;
|
||||
try {
|
||||
//_TAG_LABEL = "stream/contents/user/" + AuthenticationManager.getGoogleUserID(_USERNAME, _PASSWORD) + "/state/com.google/reading-list?n=1000&r=n&xt=user/-/state/com.google/read";
|
||||
_TAG_LABEL = "stream/contents/user/-/state/com.google/reading-list?n=1000&r=n&xt=user/-/state/com.google/read";
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
try{
|
||||
|
||||
HttpClient client = new DefaultHttpClient();
|
||||
HttpGet request = new HttpGet(GoogleReaderConstants._API_URL + _TAG_LABEL);
|
||||
request.addHeader("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD));
|
||||
|
||||
HttpResponse response = client.execute(request);
|
||||
|
||||
returnString = HttpHelper.request(response);
|
||||
|
||||
|
||||
try {
|
||||
JSONObject jObj = new JSONObject(returnString);
|
||||
JSONArray jItems = (JSONArray) jObj.get("items");
|
||||
for(int i = 0; i < jItems.length(); i++) {
|
||||
JSONObject jItem = jItems.getJSONObject(i);
|
||||
|
||||
try
|
||||
{
|
||||
String streamID = jItem.optJSONObject("origin").optString("streamId");
|
||||
String feedTitel = jItem.getString("title");
|
||||
String feedID = jItem.optString("id");
|
||||
String content = "";
|
||||
String link = "";
|
||||
String timestamp = jItem.optString("published");
|
||||
|
||||
JSONObject jSummary = jItem.optJSONObject("summary");
|
||||
JSONObject jContent = jItem.optJSONObject("content");
|
||||
|
||||
//JSONArray jCategories
|
||||
|
||||
if(jSummary != null)
|
||||
content = (String) jItem.getJSONObject("summary").get("content");
|
||||
|
||||
if(jContent != null)
|
||||
content = (String) jItem.getJSONObject("content").get("content");
|
||||
|
||||
//if(jItem.has("origin"));
|
||||
// link = (String) jItem.getJSONObject("origin").get("htmlUrl");
|
||||
|
||||
if(jItem.has("alternate"));
|
||||
link = (String) jItem.optJSONArray("alternate").getJSONObject(0).getString("href");
|
||||
|
||||
JSONArray jCategories = jItem.optJSONArray("categories");
|
||||
List<String> categories = new ArrayList<String>();
|
||||
if(jCategories != null)
|
||||
{
|
||||
for(int t = 0; t < jCategories.length(); t++)
|
||||
categories.add((String) jCategories.get(t));
|
||||
}
|
||||
|
||||
Boolean starred = false;
|
||||
Boolean read = false;
|
||||
|
||||
if(_TAG_LABEL.equals(Constants._TAG_LABEL_STARRED))
|
||||
{
|
||||
starred = true;
|
||||
read = true;
|
||||
}
|
||||
|
||||
content = content.replaceAll("<img[^>]*feedsportal.com.*>", "");
|
||||
content = content.replaceAll("<img[^>]*statisches.auslieferung.commindo-media-ressourcen.de.*>", "");
|
||||
content = content.replaceAll("<img[^>]*auslieferung.commindo-media-ressourcen.de.*>", "");
|
||||
content = content.replaceAll("<img[^>]*rss.buysellads.com.*>", "");
|
||||
|
||||
|
||||
//content = (String) jItem.getJSONObject("content").get("content");
|
||||
/*
|
||||
RssFile sItem = new RssFile(0, feedTitel, link, content, read, 0, feedID, categories, streamID, new Date(Long.parseLong(timestamp) * 1000), starred, null, null);//TODO implement this here again
|
||||
items.add(sItem);*/
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//Log.d("HI", jObj.toString());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Pattern pattern = Pattern.compile("\"alternate\":\\[\\{\"href\":\"(.*?)\",");
|
||||
Matcher matcher = pattern.matcher(returnString);
|
||||
|
||||
ArrayList<String> resultList = new ArrayList<String>();
|
||||
|
||||
while (matcher.find())
|
||||
resultList.add(matcher.group(1));
|
||||
|
||||
String[] ret = new String[resultList.size()];
|
||||
resultList.toArray(ret);*/
|
||||
//return ret;
|
||||
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Boolean performTagExecute(String _USERNAME, String _PASSWORD, List<NameValuePair> nameValuePairs)
|
||||
{
|
||||
Log.d("mygr","METHOD: performTagExecute");
|
||||
|
||||
try{
|
||||
String authToken = AuthenticationManager.getGoogleToken(_USERNAME, _PASSWORD);
|
||||
String authKey = GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD);
|
||||
|
||||
nameValuePairs.add(new BasicNameValuePair("T", authToken));
|
||||
|
||||
HttpClient httpclient = new DefaultHttpClient();
|
||||
HttpPost httppost = new HttpPost(GoogleReaderConstants._EDIT_TAG_URL);
|
||||
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
|
||||
httppost.addHeader("Authorization", authKey);
|
||||
HttpResponse response = httpclient.execute(httppost);
|
||||
String returnString = HttpHelper.request(response);
|
||||
|
||||
if(returnString.contains("OK"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
/*
|
||||
String authToken = AuthenticationManager.getGoogleToken(_USERNAME, _PASSWORD);
|
||||
String authKey = GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD);
|
||||
//String action = "user/" + AuthenticationManager.getGoogleUserID(_USERNAME, _PASSWORD) + "/state/com.google/read";
|
||||
|
||||
ACTION = ACTION.replace("-", AuthenticationManager.getGoogleUserID(_USERNAME, _PASSWORD));
|
||||
|
||||
Document doc = Jsoup.connect(TAG_URL)
|
||||
.header("Authorization", authKey)
|
||||
.data(
|
||||
"a", ACTION,
|
||||
//"a", "user/-/state/com.google/read",
|
||||
"async", "true",
|
||||
"s", SUBS_ID,
|
||||
"i", FEED_ID,
|
||||
"T", authToken)
|
||||
//I also send my API key, but I don't think this is mandatory
|
||||
.userAgent(GoogleReaderConstants.APP_NAME)
|
||||
.timeout(10000)
|
||||
// don't forget the post! (using get() will not work)
|
||||
.post();
|
||||
|
||||
|
||||
if(doc.body().text().equals("OK"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
} catch(IOException e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class HttpHelper {
|
||||
public static String request(HttpResponse response){
|
||||
String result = "";
|
||||
try{
|
||||
InputStream in = response.getEntity().getContent();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
StringBuilder str = new StringBuilder();
|
||||
String line = null;
|
||||
while((line = reader.readLine()) != null){
|
||||
str.append(line + "\n");
|
||||
}
|
||||
in.close();
|
||||
result = str.toString();
|
||||
}catch(Exception ex){
|
||||
result = "Error";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -112,7 +112,7 @@ public class AsyncTask_GetOldItems extends AsyncTask_Reader {
|
|||
Toast.makeText(context, context.getString(R.string.toast_no_more_downloads_available), Toast.LENGTH_LONG).show();
|
||||
else
|
||||
{
|
||||
String text = context.getString(R.string.toast_downloaded_x_items).replace("X", String.valueOf(downloadedItemsCount));
|
||||
String text = context.getResources().getQuantityString(R.plurals.toast_downloaded_x_items, downloadedItemsCount, downloadedItemsCount);
|
||||
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.appwidget.AppWidgetManager;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteCallbackList;
|
||||
import android.os.RemoteException;
|
||||
|
@ -209,8 +210,9 @@ public class OwnCloudSyncService extends Service {
|
|||
|
||||
ComponentName componentInfo = runningTaskInfo.get(0).topActivity;
|
||||
if(!componentInfo.getPackageName().equals("de.luhmer.owncloudnewsreader")) {
|
||||
String tickerText = getString(R.string.notification_new_items_ticker).replace("X", String.valueOf(newItemsCount));
|
||||
String contentText = getString(R.string.notification_new_items_text).replace("X", String.valueOf(newItemsCount));
|
||||
Resources res = getResources();
|
||||
String tickerText = res.getQuantityString(R.plurals.notification_new_items_ticker, newItemsCount, newItemsCount);
|
||||
String contentText = res.getQuantityString(R.plurals.notification_new_items_text, newItemsCount, newItemsCount);
|
||||
String title = getString(R.string.app_name);
|
||||
|
||||
if(mPrefs.getBoolean(SettingsActivity.CB_SHOW_NOTIFICATION_NEW_ARTICLES_STRING, true))//Default is true
|
||||
|
|
|
@ -114,7 +114,7 @@ public class WidgetTodoViewsFactory implements RemoteViewsService.RemoteViewsFac
|
|||
rv.setTextViewText(R.id.feed_title, title);
|
||||
|
||||
|
||||
int resId = rssItem.getRead_temp() ? R.drawable.btn_check_on_holo_dark : R.drawable.btn_check_off_holo_dark;
|
||||
int resId = rssItem.getRead_temp() ? R.drawable.ic_check_box_white : R.drawable.ic_check_box_outline_blank_white;
|
||||
rv.setInt(R.id.cb_lv_item_read, "setBackgroundResource", resId);
|
||||
|
||||
//View viewColor = view.findViewById(R.id.color_line_feed);
|
||||
|
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
News-Android-App/src/main/res/drawable-hdpi/ic_action_delete.png
Normal file
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 161 B |
After Width: | Height: | Size: 204 B |
BIN
News-Android-App/src/main/res/drawable-hdpi/ic_action_pause.png
Normal file
After Width: | Height: | Size: 104 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 422 B |
BIN
News-Android-App/src/main/res/drawable-hdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 252 B |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 568 B |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 983 B |
Before Width: | Height: | Size: 986 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
BIN
News-Android-App/src/main/res/drawable-mdpi/ic_action_delete.png
Normal file
After Width: | Height: | Size: 112 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 127 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 127 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 116 B |
After Width: | Height: | Size: 157 B |
BIN
News-Android-App/src/main/res/drawable-mdpi/ic_action_pause.png
Normal file
After Width: | Height: | Size: 83 B |
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 276 B |
BIN
News-Android-App/src/main/res/drawable-mdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 173 B |
After Width: | Height: | Size: 370 B |
After Width: | Height: | Size: 365 B |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 941 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.5 KiB |