diff options
author | Andrew Dolgov <[email protected]> | 2013-05-21 14:31:15 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-05-21 14:31:15 +0400 |
commit | 4f49ae38dd06974ada031153569b5fff64e8afb3 (patch) | |
tree | b1bb52e4f07b4cc4b4f436a28865d87161a72be6 /src | |
parent | 1bc939e60b361bd85915511b0b3c27bb4ae12238 (diff) | |
parent | 48f2680916df329bbe34365ee58ceed67dc082ba (diff) |
Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttrss/CommonActivity.java | 7 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedCategoriesFragment.java | 23 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedsActivity.java | 39 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedsFragment.java | 16 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesActivity.java | 4 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 11 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 113 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineActivity.java | 4 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java | 21 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineFeedsActivity.java | 41 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineFeedsFragment.java | 16 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java | 26 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 13 |
13 files changed, 251 insertions, 83 deletions
diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index e1cacb02..78d1937c 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -166,6 +166,13 @@ public class CommonActivity extends SherlockFragmentActivity { toast.show(); } + public boolean isDarkTheme() { + String defaultTheme = "THEME_DARK"; + + return (m_prefs.getString("theme", defaultTheme).equals("THEME_DARK")) || + m_prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY"); + } + protected void setAppTheme(SharedPreferences prefs) { String defaultTheme = "THEME_DARK"; diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java index 90889255..144ea7c8 100644 --- a/src/org/fox/ttrss/FeedCategoriesFragment.java +++ b/src/org/fox/ttrss/FeedCategoriesFragment.java @@ -21,6 +21,7 @@ import android.support.v4.app.Fragment; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnClickListener; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -29,6 +30,7 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -406,6 +408,21 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe icon.setImageResource(cat.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); } + ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button); + + if (ib != null) { + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + + ib.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getActivity().openContextMenu(v); + } + }); + } + + return v; } } @@ -422,6 +439,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe public void onItemClick(AdapterView<?> av, View view, int position, long id) { ListView list = (ListView)av; + Log.d(TAG, "onItemClick=" + position); + if (list != null) { FeedCategory cat = (FeedCategory)list.getItemAtPosition(position); @@ -438,8 +457,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe } } - if (!m_activity.isSmallScreen()) - m_selectedCat = cat; + //if (!m_activity.isSmallScreen()) + // m_selectedCat = cat; m_adapter.notifyDataSetChanged(); } diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 43ae5152..914d5461 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -34,6 +34,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe protected long m_lastRefresh = 0; private boolean m_actionbarUpEnabled = false; + private int m_actionbarRevertDepth = 0; @SuppressLint("NewApi") @Override @@ -58,10 +59,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe if (intent.getParcelableExtra("feed") != null || intent.getParcelableExtra("category") != null || intent.getParcelableExtra("article") != null) { - if (!isCompatMode()) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - m_actionbarUpEnabled = true; - } + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + m_actionbarUpEnabled = true; Feed feed = (Feed) intent.getParcelableExtra("feed"); FeedCategory cat = (FeedCategory) intent.getParcelableExtra("category"); @@ -120,6 +119,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe } } else { // savedInstanceState != null m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); + m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); if (!isSmallScreen()) { // temporary hack because FeedsActivity doesn't track whether active feed is open @@ -127,7 +127,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe container.setWeightSum(3f); } - if (!isCompatMode() && m_actionbarUpEnabled) { + if (m_actionbarUpEnabled) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } @@ -237,7 +237,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe } public void onCatSelected(FeedCategory cat, boolean openAsFeed) { - + FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); + if (!openAsFeed) { if (isSmallScreen()) { @@ -248,6 +249,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe startActivityForResult(intent, 0); } else { + if (fc != null) { + fc.setSelectedCategory(null); + } + FragmentTransaction ft = getSupportFragmentManager() .beginTransaction(); @@ -257,8 +262,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe ft.addToBackStack(null); ft.commit(); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + m_actionbarUpEnabled = true; + m_actionbarRevertDepth = m_actionbarRevertDepth + 1; } } else { + + if (fc != null) { + fc.setSelectedCategory(cat); + } + Feed feed = new Feed(cat.id, cat.title, true); onFeedSelected(feed); } @@ -271,6 +285,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case android.R.id.home: + if (m_actionbarRevertDepth > 0) { + + m_actionbarRevertDepth = m_actionbarRevertDepth - 1; + m_actionbarUpEnabled = m_actionbarRevertDepth > 0; + getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled); + + onBackPressed(); + } else { + finish(); + } + return true; case R.id.show_feeds: setUnreadOnly(!getUnreadOnly()); initMenu(); @@ -299,6 +325,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe super.onSaveInstanceState(out); out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled); + out.putInt("actionbarRevertDepth", m_actionbarRevertDepth); GlobalState.getInstance().save(out); } diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index da428823..181d4418 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -34,6 +34,7 @@ import android.util.Base64; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnClickListener; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -42,6 +43,7 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -529,6 +531,20 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh } } + + ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button); + + if (ib != null) { + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + + ib.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getActivity().openContextMenu(v); + } + }); + } return v; } diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 505f3344..b44b4388 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -33,9 +33,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL setContentView(R.layout.headlines); - if (!isCompatMode()) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } + getSupportActionBar().setDisplayHomeAsUpEnabled(true); setSmallScreen(findViewById(R.id.headlines_fragment) == null); diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index f9cc51d8..c8a791b0 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -41,6 +41,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.CheckBox; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -272,7 +273,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, //list.setEmptyView(view.findViewById(R.id.no_headlines)); registerForContextMenu(list); - if (m_activity.isSmallScreen() || m_activity.isPortrait()) + if (m_activity.isSmallScreen()) view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0); Log.d(TAG, "onCreateView, feed=" + m_feed); @@ -721,17 +722,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, }); } - /* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button); + ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button); if (ib != null) { - ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE); + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getActivity().openContextMenu(v); } }); - } */ + } return v; } diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 50f1c71c..c3696d02 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -621,9 +621,9 @@ public class OnlineActivity extends CommonActivity { final ArticlePager ap = (ArticlePager)getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); switch (item.getItemId()) { - case android.R.id.home: + /* case android.R.id.home: finish(); - return true; + return true; */ case R.id.subscribe_to_feed: Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class); startActivityForResult(subscribe, 0); @@ -749,55 +749,35 @@ public class OnlineActivity extends CommonActivity { int count = hf.getUnreadArticles().size(); + boolean confirm = m_prefs.getBoolean("confirm_headlines_catchup", true); + if (count > 0) { - AlertDialog.Builder builder = new AlertDialog.Builder( - OnlineActivity.this) - .setMessage(getString(R.string.mark_num_headlines_as_read, count)) - .setPositiveButton(R.string.catchup, - new Dialog.OnClickListener() { - public void onClick(DialogInterface dialog, - int which) { - - ArticleList articles = hf.getUnreadArticles(); - - for (Article a : articles) - a.unread = false; - - ApiRequest req = new ApiRequest(getApplicationContext()) { - protected void onPostExecute(JsonElement result) { - if (hf.isAdded()) { - hf.refresh(false); - } - } - }; - - final String articleIds = articlesToIdString(articles); - - @SuppressWarnings("serial") - HashMap<String, String> map = new HashMap<String, String>() { - { - put("sid", getSessionId()); - put("op", "updateArticle"); - put("article_ids", articleIds); - put("mode", "0"); - put("field", "2"); - } - }; - req.execute(map); - - - } - }) - .setNegativeButton(R.string.dialog_cancel, - new Dialog.OnClickListener() { - public void onClick(DialogInterface dialog, - int which) { - - } - }); - - AlertDialog dlg = builder.create(); - dlg.show(); + if (confirm) { + AlertDialog.Builder builder = new AlertDialog.Builder( + OnlineActivity.this) + .setMessage(getString(R.string.mark_num_headlines_as_read, count)) + .setPositiveButton(R.string.catchup, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + catchupVisibleArticles(); + + } + }) + .setNegativeButton(R.string.dialog_cancel, + new Dialog.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + + } + }); + + AlertDialog dlg = builder.create(); + dlg.show(); + } else { + catchupVisibleArticles(); + } } } return true; @@ -1020,6 +1000,39 @@ public class OnlineActivity extends CommonActivity { } } + protected void catchupVisibleArticles() { + final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); + + if (hf != null) { + ArticleList articles = hf.getUnreadArticles(); + + for (Article a : articles) + a.unread = false; + + ApiRequest req = new ApiRequest(getApplicationContext()) { + protected void onPostExecute(JsonElement result) { + if (hf.isAdded()) { + hf.refresh(false); + } + } + }; + + final String articleIds = articlesToIdString(articles); + + @SuppressWarnings("serial") + HashMap<String, String> map = new HashMap<String, String>() { + { + put("sid", getSessionId()); + put("op", "updateArticle"); + put("article_ids", articleIds); + put("mode", "0"); + put("field", "2"); + } + }; + req.execute(map); + } + } + public void editArticleNote(final Article article) { String note = ""; diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 319b76c8..de437fcf 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -169,9 +169,9 @@ public class OfflineActivity extends CommonActivity { .findFragmentByTag(FRAG_ARTICLE); switch (item.getItemId()) { - case android.R.id.home: + /* case android.R.id.home: finish(); - return true; + return true; */ case R.id.go_online: switchOnline(); return true; diff --git a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java index 85f49d6b..426cda0d 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java @@ -15,6 +15,7 @@ import android.support.v4.widget.SimpleCursorAdapter; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnClickListener; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -22,6 +23,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -195,8 +197,8 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli m_activity.onCatSelected(feedId); } - if (!m_activity.isSmallScreen()) - m_selectedCatId = feedId; + /* if (!m_activity.isSmallScreen()) + m_selectedCatId = feedId; */ m_adapter.notifyDataSetChanged(); } @@ -282,6 +284,21 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli if (icon != null) { icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); } + + ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button); + + if (ib != null) { + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + + ib.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getActivity().openContextMenu(v); + } + }); + } + return v; } diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index dea8d336..fc0f521f 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -24,6 +24,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead private final String TAG = this.getClass().getSimpleName(); private boolean m_actionbarUpEnabled = false; + private int m_actionbarRevertDepth = 0; @SuppressLint("NewApi") @Override @@ -44,8 +45,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead if (savedInstanceState != null) { m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); + m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); - if (!isCompatMode() && m_actionbarUpEnabled) { + if (m_actionbarUpEnabled) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } @@ -55,10 +57,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead if (intent.getIntExtra("feed", -10000) != -10000 || intent.getIntExtra("category", -10000) != -10000 || intent.getIntExtra("article", -10000) != -10000) { - if (!isCompatMode()) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - m_actionbarUpEnabled = true; - } + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + m_actionbarUpEnabled = true; FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); @@ -129,6 +129,18 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case android.R.id.home: + if (m_actionbarRevertDepth > 0) { + + m_actionbarRevertDepth = m_actionbarRevertDepth - 1; + m_actionbarUpEnabled = m_actionbarRevertDepth > 0; + getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled); + + onBackPressed(); + } else { + finish(); + } + return true; case R.id.show_feeds: setUnreadOnly(!getUnreadOnly()); initMenu(); @@ -145,6 +157,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead super.onSaveInstanceState(out); out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled); + out.putInt("actionbarRevertDepth", m_actionbarRevertDepth); GlobalState.getInstance().save(out); } @@ -181,7 +194,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead } public void onCatSelected(int catId, boolean openAsFeed) { + OfflineFeedCategoriesFragment fc = (OfflineFeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); + if (openAsFeed) { + if (fc != null) { + fc.setSelectedFeedId(catId); + } + onFeedSelected(catId, true, true); } else { if (isSmallScreen()) { @@ -190,6 +209,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead startActivityForResult(intent, 0); } else { + if (fc != null) { + fc.setSelectedFeedId(-1); + } + FragmentTransaction ft = getSupportFragmentManager() .beginTransaction(); @@ -198,6 +221,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS); ft.addToBackStack(null); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + m_actionbarUpEnabled = true; + m_actionbarRevertDepth = m_actionbarRevertDepth + 1; ft.commit(); } @@ -305,7 +332,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead intent.putExtra("isCat", hf.getFeedIsCat()); intent.putExtra("article", articleId); - startActivityForResult(intent, 0); + startActivityForResult(intent, 0); + + overridePendingTransition(R.anim.right_slide_in, 0); } } else { refresh(); diff --git a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java index 50e13afb..a2231485 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java @@ -20,6 +20,7 @@ import android.support.v4.widget.SimpleCursorAdapter; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnClickListener; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -27,6 +28,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -307,6 +309,20 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene } + ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button); + + if (ib != null) { + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + + ib.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getActivity().openContextMenu(v); + } + }); + } + return v; } } diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java index 9aabfc9d..cfd1e19e 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java @@ -3,6 +3,8 @@ package org.fox.ttrss.offline; import org.fox.ttrss.GlobalState; import org.fox.ttrss.R; +import com.actionbarsherlock.view.MenuItem; + import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; @@ -13,6 +15,7 @@ import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; +import android.util.Log; import android.view.View; public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener { @@ -33,9 +36,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline setContentView(R.layout.headlines); - if (!isCompatMode()) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } + getSupportActionBar().setDisplayHomeAsUpEnabled(true); setSmallScreen(findViewById(R.id.headlines_fragment) == null); @@ -93,6 +94,19 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline } @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + overridePendingTransition(0, R.anim.right_slide_out); + return true; + default: + Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); + return super.onOptionsItemSelected(item); + } + } + + @Override public void onArticleSelected(int articleId, boolean open) { SQLiteStatement stmt = getWritableDb().compileStatement( "UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID @@ -144,4 +158,10 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline public void onArticleSelected(int articleId) { onArticleSelected(articleId, true); } + + @Override + public void onBackPressed() { + super.onBackPressed(); + overridePendingTransition(0, R.anim.right_slide_out); + } } diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index e7e848d2..b8ac6023 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -38,6 +38,7 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.CheckBox; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -283,7 +284,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis list.setEmptyView(view.findViewById(R.id.no_headlines)); registerForContextMenu(list); - if (m_activity.isSmallScreen() || m_activity.isPortrait()) + if (m_activity.isSmallScreen()) view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0); getActivity().setProgressBarIndeterminateVisibility(false); @@ -576,18 +577,20 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis }); } - /* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button); + ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button); if (ib != null) { - ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE); + if (m_activity.isDarkTheme()) + ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark); + ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getActivity().openContextMenu(v); } }); - } */ - + } + return v; } |