diff options
author | fox <[email protected]> | 2021-10-07 17:34:29 +0300 |
---|---|---|
committer | fox <[email protected]> | 2021-10-07 17:34:29 +0300 |
commit | 8b4271c1859d8d1d8f5035320f73539e9b080570 (patch) | |
tree | 84e9182c604f3aecdc44613c1ffc8d213ee0c3e0 /org.fox.ttrss/src/main/java/org | |
parent | 2ce729b0043a5bdb4e5f8d6347068944789c00bb (diff) | |
parent | a449d9a9b3649e545910bba8c3d95dec1b280377 (diff) |
Merge pull request 'Avoid double brace initialization' (#9) from gaul/tt-rss-android:double-brace into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss-android/pulls/9
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
13 files changed, 249 insertions, 339 deletions
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 e32d5ad1..86feeaed 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java @@ -304,44 +304,41 @@ public class ArticlePager extends StateSavedFragment { req.setOffset(skip); - HashMap<String,String> map = new HashMap<String,String>() { - { - put("op", "getHeadlines"); - put("sid", sessionId); - put("feed_id", String.valueOf(feed.id)); - put("show_excerpt", "true"); - put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); - put("show_content", "true"); - put("include_attachments", "true"); - put("limit", m_prefs.getString("headlines_request_size", "15")); - put("offset", String.valueOf(0)); - put("view_mode", m_activity.getViewMode()); - put("skip", String.valueOf(fskip)); - put("include_nested", "true"); - put("has_sandbox", "true"); - put("order_by", m_activity.getSortMode()); - - if (feed.is_cat) put("is_cat", "true"); - - if (m_searchQuery != null && m_searchQuery.length() != 0) { - put("search", m_searchQuery); - put("search_mode", ""); - put("match_on", "both"); - } + HashMap<String,String> map = new HashMap<String, String>(); + map.put("op", "getHeadlines"); + map.put("sid", sessionId); + map.put("feed_id", String.valueOf(feed.id)); + map.put("show_excerpt", "true"); + map.put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); + map.put("show_content", "true"); + map.put("include_attachments", "true"); + map.put("limit", m_prefs.getString("headlines_request_size", "15")); + map.put("offset", String.valueOf(0)); + map.put("view_mode", m_activity.getViewMode()); + map.put("skip", String.valueOf(fskip)); + map.put("include_nested", "true"); + map.put("has_sandbox", "true"); + map.put("order_by", m_activity.getSortMode()); + + if (feed.is_cat) map.put("is_cat", "true"); + + if (m_searchQuery != null && m_searchQuery.length() != 0) { + map.put("search", m_searchQuery); + map.put("search_mode", ""); + map.put("match_on", "both"); + } - if (m_firstId > 0) put("check_first_id", String.valueOf(m_firstId)); + if (m_firstId > 0) map.put("check_first_id", String.valueOf(m_firstId)); - if (m_activity.getApiLevel() >= 12) { - put("include_header", "true"); - } + if (m_activity.getApiLevel() >= 12) { + map.put("include_header", "true"); + } - if (m_prefs.getBoolean("enable_image_downsampling", false)) { - if (m_prefs.getBoolean("always_downsample_images", false) || !m_activity.isWifiConnected()) { - put("resize_width", String.valueOf(m_activity.getResizeWidth())); - } - } - } - }; + if (m_prefs.getBoolean("enable_image_downsampling", false)) { + if (m_prefs.getBoolean("always_downsample_images", false) || !m_activity.isWifiConnected()) { + map.put("resize_width", String.valueOf(m_activity.getResizeWidth())); + } + } Log.d(TAG, "[AP] request more headlines, firstId=" + m_firstId); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/DashClock.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/DashClock.java index e062206b..a270a9ed 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/DashClock.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/DashClock.java @@ -75,12 +75,9 @@ public class DashClock extends DashClockExtension { final String fSessionId = sessionId; - HashMap<String, String> umap = new HashMap<String, String>() { - { - put("op", "getUnread"); - put("sid", fSessionId); - } - }; + HashMap<String, String> umap = new HashMap<String, String>(); + umap.put("op", "getUnread"); + umap.put("sid", fSessionId); aru.execute(umap); } 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 a63913a2..0feda5d9 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java @@ -62,16 +62,13 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt final boolean unreadOnly = m_activity.getUnreadOnly(); @SuppressWarnings("serial") - HashMap<String, String> params = new HashMap<String, String>() { - { - put("op", "getCategories"); - put("sid", sessionId); - put("enable_nested", "true"); - if (unreadOnly) { - put("unread_only", String.valueOf(unreadOnly)); - } - } - }; + HashMap<String, String> params = new HashMap<String, String>(); + params.put("op", "getCategories"); + params.put("sid", sessionId); + params.put("enable_nested", "true"); + if (unreadOnly) { + params.put("unread_only", String.valueOf(unreadOnly)); + } return new ApiLoader(getContext(), params); } 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 d73e80d8..d6f373aa 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -77,17 +77,14 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi final String sessionId = m_activity.getSessionId(); final boolean unreadOnly = m_activity.getUnreadOnly() && (m_activeCategory == null || m_activeCategory.id != -1); - HashMap<String,String> params = new HashMap<String,String>() { - { - put("op", "getFeeds"); - put("sid", sessionId); - put("include_nested", "true"); - put("cat_id", String.valueOf(catId)); - if (unreadOnly) { - put("unread_only", String.valueOf(unreadOnly)); - } - } - }; + HashMap<String,String> params = new HashMap<String,String>(); + params.put("op", "getFeeds"); + params.put("sid", sessionId); + params.put("include_nested", "true"); + params.put("cat_id", String.valueOf(catId)); + if (unreadOnly) { + params.put("unread_only", String.valueOf(unreadOnly)); + } return new FeedsLoader(getActivity().getApplicationContext(), params, catId); } 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 672da44e..fb43f7ca 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -649,48 +649,45 @@ public class HeadlinesFragment extends StateSavedFragment { req.setOffset(skip); - HashMap<String,String> map = new HashMap<String,String>() { - { - put("op", "getHeadlines"); - put("sid", sessionId); - put("feed_id", String.valueOf(m_feed.id)); - put("show_excerpt", "true"); - put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); - put("show_content", "true"); - put("include_attachments", "true"); - put("view_mode", m_activity.getViewMode()); - put("limit", m_prefs.getString("headlines_request_size", "15")); - put("offset", String.valueOf(0)); - put("skip", String.valueOf(fskip)); - put("include_nested", "true"); - put("has_sandbox", "true"); - put("order_by", m_activity.getSortMode()); - - if (m_prefs.getBoolean("enable_image_downsampling", false)) { - if (m_prefs.getBoolean("always_downsample_images", false) || !m_activity.isWifiConnected()) { - put("resize_width", String.valueOf(m_activity.getResizeWidth())); - } - } + HashMap<String,String> map = new HashMap<String,String>(); + map.put("op", "getHeadlines"); + map.put("sid", sessionId); + map.put("feed_id", String.valueOf(m_feed.id)); + map.put("show_excerpt", "true"); + map.put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); + map.put("show_content", "true"); + map.put("include_attachments", "true"); + map.put("view_mode", m_activity.getViewMode()); + map.put("limit", m_prefs.getString("headlines_request_size", "15")); + map.put("offset", String.valueOf(0)); + map.put("skip", String.valueOf(fskip)); + map.put("include_nested", "true"); + map.put("has_sandbox", "true"); + map.put("order_by", m_activity.getSortMode()); + + if (m_prefs.getBoolean("enable_image_downsampling", false)) { + if (m_prefs.getBoolean("always_downsample_images", false) || !m_activity.isWifiConnected()) { + map.put("resize_width", String.valueOf(m_activity.getResizeWidth())); + } + } - if (isCat) put("is_cat", "true"); + if (isCat) map.put("is_cat", "true"); - if (allowForceUpdate) { - put("force_update", "true"); - } + if (allowForceUpdate) { + map.put("force_update", "true"); + } - if (m_searchQuery != null && m_searchQuery.length() != 0) { - put("search", m_searchQuery); - put("search_mode", ""); - put("match_on", "both"); - } + if (m_searchQuery != null && m_searchQuery.length() != 0) { + map.put("search", m_searchQuery); + map.put("search_mode", ""); + map.put("match_on", "both"); + } - if (m_firstId > 0) put("check_first_id", String.valueOf(m_firstId)); + if (m_firstId > 0) map.put("check_first_id", String.valueOf(m_firstId)); - if (m_activity.getApiLevel() >= 12) { - put("include_header", "true"); - } - } - }; + if (m_activity.getApiLevel() >= 12) { + map.put("include_header", "true"); + } Log.d(TAG, "[HP] request more headlines, firstId=" + m_firstId); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java index f7681e42..c29e2239 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java @@ -160,13 +160,10 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList } }); - HashMap<String, String> map = new HashMap<String, String>() { - { - put("op", "login"); - put("user", m_prefs.getString("login", "").trim()); - put("password", m_prefs.getString("password", "").trim()); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("op", "login"); + map.put("user", m_prefs.getString("login", "").trim()); + map.put("password", m_prefs.getString("password", "").trim()); lr.execute(map); } @@ -611,13 +608,10 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "unsubscribeFeed"); - put("feed_id", String.valueOf(feed.id)); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "unsubscribeFeed"); + map.put("feed_id", String.valueOf(feed.id)); req.execute(map); 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 f513173a..2da97902 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -407,13 +407,10 @@ public class OnlineActivity extends CommonActivity { LoginRequest ar = new LoginRequest(getApplicationContext(), refresh, listener); - HashMap<String, String> map = new HashMap<String, String>() { - { - put("op", "login"); - put("user", m_prefs.getString("login", "").trim()); - put("password", m_prefs.getString("password", "").trim()); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("op", "login"); + map.put("user", m_prefs.getString("login", "").trim()); + map.put("password", m_prefs.getString("password", "").trim()); ar.execute(map); @@ -1057,15 +1054,12 @@ public class OnlineActivity extends CommonActivity { final int labelId = itemIds[which]; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "setArticleLabel"); - put("label_id", String.valueOf(labelId)); - put("article_ids", String.valueOf(articleId)); - if (isChecked) put("assign", "true"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "setArticleLabel"); + map.put("label_id", String.valueOf(labelId)); + map.put("article_ids", String.valueOf(articleId)); + if (isChecked) map.put("assign", "true"); ApiRequest req = new ApiRequest(OnlineActivity.this); req.execute(map); @@ -1087,13 +1081,10 @@ public class OnlineActivity extends CommonActivity { }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "getLabels"); - put("article_id", String.valueOf(articleId)); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "getLabels"); + map.put("article_id", String.valueOf(articleId)); req.execute(map); } @@ -1213,15 +1204,12 @@ public class OnlineActivity extends CommonActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", String.valueOf(article.id)); - put("mode", article.unread ? "1" : "0"); - put("field", "2"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", String.valueOf(article.id)); + map.put("mode", article.unread ? "1" : "0"); + map.put("field", "2"); req.execute(map); } @@ -1234,15 +1222,12 @@ public class OnlineActivity extends CommonActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", String.valueOf(article.id)); - put("data", String.valueOf(article.score)); - put("field", "4"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", String.valueOf(article.id)); + map.put("data", String.valueOf(article.score)); + map.put("field", "4"); req.execute(map); } @@ -1255,15 +1240,12 @@ public class OnlineActivity extends CommonActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", String.valueOf(article.id)); - put("mode", article.marked ? "1" : "0"); - put("field", "0"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", String.valueOf(article.id)); + map.put("mode", article.marked ? "1" : "0"); + map.put("field", "0"); req.execute(map); } @@ -1278,15 +1260,12 @@ public class OnlineActivity extends CommonActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", String.valueOf(article.id)); - put("mode", article.published ? "1" : "0"); - put("field", "1"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", String.valueOf(article.id)); + map.put("mode", article.published ? "1" : "0"); + map.put("field", "1"); req.execute(map); } @@ -1299,16 +1278,13 @@ public class OnlineActivity extends CommonActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", String.valueOf(article.id)); - put("mode", "1"); - put("data", note); - put("field", "3"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", String.valueOf(article.id)); + map.put("mode", "1"); + map.put("data", note); + map.put("field", "3"); req.execute(map); } @@ -1411,16 +1387,13 @@ public class OnlineActivity extends CommonActivity { }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "catchupFeed"); - put("feed_id", String.valueOf(feed.id)); - put("mode", mode); - if (feed.is_cat) - put("is_cat", "1"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "catchupFeed"); + map.put("feed_id", String.valueOf(feed.id)); + map.put("mode", mode); + if (feed.is_cat) + map.put("is_cat", "1"); req.execute(map); } @@ -1429,15 +1402,12 @@ public class OnlineActivity extends CommonActivity { ApiRequest req = new ApiRequest(getApplicationContext()); @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", articlesToIdString(articles)); - put("mode", "2"); - put("field", "0"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", articlesToIdString(articles)); + map.put("mode", "2"); + map.put("field", "0"); req.execute(map); } @@ -1446,15 +1416,12 @@ public class OnlineActivity extends CommonActivity { ApiRequest req = new ApiRequest(getApplicationContext()); @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", articlesToIdString(articles)); - put("mode", "2"); - put("field", "2"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", articlesToIdString(articles)); + map.put("mode", "2"); + map.put("field", "2"); req.execute(map); //refresh(); @@ -1464,15 +1431,12 @@ public class OnlineActivity extends CommonActivity { ApiRequest req = new ApiRequest(getApplicationContext()); @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", articlesToIdString(articles)); - put("mode", "2"); - put("field", "1"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "updateArticle"); + map.put("article_ids", articlesToIdString(articles)); + map.put("mode", "2"); + map.put("field", "1"); req.execute(map); } @@ -1660,12 +1624,9 @@ public class OnlineActivity extends CommonActivity { }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "getApiLevel"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", getSessionId()); + map.put("op", "getApiLevel"); req.execute(map); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineDownloadService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineDownloadService.java index 9c8b05db..ec1c353d 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineDownloadService.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineDownloadService.java @@ -266,22 +266,19 @@ public class OfflineDownloadService extends Service { OfflineArticlesRequest req = new OfflineArticlesRequest(this); @SuppressWarnings("serial") - HashMap<String,String> map = new HashMap<String,String>() { - { - put("op", "getHeadlines"); - put("sid", m_sessionId); - put("feed_id", "-4"); - - if (BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { - put("view_mode", "all_articles"); - } else { - put("view_mode", "unread"); - } - put("show_content", "true"); - put("skip", String.valueOf(m_articleOffset)); - put("limit", String.valueOf(OFFLINE_SYNC_SEQ)); - } - }; + HashMap<String,String> map = new HashMap<String,String>(); + map.put("op", "getHeadlines"); + map.put("sid", m_sessionId); + map.put("feed_id", "-4"); + + if (BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { + map.put("view_mode", "all_articles"); + } else { + map.put("view_mode", "unread"); + } + map.put("show_content", "true"); + map.put("skip", String.valueOf(m_articleOffset)); + map.put("limit", String.valueOf(OFFLINE_SYNC_SEQ)); req.execute(map); } @@ -351,17 +348,14 @@ public class OfflineDownloadService extends Service { }; @SuppressWarnings("serial") - HashMap<String,String> map = new HashMap<String,String>() { - { - put("op", "getFeeds"); - put("sid", m_sessionId); - put("cat_id", "-3"); - - if (!BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { - put("unread_only", "true"); - } - } - }; + HashMap<String,String> map = new HashMap<String,String>(); + map.put("op", "getFeeds"); + map.put("sid", m_sessionId); + map.put("cat_id", "-3"); + + if (!BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { + map.put("unread_only", "true"); + } req.execute(map); } @@ -422,17 +416,14 @@ public class OfflineDownloadService extends Service { }; @SuppressWarnings("serial") - HashMap<String,String> map = new HashMap<String,String>() { - { - put("op", "getCategories"); - put("sid", m_sessionId); - //put("cat_id", "-3"); - - if (!BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { - put("unread_only", "true"); - } - } - }; + HashMap<String,String> map = new HashMap<String,String>(); + map.put("op", "getCategories"); + map.put("sid", m_sessionId); + //put("cat_id", "-3"); + + if (!BuildConfig.DEBUG && OFFLINE_DEBUG_READ) { + map.put("unread_only", "true"); + } req.execute(map); } 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 8f3b11fa..fb22cafd 100755 --- 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 @@ -196,36 +196,33 @@ public class OfflineUploadService extends IntentService { }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", m_sessionId); - put("op", "updateArticle"); - put("article_ids", android.text.TextUtils.join(",", ids)); - - switch (criteria) { - case READ: - put("mode", "0"); - put("field", "2"); - break; - case PUBLISHED: - put("mode", "1"); - put("field", "1"); - break; - case UNPUBLISHED: - put("mode", "0"); - put("field", "1"); - break; - case MARKED: - put("mode", "1"); - put("field", "0"); - break; - case UNMARKED: - put("mode", "0"); - put("field", "0"); - break; - } - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", m_sessionId); + map.put("op", "updateArticle"); + map.put("article_ids", android.text.TextUtils.join(",", ids)); + + switch (criteria) { + case READ: + map.put("mode", "0"); + map.put("field", "2"); + break; + case PUBLISHED: + map.put("mode", "1"); + map.put("field", "1"); + break; + case UNPUBLISHED: + map.put("mode", "0"); + map.put("field", "1"); + break; + case MARKED: + map.put("mode", "1"); + map.put("field", "0"); + break; + case UNMARKED: + map.put("mode", "0"); + map.put("field", "0"); + break; + } req.execute(map); } else { 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 46e89b28..3b1da2c9 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 @@ -112,15 +112,12 @@ public class ShareActivity extends CommonShareActivity { final EditText content = (EditText) findViewById(R.id.content); if (url != null && title != null && content != null) { - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", m_sessionId); - put("op", "shareToPublished"); - put("title", title.getText().toString()); - put("url", url.getText().toString()); - put("content", content.getText().toString()); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", m_sessionId); + map.put("op", "shareToPublished"); + map.put("title", title.getText().toString()); + map.put("url", url.getText().toString()); + map.put("content", content.getText().toString()); setProgressBarIndeterminateVisibility(true); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java index c25784b5..1463958d 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java @@ -239,17 +239,14 @@ public class SubscribeActivity extends CommonShareActivity { final EditText feedUrl = (EditText) findViewById(R.id.feed_url); if (feedUrl != null ) { - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", m_sessionId); - put("op", "subscribeToFeed"); - put("feed_url", feedUrl.getText().toString()); - - if (cat != null) { - put("category_id", String.valueOf(cat.id)); - } - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", m_sessionId); + map.put("op", "subscribeToFeed"); + map.put("feed_url", feedUrl.getText().toString()); + + if (cat != null) { + map.put("category_id", String.valueOf(cat.id)); + } m_progressBar.setVisibility(View.VISIBLE); @@ -304,12 +301,9 @@ public class SubscribeActivity extends CommonShareActivity { } }; - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", m_sessionId); - put("op", "getCategories"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", m_sessionId); + map.put("op", "getCategories"); m_progressBar.setVisibility(View.VISIBLE); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java index 5f5c5230..7502a95c 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java @@ -56,12 +56,9 @@ public abstract class SimpleLoginManager { }; @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", m_sessionId); - put("op", "getApiLevel"); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("sid", m_sessionId); + map.put("op", "getApiLevel"); req.execute(map); @@ -83,13 +80,10 @@ public abstract class SimpleLoginManager { public void logIn(Context context, int requestId, final String login, final String password) { LoginRequest ar = new LoginRequest(context, requestId); - HashMap<String, String> map = new HashMap<String, String>() { - { - put("op", "login"); - put("user", login.trim()); - put("password", password.trim()); - } - }; + HashMap<String, String> map = new HashMap<String, String>(); + map.put("op", "login"); + map.put("user", login.trim()); + map.put("password", password.trim()); onLoggingIn(requestId); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java index 3af5b068..a38451b0 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java @@ -124,13 +124,10 @@ public class WidgetUpdateService extends JobIntentService { final String fSessionId = sessionId; - HashMap<String, String> umap = new HashMap<String, String>() { - { - put("op", "getUnread"); - put("feed_id", String.valueOf(feedId)); - put("sid", fSessionId); - } - }; + HashMap<String, String> umap = new HashMap<String, String>(); + umap.put("op", "getUnread"); + umap.put("feed_id", String.valueOf(feedId)); + umap.put("sid", fSessionId); aru.execute(umap); } |