add menu options to close active feed and article panels
This commit is contained in:
parent
969d3bb742
commit
0702083fb2
@ -62,6 +62,13 @@
|
|||||||
android:icon="@drawable/ic_menu_database"
|
android:icon="@drawable/ic_menu_database"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/headlines_select"/>
|
android:title="@string/headlines_select"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/close_feed"
|
||||||
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/close_feed"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group android:id="@+id/menu_group_headlines_selection" >
|
<group android:id="@+id/menu_group_headlines_selection" >
|
||||||
@ -132,6 +139,13 @@
|
|||||||
android:id="@+id/article_set_note"
|
android:id="@+id/article_set_note"
|
||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/article_set_note"/>
|
android:title="@string/article_set_note"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/close_article"
|
||||||
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/close_article"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
android:icon="@drawable/ic_menu_database"
|
android:icon="@drawable/ic_menu_database"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/headlines_select"/>
|
android:title="@string/headlines_select"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/close_feed"
|
||||||
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/close_feed"/>
|
||||||
</group>
|
</group>
|
||||||
<group android:id="@+id/menu_group_headlines_selection" >
|
<group android:id="@+id/menu_group_headlines_selection" >
|
||||||
<item
|
<item
|
||||||
@ -92,6 +97,11 @@
|
|||||||
android:id="@+id/catchup_above"
|
android:id="@+id/catchup_above"
|
||||||
android:icon="@drawable/ic_menu_tick"
|
android:icon="@drawable/ic_menu_tick"
|
||||||
android:title="@string/article_mark_read_above"/>
|
android:title="@string/article_mark_read_above"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/close_article"
|
||||||
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/close_article"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
@ -119,4 +119,6 @@
|
|||||||
<string name="dialog_offline_sync_stop">Stop syncing</string>
|
<string name="dialog_offline_sync_stop">Stop syncing</string>
|
||||||
<string name="dialog_offline_sync_continue">Continue</string>
|
<string name="dialog_offline_sync_continue">Continue</string>
|
||||||
<string name="article_set_note">Publish with note</string>
|
<string name="article_set_note">Publish with note</string>
|
||||||
|
<string name="close_feed">Close feed</string>
|
||||||
|
<string name="close_article">Close article</string>
|
||||||
</resources>
|
</resources>
|
@ -1014,6 +1014,28 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
.findFragmentByTag(FRAG_HEADLINES);
|
.findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.close_feed:
|
||||||
|
if (m_activeFeed != null) {
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.replace(R.id.headlines_fragment, new DummyFragment(), "");
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
|
if (m_activeFeed.is_cat) {
|
||||||
|
FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
|
cats.setSelectedCategory(null);
|
||||||
|
} else {
|
||||||
|
FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
|
feeds.setSelectedFeed(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_activeFeed = null;
|
||||||
|
|
||||||
|
initMainMenu();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case R.id.close_article:
|
||||||
|
closeArticle();
|
||||||
|
return true;
|
||||||
case R.id.donate:
|
case R.id.donate:
|
||||||
if (true) {
|
if (true) {
|
||||||
CharSequence[] items = { "Silver Donation ($2)", "Gold Donation ($5)", "Platinum Donation ($10)" };
|
CharSequence[] items = { "Silver Donation ($2)", "Gold Donation ($5)", "Platinum Donation ($10)" };
|
||||||
@ -1504,6 +1526,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
|
|
||||||
} else if (m_selectedArticle != null) {
|
} else if (m_selectedArticle != null) {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_article, true);
|
m_menu.setGroupVisible(R.id.menu_group_article, true);
|
||||||
|
m_menu.findItem(R.id.close_article).setVisible(!isSmallScreen());
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
||||||
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
|
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
|
||||||
@ -1511,11 +1534,16 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
if (m_selectedArticle != null) {
|
if (m_selectedArticle != null) {
|
||||||
Log.d(TAG, "setting up share provider");
|
Log.d(TAG, "setting up share provider");
|
||||||
shareProvider.setShareIntent(getShareIntent(m_selectedArticle));
|
shareProvider.setShareIntent(getShareIntent(m_selectedArticle));
|
||||||
|
|
||||||
|
if (!m_prefs.getBoolean("tablet_article_swipe", false) && !isSmallScreen()) {
|
||||||
|
m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (m_activeFeed != null) {
|
} else if (m_activeFeed != null) {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||||
|
m_menu.findItem(R.id.close_feed).setVisible(!isSmallScreen());
|
||||||
|
|
||||||
MenuItem search = m_menu.findItem(R.id.search);
|
MenuItem search = m_menu.findItem(R.id.search);
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.fox.ttrss.CommonActivity;
|
import org.fox.ttrss.CommonActivity;
|
||||||
import org.fox.ttrss.DummyFragment;
|
import org.fox.ttrss.DummyFragment;
|
||||||
|
import org.fox.ttrss.FeedCategoriesFragment;
|
||||||
|
import org.fox.ttrss.FeedsFragment;
|
||||||
import org.fox.ttrss.MainActivity;
|
import org.fox.ttrss.MainActivity;
|
||||||
import org.fox.ttrss.OnlineServices;
|
import org.fox.ttrss.OnlineServices;
|
||||||
import org.fox.ttrss.OnlineServices.RelativeArticle;
|
import org.fox.ttrss.OnlineServices.RelativeArticle;
|
||||||
@ -604,6 +606,28 @@ public class OfflineActivity extends CommonActivity implements
|
|||||||
.findFragmentByTag(FRAG_HEADLINES);
|
.findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.close_feed:
|
||||||
|
if (m_activeFeedId != 0 || m_activeFeedIsCat) {
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
ft.replace(R.id.headlines_fragment, new DummyFragment(), "");
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
|
if (m_activeFeedIsCat) {
|
||||||
|
OfflineFeedCategoriesFragment cats = (OfflineFeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
|
cats.setSelectedFeedId(-1);
|
||||||
|
} else {
|
||||||
|
OfflineFeedsFragment feeds = (OfflineFeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
|
feeds.setSelectedFeedId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_activeFeedId = 0;
|
||||||
|
|
||||||
|
initMainMenu();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case R.id.close_article:
|
||||||
|
closeArticle();
|
||||||
|
return true;
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
goBack(false);
|
goBack(false);
|
||||||
return true;
|
return true;
|
||||||
@ -882,8 +906,23 @@ public class OfflineActivity extends CommonActivity implements
|
|||||||
}
|
}
|
||||||
} else if (m_selectedArticleId != 0) {
|
} else if (m_selectedArticleId != 0) {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_article, true);
|
m_menu.setGroupVisible(R.id.menu_group_article, true);
|
||||||
|
m_menu.findItem(R.id.close_article).setVisible(!isSmallScreen());
|
||||||
|
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
||||||
|
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
|
||||||
|
|
||||||
|
if (m_selectedArticleId != 0) {
|
||||||
|
Log.d(TAG, "setting up share provider");
|
||||||
|
shareProvider.setShareIntent(getShareIntent(getArticleById(m_selectedArticleId)));
|
||||||
|
|
||||||
|
if (!m_prefs.getBoolean("tablet_article_swipe", false) && !isSmallScreen()) {
|
||||||
|
m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (m_activeFeedId != 0) {
|
} else if (m_activeFeedId != 0) {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
m_menu.setGroupVisible(R.id.menu_group_headlines, true);
|
||||||
|
m_menu.findItem(R.id.close_feed).setVisible(!isSmallScreen());
|
||||||
|
|
||||||
MenuItem search = m_menu.findItem(R.id.search);
|
MenuItem search = m_menu.findItem(R.id.search);
|
||||||
|
|
||||||
@ -929,15 +968,6 @@ public class OfflineActivity extends CommonActivity implements
|
|||||||
if (numSelected == 0 && m_headlinesActionMode != null) {
|
if (numSelected == 0 && m_headlinesActionMode != null) {
|
||||||
m_headlinesActionMode.finish();
|
m_headlinesActionMode.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
|
||||||
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
|
|
||||||
|
|
||||||
if (m_selectedArticleId != 0) {
|
|
||||||
Log.d(TAG, "setting up share provider");
|
|
||||||
shareProvider.setShareIntent(getShareIntent(getArticleById(m_selectedArticleId)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
Loading…
Reference in New Issue
Block a user