further refactoring
This commit is contained in:
parent
dffc737a93
commit
4acc9ac37e
@ -14,7 +14,7 @@
|
|||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".GlobalState"
|
android:name=".Application"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:backupAgent=".util.PrefsBackupAgent"
|
android:backupAgent=".util.PrefsBackupAgent"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
@ -39,14 +39,14 @@
|
|||||||
android:label="@string/preferences" >
|
android:label="@string/preferences" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".FeedsActivity"
|
android:name=".MasterActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".HeadlinesActivity"
|
android:name=".DetailActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -69,11 +69,11 @@
|
|||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".offline.OfflineFeedsActivity"
|
android:name=".offline.OfflineMasterActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".offline.OfflineHeadlinesActivity"
|
android:name=".offline.OfflineDetailActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
7
org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java → org.fox.ttrss/src/main/java/org/fox/ttrss/Application.java
Executable file → Normal file
7
org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java → org.fox.ttrss/src/main/java/org/fox/ttrss/Application.java
Executable file → Normal file
@ -1,6 +1,5 @@
|
|||||||
package org.fox.ttrss;
|
package org.fox.ttrss;
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
@ -12,8 +11,8 @@ import org.fox.ttrss.types.ArticleList;
|
|||||||
excludeMatchingSharedPreferencesKeys = {"password"},
|
excludeMatchingSharedPreferencesKeys = {"password"},
|
||||||
resDialogText = R.string.crash_dialog_text,
|
resDialogText = R.string.crash_dialog_text,
|
||||||
formUri = "http://tt-rss.org/acra/submit/")
|
formUri = "http://tt-rss.org/acra/submit/")
|
||||||
public class GlobalState extends Application {
|
public class Application extends android.app.Application {
|
||||||
private static GlobalState m_singleton;
|
private static Application m_singleton;
|
||||||
|
|
||||||
public ArticleList tmpArticleList;
|
public ArticleList tmpArticleList;
|
||||||
//public Feed m_activeFeed;
|
//public Feed m_activeFeed;
|
||||||
@ -23,7 +22,7 @@ public class GlobalState extends Application {
|
|||||||
public int m_apiLevel;
|
public int m_apiLevel;
|
||||||
public boolean m_canUseProgress;
|
public boolean m_canUseProgress;
|
||||||
|
|
||||||
public static GlobalState getInstance(){
|
public static Application getInstance(){
|
||||||
return m_singleton;
|
return m_singleton;
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
private SharedPreferences m_prefs;
|
private SharedPreferences m_prefs;
|
||||||
private Article m_article;
|
private Article m_article;
|
||||||
private HeadlinesActivity m_activity;
|
private DetailActivity m_activity;
|
||||||
private WebView m_web;
|
private WebView m_web;
|
||||||
protected View m_customView;
|
protected View m_customView;
|
||||||
protected FrameLayout m_customViewContainer;
|
protected FrameLayout m_customViewContainer;
|
||||||
@ -136,7 +136,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
|
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
|
||||||
|
|
||||||
menu.setHeaderTitle(result.getExtra());
|
menu.setHeaderTitle(result.getExtra());
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_content_img, menu);
|
||||||
|
|
||||||
/* FIXME I have no idea how to do this correctly ;( */
|
/* FIXME I have no idea how to do this correctly ;( */
|
||||||
|
|
||||||
@ -144,11 +144,11 @@ public class ArticleFragment extends Fragment {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
menu.setHeaderTitle(m_article.title);
|
menu.setHeaderTitle(m_article.title);
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_link_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_link, menu);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.setHeaderTitle(m_article.title);
|
menu.setHeaderTitle(m_article.title);
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_link_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_link, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
@ -586,7 +586,7 @@ public class ArticleFragment extends Fragment {
|
|||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
|
||||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
m_activity = (HeadlinesActivity)activity;
|
m_activity = (DetailActivity)activity;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenu.ContextMenuInfo menuInfo) {
|
ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu);
|
getMenuInflater().inflate(R.menu.context_article_content_img, menu);
|
||||||
|
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu);
|
getMenuInflater().inflate(R.menu.context_article_content_img, menu);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -31,7 +31,7 @@ public class ArticlePager extends Fragment {
|
|||||||
private PagerAdapter m_adapter;
|
private PagerAdapter m_adapter;
|
||||||
private HeadlinesEventListener m_listener;
|
private HeadlinesEventListener m_listener;
|
||||||
private Article m_article;
|
private Article m_article;
|
||||||
private ArticleList m_articles = new ArticleList(); //m_articles = GlobalState.getInstance().m_loadedArticles;
|
private ArticleList m_articles = new ArticleList(); //m_articles = Application.getInstance().m_loadedArticles;
|
||||||
private OnlineActivity m_activity;
|
private OnlineActivity m_activity;
|
||||||
private String m_searchQuery = "";
|
private String m_searchQuery = "";
|
||||||
private Feed m_feed;
|
private Feed m_feed;
|
||||||
@ -79,7 +79,7 @@ public class ArticlePager extends Fragment {
|
|||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
m_article = savedInstanceState.getParcelable("article");
|
m_article = savedInstanceState.getParcelable("article");
|
||||||
m_articles = ((HeadlinesActivity)m_activity).m_articles;
|
m_articles = ((DetailActivity)m_activity).m_articles;
|
||||||
m_feed = savedInstanceState.getParcelable("feed");
|
m_feed = savedInstanceState.getParcelable("feed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ public class ArticlePager extends Fragment {
|
|||||||
@SuppressWarnings({ "serial" })
|
@SuppressWarnings({ "serial" })
|
||||||
protected void refresh(boolean append) {
|
protected void refresh(boolean append) {
|
||||||
|
|
||||||
/* if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
/* if (!m_feed.equals(Application.getInstance().m_activeFeed)) {
|
||||||
append = false;
|
append = false;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
@ -274,9 +274,9 @@ public class ArticlePager extends Fragment {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
/* if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
/* if (m_articles.size() == 0 || !m_feed.equals(Application.getInstance().m_activeFeed)) {
|
||||||
refresh(false);
|
refresh(false);
|
||||||
GlobalState.getInstance().m_activeFeed = m_feed;
|
Application.getInstance().m_activeFeed = m_feed;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
if (m_adapter != null) m_adapter.notifyDataSetChanged();
|
if (m_adapter != null) m_adapter.notifyDataSetChanged();
|
||||||
|
16
org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java → org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java
Executable file → Normal file
16
org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java → org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java
Executable file → Normal file
@ -18,7 +18,7 @@ import org.fox.ttrss.types.Article;
|
|||||||
import org.fox.ttrss.types.ArticleList;
|
import org.fox.ttrss.types.ArticleList;
|
||||||
import org.fox.ttrss.types.Feed;
|
import org.fox.ttrss.types.Feed;
|
||||||
|
|
||||||
public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventListener {
|
public class DetailActivity extends OnlineActivity implements HeadlinesEventListener {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
protected ArticleList m_articles = new ArticleList();
|
protected ArticleList m_articles = new ArticleList();
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_headlines_articles);
|
setContentView(R.layout.activity_detail);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -47,7 +47,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
GlobalState.getInstance().load(savedInstanceState);
|
Application.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
if (isPortrait() && !isSmallScreen()) {
|
if (isPortrait() && !isSmallScreen()) {
|
||||||
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
|
||||||
@ -72,7 +72,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
tmpFeed = new Feed(feedId, feedTitle, isCat);
|
tmpFeed = new Feed(feedId, feedTitle, isCat);
|
||||||
|
|
||||||
//GlobalState.getInstance().m_loadedArticles.clear();
|
//Application.getInstance().m_loadedArticles.clear();
|
||||||
} else {
|
} else {
|
||||||
tmpFeed = i.getParcelableExtra("feed");
|
tmpFeed = i.getParcelableExtra("feed");
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
final Article article = i.getParcelableExtra("article");
|
final Article article = i.getParcelableExtra("article");
|
||||||
final String searchQuery = i.getStringExtra("searchQuery");
|
final String searchQuery = i.getStringExtra("searchQuery");
|
||||||
|
|
||||||
ArticleList tmp = GlobalState.getInstance().tmpArticleList;
|
ArticleList tmp = Application.getInstance().tmpArticleList;
|
||||||
|
|
||||||
if (tmp != null) {
|
if (tmp != null) {
|
||||||
m_articles.addAll(tmp);
|
m_articles.addAll(tmp);
|
||||||
@ -153,7 +153,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
out.putParcelable("articles", m_articles);
|
out.putParcelable("articles", m_articles);
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
Application.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -253,7 +253,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
m_activeArticle = article;
|
m_activeArticle = article;
|
||||||
|
|
||||||
//GlobalState.getInstance().m_activeArticle = article;
|
//Application.getInstance().m_activeArticle = article;
|
||||||
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
Intent resultIntent = new Intent();
|
Intent resultIntent = new Intent();
|
||||||
|
|
||||||
GlobalState.getInstance().tmpArticleList = m_articles;
|
Application.getInstance().tmpArticleList = m_articles;
|
||||||
resultIntent.putExtra("activeArticle", m_activeArticle);
|
resultIntent.putExtra("activeArticle", m_activeArticle);
|
||||||
|
|
||||||
setResult(Activity.RESULT_OK, resultIntent);
|
setResult(Activity.RESULT_OK, resultIntent);
|
@ -48,7 +48,7 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
private FeedCategoryListAdapter m_adapter;
|
private FeedCategoryListAdapter m_adapter;
|
||||||
private FeedCategoryList m_cats = new FeedCategoryList();
|
private FeedCategoryList m_cats = new FeedCategoryList();
|
||||||
private FeedCategory m_selectedCat;
|
private FeedCategory m_selectedCat;
|
||||||
private FeedsActivity m_activity;
|
private MasterActivity m_activity;
|
||||||
private SwipeRefreshLayout m_swipeLayout;
|
private SwipeRefreshLayout m_swipeLayout;
|
||||||
private ListView m_list;
|
private ListView m_list;
|
||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
@ -173,7 +173,7 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
m_activity.getMenuInflater().inflate(R.menu.category_menu, menu);
|
m_activity.getMenuInflater().inflate(R.menu.context_category, menu);
|
||||||
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||||
FeedCategory cat = (FeedCategory) m_list.getItemAtPosition(info.position);
|
FeedCategory cat = (FeedCategory) m_list.getItemAtPosition(info.position);
|
||||||
@ -237,7 +237,7 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
|
|||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
|
||||||
m_activity = (FeedsActivity)activity;
|
m_activity = (MasterActivity)activity;
|
||||||
|
|
||||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
@ -50,7 +50,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
private SharedPreferences m_prefs;
|
private SharedPreferences m_prefs;
|
||||||
private FeedListAdapter m_adapter;
|
private FeedListAdapter m_adapter;
|
||||||
private FeedList m_feeds = new FeedList();
|
private FeedList m_feeds = new FeedList();
|
||||||
private FeedsActivity m_activity;
|
private MasterActivity m_activity;
|
||||||
private Feed m_selectedFeed;
|
private Feed m_selectedFeed;
|
||||||
private FeedCategory m_activeCategory;
|
private FeedCategory m_activeCategory;
|
||||||
private static final String ICON_PATH = "/icons/";
|
private static final String ICON_PATH = "/icons/";
|
||||||
@ -223,7 +223,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getActivity().getMenuInflater().inflate(R.menu.feed_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_feed, menu);
|
||||||
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
|
|||||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
m_activity = (FeedsActivity)activity;
|
m_activity = (MasterActivity)activity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
private ArticleListAdapter m_adapter;
|
private ArticleListAdapter m_adapter;
|
||||||
private AnimationAdapter m_animationAdapter;
|
private AnimationAdapter m_animationAdapter;
|
||||||
private ArticleList m_articles = new ArticleList(); //GlobalState.getInstance().m_loadedArticles;
|
private ArticleList m_articles = new ArticleList(); //Application.getInstance().m_loadedArticles;
|
||||||
//private ArticleList m_selectedArticles = new ArticleList();
|
//private ArticleList m_selectedArticles = new ArticleList();
|
||||||
private ArticleList m_readArticles = new ArticleList();
|
private ArticleList m_readArticles = new ArticleList();
|
||||||
private HeadlinesEventListener m_listener;
|
private HeadlinesEventListener m_listener;
|
||||||
@ -301,7 +301,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getActivity().getMenuInflater().inflate(R.menu.headlines_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_headlines, menu);
|
||||||
|
|
||||||
if (getSelectedArticles().size() > 0) {
|
if (getSelectedArticles().size() > 0) {
|
||||||
menu.setHeaderTitle(R.string.headline_context_multiple);
|
menu.setHeaderTitle(R.string.headline_context_multiple);
|
||||||
@ -327,10 +327,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
m_feed = savedInstanceState.getParcelable("feed");
|
m_feed = savedInstanceState.getParcelable("feed");
|
||||||
|
|
||||||
if (! (m_activity instanceof HeadlinesActivity)) {
|
if (! (m_activity instanceof DetailActivity)) {
|
||||||
m_articles = savedInstanceState.getParcelable("articles");
|
m_articles = savedInstanceState.getParcelable("articles");
|
||||||
} else {
|
} else {
|
||||||
m_articles = ((HeadlinesActivity)m_activity).m_articles;
|
m_articles = ((DetailActivity)m_activity).m_articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
m_activeArticle = savedInstanceState.getParcelable("activeArticle");
|
||||||
@ -407,16 +407,16 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (m_adapter != null) m_adapter.notifyDataSetChanged();
|
if (m_adapter != null) m_adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
/* if (GlobalState.getInstance().m_activeArticle != null) {
|
/* if (Application.getInstance().m_activeArticle != null) {
|
||||||
m_activeArticle = GlobalState.getInstance().m_activeArticle;
|
m_activeArticle = Application.getInstance().m_activeArticle;
|
||||||
GlobalState.getInstance().m_activeArticle = null;
|
Application.getInstance().m_activeArticle = null;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
if (m_activeArticle != null) {
|
if (m_activeArticle != null) {
|
||||||
setActiveArticle(m_activeArticle);
|
setActiveArticle(m_activeArticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!(m_activity instanceof HeadlinesActivity)) {
|
/* if (!(m_activity instanceof DetailActivity)) {
|
||||||
refresh(false);
|
refresh(false);
|
||||||
} */
|
} */
|
||||||
|
|
||||||
@ -424,10 +424,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
refresh(false);
|
refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
/* if (m_articles.size() == 0 || !m_feed.equals(Application.getInstance().m_activeFeed)) {
|
||||||
if (m_activity.getSupportFragmentManager().findFragmentByTag(CommonActivity.FRAG_ARTICLE) == null) {
|
if (m_activity.getSupportFragmentManager().findFragmentByTag(CommonActivity.FRAG_ARTICLE) == null) {
|
||||||
refresh(false);
|
refresh(false);
|
||||||
GlobalState.getInstance().m_activeFeed = m_feed;
|
Application.getInstance().m_activeFeed = m_feed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notifyUpdated();
|
notifyUpdated();
|
||||||
@ -457,8 +457,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
if (article != null && article.id >= 0) {
|
if (article != null && article.id >= 0) {
|
||||||
m_listener.onArticleSelected(article);
|
m_listener.onArticleSelected(article);
|
||||||
|
|
||||||
// only set active article when it makes sense (in HeadlinesActivity)
|
// only set active article when it makes sense (in DetailActivity)
|
||||||
if (getActivity() instanceof HeadlinesActivity) {
|
if (getActivity() instanceof DetailActivity) {
|
||||||
m_activeArticle = article;
|
m_activeArticle = article;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
|
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
|
||||||
|
|
||||||
/* if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
/* if (!m_feed.equals(Application.getInstance().m_activeFeed)) {
|
||||||
append = false;
|
append = false;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
@ -1155,8 +1155,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
public void setActiveArticle(Article article) {
|
public void setActiveArticle(Article article) {
|
||||||
if (article != m_activeArticle && article != null) {
|
if (article != m_activeArticle && article != null) {
|
||||||
|
|
||||||
// only set active article when it makes sense (in HeadlinesActivity)
|
// only set active article when it makes sense (in DetailActivity)
|
||||||
if (getActivity() instanceof HeadlinesActivity) {
|
if (getActivity() instanceof DetailActivity) {
|
||||||
m_activeArticle = article;
|
m_activeArticle = article;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java → org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java
Executable file → Normal file
22
org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java → org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java
Executable file → Normal file
@ -30,7 +30,7 @@ import org.fox.ttrss.widget.SmallWidgetProvider;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
|
public class MasterActivity extends OnlineActivity implements HeadlinesEventListener {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
|
|
||||||
private static final int HEADLINES_REQUEST = 1;
|
private static final int HEADLINES_REQUEST = 1;
|
||||||
@ -54,14 +54,14 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.headlines);
|
setContentView(R.layout.activity_master);
|
||||||
|
|
||||||
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
GlobalState.getInstance().load(savedInstanceState);
|
Application.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
||||||
out.putBoolean("userFeedSelected", m_userFeedSelected);
|
out.putBoolean("userFeedSelected", m_userFeedSelected);
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
Application.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -417,9 +417,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* public void openFeedArticles(Feed feed) {
|
/* public void openFeedArticles(Feed feed) {
|
||||||
//GlobalState.getInstance().m_loadedArticles.clear();
|
//Application.getInstance().m_loadedArticles.clear();
|
||||||
|
|
||||||
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
Intent intent = new Intent(MasterActivity.this, DetailActivity.class);
|
||||||
intent.putExtra("feed", feed);
|
intent.putExtra("feed", feed);
|
||||||
intent.putExtra("article", (Article)null);
|
intent.putExtra("article", (Article)null);
|
||||||
intent.putExtra("searchQuery", (String)null);
|
intent.putExtra("searchQuery", (String)null);
|
||||||
@ -432,12 +432,12 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
if (open) {
|
if (open) {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
Intent intent = new Intent(MasterActivity.this, DetailActivity.class);
|
||||||
intent.putExtra("feed", hf.getFeed());
|
intent.putExtra("feed", hf.getFeed());
|
||||||
intent.putExtra("article", article);
|
intent.putExtra("article", article);
|
||||||
intent.putExtra("searchQuery", hf.getSearchQuery());
|
intent.putExtra("searchQuery", hf.getSearchQuery());
|
||||||
//intent.putExtra("articles", (Parcelable)hf.getAllArticles());
|
//intent.putExtra("articles", (Parcelable)hf.getAllArticles());
|
||||||
GlobalState.getInstance().tmpArticleList = hf.getAllArticles();
|
Application.getInstance().tmpArticleList = hf.getAllArticles();
|
||||||
|
|
||||||
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
startActivityForResult(intent, HEADLINES_REQUEST, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
|
startActivityForResult(intent, HEADLINES_REQUEST, ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
|
||||||
@ -486,11 +486,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == HEADLINES_REQUEST && data != null) {
|
if (requestCode == HEADLINES_REQUEST && data != null) {
|
||||||
//GlobalState.getInstance().m_activeArticle = null;
|
//Application.getInstance().m_activeArticle = null;
|
||||||
|
|
||||||
//ArrayList<Article> tmp = data.getParcelableArrayListExtra("articles");
|
//ArrayList<Article> tmp = data.getParcelableArrayListExtra("articles");
|
||||||
Article article = data.getParcelableExtra("activeArticle");
|
Article article = data.getParcelableExtra("activeArticle");
|
||||||
ArticleList articles = GlobalState.getInstance().tmpArticleList;
|
ArticleList articles = Application.getInstance().tmpArticleList;
|
||||||
|
|
||||||
if (articles != null) {
|
if (articles != null) {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
@ -506,7 +506,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createFeedShortcut(Feed feed) {
|
public void createFeedShortcut(Feed feed) {
|
||||||
final Intent shortcutIntent = new Intent(this, FeedsActivity.class);
|
final Intent shortcutIntent = new Intent(this, MasterActivity.class);
|
||||||
shortcutIntent.putExtra("feed_id", feed.id);
|
shortcutIntent.putExtra("feed_id", feed.id);
|
||||||
shortcutIntent.putExtra("feed_is_cat", feed.is_cat);
|
shortcutIntent.putExtra("feed_is_cat", feed.is_cat);
|
||||||
shortcutIntent.putExtra("feed_title", feed.title);
|
shortcutIntent.putExtra("feed_title", feed.title);
|
@ -123,7 +123,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.headlines_action_menu, menu);
|
inflater.inflate(R.menu.action_mode_headlines, menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -136,11 +136,11 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getSessionId() {
|
protected String getSessionId() {
|
||||||
return GlobalState.getInstance().m_sessionId;
|
return Application.getInstance().m_sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setSessionId(String sessionId) {
|
protected void setSessionId(String sessionId) {
|
||||||
GlobalState.getInstance().m_sessionId = sessionId;
|
Application.getInstance().m_sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,7 +163,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
Log.d(TAG, "m_isOffline=" + isOffline);
|
Log.d(TAG, "m_isOffline=" + isOffline);
|
||||||
|
|
||||||
setContentView(R.layout.login);
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -197,7 +197,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canUseProgress() {
|
protected boolean canUseProgress() {
|
||||||
return GlobalState.getInstance().m_canUseProgress;
|
return Application.getInstance().m_canUseProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void switchOffline() {
|
protected void switchOffline() {
|
||||||
@ -457,7 +457,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
initMenu();
|
initMenu();
|
||||||
|
|
||||||
Intent intent = new Intent(OnlineActivity.this, FeedsActivity.class);
|
Intent intent = new Intent(OnlineActivity.this, MasterActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
@ -1252,7 +1252,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.main_menu, menu);
|
inflater.inflate(R.menu.activity_main, menu);
|
||||||
|
|
||||||
m_menu = menu;
|
m_menu = menu;
|
||||||
|
|
||||||
@ -1273,11 +1273,11 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int getApiLevel() {
|
protected int getApiLevel() {
|
||||||
return GlobalState.getInstance().m_apiLevel;
|
return Application.getInstance().m_apiLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setApiLevel(int apiLevel) {
|
protected void setApiLevel(int apiLevel) {
|
||||||
GlobalState.getInstance().m_apiLevel = apiLevel;
|
Application.getInstance().m_apiLevel = apiLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "serial" })
|
@SuppressWarnings({ "unchecked", "serial" })
|
||||||
@ -1623,7 +1623,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
JsonElement apiLevel = content.get("api_level");
|
JsonElement apiLevel = content.get("api_level");
|
||||||
|
|
||||||
GlobalState.getInstance().m_canUseProgress = m_canUseProgress;
|
Application.getInstance().m_canUseProgress = m_canUseProgress;
|
||||||
|
|
||||||
Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress);
|
Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class PreferencesActivity extends CommonActivity {
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.preferences);
|
setContentView(R.layout.activity_preferences);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
@ -60,7 +60,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.headlines_action_menu, menu);
|
inflater.inflate(R.menu.action_mode_headlines, menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.login);
|
setContentView(R.layout.activity_login);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -181,7 +181,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
|
|
||||||
if (intent.getExtras() != null) {
|
if (intent.getExtras() != null) {
|
||||||
if (intent.getBooleanExtra("initial", false)) {
|
if (intent.getBooleanExtra("initial", false)) {
|
||||||
intent = new Intent(OfflineActivity.this, OfflineFeedsActivity.class);
|
intent = new Intent(OfflineActivity.this, OfflineMasterActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
@ -552,7 +552,7 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.offline_menu, menu);
|
inflater.inflate(R.menu.activity_offline, menu);
|
||||||
|
|
||||||
m_menu = menu;
|
m_menu = menu;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
//getActivity().getMenuInflater().inflate(R.menu.article_link_context_menu, menu);
|
//getActivity().getMenuInflater().inflate(R.menu.context_article_link, menu);
|
||||||
//menu.setHeaderTitle(m_cursor.getString(m_cursor.getColumnIndex("title")));
|
//menu.setHeaderTitle(m_cursor.getString(m_cursor.getColumnIndex("title")));
|
||||||
|
|
||||||
String title = m_cursor.getString(m_cursor.getColumnIndex("title"));
|
String title = m_cursor.getString(m_cursor.getColumnIndex("title"));
|
||||||
@ -97,7 +97,7 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
|
|
||||||
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
|
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
|
||||||
menu.setHeaderTitle(result.getExtra());
|
menu.setHeaderTitle(result.getExtra());
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_content_img, menu);
|
||||||
|
|
||||||
/* FIXME I have no idea how to do this correctly ;( */
|
/* FIXME I have no idea how to do this correctly ;( */
|
||||||
|
|
||||||
@ -105,11 +105,11 @@ public class OfflineArticleFragment extends Fragment {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
menu.setHeaderTitle(title);
|
menu.setHeaderTitle(title);
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_link_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_link, menu);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.setHeaderTitle(title);
|
menu.setHeaderTitle(title);
|
||||||
getActivity().getMenuInflater().inflate(R.menu.article_link_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_article_link, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
@ -17,10 +17,10 @@ import android.util.Log;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import org.fox.ttrss.GlobalState;
|
import org.fox.ttrss.Application;
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
|
|
||||||
public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
|
public class OfflineDetailActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
|
|
||||||
protected SharedPreferences m_prefs;
|
protected SharedPreferences m_prefs;
|
||||||
@ -38,7 +38,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_headlines_articles);
|
setContentView(R.layout.activity_detail);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -168,7 +168,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
|
|||||||
hf.setActiveArticleId(articleId);
|
hf.setActiveArticleId(articleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalState.getInstance().m_selectedArticleId = articleId;
|
Application.getInstance().m_selectedArticleId = articleId;
|
||||||
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
refresh();
|
refresh();
|
@ -34,7 +34,7 @@ public class OfflineFeedCategoriesFragment extends BaseFeedlistFragment implemen
|
|||||||
private FeedCategoryListAdapter m_adapter;
|
private FeedCategoryListAdapter m_adapter;
|
||||||
private int m_selectedCatId;
|
private int m_selectedCatId;
|
||||||
private Cursor m_cursor;
|
private Cursor m_cursor;
|
||||||
private OfflineFeedsActivity m_activity;
|
private OfflineMasterActivity m_activity;
|
||||||
private SwipeRefreshLayout m_swipeLayout;
|
private SwipeRefreshLayout m_swipeLayout;
|
||||||
private ListView m_list;
|
private ListView m_list;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class OfflineFeedCategoriesFragment extends BaseFeedlistFragment implemen
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getActivity().getMenuInflater().inflate(R.menu.category_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_category, menu);
|
||||||
|
|
||||||
menu.findItem(R.id.create_shortcut).setEnabled(false);
|
menu.findItem(R.id.create_shortcut).setEnabled(false);
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ public class OfflineFeedCategoriesFragment extends BaseFeedlistFragment implemen
|
|||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
|
||||||
m_activity = (OfflineFeedsActivity)activity;
|
m_activity = (OfflineMasterActivity)activity;
|
||||||
|
|
||||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
@ -35,7 +35,7 @@ public class OfflineFeedsFragment extends BaseFeedlistFragment implements OnItem
|
|||||||
private int m_catId = -1;
|
private int m_catId = -1;
|
||||||
private boolean m_enableFeedIcons;
|
private boolean m_enableFeedIcons;
|
||||||
private Cursor m_cursor;
|
private Cursor m_cursor;
|
||||||
private OfflineFeedsActivity m_activity;
|
private OfflineMasterActivity m_activity;
|
||||||
private SwipeRefreshLayout m_swipeLayout;
|
private SwipeRefreshLayout m_swipeLayout;
|
||||||
private boolean m_enableParentBtn = false;
|
private boolean m_enableParentBtn = false;
|
||||||
private ListView m_list;
|
private ListView m_list;
|
||||||
@ -80,7 +80,7 @@ public class OfflineFeedsFragment extends BaseFeedlistFragment implements OnItem
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getActivity().getMenuInflater().inflate(R.menu.feed_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_feed, menu);
|
||||||
|
|
||||||
menu.findItem(R.id.create_shortcut).setEnabled(false);
|
menu.findItem(R.id.create_shortcut).setEnabled(false);
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ public class OfflineFeedsFragment extends BaseFeedlistFragment implements OnItem
|
|||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
|
|
||||||
m_activity = (OfflineFeedsActivity)activity;
|
m_activity = (OfflineMasterActivity)activity;
|
||||||
|
|
||||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
@ -38,8 +38,8 @@ import android.widget.TextView;
|
|||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||||
|
|
||||||
|
import org.fox.ttrss.Application;
|
||||||
import org.fox.ttrss.CommonActivity;
|
import org.fox.ttrss.CommonActivity;
|
||||||
import org.fox.ttrss.GlobalState;
|
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
getActivity().getMenuInflater().inflate(R.menu.headlines_context_menu, menu);
|
getActivity().getMenuInflater().inflate(R.menu.context_headlines, menu);
|
||||||
|
|
||||||
if (getSelectedArticleCount() > 0) {
|
if (getSelectedArticleCount() > 0) {
|
||||||
menu.setHeaderTitle(R.string.headline_context_multiple);
|
menu.setHeaderTitle(R.string.headline_context_multiple);
|
||||||
@ -238,9 +238,9 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (GlobalState.getInstance().m_selectedArticleId != 0) {
|
if (Application.getInstance().m_selectedArticleId != 0) {
|
||||||
m_activeArticleId = GlobalState.getInstance().m_selectedArticleId;
|
m_activeArticleId = Application.getInstance().m_selectedArticleId;
|
||||||
GlobalState.getInstance().m_selectedArticleId = 0;
|
Application.getInstance().m_selectedArticleId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_activeArticleId != 0) {
|
if (m_activeArticleId != 0) {
|
||||||
|
@ -21,10 +21,10 @@ import android.view.Gravity;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import org.fox.ttrss.GlobalState;
|
import org.fox.ttrss.Application;
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
|
|
||||||
public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
|
public class OfflineMasterActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
|
|
||||||
//private boolean m_actionbarUpEnabled = false;
|
//private boolean m_actionbarUpEnabled = false;
|
||||||
@ -45,14 +45,14 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.headlines);
|
setContentView(R.layout.activity_master);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
GlobalState.getInstance().load(savedInstanceState);
|
Application.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
m_drawerLayout = (DrawerLayout) findViewById(R.id.headlines_drawer);
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
|
|
||||||
public void openFeedArticles(int feedId, boolean isCat) {
|
public void openFeedArticles(int feedId, boolean isCat) {
|
||||||
if (isSmallScreen()) {
|
if (isSmallScreen()) {
|
||||||
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class);
|
Intent intent = new Intent(OfflineMasterActivity.this, OfflineDetailActivity.class);
|
||||||
|
|
||||||
intent.putExtra("feed", feedId);
|
intent.putExtra("feed", feedId);
|
||||||
intent.putExtra("isCat", isCat);
|
intent.putExtra("isCat", isCat);
|
||||||
@ -197,7 +197,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
|
|
||||||
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
out.putBoolean("feedIsSelected", m_feedIsSelected);
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
Application.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initMenu() {
|
public void initMenu() {
|
||||||
@ -335,7 +335,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
|
|||||||
if (open) {
|
if (open) {
|
||||||
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class);
|
Intent intent = new Intent(OfflineMasterActivity.this, OfflineDetailActivity.class);
|
||||||
intent.putExtra("feed", hf.getFeedId());
|
intent.putExtra("feed", hf.getFeedId());
|
||||||
intent.putExtra("isCat", hf.getFeedIsCat());
|
intent.putExtra("isCat", hf.getFeedIsCat());
|
||||||
intent.putExtra("article", articleId);
|
intent.putExtra("article", articleId);
|
@ -1,17 +1,11 @@
|
|||||||
package org.fox.ttrss.share;
|
package org.fox.ttrss.share;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.fox.ttrss.ApiRequest;
|
import org.fox.ttrss.ApiRequest;
|
||||||
import org.fox.ttrss.PreferencesActivity;
|
import org.fox.ttrss.PreferencesActivity;
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
import org.fox.ttrss.util.SimpleLoginManager;
|
import org.fox.ttrss.util.SimpleLoginManager;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -127,7 +121,7 @@ public abstract class CommonShareActivity extends CommonActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.share_menu, menu);
|
inflater.inflate(R.menu.activity_share, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package org.fox.ttrss.tasker;
|
package org.fox.ttrss.tasker;
|
||||||
|
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
import org.fox.ttrss.offline.OfflineDownloadService;
|
|
||||||
import org.fox.ttrss.offline.OfflineUploadService;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -30,7 +28,7 @@ public class TaskerSettingsActivity extends Activity {
|
|||||||
|
|
||||||
int actionId = settings != null ? settings.getInt("actionId", -1) : -1;
|
int actionId = settings != null ? settings.getInt("actionId", -1) : -1;
|
||||||
|
|
||||||
setContentView(R.layout.tasker_settings);
|
setContentView(R.layout.settings_tasker);
|
||||||
|
|
||||||
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.taskerActions);
|
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.taskerActions);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class FontSizeDialogPreference extends DialogPreference {
|
|||||||
setProgressTextSuffix(" " + context.getString(R.string.font_size_dialog_suffix));
|
setProgressTextSuffix(" " + context.getString(R.string.font_size_dialog_suffix));
|
||||||
|
|
||||||
// set layout
|
// set layout
|
||||||
setDialogLayoutResource(R.layout.dialog_select_font_size);
|
setDialogLayoutResource(R.layout.settings_select_font_size);
|
||||||
setPositiveButtonText(android.R.string.ok);
|
setPositiveButtonText(android.R.string.ok);
|
||||||
setNegativeButtonText(android.R.string.cancel);
|
setNegativeButtonText(android.R.string.cancel);
|
||||||
setDialogIcon(null);
|
setDialogIcon(null);
|
||||||
|
@ -25,7 +25,7 @@ public class HeadlinesRequest extends ApiRequest {
|
|||||||
|
|
||||||
private int m_offset = 0;
|
private int m_offset = 0;
|
||||||
private OnlineActivity m_activity;
|
private OnlineActivity m_activity;
|
||||||
private ArticleList m_articles; // = new ArticleList(); //GlobalState.getInstance().m_loadedArticles;
|
private ArticleList m_articles; // = new ArticleList(); //Application.getInstance().m_loadedArticles;
|
||||||
private Feed m_feed;
|
private Feed m_feed;
|
||||||
|
|
||||||
public HeadlinesRequest(Context context, OnlineActivity activity, final Feed feed, ArticleList articles) {
|
public HeadlinesRequest(Context context, OnlineActivity activity, final Feed feed, ArticleList articles) {
|
||||||
@ -41,7 +41,7 @@ public class HeadlinesRequest extends ApiRequest {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// check if we are returning results for correct feed
|
// check if we are returning results for correct feed
|
||||||
/* if (GlobalState.getInstance().m_activeFeed != null && !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
/* if (Application.getInstance().m_activeFeed != null && !m_feed.equals(Application.getInstance().m_activeFeed)) {
|
||||||
Log.d(TAG, "received results for wrong feed, bailing out.");
|
Log.d(TAG, "received results for wrong feed, bailing out.");
|
||||||
return;
|
return;
|
||||||
} */
|
} */
|
||||||
|
0
org.fox.ttrss/src/main/res/layout/login.xml → org.fox.ttrss/src/main/res/layout/activity_login.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/layout/login.xml → org.fox.ttrss/src/main/res/layout/activity_login.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/layout/preferences.xml → org.fox.ttrss/src/main/res/layout/activity_preferences.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/layout/preferences.xml → org.fox.ttrss/src/main/res/layout/activity_preferences.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/headlines_action_menu.xml → org.fox.ttrss/src/main/res/menu/action_mode_headlines.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/headlines_action_menu.xml → org.fox.ttrss/src/main/res/menu/action_mode_headlines.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/main_menu.xml → org.fox.ttrss/src/main/res/menu/activity_main.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/main_menu.xml → org.fox.ttrss/src/main/res/menu/activity_main.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/offline_menu.xml → org.fox.ttrss/src/main/res/menu/activity_offline.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/offline_menu.xml → org.fox.ttrss/src/main/res/menu/activity_offline.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/share_menu.xml → org.fox.ttrss/src/main/res/menu/activity_share.xml
Executable file → Normal file
0
org.fox.ttrss/src/main/res/menu/share_menu.xml → org.fox.ttrss/src/main/res/menu/activity_share.xml
Executable file → Normal file
Loading…
Reference in New Issue
Block a user