diff options
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
13 files changed, 77 insertions, 140 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java index 65e97e8e..b6de9a32 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java @@ -1,5 +1,21 @@ package org.fox.ttrss; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.SharedPreferences; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.AsyncTask; +import android.os.Build; +import android.preference.PreferenceManager; +import android.util.Base64; +import android.util.Log; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; @@ -17,30 +33,14 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.SharedPreferences; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.os.AsyncTask; -import android.os.Build; -import android.preference.PreferenceManager; -import android.util.Base64; -import android.util.Log; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonElement> { private final String TAG = this.getClass().getSimpleName(); public enum ApiError { NO_ERROR, HTTP_UNAUTHORIZED, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_SERVER_ERROR, HTTP_OTHER_ERROR, SSL_REJECTED, SSL_HOSTNAME_REJECTED, PARSE_ERROR, IO_ERROR, OTHER_ERROR, API_DISABLED, - API_UNKNOWN, LOGIN_FAILED, INVALID_URL, API_INCORRECT_USAGE, NETWORK_UNAVAILABLE, API_UNKNOWN_METHOD }; - - public static final int API_STATUS_OK = 0; + API_UNKNOWN, LOGIN_FAILED, INVALID_URL, API_INCORRECT_USAGE, NETWORK_UNAVAILABLE, API_UNKNOWN_METHOD } + + public static final int API_STATUS_OK = 0; public static final int API_STATUS_ERR = 1; private String m_api; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index f6d2f4ed..cec48fb1 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -19,7 +19,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebView.HitTestResult; @@ -50,9 +49,9 @@ public class ArticleFragment extends Fragment { public void initialize(Article article) { m_article = article; } - - private View.OnTouchListener m_gestureListener; - + + //private View.OnTouchListener m_gestureListener; + @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { @@ -84,8 +83,7 @@ public class ArticleFragment extends Fragment { @SuppressLint("NewApi") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - m_activity.setProgressBarVisibility(true); - + if (savedInstanceState != null) { m_article = savedInstanceState.getParcelable("article"); } @@ -209,7 +207,7 @@ public class ArticleFragment extends Fragment { } - final WebView web = (WebView)view.findViewById(R.id.content); + final WebView web = (WebView)view.findViewById(R.id.article_content); if (web != null) { @@ -241,16 +239,6 @@ public class ArticleFragment extends Fragment { } } - web.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int progress) { - m_activity.setProgress(Math.round(((float)progress / 100f) * 10000)); - if (progress == 100) { - m_activity.setProgressBarVisibility(false); - } - } - }); - String content; String cssOverride = ""; @@ -359,8 +347,8 @@ public class ArticleFragment extends Fragment { e.printStackTrace(); } - if (m_activity.isSmallScreen()) - web.setOnTouchListener(m_gestureListener); +// if (m_activity.isSmallScreen()) +// web.setOnTouchListener(m_gestureListener); web.setVisibility(View.VISIBLE); } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java index 2f53275b..2b19daba 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java @@ -17,7 +17,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; @@ -184,12 +183,6 @@ public class ArticleImagesPagerActivity extends CommonActivity { // we use that before parent onCreate so let's init locally m_prefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); - - requestWindowFeature(Window.FEATURE_PROGRESS); - - setProgressBarVisibility(false); - setProgressBarIndeterminateVisibility(false); - setAppTheme(m_prefs); super.onCreate(savedInstanceState); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java index 994bfe90..6f45432b 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java @@ -93,9 +93,7 @@ public class ArticlePager extends Fragment { int position = m_articles.indexOf(m_article); m_listener.onArticleSelected(m_article, false); - - m_activity.setProgressBarVisibility(true); - + pager.setAdapter(m_adapter); UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_titles); @@ -142,10 +140,7 @@ public class ArticlePager extends Fragment { @SuppressWarnings({ "serial" }) protected void refresh(boolean append) { - //m_activity.setLoadingStatus(R.string.blank, true); - m_activity.setProgressBarVisibility(true); - //m_activity.m_pullToRefreshAttacher.setRefreshing(true); - + if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) { append = false; } @@ -160,9 +155,6 @@ public class ArticlePager extends Fragment { protected void onPostExecute(JsonElement result) { if (isDetached()) return; - m_activity.setProgressBarVisibility(false); - //m_activity.m_pullToRefreshAttacher.setRefreshComplete(); - super.onPostExecute(result); if (result != null) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java index f6b45343..5ec0ba60 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java @@ -324,7 +324,6 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe protected void onPostExecute(JsonElement result) { if (isDetached()) return; - m_activity.setProgressBarVisibility(false); if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false); if (getView() != null) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java index d5e1aab4..a3a972a4 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -520,8 +520,6 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh } } - m_activity.setProgressBarVisibility(false); - //m_activity.m_pullToRefreshAttacher.setRefreshComplete(); if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false); if (result != null) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index 68d2b3fe..f48dd529 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -68,9 +68,9 @@ import java.util.HashMap; import java.util.TimeZone; public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener { - public static enum ArticlesSelection { ALL, NONE, UNREAD }; + public static enum ArticlesSelection { ALL, NONE, UNREAD } - public static final int HEADLINES_REQUEST_SIZE = 30; + public static final int HEADLINES_REQUEST_SIZE = 30; public static final int HEADLINES_BUFFER_MAX = 500; private final String TAG = this.getClass().getSimpleName(); @@ -417,8 +417,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, m_refreshInProgress = true; if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true); - m_activity.setProgressBarVisibility(true); - + if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) { append = false; } @@ -458,8 +457,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, list.setEmptyView(getView().findViewById(R.id.no_headlines)); } } - - m_activity.setProgressBarVisibility(false); super.onPostExecute(result); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 0209d697..b92b072e 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -25,7 +25,6 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.view.Window; import android.widget.EditText; import android.widget.TextView; @@ -76,9 +75,9 @@ public class OnlineActivity extends CommonActivity { protected abstract class OnLoginFinishedListener { public abstract void OnLoginSuccess(); public abstract void OnLoginFailed(); - }; - - private BroadcastReceiver m_broadcastReceiver = new BroadcastReceiver() { + } + + private BroadcastReceiver m_broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context content, Intent intent) { @@ -134,9 +133,9 @@ public class OnlineActivity extends CommonActivity { onOptionsItemSelected(item); return false; } - }; - - protected String getSessionId() { + } + + protected String getSessionId() { return GlobalState.getInstance().m_sessionId; } @@ -152,19 +151,10 @@ public class OnlineActivity extends CommonActivity { m_prefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); -// if (canUseProgress()) { - requestWindowFeature(Window.FEATURE_PROGRESS); -// } - setAppTheme(m_prefs); super.onCreate(savedInstanceState); - //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); - - setProgressBarVisibility(false); - setProgressBarIndeterminateVisibility(false); - // SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); @@ -1207,8 +1197,6 @@ public class OnlineActivity extends CommonActivity { if (loadingContainer != null) { loadingContainer.setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE); } - - setProgressBarIndeterminateVisibility(showProgress); } protected void logout() { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java index 55bcfa7b..e4450902 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineActivity.java @@ -21,7 +21,6 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.view.Window; import android.widget.EditText; import android.widget.TextView; @@ -71,9 +70,9 @@ public class OfflineActivity extends CommonActivity { onOptionsItemSelected(item); return false; } - }; + } - @Override + @Override public boolean onContextItemSelected(android.view.MenuItem item) { /* AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo(); */ @@ -167,14 +166,10 @@ public class OfflineActivity extends CommonActivity { m_prefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); - requestWindowFeature(Window.FEATURE_PROGRESS); - setAppTheme(m_prefs); super.onCreate(savedInstanceState); - setProgressBarVisibility(false); - setContentView(R.layout.login); initMenu(); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java index 77d7698a..171aadae 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -22,7 +22,6 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebView.HitTestResult; @@ -217,40 +216,30 @@ public class OfflineArticleFragment extends Fragment { note.setVisibility(View.GONE); } - final WebView web = (WebView)view.findViewById(R.id.content); + final WebView web = (WebView)view.findViewById(R.id.article_content); if (web != null) { - web.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - HitTestResult result = ((WebView)v).getHitTestResult(); + web.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + HitTestResult result = ((WebView) v).getHitTestResult(); - if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) { - registerForContextMenu(web); - m_activity.openContextMenu(web); - unregisterForContextMenu(web); - return true; - } else { - if (m_activity.isCompatMode()) { - KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); - shiftPressEvent.dispatch(web); - } - - return false; - } - } - }); - - web.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int progress) { - m_activity.setProgress(Math.round(((float)progress / 100f) * 10000)); - if (progress == 100) { - m_activity.setProgressBarVisibility(false); - } - } - }); + if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) { + registerForContextMenu(web); + m_activity.openContextMenu(web); + unregisterForContextMenu(web); + return true; + } else { + if (m_activity.isCompatMode()) { + KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); + shiftPressEvent.dispatch(web); + } + + return false; + } + } + }); String content; String cssOverride = ""; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 4c8dd5d5..8b46570e 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -48,9 +48,9 @@ import java.util.Date; import java.util.TimeZone; public class OfflineHeadlinesFragment extends Fragment implements OnItemClickListener, AbsListView.OnScrollListener { - public static enum ArticlesSelection { ALL, NONE, UNREAD }; + public static enum ArticlesSelection { ALL, NONE, UNREAD } - private final String TAG = this.getClass().getSimpleName(); + private final String TAG = this.getClass().getSimpleName(); private int m_feedId; private boolean m_feedIsCat = false; @@ -324,8 +324,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis list.setEmptyView(view.findViewById(R.id.no_headlines)); registerForContextMenu(list); - getActivity().setProgressBarIndeterminateVisibility(false); - return view; } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineUploadService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineUploadService.java index 4c3349d4..989f1e45 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineUploadService.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineUploadService.java @@ -1,12 +1,5 @@ package org.fox.ttrss.offline; -import java.util.HashMap; - -import org.fox.ttrss.ApiRequest; -import org.fox.ttrss.OnlineActivity; -import org.fox.ttrss.R; -import org.fox.ttrss.util.DatabaseHelper; - import android.app.IntentService; import android.app.Notification; import android.app.NotificationManager; @@ -20,6 +13,13 @@ import android.util.Log; import com.google.gson.JsonElement; +import org.fox.ttrss.ApiRequest; +import org.fox.ttrss.OnlineActivity; +import org.fox.ttrss.R; +import org.fox.ttrss.util.DatabaseHelper; + +import java.util.HashMap; + public class OfflineUploadService extends IntentService { private final String TAG = this.getClass().getSimpleName(); @@ -122,9 +122,9 @@ public class OfflineUploadService extends IntentService { private enum ModifiedCriteria { READ, MARKED, PUBLISHED - }; + } - private String getModifiedIds(ModifiedCriteria criteria) { + private String getModifiedIds(ModifiedCriteria criteria) { String criteriaStr = ""; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/ShareActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/ShareActivity.java index dff48502..12a8b14b 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/ShareActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/ShareActivity.java @@ -1,10 +1,5 @@ package org.fox.ttrss.share; -import java.util.HashMap; - -import org.fox.ttrss.ApiRequest; -import org.fox.ttrss.R; - import android.content.Intent; import android.os.Bundle; import android.view.View; @@ -14,6 +9,11 @@ import android.widget.EditText; import com.google.gson.JsonElement; +import org.fox.ttrss.ApiRequest; +import org.fox.ttrss.R; + +import java.util.HashMap; + public class ShareActivity extends CommonShareActivity { private final String TAG = this.getClass().getSimpleName(); @@ -120,9 +120,9 @@ public class ShareActivity extends CommonShareActivity { put("content", content.getText().toString()); } }; - + setProgressBarIndeterminateVisibility(true); - + req.execute(map); } } |