add category support to tablet UI
This commit is contained in:
parent
b150696e79
commit
2b15ba91d4
@ -7,6 +7,7 @@
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="300dp" android:layout_weight="0" android:id="@+id/feeds_fragment"></FrameLayout>
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="300dp" android:layout_weight="0" android:id="@+id/cats_fragment"></FrameLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_height="match_parent" android:orientation="vertical" android:layout_width="match_parent">
|
||||
|
@ -7,6 +7,7 @@
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.3" android:id="@+id/feeds_fragment"></FrameLayout>
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.3" android:id="@+id/cats_fragment"></FrameLayout>
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/headlines_fragment"></FrameLayout>
|
||||
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/article_fragment"></FrameLayout>
|
||||
</LinearLayout>
|
||||
|
@ -16,7 +16,12 @@
|
||||
android:icon="@android:drawable/ic_menu_agenda"
|
||||
android:title="@string/menu_all_feeds"
|
||||
android:showAsAction=""/>
|
||||
|
||||
|
||||
<item android:id="@+id/back_to_categories"
|
||||
android:icon="@android:drawable/ic_menu_revert"
|
||||
android:title="@string/back_to_categories"
|
||||
android:showAsAction="ifRoom|withText"/>
|
||||
|
||||
<item android:id="@+id/close_article"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||
android:title="@string/close_article"
|
||||
|
@ -56,4 +56,5 @@
|
||||
<string name="ttrss_url_summary">URL of your tt-rss installation directory, e.g. http://site.com/tt-rss/</string>
|
||||
<string name="download_feed_icons">Download and display feed icons</string>
|
||||
<string name="enable_cats">Enable feed categories</string>
|
||||
<string name="back_to_categories">Close category</string>
|
||||
</resources>
|
||||
|
@ -131,6 +131,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
m_prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
m_feedSelectedListener = (OnFeedSelectedListener) activity;
|
||||
|
||||
Feed activeFeed = ((MainActivity)activity).getActiveFeed();
|
||||
|
||||
if (activeFeed != null)
|
||||
m_selectedFeedId = activeFeed.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -244,10 +244,20 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (m_selectedArticle == null)
|
||||
if (m_selectedArticle == null) {
|
||||
findViewById(R.id.article_fragment).setVisibility(View.GONE);
|
||||
else
|
||||
|
||||
if (!m_enableCats || m_activeCategory != null)
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
|
||||
else
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (m_sessionId != null) {
|
||||
@ -375,13 +385,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));
|
||||
}
|
||||
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
m_activeCategory = null;
|
||||
|
||||
initMainMenu();
|
||||
refreshCategories();
|
||||
closeCategory();
|
||||
|
||||
} else {
|
||||
finish();
|
||||
@ -389,6 +393,14 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
} else {
|
||||
if (m_selectedArticle != null) {
|
||||
closeArticle();
|
||||
} else if (m_activeCategory != null) {
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
m_activeCategory = null;
|
||||
|
||||
initMainMenu();
|
||||
refreshCategories();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
@ -399,6 +411,16 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void closeCategory() {
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
m_activeCategory = null;
|
||||
|
||||
initMainMenu();
|
||||
refreshCategories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
@ -418,6 +440,9 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
case R.id.close_article:
|
||||
closeArticle();
|
||||
return true;
|
||||
case R.id.back_to_categories:
|
||||
closeCategory();
|
||||
return true;
|
||||
case R.id.load_more_articles:
|
||||
viewFeed(m_activeFeed, true);
|
||||
return true;
|
||||
@ -482,7 +507,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
}
|
||||
}
|
||||
|
||||
public void closeArticle() {
|
||||
private void closeArticle() {
|
||||
if (m_compatMode) {
|
||||
findViewById(R.id.main).setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));
|
||||
}
|
||||
@ -547,6 +572,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null && m_selectedArticle == null);
|
||||
}
|
||||
|
||||
m_menu.findItem(R.id.back_to_categories).setVisible(m_activeCategory != null);
|
||||
|
||||
} else {
|
||||
m_menu.findItem(R.id.login).setVisible(true);
|
||||
|
||||
@ -554,6 +581,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
m_menu.findItem(R.id.close_article).setVisible(false);
|
||||
m_menu.findItem(R.id.share_article).setVisible(false);
|
||||
m_menu.findItem(R.id.load_more_articles).setVisible(false);
|
||||
m_menu.findItem(R.id.back_to_categories).setVisible(false);
|
||||
|
||||
m_menu.findItem(R.id.update_feeds).setVisible(false);
|
||||
m_menu.findItem(R.id.show_feeds).setVisible(false);
|
||||
@ -686,10 +714,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
|
||||
initMainMenu();
|
||||
|
||||
if (m_smallScreenMode) {
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
|
||||
}
|
||||
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
FeedsFragment frag = new FeedsFragment();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user