fix some codacy issues
This commit is contained in:
parent
a8a138e1e0
commit
630624eae5
31 changed files with 365 additions and 411 deletions
|
@ -103,7 +103,7 @@ public class NewsReaderListActivityUiTests {
|
|||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
na.ChangeReadStateOfItem(vh, false);
|
||||
na.changeReadStateOfItem(vh, false);
|
||||
}
|
||||
});
|
||||
sleep(0.5f);
|
||||
|
|
|
@ -27,7 +27,7 @@ import static android.support.test.InstrumentationRegistry.registerInstance;
|
|||
public class SyncTests {
|
||||
|
||||
private MockWebServer server;
|
||||
private HttpUrl baseUrl;
|
||||
//private HttpUrl baseUrl;
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<NewsReaderListActivity> mActivityRule = new ActivityTestRule<>(
|
||||
|
@ -43,7 +43,7 @@ public class SyncTests {
|
|||
server = new MockWebServer();
|
||||
server.start();
|
||||
// Ask the server for its URL. You'll need this to make HTTP requests.
|
||||
baseUrl = server.url("/");
|
||||
HttpUrl baseUrl = server.url("/");
|
||||
|
||||
//HttpJsonRequest.init(mActivityRule.getActivity());
|
||||
//HttpJsonRequest.getInstance().setCredentials("test", "test", baseUrl.toString());
|
||||
|
@ -106,7 +106,7 @@ public class SyncTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void testItemSync() throws Exception {
|
||||
public void testItemSync() {
|
||||
JsonObject jItem = new JsonObject();
|
||||
JsonObject jI = new JsonObject();
|
||||
jI.addProperty("id", "-1");
|
||||
|
@ -149,6 +149,7 @@ public class SyncTests {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
private void sleep(float seconds) {
|
||||
try {
|
||||
Thread.sleep((long) seconds * 1000);
|
||||
|
@ -156,5 +157,6 @@ public class SyncTests {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
|
@ -5,14 +5,12 @@ import android.preference.PreferenceManager;
|
|||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -47,7 +45,7 @@ public class ScreenshotTest {
|
|||
private int podcastGroupPosition = 3;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
public void setUp() {
|
||||
activity = mActivityRule.getActivity();
|
||||
nrlf = mActivityRule.getActivity().getSlidingListFragment();
|
||||
nrdf = mActivityRule.getActivity().getNewsReaderDetailFragment();
|
||||
|
@ -123,7 +121,7 @@ public class ScreenshotTest {
|
|||
public void run() {
|
||||
NewsListRecyclerAdapter na = (NewsListRecyclerAdapter) nrdf.getRecyclerView().getAdapter();
|
||||
ViewHolder vh = (ViewHolder) nrdf.getRecyclerView().getChildViewHolder(nrdf.getRecyclerView().getLayoutManager().findViewByPosition(itemPos));
|
||||
na.ChangeReadStateOfItem(vh, false);
|
||||
na.changeReadStateOfItem(vh, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,26 +10,24 @@ import java.util.regex.Pattern;
|
|||
public class Constants {
|
||||
public static final Boolean debugModeWidget = false;
|
||||
|
||||
//public static final String LAST_SYNC = "LAST_SYNC";
|
||||
|
||||
public static final int maxItemsCount = 1500;
|
||||
public static final String LAST_UPDATE_NEW_ITEMS_COUNT_STRING = "LAST_UPDATE_NEW_ITEMS_COUNT_STRING";
|
||||
public static final String NEWS_WEB_VERSION_NUMBER_STRING = "NewsWebVersionNumber";
|
||||
public static final String NOTIFICATION_ACTION_STOP_STRING = "NOTIFICATION_STOP";
|
||||
protected static final String NEWS_WEB_VERSION_NUMBER_STRING = "NewsWebVersionNumber";
|
||||
|
||||
public static final int MIN_NEXTCLOUD_FILES_APP_VERSION_CODE = 30030052;
|
||||
static final int MIN_NEXTCLOUD_FILES_APP_VERSION_CODE = 30030052;
|
||||
|
||||
|
||||
public static boolean IsNextCloud(Context context) {
|
||||
static boolean isNextCloud(Context context) {
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int[] version = ExtractVersionNumberFromString(mPrefs.getString(Constants.NEWS_WEB_VERSION_NUMBER_STRING, ""));
|
||||
int[] version = extractVersionNumberFromString(mPrefs.getString(Constants.NEWS_WEB_VERSION_NUMBER_STRING, ""));
|
||||
if(version[0] >= 9) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int[] ExtractVersionNumberFromString(String appVersion) {
|
||||
private static int[] extractVersionNumberFromString(String appVersion) {
|
||||
Pattern p = Pattern.compile("(\\d+).(\\d+).(\\d+)");
|
||||
Matcher m = p.matcher(appVersion);
|
||||
|
||||
|
@ -41,17 +39,4 @@ public class Constants {
|
|||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/*
|
||||
private static final String _P_KEY_PART1 = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgNmCsMj6M4zkjpKRG8MG5+yIAyqSQE2etVkZsc3s";
|
||||
private static final String _P_KEY_PART2 = "V5zLoQ/NUOVC0fS2tj8IWk6UYqQGk9rmVold3sDGiTCvWGFecjwel3qxzz23hKLlemrv2+0WPrZ5KOqiaCEMi";
|
||||
private static final String _P_KEY_PART3 = "CeQ7zgpcytcQdD9Y/aeaHJ9P27ntn0ub6H1Bx3VDRHm4Jkg6LQnqmdIpEmeIztnoMFlLXTaVKapaFmqJGX9ar";
|
||||
private static final String _P_KEY_PART4 = "RizGd9kqtgAqIP7YnGGDV1vP/MqYpegJkOMOlxhuVvXUsg7t7hBLdGXsJ572DzUK/2/fbZ+PIcG7OF4RgJV7Yb";
|
||||
private static final String _P_KEY_PART5 = "/AVD0ssqydMlwuheOG82FCqhBtw2vShAz7mkWgL0l0u5HQIDAQAB";
|
||||
|
||||
public static String getBase64EncodedPublicKey()
|
||||
{
|
||||
return _P_KEY_PART1 + _P_KEY_PART2 + _P_KEY_PART3 + _P_KEY_PART4 + _P_KEY_PART5;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -21,8 +21,9 @@ import de.luhmer.owncloudnewsreader.helper.FileUtils;
|
|||
import de.luhmer.owncloudnewsreader.model.PodcastItem;
|
||||
|
||||
public class PodcastArrayAdapter extends ArrayAdapter<PodcastItem> {
|
||||
LayoutInflater inflater;
|
||||
EventBus eventBus;
|
||||
|
||||
private LayoutInflater inflater;
|
||||
private EventBus eventBus;
|
||||
|
||||
public PodcastArrayAdapter(Context context, PodcastItem[] values) {
|
||||
super(context, R.layout.podcast_row, values);
|
||||
|
|
|
@ -16,8 +16,9 @@ import de.luhmer.owncloudnewsreader.events.podcast.PodcastFeedClicked;
|
|||
import de.luhmer.owncloudnewsreader.model.PodcastFeedItem;
|
||||
|
||||
public class PodcastFeedArrayAdapter extends ArrayAdapter<PodcastFeedItem> {
|
||||
LayoutInflater inflater;
|
||||
EventBus eventBus;
|
||||
|
||||
private LayoutInflater inflater;
|
||||
private EventBus eventBus;
|
||||
|
||||
public PodcastFeedArrayAdapter(Context context, PodcastFeedItem[] values) {
|
||||
super(context, R.layout.podcast_feed_row, values);
|
||||
|
|
|
@ -68,16 +68,24 @@ import static de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAd
|
|||
public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
private final String TAG = getClass().getCanonicalName();
|
||||
|
||||
private Context mContext;
|
||||
private Context mContext;
|
||||
private DatabaseConnectionOrm dbConn;
|
||||
|
||||
ListView listView;
|
||||
private ListView listView;
|
||||
|
||||
ExpListTextClicked eListTextClickHandler;
|
||||
private ExpListTextClicked eListTextClickHandler;
|
||||
|
||||
private FavIconHandler favIconHandler;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
private ArrayList<AbstractItem> mCategoriesArrayList;
|
||||
private SparseArray<ArrayList<ConcreteFeedItem>> mItemsArrayList;
|
||||
private boolean showOnlyUnread = false;
|
||||
private boolean showOnlyUnread = false;
|
||||
private Integer btn_rating_star_off_normal_holo_light;
|
||||
|
||||
private SparseArray<String> starredCountFeeds;
|
||||
private SparseArray<String> unreadCountFolders;
|
||||
private SparseArray<String> unreadCountFeeds;
|
||||
|
||||
public enum SPECIAL_FOLDERS {
|
||||
ALL_UNREAD_ITEMS(-10), ALL_STARRED_ITEMS(-11), ALL_ITEMS(-12), ITEMS_WITHOUT_FOLDER(-22);
|
||||
|
@ -102,10 +110,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
}
|
||||
}
|
||||
|
||||
private FavIconHandler favIconHandler;
|
||||
|
||||
LayoutInflater inflater;
|
||||
|
||||
public SubscriptionExpandableListAdapter(Context mContext, DatabaseConnectionOrm dbConn, ListView listView)
|
||||
{
|
||||
favIconHandler = new FavIconHandler(mContext);
|
||||
|
@ -354,14 +358,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
viewHolder.imgView.setContentDescription(viewHolder.imgView.getContext().getString(contentDescriptionId));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private Integer btn_rating_star_off_normal_holo_light;
|
||||
|
||||
private int getBtn_rating_star_off_normal_holo_light() {
|
||||
if(btn_rating_star_off_normal_holo_light == null) {
|
||||
if(ThemeChooser.getInstance(mContext).isDarkTheme(mContext)) {
|
||||
|
@ -387,23 +386,16 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SparseArray<String> starredCountFeeds;
|
||||
SparseArray<String> unreadCountFolders;
|
||||
SparseArray<String> unreadCountFeeds;
|
||||
SparseArray<String> urlsToFavIcons;
|
||||
|
||||
|
||||
public void NotifyDataSetChangedAsync() {
|
||||
new NotifyDataSetChangedAsyncTask().execute((Void) null);
|
||||
}
|
||||
|
@ -449,9 +441,9 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
Log.v(TAG, "Remove feed item!!!");
|
||||
mCategoriesArrayList.remove(i);
|
||||
i--;
|
||||
} else {
|
||||
//Log.v(TAG, "Keep.. " + unreadCountFoldersTemp.get(((Long) item.id_database).intValue()));
|
||||
}
|
||||
} /* else {
|
||||
Log.v(TAG, "Keep.. " + unreadCountFoldersTemp.get(((Long) item.id_database).intValue()));
|
||||
} */
|
||||
}
|
||||
|
||||
for (int i = 0; i < mItemsArrayList.size(); i++) {
|
||||
|
@ -487,7 +479,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
stopWatch.start();
|
||||
|
||||
Tuple<ArrayList<AbstractItem>, SparseArray<ArrayList<ConcreteFeedItem>>> ad = ReloadAdapter();
|
||||
//return ReloadAdapter();
|
||||
//return reloadAdapter();
|
||||
|
||||
stopWatch.stop();
|
||||
Log.v(TAG, "Reload Adapter - time taken: " + stopWatch.toString());
|
||||
|
@ -579,7 +571,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
|
|||
public void notifyCountDataSetChanged(SparseArray<String> unreadCountFolders, SparseArray<String> unreadCountFeeds, SparseArray<String> urlsToFavIcons, SparseArray<String> starredCountFeeds) {
|
||||
this.unreadCountFolders = unreadCountFolders;
|
||||
this.unreadCountFeeds = unreadCountFeeds;
|
||||
this.urlsToFavIcons = urlsToFavIcons;
|
||||
SparseArray<String> urlsToFavIcons1 = urlsToFavIcons;
|
||||
this.starredCountFeeds = starredCountFeeds;
|
||||
|
||||
BlockingExpandableListView bView = (BlockingExpandableListView) listView;
|
||||
|
|
|
@ -90,37 +90,37 @@ import static de.luhmer.owncloudnewsreader.Constants.MIN_NEXTCLOUD_FILES_APP_VER
|
|||
*/
|
||||
public class LoginDialogFragment extends DialogFragment {
|
||||
|
||||
final String TAG = LoginDialogFragment.class.getCanonicalName();
|
||||
private final String TAG = LoginDialogFragment.class.getCanonicalName();
|
||||
|
||||
/**
|
||||
* Keep track of the login task to ensure we can cancel it if requested.
|
||||
*/
|
||||
@Inject ApiProvider mApi;
|
||||
@Inject SharedPreferences mPrefs;
|
||||
protected @Inject ApiProvider mApi;
|
||||
protected @Inject SharedPreferences mPrefs;
|
||||
//private UserLoginTask mAuthTask = null;
|
||||
|
||||
private Activity mActivity;
|
||||
private Activity mActivity;
|
||||
|
||||
// Values for email and password at the time of the login attempt.
|
||||
private String mUsername;
|
||||
private String mPassword;
|
||||
private String mOc_root_path;
|
||||
private boolean mCbDisableHostnameVerification;
|
||||
// Values for email and password at the time of the login attempt.
|
||||
private String mUsername;
|
||||
private String mPassword;
|
||||
private String mOc_root_path;
|
||||
private boolean mCbDisableHostnameVerification;
|
||||
|
||||
// UI references.
|
||||
@BindView(R.id.username) EditText mUsernameView;
|
||||
@BindView(R.id.password) EditText mPasswordView;
|
||||
@BindView(R.id.password_container) TextInputLayout mPasswordContainerView;
|
||||
@BindView(R.id.edt_owncloudRootPath) EditText mOc_root_path_View;
|
||||
@BindView(R.id.cb_AllowAllSSLCertificates) CheckBox mCbDisableHostnameVerificationView;
|
||||
@BindView(R.id.imgView_ShowPassword) ImageView mImageViewShowPwd;
|
||||
@BindView(R.id.swSingleSignOn) Switch mSwSingleSignOn;
|
||||
// UI references.
|
||||
protected @BindView(R.id.username) EditText mUsernameView;
|
||||
protected @BindView(R.id.password) EditText mPasswordView;
|
||||
protected @BindView(R.id.password_container) TextInputLayout mPasswordContainerView;
|
||||
protected @BindView(R.id.edt_owncloudRootPath) EditText mOc_root_path_View;
|
||||
protected @BindView(R.id.cb_AllowAllSSLCertificates) CheckBox mCbDisableHostnameVerificationView;
|
||||
protected @BindView(R.id.imgView_ShowPassword) ImageView mImageViewShowPwd;
|
||||
protected @BindView(R.id.swSingleSignOn) Switch mSwSingleSignOn;
|
||||
|
||||
private SingleSignOnAccount importedAccount = null;
|
||||
private boolean mPasswordVisible = false;
|
||||
private LoginSuccessfulListener listener;
|
||||
|
||||
static LoginDialogFragment instance;
|
||||
private static LoginDialogFragment instance;
|
||||
public static LoginDialogFragment getInstance() {
|
||||
if(instance == null)
|
||||
instance = new LoginDialogFragment();
|
||||
|
@ -128,14 +128,10 @@ public class LoginDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
public interface LoginSuccessfulListener {
|
||||
void LoginSucceeded();
|
||||
}
|
||||
void loginSucceeded();
|
||||
}
|
||||
|
||||
public LoginDialogFragment() {
|
||||
|
||||
}
|
||||
|
||||
public void setActivity(Activity mActivity) {
|
||||
public void setActivity(Activity mActivity) {
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
|
@ -476,7 +472,7 @@ public class LoginDialogFragment extends DialogFragment {
|
|||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(getActivity());
|
||||
dbConn.resetDatabase();
|
||||
|
||||
listener.LoginSucceeded();
|
||||
listener.loginSucceeded();
|
||||
LoginDialogFragment.this.getDialog().cancel();
|
||||
if(mActivity instanceof AuthenticatorActivity)
|
||||
mActivity.finish();
|
||||
|
|
|
@ -63,16 +63,19 @@ import retrofit2.Response;
|
|||
|
||||
public class NewFeedActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = NewFeedActivity.class.getCanonicalName();
|
||||
public final static String ADD_NEW_SUCCESS = "success";
|
||||
|
||||
// UI references.
|
||||
@BindView(R.id.et_feed_url) EditText mFeedUrlView;
|
||||
@BindView(R.id.sp_folder) Spinner mFolderView;
|
||||
@BindView(R.id.new_feed_progress) View mProgressView;
|
||||
@BindView(R.id.new_feed_form) View mLoginFormView;
|
||||
@BindView(R.id.btn_addFeed) Button mAddFeedButton;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
protected @BindView(R.id.et_feed_url) EditText mFeedUrlView;
|
||||
protected @BindView(R.id.sp_folder) Spinner mFolderView;
|
||||
protected @BindView(R.id.new_feed_progress) View mProgressView;
|
||||
protected @BindView(R.id.new_feed_form) View mLoginFormView;
|
||||
protected @BindView(R.id.btn_addFeed) Button mAddFeedButton;
|
||||
protected @BindView(R.id.toolbar) Toolbar toolbar;
|
||||
|
||||
private List<Folder> folders;
|
||||
@Inject ApiProvider mApi;
|
||||
protected @Inject ApiProvider mApi;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -254,8 +257,9 @@ public class NewFeedActivity extends AppCompatActivity {
|
|||
final Map<String, Object> feedMap = new HashMap<>(2);
|
||||
feedMap.put("url", feedUrl);
|
||||
feedMap.put("folderId", folderId);
|
||||
|
||||
Feed feed = mApi.getAPI().createFeed(feedMap).execute().body().get(0);
|
||||
//TODO check above!
|
||||
Log.v(TAG, "New Feed-ID: " + feed.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -396,9 +400,6 @@ public class NewFeedActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
public final static String ADD_NEW_SUCCESS = "success";
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -407,6 +408,8 @@ public class NewFeedActivity extends AppCompatActivity {
|
|||
//NavUtils.navigateUpFromSameTask(this);
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
Log.v(TAG, "Unknown option selected..");
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
try
|
||||
{
|
||||
mViewPager.setCurrentItem(item_id, true);
|
||||
PageChanged(item_id);
|
||||
pageChanged(item_id);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
|
||||
@Override
|
||||
public void onPageSelected(int pos) {
|
||||
PageChanged(pos);
|
||||
pageChanged(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -251,7 +251,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
private void PageChanged(int position)
|
||||
private void pageChanged(int position)
|
||||
{
|
||||
StopVideoOnCurrentPage();
|
||||
currentPosition = position;
|
||||
|
@ -284,7 +284,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
{
|
||||
NewsDetailFragment fragment = getNewsDetailFragmentAtPosition(currentPosition);
|
||||
if(fragment != null) // could be null if not instantiated yet
|
||||
fragment.ResumeCurrentPage();
|
||||
fragment.resumeCurrentPage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
{
|
||||
NewsDetailFragment fragment = getNewsDetailFragmentAtPosition(currentPosition);
|
||||
if(fragment != null) // could be null if not instantiated yet
|
||||
fragment.PauseCurrentPage();
|
||||
fragment.pauseCurrentPage();
|
||||
}
|
||||
|
||||
public void UpdateActionBarIcons()
|
||||
|
@ -304,7 +304,7 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
|
|||
|
||||
|
||||
PodcastItem podcastItem = DatabaseConnectionOrm.ParsePodcastItemFromRssItem(this, rssItem);
|
||||
boolean podcastAvailable = !podcastItem.link.equals("");
|
||||
boolean podcastAvailable = !"".equals(podcastItem.link);
|
||||
|
||||
|
||||
if(menuItem_PlayPodcast != null)
|
||||
|
|
|
@ -83,9 +83,9 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
protected @BindView(R.id.progressbar_webview) ProgressBar mProgressbarWebView;
|
||||
protected @BindView(R.id.tv_offline_version) TextView mTvOfflineVersion;
|
||||
|
||||
|
||||
private int section_number;
|
||||
private int section_number;
|
||||
protected String html;
|
||||
boolean changedUrl = false;
|
||||
|
||||
|
||||
public NewsDetailFragment() {
|
||||
|
@ -99,13 +99,13 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
ResumeCurrentPage();
|
||||
resumeCurrentPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
PauseCurrentPage();
|
||||
pauseCurrentPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,8 +116,7 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
}
|
||||
}
|
||||
|
||||
public void PauseCurrentPage()
|
||||
{
|
||||
public void pauseCurrentPage() {
|
||||
if(mWebView != null) {
|
||||
mWebView.onPause();
|
||||
mWebView.pauseTimers();
|
||||
|
@ -125,8 +124,7 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
}
|
||||
|
||||
|
||||
public void ResumeCurrentPage()
|
||||
{
|
||||
public void resumeCurrentPage() {
|
||||
if(mWebView != null) {
|
||||
mWebView.onResume();
|
||||
mWebView.resumeTimers();
|
||||
|
@ -223,10 +221,7 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
boolean changedUrl = false;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private void init_webView() {
|
||||
int backgroundColor = ColorHelper.getColorFromAttribute(getContext(),
|
||||
R.attr.news_detail_background_color);
|
||||
|
@ -399,6 +394,8 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
case WebView.HitTestResult.PHONE_TYPE:
|
||||
case WebView.HitTestResult.EDIT_TEXT_TYPE:
|
||||
break;
|
||||
default:
|
||||
Log.v(TAG, "Unknown type: " + type + ". Skipping..");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,18 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
public enum TYPE { IMAGE, URL }
|
||||
private static final String TAG = NewsDetailImageDialogFragment.class.getCanonicalName();
|
||||
|
||||
private int mDialogIcon;
|
||||
private String mDialogTitle;
|
||||
private String mDialogText;
|
||||
private URL mImageUrl;
|
||||
private TYPE mDialogType;
|
||||
|
||||
private long downloadID;
|
||||
private DownloadManager downloadManager;
|
||||
private BroadcastReceiver downloadCompleteReceiver;
|
||||
|
||||
private LinkedHashMap<String, MenuAction> mMenuItems;
|
||||
|
||||
static NewsDetailImageDialogFragment newInstanceImage(String dialogTitle, Integer titleIcon, String dialogText, URL imageUrl) {
|
||||
NewsDetailImageDialogFragment f = new NewsDetailImageDialogFragment();
|
||||
|
||||
|
@ -65,7 +77,7 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
return f;
|
||||
}
|
||||
|
||||
static NewsDetailImageDialogFragment newInstanceUrl(String dialogTitle, String dialogText) {
|
||||
protected static NewsDetailImageDialogFragment newInstanceUrl(String dialogTitle, String dialogText) {
|
||||
NewsDetailImageDialogFragment f = new NewsDetailImageDialogFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
@ -77,20 +89,6 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
return f;
|
||||
}
|
||||
|
||||
private int mDialogIcon;
|
||||
private String mDialogTitle;
|
||||
private String mDialogText;
|
||||
private URL mImageUrl;
|
||||
private TYPE mDialogType;
|
||||
|
||||
private ListView mListView;
|
||||
|
||||
private long downloadID;
|
||||
private DownloadManager downloadManager;
|
||||
private BroadcastReceiver downloadCompleteReceiver;
|
||||
|
||||
private LinkedHashMap<String, MenuAction> mMenuItems;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -111,8 +109,6 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
public void execute() {
|
||||
if(haveStoragePermission()) {
|
||||
downloadImage(mImageUrl);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +215,7 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
mListView = (ListView) v.findViewById(R.id.ic_menu_item_list);
|
||||
ListView mListView = (ListView) v.findViewById(R.id.ic_menu_item_list);
|
||||
List<String> menuItemsList = new ArrayList<>(mMenuItems.keySet());
|
||||
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(
|
||||
|
@ -272,19 +268,19 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
private void shareImage() {
|
||||
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mDialogText);
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, mImageUrl.toString());
|
||||
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, mDialogText);
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, mImageUrl.toString());
|
||||
startActivity(Intent.createChooser(sharingIntent, getString(R.string.intent_title_share)));
|
||||
dismiss();
|
||||
}
|
||||
|
||||
private void shareLink() {
|
||||
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mDialogTitle);
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, mDialogText);
|
||||
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, mDialogTitle);
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, mDialogText);
|
||||
startActivity(Intent.createChooser(sharingIntent, getString(R.string.intent_title_share)));
|
||||
dismiss();
|
||||
}
|
||||
|
@ -417,7 +413,7 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
String downloadFileLocalUri = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
|
||||
File image = new File(Uri.parse(downloadFileLocalUri).getPath());
|
||||
|
||||
NextcloudNotificationManager.ShowNotificationDownloadSingleImageComplete(context, image);
|
||||
NextcloudNotificationManager.showNotificationDownloadSingleImageComplete(context, image);
|
||||
|
||||
if(isVisible()) {
|
||||
dismiss();
|
||||
|
@ -429,6 +425,8 @@ public class NewsDetailImageDialogFragment extends DialogFragment {
|
|||
dismiss();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "this should never happen! - unknown download status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
return idFeed;
|
||||
}
|
||||
|
||||
Long idFolder;
|
||||
private Long idFolder;
|
||||
/**
|
||||
* @return the idFolder
|
||||
*/
|
||||
|
@ -102,7 +102,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
return idFolder;
|
||||
}
|
||||
|
||||
String titel;
|
||||
private String titel;
|
||||
|
||||
/**
|
||||
* @return the titel
|
||||
|
@ -136,10 +136,11 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
this.titel = titel;
|
||||
((AppCompatActivity)getActivity()).getSupportActionBar().setTitle(titel);
|
||||
|
||||
if(updateListView)
|
||||
UpdateCurrentRssView(getActivity());
|
||||
else
|
||||
RefreshCurrentRssView();
|
||||
if(updateListView) {
|
||||
updateCurrentRssView(getActivity());
|
||||
} else {
|
||||
refreshCurrentRssView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,7 +153,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
|
||||
//When the fragment is instantiated by the xml file, onResume will be called twice
|
||||
if(onResumeCount >= 2) {
|
||||
RefreshCurrentRssView();
|
||||
refreshCurrentRssView();
|
||||
}
|
||||
onResumeCount++;
|
||||
|
||||
|
@ -172,7 +173,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
//Set the item at top to read
|
||||
ViewHolder vh = (ViewHolder) recyclerView.findViewHolderForLayoutPosition(firstVisibleItem);
|
||||
if (vh != null && !vh.shouldStayUnread()) {
|
||||
adapter.ChangeReadStateOfItem(vh, true);
|
||||
adapter.changeReadStateOfItem(vh, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,7 +187,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
if(vhTemp instanceof ViewHolder) { //Check for ViewHolder instance because of ProgressViewHolder
|
||||
vh = (ViewHolder) vhTemp;
|
||||
if (!vh.shouldStayUnread()) {
|
||||
adapter.ChangeReadStateOfItem(vh, true);
|
||||
adapter.changeReadStateOfItem(vh, true);
|
||||
} else {
|
||||
Log.v(TAG, "shouldStayUnread");
|
||||
}
|
||||
|
@ -196,31 +197,29 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
}
|
||||
*/
|
||||
|
||||
public void UpdateMenuItemsState()
|
||||
{
|
||||
public void UpdateMenuItemsState() {
|
||||
NewsReaderListActivity nla = (NewsReaderListActivity)getActivity();
|
||||
if(nla.getMenuItemDownloadMoreItems() != null)
|
||||
{
|
||||
if(idFolder != null && idFolder == SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue()) {
|
||||
if(nla.getMenuItemDownloadMoreItems() != null) {
|
||||
if(idFolder != null && idFolder == SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue()) {
|
||||
nla.getMenuItemDownloadMoreItems().setEnabled(false);
|
||||
} else {
|
||||
nla.getMenuItemDownloadMoreItems().setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyDataSetChangedOnAdapter()
|
||||
{
|
||||
public void notifyDataSetChangedOnAdapter() {
|
||||
NewsListRecyclerAdapter nca = (NewsListRecyclerAdapter) recyclerView.getAdapter();
|
||||
if(nca != null)
|
||||
if(nca != null) {
|
||||
nca.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the current RSS-View
|
||||
*/
|
||||
public void RefreshCurrentRssView() {
|
||||
Log.v(TAG, "RefreshCurrentRssView");
|
||||
public void refreshCurrentRssView() {
|
||||
Log.v(TAG, "refreshCurrentRssView");
|
||||
NewsListRecyclerAdapter nra = ((NewsListRecyclerAdapter) recyclerView.getAdapter());
|
||||
|
||||
if(nra != null) {
|
||||
|
@ -242,8 +241,8 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
* Updates the current RSS-View
|
||||
* @param context
|
||||
*/
|
||||
public void UpdateCurrentRssView(Context context) {
|
||||
Log.v(TAG, "UpdateCurrentRssView");
|
||||
public void updateCurrentRssView(Context context) {
|
||||
Log.v(TAG, "updateCurrentRssView");
|
||||
AsyncTaskHelper.StartAsyncTask(new UpdateCurrentRssViewTask(context));
|
||||
}
|
||||
|
||||
|
@ -474,7 +473,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
|
||||
ViewHolder vh = (ViewHolder) recyclerView.findViewHolderForLayoutPosition(i);
|
||||
if (vh != null && !vh.shouldStayUnread()) {
|
||||
adapter.ChangeReadStateOfItem(vh, true);
|
||||
adapter.changeReadStateOfItem(vh, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,7 +486,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
if(vhTemp instanceof ViewHolder) { //Check for ViewHolder instance because of ProgressViewHolder
|
||||
ViewHolder vh = (ViewHolder) vhTemp;
|
||||
if (!vh.shouldStayUnread()) {
|
||||
adapter.ChangeReadStateOfItem(vh, true);
|
||||
adapter.changeReadStateOfItem(vh, true);
|
||||
} else {
|
||||
Log.v(TAG, "shouldStayUnread");
|
||||
}
|
||||
|
@ -514,7 +513,7 @@ public class NewsReaderDetailFragment extends Fragment {
|
|||
TypedArray a = context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable, R.attr.starredDrawable, R.attr.colorAccent});
|
||||
markAsReadDrawable = a.getDrawable(0);
|
||||
starredDrawable = a.getDrawable(1);
|
||||
int color = Constants.IsNextCloud(getContext()) ? R.color.nextcloudBlue : R.color.owncloudBlue;
|
||||
int color = Constants.isNextCloud(getContext()) ? R.color.nextcloudBlue : R.color.owncloudBlue;
|
||||
accentColor = a.getColor(2, ContextCompat.getColor(context, color));
|
||||
a.recycle();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ import static de.luhmer.owncloudnewsreader.LoginDialogFragment.ShowAlertDialog;
|
|||
* selections.
|
||||
*/
|
||||
public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
||||
NewsReaderListFragment.Callbacks,RecyclerItemClickListener,SwipeRefreshLayout.OnRefreshListener, SearchView.OnQueryTextListener {
|
||||
NewsReaderListFragment.Callbacks, RecyclerItemClickListener, SwipeRefreshLayout.OnRefreshListener, SearchView.OnQueryTextListener {
|
||||
|
||||
private static final String TAG = NewsReaderListActivity.class.getCanonicalName();
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
//private Date mLastSyncDate = new Date(0);
|
||||
private boolean mSyncOnStartupPerformed = false;
|
||||
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
protected @BindView(R.id.toolbar) Toolbar toolbar;
|
||||
|
||||
private ServiceConnection mConnection = null;
|
||||
|
||||
|
@ -151,6 +151,13 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
private PublishSubject<String> searchPublishSubject;
|
||||
private static final int REQUEST_CODE_PERMISSION_DOWNLOAD_WEB_ARCHIVE = 1;
|
||||
|
||||
private static final String ID_FEED_STRING = "ID_FEED_STRING";
|
||||
private static final String IS_FOLDER_BOOLEAN = "IS_FOLDER_BOOLEAN";
|
||||
private static final String OPTIONAL_FOLDER_ID = "OPTIONAL_FOLDER_ID";
|
||||
private static final String LIST_ADAPTER_TOTAL_COUNT = "LIST_ADAPTER_TOTAL_COUNT";
|
||||
private static final String LIST_ADAPTER_PAGE_COUNT = "LIST_ADAPTER_PAGE_COUNT";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences defaultValueSp = getSharedPreferences(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES, Context.MODE_PRIVATE);
|
||||
|
@ -243,13 +250,13 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
}
|
||||
|
||||
if (savedInstanceState == null) {//When the app starts (no orientation change)
|
||||
StartDetailFragment(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue(), true, null, true);
|
||||
startDetailFragment(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue(), true, null, true);
|
||||
}
|
||||
|
||||
//AppRater.app_launched(this);
|
||||
//AppRater.rateNow(this);
|
||||
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,7 +264,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
getSlidingListFragment().showTapLogoToSyncShowcaseView();
|
||||
}
|
||||
|
||||
View.OnClickListener mSnackbarListener = new View.OnClickListener() {
|
||||
private View.OnClickListener mSnackbarListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//Toast.makeText(getActivity(), "button 1 pressed", 3000).show();
|
||||
|
@ -266,13 +273,6 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
};
|
||||
|
||||
|
||||
private static final String ID_FEED_STRING = "ID_FEED_STRING";
|
||||
private static final String IS_FOLDER_BOOLEAN = "IS_FOLDER_BOOLEAN";
|
||||
private static final String OPTIONAL_FOLDER_ID = "OPTIONAL_FOLDER_ID";
|
||||
private static final String LIST_ADAPTER_TOTAL_COUNT = "LIST_ADAPTER_TOTAL_COUNT";
|
||||
private static final String LIST_ADAPTER_PAGE_COUNT = "LIST_ADAPTER_PAGE_COUNT";
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.actionbarsherlock.app.SherlockFragmentActivity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
|
@ -337,7 +337,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
.getRecyclerView()
|
||||
.setAdapter(adapter);
|
||||
|
||||
StartDetailFragment(savedInstanceState.getLong(OPTIONAL_FOLDER_ID),
|
||||
startDetailFragment(savedInstanceState.getLong(OPTIONAL_FOLDER_ID),
|
||||
savedInstanceState.getBoolean(IS_FOLDER_BOOLEAN),
|
||||
savedInstanceState.getLong(ID_FEED_STRING),
|
||||
false);
|
||||
|
@ -383,12 +383,12 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
NewsReaderDetailFragment ndf = getNewsReaderDetailFragment();
|
||||
if (ndf != null) {
|
||||
//ndf.reloadAdapterFromScratch();
|
||||
ndf.UpdateCurrentRssView(NewsReaderListActivity.this);
|
||||
ndf.updateCurrentRssView(NewsReaderListActivity.this);
|
||||
}
|
||||
}
|
||||
|
||||
public void switchToAllUnreadItemsFolder() {
|
||||
StartDetailFragment(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue(), true, null, true);
|
||||
startDetailFragment(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS.getValue(), true, null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -437,7 +437,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
mLastSyncDate = new Date();
|
||||
}*/
|
||||
}
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -466,18 +466,18 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
} else {
|
||||
Toast.makeText(NewsReaderListActivity.this, exception.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
syncFinishedHandler();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(SyncStartedEvent event) {
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(SyncFinishedEvent event) {
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
syncFinishedHandler();
|
||||
}
|
||||
|
||||
|
@ -496,9 +496,9 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
sequence.start();
|
||||
|
||||
NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
|
||||
newsReaderListFragment.ReloadAdapter();
|
||||
newsReaderListFragment.reloadAdapter();
|
||||
UpdateItemList();
|
||||
UpdatePodcastView();
|
||||
updatePodcastView();
|
||||
|
||||
getSlidingListFragment().startAsyncTaskGetUserInfo();
|
||||
|
||||
|
@ -536,7 +536,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
protected void onResume() {
|
||||
NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
|
||||
if (newsReaderListFragment != null) {
|
||||
newsReaderListFragment.ReloadAdapter();
|
||||
newsReaderListFragment.reloadAdapter();
|
||||
newsReaderListFragment.bindUserInfoToUI();
|
||||
}
|
||||
invalidateOptionsMenu();
|
||||
|
@ -553,11 +553,11 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
* that the item with the given ID was selected.
|
||||
*/
|
||||
@Override
|
||||
public void onTopItemClicked(long idFeed, boolean isFolder, Long optional_folder_id) {
|
||||
public void onTopItemClicked(long idFeed, boolean isFolder, long optional_folder_id) {
|
||||
if (drawerLayout != null)
|
||||
drawerLayout.closeDrawer(GravityCompat.START);
|
||||
|
||||
StartDetailFragment(idFeed, isFolder, optional_folder_id, true);
|
||||
startDetailFragment(idFeed, isFolder, optional_folder_id, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -565,21 +565,21 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
if (drawerLayout != null)
|
||||
drawerLayout.closeDrawer(GravityCompat.START);
|
||||
|
||||
StartDetailFragment(idFeed, false, optional_folder_id, true);
|
||||
startDetailFragment(idFeed, false, optional_folder_id, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTopItemLongClicked(long idFeed, boolean isFolder, Long optional_folder_id) {
|
||||
StartDialogFragment(idFeed, isFolder, optional_folder_id);
|
||||
public void onTopItemLongClicked(long idFeed, boolean isFolder) {
|
||||
startDialogFragment(idFeed, isFolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildItemLongClicked(long idFeed, Long optional_folder_id) {
|
||||
StartDialogFragment(idFeed, false, optional_folder_id);
|
||||
public void onChildItemLongClicked(long idFeed) {
|
||||
startDialogFragment(idFeed, false);
|
||||
}
|
||||
|
||||
|
||||
private void StartDialogFragment(long idFeed, Boolean isFolder, Long optional_folder_id) {
|
||||
private void startDialogFragment(long idFeed, Boolean isFolder) {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(getApplicationContext());
|
||||
|
||||
if (isFolder) {
|
||||
|
@ -607,7 +607,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
}
|
||||
|
||||
|
||||
private NewsReaderDetailFragment StartDetailFragment(long id, Boolean folder, Long optional_folder_id, boolean updateListView)
|
||||
private NewsReaderDetailFragment startDetailFragment(long id, Boolean folder, Long optional_folder_id, boolean updateListView)
|
||||
{
|
||||
if(menuItemDownloadMoreItems != null) {
|
||||
menuItemDownloadMoreItems.setEnabled(true);
|
||||
|
@ -617,29 +617,29 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
|
||||
Long feedId = null;
|
||||
Long folderId;
|
||||
String titel = null;
|
||||
String title = null;
|
||||
|
||||
if(!folder)
|
||||
{
|
||||
feedId = id;
|
||||
folderId = optional_folder_id;
|
||||
titel = dbConn.getFeedById(id).getFeedTitle();
|
||||
title = dbConn.getFeedById(id).getFeedTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
folderId = id;
|
||||
int idFolder = (int) id;
|
||||
if(idFolder >= 0)
|
||||
titel = dbConn.getFolderById(id).getLabel();
|
||||
title = dbConn.getFolderById(id).getLabel();
|
||||
else if(idFolder == -10)
|
||||
titel = getString(R.string.allUnreadFeeds);
|
||||
title = getString(R.string.allUnreadFeeds);
|
||||
else if(idFolder == -11)
|
||||
titel = getString(R.string.starredFeeds);
|
||||
title = getString(R.string.starredFeeds);
|
||||
|
||||
}
|
||||
|
||||
NewsReaderDetailFragment fragment = getNewsReaderDetailFragment();
|
||||
fragment.setData(feedId, folderId, titel, updateListView);
|
||||
fragment.setData(feedId, folderId, title, updateListView);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
@ -676,12 +676,12 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
ContentResolver.requestSync(acc, AccountGeneral.ACCOUNT_TYPE, accBundle);
|
||||
//http://stackoverflow.com/questions/5253858/why-does-contentresolver-requestsync-not-trigger-a-sync
|
||||
} else {
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateButtonLayout()
|
||||
public void updateButtonLayout()
|
||||
{
|
||||
NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
|
||||
NewsReaderDetailFragment newsReaderDetailFragment = getNewsReaderDetailFragment();
|
||||
|
@ -728,7 +728,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
if(ndf != null)
|
||||
ndf.UpdateMenuItemsState();
|
||||
|
||||
UpdateButtonLayout();
|
||||
updateButtonLayout();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
dbConn2.markAllItemsAsReadForCurrentView();
|
||||
|
||||
reloadCountNumbersOfSlidingPaneAdapter();
|
||||
ndf.RefreshCurrentRssView();
|
||||
ndf.refreshCurrentRssView();
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -992,7 +992,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
dialog.setActivity(activity);
|
||||
dialog.setListener(new LoginSuccessfulListener() {
|
||||
@Override
|
||||
public void LoginSucceeded() {
|
||||
public void loginSucceeded() {
|
||||
((NewsReaderListActivity) activity).resetUiAndStartSync();
|
||||
}
|
||||
});
|
||||
|
@ -1000,7 +1000,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
}
|
||||
|
||||
private void resetUiAndStartSync() {
|
||||
getSlidingListFragment().ReloadAdapter();
|
||||
getSlidingListFragment().reloadAdapter();
|
||||
updateCurrentRssView();
|
||||
startSync();
|
||||
getSlidingListFragment().bindUserInfoToUI();
|
||||
|
@ -1021,7 +1021,7 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(currentUrl));
|
||||
startActivity(browserIntent);
|
||||
|
||||
((NewsListRecyclerAdapter) getNewsReaderDetailFragment().getRecyclerView().getAdapter()).ChangeReadStateOfItem(vh, true);
|
||||
((NewsListRecyclerAdapter) getNewsReaderDetailFragment().getRecyclerView().getAdapter()).changeReadStateOfItem(vh, true);
|
||||
} else {
|
||||
Intent intentNewsDetailAct = new Intent(this, NewsDetailActivity.class);
|
||||
|
||||
|
|
|
@ -44,6 +44,38 @@ import io.reactivex.schedulers.Schedulers;
|
|||
|
||||
public class NewsReaderListDialogFragment extends DialogFragment{
|
||||
|
||||
protected @Inject ApiProvider mApi;
|
||||
|
||||
private long mFeedId;
|
||||
private String mDialogTitle;
|
||||
private String mDialogText;
|
||||
private String mDialogIconUrl;
|
||||
|
||||
private LinkedHashMap<String, MenuAction> mMenuItems;
|
||||
private NewsReaderListActivity parentActivity;
|
||||
|
||||
protected @BindView(R.id.lv_menu_list) ListView mListView;
|
||||
protected @BindView(R.id.folder_list) ListView mFolderList;
|
||||
|
||||
protected @BindView(R.id.tv_menu_title) TextView tvTitle;
|
||||
protected @BindView(R.id.tv_menu_text) TextView tvText;
|
||||
|
||||
protected @BindView(R.id.ic_menu_feedicon) ImageView imgTitle;
|
||||
|
||||
protected @BindView(R.id.remove_feed_dialog) RelativeLayout mRemoveFeedDialogView;
|
||||
protected @BindView(R.id.rename_feed_dialog) RelativeLayout mRenameFeedDialogView;
|
||||
protected @BindView(R.id.move_feed_dialog) RelativeLayout mMoveFeedDialogView;
|
||||
|
||||
protected @BindView(R.id.progressView) RelativeLayout mProgressView;
|
||||
|
||||
protected @BindView(R.id.button_remove_confirm) Button mButtonRemoveConfirm;
|
||||
protected @BindView(R.id.button_remove_cancel) Button mButtonRemoveCancel;
|
||||
protected @BindView(R.id.button_rename_confirm) Button mButtonRenameConfirm;
|
||||
protected @BindView(R.id.button_rename_cancel) Button mButtonRenameCancel;
|
||||
|
||||
protected @BindView(R.id.renamefeed_feedname) EditText mFeedName;
|
||||
|
||||
|
||||
static NewsReaderListDialogFragment newInstance(long feedId, String dialogTitle, String iconurl, String feedurl) {
|
||||
NewsReaderListDialogFragment f = new NewsReaderListDialogFragment();
|
||||
|
||||
|
@ -58,40 +90,6 @@ public class NewsReaderListDialogFragment extends DialogFragment{
|
|||
}
|
||||
|
||||
|
||||
@Inject ApiProvider mApi;
|
||||
|
||||
private long mFeedId;
|
||||
private String mDialogTitle;
|
||||
private String mDialogText;
|
||||
private String mDialogIconUrl;
|
||||
|
||||
private LinkedHashMap<String, MenuAction> mMenuItems;
|
||||
|
||||
private NewsReaderListActivity parentActivity;
|
||||
|
||||
@BindView(R.id.lv_menu_list) ListView mListView;
|
||||
@BindView(R.id.folder_list) ListView mFolderList;
|
||||
|
||||
@BindView(R.id.tv_menu_title) TextView tvTitle;
|
||||
@BindView(R.id.tv_menu_text) TextView tvText;
|
||||
|
||||
@BindView(R.id.ic_menu_feedicon) ImageView imgTitle;
|
||||
|
||||
@BindView(R.id.remove_feed_dialog) RelativeLayout mRemoveFeedDialogView;
|
||||
@BindView(R.id.rename_feed_dialog) RelativeLayout mRenameFeedDialogView;
|
||||
@BindView(R.id.move_feed_dialog) RelativeLayout mMoveFeedDialogView;
|
||||
|
||||
@BindView(R.id.progressView) RelativeLayout mProgressView;
|
||||
|
||||
@BindView(R.id.button_remove_confirm) Button mButtonRemoveConfirm;
|
||||
@BindView(R.id.button_remove_cancel) Button mButtonRemoveCancel;
|
||||
@BindView(R.id.button_rename_confirm) Button mButtonRenameConfirm;
|
||||
@BindView(R.id.button_rename_cancel) Button mButtonRenameCancel;
|
||||
|
||||
@BindView(R.id.renamefeed_feedname) EditText mFeedName;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -243,7 +241,7 @@ public class NewsReaderListDialogFragment extends DialogFragment{
|
|||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(getContext());
|
||||
dbConn.renameFeedById(mFeedId, mFeedName.getText().toString());
|
||||
|
||||
parentActivity.getSlidingListFragment().ReloadAdapter();
|
||||
parentActivity.getSlidingListFragment().reloadAdapter();
|
||||
parentActivity.startSync();
|
||||
|
||||
dismiss();
|
||||
|
@ -290,7 +288,7 @@ public class NewsReaderListDialogFragment extends DialogFragment{
|
|||
if(currentFeedId != null && currentFeedId == mFeedId) {
|
||||
parentActivity.switchToAllUnreadItemsFolder();
|
||||
}
|
||||
parentActivity.getSlidingListFragment().ReloadAdapter();
|
||||
parentActivity.getSlidingListFragment().reloadAdapter();
|
||||
parentActivity.updateCurrentRssView();
|
||||
|
||||
dismiss();
|
||||
|
@ -349,7 +347,7 @@ public class NewsReaderListDialogFragment extends DialogFragment{
|
|||
Feed feed = dbConn.getFeedById(mFeedId);
|
||||
feed.setFolder(folder);
|
||||
|
||||
parentActivity.getSlidingListFragment().ReloadAdapter();
|
||||
parentActivity.getSlidingListFragment().reloadAdapter();
|
||||
parentActivity.startSync();
|
||||
|
||||
dismiss();
|
||||
|
|
|
@ -76,8 +76,14 @@ import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
|
|||
*/
|
||||
public class NewsReaderListFragment extends Fragment implements OnCreateContextMenuListener {
|
||||
|
||||
@Inject ApiProvider mApi;
|
||||
@Inject SharedPreferences mPrefs;
|
||||
protected @Inject ApiProvider mApi;
|
||||
protected @Inject SharedPreferences mPrefs;
|
||||
|
||||
/**
|
||||
* The fragment's current callback object, which is notified of list item
|
||||
* clicks.
|
||||
*/
|
||||
private Callbacks mCallbacks = null;
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -87,16 +93,10 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
lvAdapter.NotifyDataSetChangedAsync();
|
||||
}
|
||||
|
||||
public void ReloadAdapter() {
|
||||
public void reloadAdapter() {
|
||||
lvAdapter.ReloadAdapterAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
* The fragment's current callback object, which is notified of list item
|
||||
* clicks.
|
||||
*/
|
||||
private Callbacks mCallbacks = null;
|
||||
|
||||
public void setRefreshing(boolean isRefreshing) {
|
||||
if(isRefreshing) {
|
||||
//headerLogo.setImageResource(R.drawable.ic_launcher_background);
|
||||
|
@ -119,9 +119,9 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
* Callback for when an item has been selected.
|
||||
*/
|
||||
void onChildItemClicked(long idFeed, Long optional_folder_id);
|
||||
void onTopItemClicked(long idFeed, boolean isFolder, Long optional_folder_id);
|
||||
void onChildItemLongClicked(long idFeed, Long optional_folder_id);
|
||||
void onTopItemLongClicked(long idFeed, boolean isFolder, Long optional_folder_id);
|
||||
void onTopItemClicked(long idFeed, boolean isFolder, long onTopItemClicked);
|
||||
void onChildItemLongClicked(long idFeed);
|
||||
void onTopItemLongClicked(long idFeed, boolean isFolder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
if(!Constants.IsNextCloud(getContext())) {
|
||||
if(!Constants.isNextCloud(getContext())) {
|
||||
// Set ownCloud view
|
||||
headerView.setBackgroundResource(R.drawable.left_drawer_header_background);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
});
|
||||
|
||||
lvAdapter.notifyDataSetChanged();
|
||||
ReloadAdapter();
|
||||
reloadAdapter();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
|
||||
@Override
|
||||
public void onTextLongClicked(long idFeed, boolean isFolder, Long optional_folder_id) {
|
||||
mCallbacks.onTopItemLongClicked(idFeed, isFolder, optional_folder_id);
|
||||
mCallbacks.onTopItemLongClicked(idFeed, isFolder);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -242,7 +242,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
|
|||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
|
||||
int childPosition = ExpandableListView.getPackedPositionChild(id);
|
||||
mCallbacks.onChildItemLongClicked(childPosition, null);
|
||||
mCallbacks.onChildItemLongClicked(childPosition);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -83,6 +83,17 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
@BindView(R.id.sliding_layout) PodcastSlidingUpPanelLayout sliding_layout;
|
||||
//YouTubePlayerFragment youtubeplayerfragment;
|
||||
|
||||
private boolean currentlyPlaying = false;
|
||||
private boolean showedYoutubeFeatureNotAvailableDialog = false;
|
||||
private boolean videoViewInitialized = false;
|
||||
private boolean isVideoViewVisible = true;
|
||||
|
||||
|
||||
private static final int animationTime = 300; //Milliseconds
|
||||
private boolean isFullScreen = false;
|
||||
private float scaleFactor = 1;
|
||||
private boolean useAnimation = false;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -138,7 +149,7 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
|
||||
rlVideoPodcastSurfaceWrapper.setVisibility(View.INVISIBLE);
|
||||
|
||||
UpdatePodcastView();
|
||||
updatePodcastView();
|
||||
|
||||
if(isMyServiceRunning(PodcastPlaybackService.class, this)) {
|
||||
Intent intent = new Intent(this, PodcastPlaybackService.class);
|
||||
|
@ -212,13 +223,13 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
WidgetProvider.UpdateWidget(this);
|
||||
|
||||
|
||||
if(NextcloudNotificationManager.IsUnreadRssCountNotificationVisible(this)) {
|
||||
if(NextcloudNotificationManager.isUnreadRssCountNotificationVisible(this)) {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(this);
|
||||
int count = Integer.parseInt(dbConn.getUnreadItemsCountForSpecificFolder(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS));
|
||||
NextcloudNotificationManager.ShowUnreadRssItemsNotification(this, count);
|
||||
NextcloudNotificationManager.showUnreadRssItemsNotification(this, count);
|
||||
|
||||
if(count == 0) {
|
||||
NextcloudNotificationManager.RemoveRssItemsNotification(this);
|
||||
NextcloudNotificationManager.removeRssItemsNotification(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,7 +286,7 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void UpdatePodcastView() {
|
||||
protected void updatePodcastView() {
|
||||
|
||||
if(mPodcastFragment != null) {
|
||||
getSupportFragmentManager().beginTransaction().remove(mPodcastFragment).commitAllowingStateLoss();
|
||||
|
@ -290,11 +301,6 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
sliding_layout.setPanelHeight(0);
|
||||
}
|
||||
|
||||
boolean currentlyPlaying = false;
|
||||
boolean showedYoutubeFeatureNotAvailableDialog = false;
|
||||
|
||||
boolean videoViewInitialized = false;
|
||||
boolean isVideoViewVisible = true;
|
||||
@Subscribe
|
||||
public void onEvent(UpdatePodcastStatusEvent podcast) {
|
||||
boolean playStateChanged = currentlyPlaying;
|
||||
|
@ -396,13 +402,6 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static final int animationTime = 300; //Milliseconds
|
||||
float oldScaleFactor = 1;
|
||||
boolean isFullScreen = false;
|
||||
float scaleFactor = 1;
|
||||
boolean useAnimation = false;
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(VideoDoubleClicked videoDoubleClicked) {
|
||||
appHeight = getWindow().getDecorView().findViewById(android.R.id.content).getHeight();
|
||||
|
@ -417,7 +416,7 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
//hideSystemUI();
|
||||
|
||||
rlVideoPodcastSurfaceWrapper.setDisableScale(true);
|
||||
oldScaleFactor = rlVideoPodcastSurfaceWrapper.getScaleFactor();
|
||||
//oldScaleFactor = rlVideoPodcastSurfaceWrapper.getScaleFactor();
|
||||
|
||||
final View view = rlVideoPodcastSurfaceWrapper;
|
||||
|
||||
|
@ -571,17 +570,12 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
|
|||
view.setScaleY(oldScaleFactor);
|
||||
view.getLayoutParams().height = height;
|
||||
view.getLayoutParams().width = width;
|
||||
*/
|
||||
oldScaleFactor = 1;
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
float dipToPx(float dip) {
|
||||
Resources r = getResources();
|
||||
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, r.getDisplayMetrics());
|
||||
return px;
|
||||
private float dipToPx(float dip) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
|
|
@ -53,6 +53,7 @@ import android.support.v7.widget.AppCompatRadioButton;
|
|||
import android.support.v7.widget.AppCompatSpinner;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -81,18 +82,20 @@ import de.luhmer.owncloudnewsreader.services.DownloadWebPageService;
|
|||
* API Guide</a> for more information on developing a Settings UI.
|
||||
*/
|
||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
/**
|
||||
* Determines whether to always show the simplified settings UI, where
|
||||
* settings are presented in a single list. When false, settings are shown
|
||||
* as a master/detail two-pane view on tablets. When true, a single pane is
|
||||
* shown on tablets.
|
||||
*/
|
||||
private static final boolean ALWAYS_SIMPLE_PREFS = false;
|
||||
public static final String EDT_USERNAME_STRING = "edt_username";
|
||||
public static final String EDT_PASSWORD_STRING = "edt_password";
|
||||
public static final String EDT_OWNCLOUDROOTPATH_STRING = "edt_owncloudRootPath";
|
||||
public static final String SW_USE_SINGLE_SIGN_ON = "sw_use_single_sign_on";
|
||||
public static final String EDT_CLEAR_CACHE = "edt_clearCache";
|
||||
|
||||
private static final String TAG = SettingsActivity.class.getCanonicalName();
|
||||
|
||||
/**
|
||||
* Determines whether to always show the simplified settings UI, where
|
||||
* settings are presented in a single list. When false, settings are shown
|
||||
* as a master/detail two-pane view on tablets. When true, a single pane is
|
||||
* shown on tablets.
|
||||
*/
|
||||
public static final String EDT_USERNAME_STRING = "edt_username";
|
||||
public static final String EDT_PASSWORD_STRING = "edt_password";
|
||||
public static final String EDT_OWNCLOUDROOTPATH_STRING = "edt_owncloudRootPath";
|
||||
public static final String SW_USE_SINGLE_SIGN_ON = "sw_use_single_sign_on";
|
||||
public static final String EDT_CLEAR_CACHE = "edt_clearCache";
|
||||
|
||||
//public static final String CB_ALLOWALLSSLCERTIFICATES_STRING = "cb_AllowAllSSLCertificates";
|
||||
public static final String CB_SYNCONSTARTUP_STRING = "cb_AutoSyncOnStart";
|
||||
|
@ -119,15 +122,15 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||
public static final String CACHE_CLEARED = "CACHE_CLEARED";
|
||||
public static final String SP_MAX_CACHE_SIZE = "sp_max_cache_size";
|
||||
public static final String SP_SORT_ORDER = "sp_sort_order";
|
||||
public static final String SP_DISPLAY_BROWSER = "sp_display_browser";
|
||||
public static final String SP_SEARCH_IN = "sp_search_in";
|
||||
public static final String SP_DISPLAY_BROWSER = "sp_display_browser";
|
||||
public static final String SP_SEARCH_IN = "sp_search_in";
|
||||
|
||||
|
||||
//public static final String PREF_SIGN_IN_DIALOG = "sPref_signInDialog";
|
||||
//public static final String SP_MAX_ITEMS_SYNC = "sync_max_items";
|
||||
|
||||
static EditTextPreference clearCachePref;
|
||||
static Activity _mActivity;
|
||||
private static EditTextPreference clearCachePref;
|
||||
private static Activity _mActivity;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -389,6 +392,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||
return new AppCompatRadioButton(this, attrs);
|
||||
case "CheckedTextView":
|
||||
return new AppCompatCheckedTextView(this, attrs);
|
||||
default:
|
||||
Log.v(TAG, "Error. Didn't find view of type: " + name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,8 @@ import android.content.SharedPreferences;
|
|||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -42,7 +40,6 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
|
||||
private List<RssItem> lazyList;
|
||||
private DatabaseConnectionOrm dbConn;
|
||||
private ForegroundColorSpan bodyForegroundColor;
|
||||
private PostDelayHandler pDelayHandler;
|
||||
private FragmentActivity activity;
|
||||
private HashSet<Long> stayUnreadItems = new HashSet<>();
|
||||
|
@ -79,16 +76,11 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
|
||||
pDelayHandler = new PostDelayHandler(activity);
|
||||
|
||||
bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(activity, android.R.color.secondary_text_dark));
|
||||
|
||||
dbConn = new DatabaseConnectionOrm(activity);
|
||||
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
setHasStableIds(true);
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
|
||||
|
||||
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||
|
||||
final LinearLayoutManager linearLayoutManager =
|
||||
|
@ -179,6 +171,8 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
case 4:
|
||||
layout = R.layout.subscription_detail_list_item_card_view;
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "Unknown layout..");
|
||||
}
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(layout, parent, false);
|
||||
|
||||
|
@ -243,7 +237,7 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
EventBus.getDefault().register(holder);
|
||||
}
|
||||
|
||||
public void ChangeReadStateOfItem(ViewHolder viewHolder, boolean isChecked) {
|
||||
public void changeReadStateOfItem(ViewHolder viewHolder, boolean isChecked) {
|
||||
RssItem rssItem = viewHolder.getRssItem();
|
||||
if (rssItem.getRead_temp() != isChecked) { //Only perform database operations if really needed
|
||||
rssItem.setRead_temp(isChecked);
|
||||
|
@ -261,7 +255,7 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
public void toggleReadStateOfItem(ViewHolder viewHolder) {
|
||||
RssItem rssItem = viewHolder.getRssItem();
|
||||
boolean isRead = !rssItem.getRead_temp();
|
||||
ChangeReadStateOfItem(viewHolder, isRead);
|
||||
changeReadStateOfItem(viewHolder, isRead);
|
||||
}
|
||||
|
||||
public void toggleStarredStateOfItem(ViewHolder viewHolder) {
|
||||
|
@ -269,7 +263,7 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
|
|||
boolean isStarred = !rssItem.getStarred_temp();
|
||||
rssItem.setStarred_temp(isStarred);
|
||||
if (isStarred) {
|
||||
ChangeReadStateOfItem(viewHolder, true);
|
||||
changeReadStateOfItem(viewHolder, true);
|
||||
} else {
|
||||
dbConn.updateRssItem(rssItem);
|
||||
pDelayHandler.DelayTimer();
|
||||
|
|
|
@ -33,6 +33,18 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
private static final double HEADING_FONT_SIZE = 1.1;
|
||||
private static final double SUBSCRIPT_FONT_SIZE = 0.7;
|
||||
|
||||
private static Pattern PATTERN_PRELOAD_VIDEOS_REMOVE = Pattern.compile("(<video[^>]*)(preload=\".*?\")(.*?>)");
|
||||
private static Pattern PATTERN_PRELOAD_VIDEOS_INSERT = Pattern.compile("(<video[^>]*)(.*?)(.*?>)");
|
||||
private static Pattern PATTERN_AUTOPLAY_VIDEOS_1 = Pattern.compile("(<video[^>]*)(autoplay=\".*?\")(.*?>)");
|
||||
private static Pattern PATTERN_AUTOPLAY_VIDEOS_2 = Pattern.compile("(<video[^>]*)(\\sautoplay)(.*?>)");
|
||||
private static Pattern PATTERN_AUTOPLAY_REGEX_CB = Pattern.compile("(.*?)^(Unser Feedsponsor:\\s*<\\/p><p>\\s*.*?\\s*<\\/p>)(.*)", Pattern.MULTILINE);
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private RssItem mRssItem;
|
||||
private Listener mListener;
|
||||
|
||||
|
||||
public interface Listener {
|
||||
/**
|
||||
* The RSS item has successfully been parsed.
|
||||
|
@ -42,11 +54,6 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
}
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private RssItem mRssItem;
|
||||
private Listener mListener;
|
||||
|
||||
|
||||
public RssItemToHtmlTask(Context context, RssItem rssItem, Listener listener) {
|
||||
this.mContext = context;
|
||||
this.mRssItem = rssItem;
|
||||
|
@ -80,13 +87,13 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
R.attr.dividerLineColor,
|
||||
R.attr.rssItemListBackground);
|
||||
|
||||
int feedColor = colors[0];
|
||||
//int feedColor = colors[0];
|
||||
if (feed != null) {
|
||||
feedTitle = StringEscapeUtils.escapeHtml4(feed.getFeedTitle());
|
||||
favIconUrl = feed.getFaviconUrl();
|
||||
if(feed.getAvgColour() != null) {
|
||||
feedColor = Integer.parseInt(feed.getAvgColour());
|
||||
}
|
||||
//if(feed.getAvgColour() != null) {
|
||||
// feedColor = Integer.parseInt(feed.getAvgColour());
|
||||
//}
|
||||
}
|
||||
|
||||
if (favIconUrl != null) {
|
||||
|
@ -100,7 +107,8 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
}
|
||||
|
||||
String body_id;
|
||||
switch(ThemeChooser.getInstance(context).getSelectedTheme(context, false)) {
|
||||
int selectedTheme = ThemeChooser.getInstance(context).getSelectedTheme(context, false);
|
||||
switch(selectedTheme) {
|
||||
case 0: // Auto (Light / Dark)
|
||||
body_id = ThemeChooser.getInstance(context).isDarkTheme(context) ? "darkTheme" : "lightTheme";
|
||||
break;
|
||||
|
@ -121,7 +129,7 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
|
||||
boolean isRightToLeft = context.getResources().getBoolean(R.bool.is_right_to_left);
|
||||
String rtlClass = isRightToLeft ? "rtl" : "";
|
||||
String borderSide = isRightToLeft ? "right" : "left";
|
||||
//String borderSide = isRightToLeft ? "right" : "left";
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
|
@ -219,15 +227,6 @@ public class RssItemToHtmlTask extends AsyncTask<Void, Void, String> {
|
|||
return text;
|
||||
}
|
||||
|
||||
private static Pattern PATTERN_PRELOAD_VIDEOS_REMOVE = Pattern.compile("(<video[^>]*)(preload=\".*?\")(.*?>)");
|
||||
private static Pattern PATTERN_PRELOAD_VIDEOS_INSERT = Pattern.compile("(<video[^>]*)(.*?)(.*?>)");
|
||||
|
||||
private static Pattern PATTERN_AUTOPLAY_VIDEOS_1 = Pattern.compile("(<video[^>]*)(autoplay=\".*?\")(.*?>)");
|
||||
private static Pattern PATTERN_AUTOPLAY_VIDEOS_2 = Pattern.compile("(<video[^>]*)(\\sautoplay)(.*?>)");
|
||||
|
||||
private static Pattern PATTERN_AUTOPLAY_REGEX_CB = Pattern.compile("(.*?)^(Unser Feedsponsor:\\s*<\\/p><p>\\s*.*?\\s*<\\/p>)(.*)", Pattern.MULTILINE);
|
||||
|
||||
|
||||
private static String replacePatternInText(Pattern pattern, String text, String replacement) {
|
||||
Matcher m = pattern.matcher(text);
|
||||
return m.replaceAll(replacement);
|
||||
|
|
|
@ -52,12 +52,13 @@ public class DatabaseConnectionOrm {
|
|||
}
|
||||
};
|
||||
|
||||
public static final String[] VIDEO_FORMATS = { "youtube", "video/mp4" };
|
||||
private final String TAG = getClass().getCanonicalName();
|
||||
|
||||
private static final String[] VIDEO_FORMATS = { "youtube", "video/mp4" };
|
||||
public enum SORT_DIRECTION { asc, desc }
|
||||
|
||||
DaoSession daoSession;
|
||||
private DaoSession daoSession;
|
||||
|
||||
private final static int PageSize = 100;
|
||||
|
||||
public void resetDatabase() {
|
||||
daoSession.getRssItemDao().deleteAll();
|
||||
|
@ -263,7 +264,7 @@ public class DatabaseConnectionOrm {
|
|||
* @param itemIds
|
||||
* @param markAsStarred
|
||||
*/
|
||||
public void change_starrUnstarrStateOfItem(List<String> itemIds, boolean markAsStarred)
|
||||
public void changeStarrUnstarrStateOfItem(List<String> itemIds, boolean markAsStarred)
|
||||
{
|
||||
if(itemIds != null)
|
||||
for(String idItem : itemIds)
|
||||
|
@ -433,8 +434,6 @@ public class DatabaseConnectionOrm {
|
|||
|
||||
}
|
||||
|
||||
public final static int PageSize = 100;
|
||||
|
||||
public List<RssItem> getCurrentRssItemView(int page) {
|
||||
if(page != -1) {
|
||||
String where_clause = ", " + CurrentRssItemViewDao.TABLENAME + " C "
|
||||
|
@ -757,10 +756,8 @@ public class DatabaseConnectionOrm {
|
|||
Cursor cursor = daoSession.getDatabase().rawQuery(buildSQL, null);
|
||||
try
|
||||
{
|
||||
if(cursor != null)
|
||||
{
|
||||
if(cursor.moveToFirst())
|
||||
result = cursor.getLong(0);
|
||||
if(cursor != null && cursor.moveToFirst()) {
|
||||
result = cursor.getLong(0);
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
|
|
|
@ -46,14 +46,10 @@ public class ApiProvider {
|
|||
this.context = context;
|
||||
initApi(new NextcloudAPI.ApiConnectedListener() {
|
||||
@Override
|
||||
public void onConnected() {
|
||||
|
||||
}
|
||||
public void onConnected() { }
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
}
|
||||
public void onError(Exception ex) { }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class FavIconHandler {
|
|||
imgView.setTranslationY(offset);
|
||||
}
|
||||
|
||||
public static int getResourceIdForRightDefaultFeedIcon(Context context)
|
||||
private static int getResourceIdForRightDefaultFeedIcon(Context context)
|
||||
{
|
||||
if(ThemeChooser.getInstance(context).isDarkTheme(context))
|
||||
return R.drawable.default_feed_icon_light;
|
||||
|
@ -81,7 +81,7 @@ public class FavIconHandler {
|
|||
return R.drawable.default_feed_icon_dark;
|
||||
}
|
||||
|
||||
public void PreCacheFavIcon(final Feed feed) throws IllegalStateException {
|
||||
public void preCacheFavIcon(final Feed feed) throws IllegalStateException {
|
||||
if(feed.getFaviconUrl() == null) {
|
||||
Log.v(TAG, "No favicon for "+feed.getFeedTitle());
|
||||
return;
|
||||
|
@ -111,7 +111,7 @@ public class FavIconHandler {
|
|||
});
|
||||
}
|
||||
|
||||
public void DownloadFinished(long feedId, Bitmap bitmap) {
|
||||
private void DownloadFinished(long feedId, Bitmap bitmap) {
|
||||
if(bitmap != null) {
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(context);
|
||||
Feed feed = dbConn.getFeedById(feedId);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class NextcloudNotificationManager {
|
|||
private static final int ID_DownloadSingleImageComplete = 10;
|
||||
private static final int UNREAD_RSS_ITEMS_NOTIFICATION_ID = 246;
|
||||
|
||||
public static void ShowNotificationDownloadSingleImageComplete(Context context, File imagePath) {
|
||||
public static void showNotificationDownloadSingleImageComplete(Context context, File imagePath) {
|
||||
String channelDownloadImage = context.getString(R.string.action_img_download);
|
||||
NotificationManager notificationManager = getNotificationManagerAndCreateChannel(context, channelDownloadImage);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class NextcloudNotificationManager {
|
|||
|
||||
|
||||
|
||||
public static NotificationCompat.Builder BuildNotificationDownloadImageService(Context context, String channelId) {
|
||||
public static NotificationCompat.Builder buildNotificationDownloadImageService(Context context, String channelId) {
|
||||
getNotificationManagerAndCreateChannel(context, channelId);
|
||||
|
||||
Intent intentNewsReader = new Intent(context, NewsReaderListActivity.class);
|
||||
|
@ -96,7 +96,7 @@ public class NextcloudNotificationManager {
|
|||
|
||||
|
||||
|
||||
public static void ShowNotificationImageDownloadLimitReached(Context context, String channelId, int limit) {
|
||||
public static void showNotificationImageDownloadLimitReached(Context context, String channelId, int limit) {
|
||||
NotificationManager notificationManager = getNotificationManagerAndCreateChannel(context, channelId);
|
||||
|
||||
Intent intentNewsReader = new Intent(context, NewsReaderListActivity.class);
|
||||
|
@ -117,7 +117,7 @@ public class NextcloudNotificationManager {
|
|||
}
|
||||
|
||||
|
||||
public static NotificationCompat.Builder BuildPodcastNotification(Context context, String channelId) {
|
||||
public static NotificationCompat.Builder buildPodcastNotification(Context context, String channelId) {
|
||||
getNotificationManagerAndCreateChannel(context, channelId);
|
||||
|
||||
// Creates an explicit intent for an ResultActivity to receive.
|
||||
|
@ -140,7 +140,7 @@ public class NextcloudNotificationManager {
|
|||
.setContentIntent(resultPendingIntent);
|
||||
}
|
||||
|
||||
public static NotificationCompat.Builder BuildDownloadPodcastNotification(Context context, String channelId) {
|
||||
public static NotificationCompat.Builder buildDownloadPodcastNotification(Context context, String channelId) {
|
||||
getNotificationManagerAndCreateChannel(context, channelId);
|
||||
|
||||
Intent intentNewsReader = new Intent(context, NewsReaderListActivity.class);
|
||||
|
@ -160,7 +160,7 @@ public class NextcloudNotificationManager {
|
|||
|
||||
|
||||
|
||||
public static void ShowUnreadRssItemsNotification(Context context, int newItemsCount) {
|
||||
public static void showUnreadRssItemsNotification(Context context, int newItemsCount) {
|
||||
Resources res = context.getResources();
|
||||
String tickerMessage = res.getQuantityString(R.plurals.notification_new_items_ticker, newItemsCount, newItemsCount);
|
||||
String contentText = res.getQuantityString(R.plurals.notification_new_items_text, newItemsCount, newItemsCount);
|
||||
|
@ -186,7 +186,7 @@ public class NextcloudNotificationManager {
|
|||
notificationManager.notify(UNREAD_RSS_ITEMS_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
public static boolean IsUnreadRssCountNotificationVisible(Context context) {
|
||||
public static boolean isUnreadRssCountNotificationVisible(Context context) {
|
||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
@ -200,7 +200,7 @@ public class NextcloudNotificationManager {
|
|||
|
||||
}
|
||||
|
||||
public static void RemoveRssItemsNotification(Context context) {
|
||||
public static void removeRssItemsNotification(Context context) {
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.cancel(UNREAD_RSS_ITEMS_NOTIFICATION_ID);
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ public class ItemStateSync {
|
|||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewStarredRssItems());
|
||||
result = PerformTagExecution(itemIds, FeedItemTags.MARK_ITEM_AS_STARRED, dbConn, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, true);
|
||||
dbConn.changeStarrUnstarrStateOfItem(itemIds, true);
|
||||
|
||||
//Mark as UNSTARRED
|
||||
itemIds = dbConn.getRssItemsIdsFromList(dbConn.getAllNewUnstarredRssItems());
|
||||
result = PerformTagExecution(itemIds, FeedItemTags.MARK_ITEM_AS_UNSTARRED, dbConn, api);
|
||||
if(result)
|
||||
dbConn.change_starrUnstarrStateOfItem(itemIds, false);
|
||||
dbConn.changeStarrUnstarrStateOfItem(itemIds, false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -108,14 +108,14 @@ public class DownloadImagesService extends JobIntentService {
|
|||
DownloadMode downloadMode = (DownloadMode) intent.getSerializableExtra(DOWNLOAD_MODE_STRING);
|
||||
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(this);
|
||||
mNotificationDownloadImages = NextcloudNotificationManager.BuildNotificationDownloadImageService(this, CHANNEL_ID);
|
||||
mNotificationDownloadImages = NextcloudNotificationManager.buildNotificationDownloadImageService(this, CHANNEL_ID);
|
||||
|
||||
if(downloadMode.equals(DownloadMode.FAVICONS_ONLY)) {
|
||||
List<Feed> feedList = dbConn.getListOfFeeds();
|
||||
FavIconHandler favIconHandler = new FavIconHandler(this);
|
||||
for(Feed feed : feedList) {
|
||||
try {
|
||||
favIconHandler.PreCacheFavIcon(feed);
|
||||
favIconHandler.preCacheFavIcon(feed);
|
||||
} catch(IllegalStateException ex) {
|
||||
Log.e(TAG, ex.getMessage());
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class DownloadImagesService extends JobIntentService {
|
|||
links.addAll(ImageHandler.getImageLinksFromText(body));
|
||||
|
||||
if(links.size() > 10000) {
|
||||
NextcloudNotificationManager.ShowNotificationImageDownloadLimitReached(this, CHANNEL_ID, 10000);
|
||||
NextcloudNotificationManager.showNotificationImageDownloadLimitReached(this, CHANNEL_ID, 10000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,41 +72,40 @@ import io.reactivex.schedulers.Schedulers;
|
|||
|
||||
public class OwnCloudSyncService extends Service {
|
||||
|
||||
StopWatch syncStopWatch;
|
||||
// This is the object that receives interactions from clients. See
|
||||
// RemoteService for a more complete example.
|
||||
private final IBinder mBinder = new OwnCloudSyncServiceBinder();
|
||||
private StopWatch syncStopWatch;
|
||||
// This is the object that receives interactions from clients. See
|
||||
// RemoteService for a more complete example.
|
||||
private final IBinder mBinder = new OwnCloudSyncServiceBinder();
|
||||
|
||||
/**
|
||||
* Class for clients to access. Because we know this service always
|
||||
* runs in the same process as its clients, we don't need to deal with
|
||||
* IPC.
|
||||
*/
|
||||
public class OwnCloudSyncServiceBinder extends Binder {
|
||||
public OwnCloudSyncService getService() {
|
||||
return OwnCloudSyncService.this;
|
||||
}
|
||||
}
|
||||
protected static final String TAG = "OwnCloudSyncService";
|
||||
|
||||
protected static final String TAG = "OwnCloudSyncService";
|
||||
|
||||
|
||||
private boolean syncRunning;
|
||||
private boolean syncRunning;
|
||||
private CompositeDisposable mDisposable;
|
||||
|
||||
@Inject SharedPreferences mPrefs;
|
||||
@Inject ApiProvider mApi;
|
||||
@Inject MemorizingTrustManager mMTM;
|
||||
protected @Inject SharedPreferences mPrefs;
|
||||
protected @Inject ApiProvider mApi;
|
||||
protected @Inject MemorizingTrustManager mMTM;
|
||||
|
||||
|
||||
public void startSync() {
|
||||
if(!isSyncRunning()) {
|
||||
startedSync();
|
||||
start();
|
||||
/**
|
||||
* Class for clients to access. Because we know this service always
|
||||
* runs in the same process as its clients, we don't need to deal with
|
||||
* IPC.
|
||||
* */
|
||||
public class OwnCloudSyncServiceBinder extends Binder {
|
||||
public OwnCloudSyncService getService() {
|
||||
return OwnCloudSyncService.this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSyncRunning() {
|
||||
|
||||
public void startSync() {
|
||||
if(!isSyncRunning()) {
|
||||
startedSync();
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSyncRunning() {
|
||||
return syncRunning;
|
||||
}
|
||||
|
||||
|
@ -142,14 +141,15 @@ public class OwnCloudSyncService extends Service {
|
|||
}
|
||||
|
||||
private class SyncResult {
|
||||
List<Folder> folders;
|
||||
List<Feed> feeds;
|
||||
boolean stateSyncSuccessful;
|
||||
|
||||
SyncResult(List<Folder> folders, List<Feed> feeds, Boolean stateSyncSuccessful) {
|
||||
this.folders = folders;
|
||||
this.feeds = feeds;
|
||||
this.stateSyncSuccessful = stateSyncSuccessful;
|
||||
}
|
||||
List<Folder> folders;
|
||||
List<Feed> feeds;
|
||||
boolean stateSyncSuccessful;
|
||||
}
|
||||
|
||||
// Start sync
|
||||
|
@ -299,7 +299,7 @@ public class OwnCloudSyncService extends Service {
|
|||
// If another app is opened show a notification
|
||||
if (!foregroundActivityPackageName.equals(getPackageName())) {
|
||||
if (mPrefs.getBoolean(SettingsActivity.CB_SHOW_NOTIFICATION_NEW_ARTICLES_STRING, true)) {
|
||||
NextcloudNotificationManager.ShowUnreadRssItemsNotification(OwnCloudSyncService.this, newItemsCount);
|
||||
NextcloudNotificationManager.showUnreadRssItemsNotification(OwnCloudSyncService.this, newItemsCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class PodcastDownloadService extends IntentService {
|
|||
private void downloadPodcast(PodcastItem podcast, Context context) {
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationCompat.Builder mNotificationDownloadPodcast = NextcloudNotificationManager.BuildDownloadPodcastNotification(context, "Download Podcast");
|
||||
NotificationCompat.Builder mNotificationDownloadPodcast = NextcloudNotificationManager.buildDownloadPodcastNotification(context, "Download Podcast");
|
||||
int NOTIFICATION_ID = 543226;
|
||||
notificationManager.notify(NOTIFICATION_ID, mNotificationDownloadPodcast.build());
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ public class SyncItemStateService extends JobIntentService {
|
|||
/**
|
||||
* Unique job/channel ID for this service.
|
||||
*/
|
||||
static final int JOB_ID = 1001;
|
||||
private static final int JOB_ID = 1001;
|
||||
private static final String TAG = SyncItemStateService.class.getCanonicalName();
|
||||
|
||||
@Inject ApiProvider mApi;
|
||||
protected @Inject ApiProvider mApi;
|
||||
|
||||
/**
|
||||
* Convenience method for enqueuing work in to this service.
|
||||
|
|
|
@ -77,7 +77,7 @@ public class PodcastNotification {
|
|||
if(lastDrawableId != drawableId) {
|
||||
lastDrawableId = drawableId;
|
||||
|
||||
notificationBuilder = NextcloudNotificationManager.BuildPodcastNotification(mContext, CHANNEL_ID);
|
||||
notificationBuilder = NextcloudNotificationManager.buildPodcastNotification(mContext, CHANNEL_ID);
|
||||
notificationBuilder.setContentTitle(podcast.getTitle());
|
||||
notificationBuilder.addAction(
|
||||
drawableId,
|
||||
|
|
|
@ -24,9 +24,11 @@ import static org.junit.Assert.assertTrue;
|
|||
public class TestDbTest {
|
||||
|
||||
private NewsReaderListActivity activity;
|
||||
private static final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private static SecureRandom rnd = new SecureRandom();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
public void setUp() {
|
||||
activity = Robolectric.buildActivity(NewsReaderListActivity.class).create().get();
|
||||
}
|
||||
|
||||
|
@ -84,9 +86,6 @@ public class TestDbTest {
|
|||
}
|
||||
}
|
||||
|
||||
private static final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private static SecureRandom rnd = new SecureRandom();
|
||||
|
||||
private String randomString( int len ){
|
||||
StringBuilder sb = new StringBuilder( len );
|
||||
for( int i = 0; i < len; i++ )
|
||||
|
|
Loading…
Reference in a new issue