minor code cleanup
This commit is contained in:
parent
0fa771ab37
commit
ff63819a65
@ -144,7 +144,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
|||||||
out.putParcelable("cats", m_cats);
|
out.putParcelable("cats", m_cats);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingStatus(int status, boolean showProgress) {
|
private void setLoadingStatus(int status, boolean showProgress) {
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingStatus(int status, boolean showProgress) {
|
private void setLoadingStatus(int status, boolean showProgress) {
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
article.unread = false;
|
article.unread = false;
|
||||||
m_onlineServices.saveArticleUnread(article);
|
m_onlineServices.saveArticleUnread(article);
|
||||||
} else {
|
} else {
|
||||||
m_onlineServices.openArticle(article, 0);
|
m_onlineServices.onArticleSelected(article);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeArticle = article;
|
m_activeArticle = article;
|
||||||
@ -252,7 +252,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
out.putCharSequence("searchQuery", m_searchQuery);
|
out.putCharSequence("searchQuery", m_searchQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingStatus(int status, boolean showProgress) {
|
private void setLoadingStatus(int status, boolean showProgress) {
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
|
||||||
|
|
||||||
@ -589,7 +589,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
m_selectedArticles.remove(article);
|
m_selectedArticles.remove(article);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_onlineServices.initMainMenu();
|
m_onlineServices.onArticleListSelectionChange(m_selectedArticles);
|
||||||
|
|
||||||
Log.d(TAG, "num selected: " + m_selectedArticles.size());
|
Log.d(TAG, "num selected: " + m_selectedArticles.size());
|
||||||
}
|
}
|
||||||
@ -602,13 +602,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void notifyUpdated() {
|
/* public void notifyUpdated() {
|
||||||
m_adapter.notifyDataSetChanged();
|
m_adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
Article article = m_onlineServices.getSelectedArticle();
|
Article article = m_onlineServices.getSelectedArticle();
|
||||||
|
|
||||||
setActiveArticle(article);
|
setActiveArticle(article);
|
||||||
}
|
} */
|
||||||
|
|
||||||
public ArticleList getAllArticles() {
|
public ArticleList getAllArticles() {
|
||||||
return m_articles;
|
return m_articles;
|
||||||
|
@ -332,7 +332,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
|
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(FRAG_HEADLINES);
|
.findFragmentByTag(FRAG_HEADLINES);
|
||||||
if (frag != null) {
|
if (frag != null) {
|
||||||
frag.notifyUpdated();
|
frag.setActiveArticle(m_selectedArticle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +997,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
if (selected.size() > 0) {
|
if (selected.size() > 0) {
|
||||||
selected.clear();
|
selected.clear();
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1201,7 +1201,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
for (Article a : articles)
|
for (Article a : articles)
|
||||||
a.unread = false;
|
a.unread = false;
|
||||||
|
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
|
|
||||||
ApiRequest req = new ApiRequest(getApplicationContext());
|
ApiRequest req = new ApiRequest(getApplicationContext());
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
if (m_selectedArticle != null) {
|
if (m_selectedArticle != null) {
|
||||||
m_selectedArticle.marked = !m_selectedArticle.marked;
|
m_selectedArticle.marked = !m_selectedArticle.marked;
|
||||||
saveArticleMarked(m_selectedArticle);
|
saveArticleMarked(m_selectedArticle);
|
||||||
//updateHeadlines();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.selection_select_none:
|
case R.id.selection_select_none:
|
||||||
@ -1246,7 +1246,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.unread = !a.unread;
|
a.unread = !a.unread;
|
||||||
|
|
||||||
toggleArticlesUnread(selected);
|
toggleArticlesUnread(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.marked = !a.marked;
|
a.marked = !a.marked;
|
||||||
|
|
||||||
toggleArticlesMarked(selected);
|
toggleArticlesMarked(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1273,7 +1273,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.published = !a.published;
|
a.published = !a.published;
|
||||||
|
|
||||||
toggleArticlesPublished(selected);
|
toggleArticlesPublished(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1297,7 +1297,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
}
|
}
|
||||||
if (tmp.size() > 0) {
|
if (tmp.size() > 0) {
|
||||||
toggleArticlesUnread(tmp);
|
toggleArticlesUnread(tmp);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1471,7 +1471,6 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint({ "NewApi", "NewApi", "NewApi" })
|
@SuppressLint({ "NewApi", "NewApi", "NewApi" })
|
||||||
@Override
|
|
||||||
public void initMainMenu() {
|
public void initMainMenu() {
|
||||||
if (m_menu != null) {
|
if (m_menu != null) {
|
||||||
|
|
||||||
@ -1893,8 +1892,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArticleSelected(Article article) {
|
||||||
|
openArticle(article);
|
||||||
|
}
|
||||||
|
|
||||||
public void openArticle(Article article, int compatAnimation) {
|
public void openArticle(Article article) {
|
||||||
m_selectedArticle = article;
|
m_selectedArticle = article;
|
||||||
|
|
||||||
if (article.unread) {
|
if (article.unread) {
|
||||||
@ -1904,13 +1908,6 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
|
|
||||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(FRAG_HEADLINES);
|
|
||||||
|
|
||||||
if (hf != null) {
|
|
||||||
hf.setActiveArticle(article);
|
|
||||||
}
|
|
||||||
|
|
||||||
Fragment frag;
|
Fragment frag;
|
||||||
|
|
||||||
if (m_smallScreenMode || m_prefs.getBoolean("tablet_article_swipe", false)) {
|
if (m_smallScreenMode || m_prefs.getBoolean("tablet_article_swipe", false)) {
|
||||||
@ -2105,13 +2102,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.marked = !a.marked;
|
a.marked = !a.marked;
|
||||||
|
|
||||||
toggleArticlesMarked(selected);
|
toggleArticlesMarked(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
} else {
|
} else {
|
||||||
Article article = hf.getArticleAtPosition(info.position);
|
Article article = hf.getArticleAtPosition(info.position);
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
article.marked = !article.marked;
|
article.marked = !article.marked;
|
||||||
saveArticleMarked(article);
|
saveArticleMarked(article);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2125,13 +2122,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.published = !a.published;
|
a.published = !a.published;
|
||||||
|
|
||||||
toggleArticlesPublished(selected);
|
toggleArticlesPublished(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
} else {
|
} else {
|
||||||
Article article = hf.getArticleAtPosition(info.position);
|
Article article = hf.getArticleAtPosition(info.position);
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
article.published = !article.published;
|
article.published = !article.published;
|
||||||
saveArticlePublished(article);
|
saveArticlePublished(article);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2145,13 +2142,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
a.unread = !a.unread;
|
a.unread = !a.unread;
|
||||||
|
|
||||||
toggleArticlesUnread(selected);
|
toggleArticlesUnread(selected);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
} else {
|
} else {
|
||||||
Article article = hf.getArticleAtPosition(info.position);
|
Article article = hf.getArticleAtPosition(info.position);
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
article.unread = !article.unread;
|
article.unread = !article.unread;
|
||||||
saveArticleUnread(article);
|
saveArticleUnread(article);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2177,7 +2174,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
}
|
}
|
||||||
if (tmp.size() > 0) {
|
if (tmp.size() > 0) {
|
||||||
toggleArticlesUnread(tmp);
|
toggleArticlesUnread(tmp);
|
||||||
hf.notifyUpdated();
|
updateHeadlines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2194,8 +2191,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private Article getRelativeArticle(Article article, RelativeArticle ra) {
|
||||||
public Article getRelativeArticle(Article article, RelativeArticle ra) {
|
|
||||||
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
|
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(FRAG_HEADLINES);
|
.findFragmentByTag(FRAG_HEADLINES);
|
||||||
if (frag != null) {
|
if (frag != null) {
|
||||||
@ -2249,7 +2245,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
next.unread = false;
|
next.unread = false;
|
||||||
saveArticleUnread(next);
|
saveArticleUnread(next);
|
||||||
} else {
|
} else {
|
||||||
openArticle(next, 0);
|
openArticle(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2277,7 +2273,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
prev.unread = false;
|
prev.unread = false;
|
||||||
saveArticleUnread(prev);
|
saveArticleUnread(prev);
|
||||||
} else {
|
} else {
|
||||||
openArticle(prev, 0);
|
openArticle(prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2319,11 +2315,6 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _closeFeed() {
|
|
||||||
if (m_activeFeed != null) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restart() {
|
public void restart() {
|
||||||
Intent refresh = new Intent(MainActivity.this, MainActivity.class);
|
Intent refresh = new Intent(MainActivity.this, MainActivity.class);
|
||||||
@ -2331,4 +2322,9 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
startActivity(refresh);
|
startActivity(refresh);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArticleListSelectionChange(ArticleList selection) {
|
||||||
|
initMainMenu();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,31 +1,30 @@
|
|||||||
package org.fox.ttrss;
|
package org.fox.ttrss;
|
||||||
|
|
||||||
import org.fox.ttrss.types.Article;
|
import org.fox.ttrss.types.Article;
|
||||||
|
import org.fox.ttrss.types.ArticleList;
|
||||||
import org.fox.ttrss.types.Feed;
|
import org.fox.ttrss.types.Feed;
|
||||||
import org.fox.ttrss.types.FeedCategory;
|
import org.fox.ttrss.types.FeedCategory;
|
||||||
|
|
||||||
public interface OnlineServices {
|
public interface OnlineServices {
|
||||||
public enum RelativeArticle { BEFORE, AFTER };
|
public enum RelativeArticle { BEFORE, AFTER };
|
||||||
|
|
||||||
public Article getSelectedArticle();
|
|
||||||
public void saveArticleUnread(final Article article);
|
public void saveArticleUnread(final Article article);
|
||||||
public void saveArticleMarked(final Article article);
|
public void saveArticleMarked(final Article article);
|
||||||
public void saveArticlePublished(final Article article);
|
public void saveArticlePublished(final Article article);
|
||||||
public void openArticle(Article article, int compatAnimation);
|
public void setSelectedArticle(Article article);
|
||||||
public Article getRelativeArticle(Article article, RelativeArticle ra);
|
public boolean getUnreadArticlesOnly();
|
||||||
|
|
||||||
public void onCatSelected(FeedCategory cat);
|
public void onCatSelected(FeedCategory cat);
|
||||||
public void onFeedSelected(Feed feed);
|
public void onFeedSelected(Feed feed);
|
||||||
|
public void onArticleSelected(Article article);
|
||||||
|
public void onArticleListSelectionChange(ArticleList selection);
|
||||||
|
|
||||||
public void initMainMenu();
|
//public void initMainMenu();
|
||||||
//public void login();
|
|
||||||
public void restart();
|
public void restart();
|
||||||
public String getSessionId();
|
public String getSessionId();
|
||||||
public boolean getUnreadArticlesOnly();
|
|
||||||
public boolean isSmallScreen();
|
public boolean isSmallScreen();
|
||||||
public boolean getUnreadOnly();
|
public boolean getUnreadOnly();
|
||||||
public int getApiLevel();
|
public int getApiLevel();
|
||||||
public void setSelectedArticle(Article article);
|
|
||||||
public int getOrientation();
|
public int getOrientation();
|
||||||
|
|
||||||
public void copyToClipboard(String str);
|
public void copyToClipboard(String str);
|
||||||
|
@ -1461,12 +1461,12 @@ public class OfflineActivity extends FragmentActivity implements
|
|||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
|
|
||||||
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager()
|
/* OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag(FRAG_HEADLINES);
|
.findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
if (hf != null) {
|
if (hf != null) {
|
||||||
hf.setActiveArticleId(articleId);
|
hf.setActiveArticleId(articleId);
|
||||||
}
|
} */
|
||||||
|
|
||||||
SQLiteStatement stmt = getWritableDb().compileStatement(
|
SQLiteStatement stmt = getWritableDb().compileStatement(
|
||||||
"UPDATE articles SET unread = 0 " + "WHERE " + BaseColumns._ID
|
"UPDATE articles SET unread = 0 " + "WHERE " + BaseColumns._ID
|
||||||
|
Loading…
Reference in New Issue
Block a user