initial implementation of slidingmenu stuff
This commit is contained in:
parent
b87a1056d7
commit
882f3a370e
@ -39,6 +39,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".HeadlinesActivity"
|
android:name=".HeadlinesActivity"
|
||||||
|
android:uiOptions="splitActionBarWhenNarrow"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
@ -11,3 +11,4 @@
|
|||||||
target=android-17
|
target=android-17
|
||||||
android.library.reference.1=..\\Android-ViewPagerIndicator\\library
|
android.library.reference.1=..\\Android-ViewPagerIndicator\\library
|
||||||
android.library.reference.2=..\\ActionBarSherlock\\actionbarsherlock
|
android.library.reference.2=..\\ActionBarSherlock\\actionbarsherlock
|
||||||
|
android.library.reference.3=../SlidingMenu/library
|
||||||
|
@ -5,22 +5,13 @@
|
|||||||
android:background="?headlinesBackgroundSolid"
|
android:background="?headlinesBackgroundSolid"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/loading_container"
|
android:id="@+id/sw600dp_anchor"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?loadingBackground"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/loading_message"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:visibility="gone" >
|
||||||
android:text="@string/loading_message"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
</FrameLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fragment_container"
|
android:id="@+id/fragment_container"
|
||||||
|
@ -1,48 +1,40 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/headlines"
|
android:id="@+id/main"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
android:background="?headlinesBackgroundSolid"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/loading_container"
|
android:id="@+id/sw600dp_anchor"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?loadingBackground"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="visible" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/loading_message"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:visibility="gone" >
|
||||||
android:text="@string/loading_message"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
</FrameLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fragment_container"
|
android:id="@+id/fragment_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
|
android:weightSum="1.05"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/feeds_fragment"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?feedlistBackground" >
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/headlines_fragment"
|
android:id="@+id/headlines_fragment"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.4"
|
android:layout_weight="2"
|
||||||
android:background="?feedlistBackground" >
|
android:background="?headlinesBackground" >
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/article_fragment"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="0.6"
|
|
||||||
android:background="?articleBackground" >
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -4,21 +4,6 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" >
|
android:layout_height="fill_parent" >
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/loading_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/loading_message"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="@string/loading_message" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/feeds_fragment"
|
android:id="@+id/feeds_fragment"
|
||||||
android:background="?smallScreenBackground"
|
android:background="?smallScreenBackground"
|
||||||
|
@ -4,23 +4,8 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" >
|
android:layout_height="fill_parent" >
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/loading_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/loading_message"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="@string/loading_message" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/headlines_container"
|
android:id="@+id/headlines_fragment"
|
||||||
android:background="?smallScreenBackground"
|
android:background="?smallScreenBackground"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
@ -56,7 +56,7 @@ public class CommonActivity extends SherlockFragmentActivity {
|
|||||||
tv.setText(status);
|
tv.setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById(R.id.loading_container).setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE);
|
//findViewById(R.id.loading_container).setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
setProgressBarIndeterminateVisibility(showProgress);
|
setProgressBarIndeterminateVisibility(showProgress);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import org.fox.ttrss.types.FeedCategory;
|
|||||||
import org.fox.ttrss.util.AppRater;
|
import org.fox.ttrss.util.AppRater;
|
||||||
|
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||||
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.animation.LayoutTransition;
|
import android.animation.LayoutTransition;
|
||||||
@ -35,6 +36,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
private boolean m_actionbarUpEnabled = false;
|
private boolean m_actionbarUpEnabled = false;
|
||||||
private int m_actionbarRevertDepth = 0;
|
private int m_actionbarRevertDepth = 0;
|
||||||
|
private SlidingMenu m_slidingMenu;
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
@ -46,18 +48,38 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.feeds);
|
setContentView(R.layout.headlines);
|
||||||
|
|
||||||
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
|
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
|
||||||
|
|
||||||
GlobalState.getInstance().load(savedInstanceState);
|
GlobalState.getInstance().load(savedInstanceState);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
if (isSmallScreen()) {
|
||||||
|
m_slidingMenu = new SlidingMenu(this);
|
||||||
|
|
||||||
|
m_slidingMenu.setMode(SlidingMenu.LEFT);
|
||||||
|
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
|
||||||
|
m_slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
|
||||||
|
m_slidingMenu.setSlidingEnabled(true);
|
||||||
|
m_slidingMenu.setMenu(R.layout.feeds);
|
||||||
|
m_slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOpened() {
|
||||||
|
if (m_actionbarRevertDepth == 0) {
|
||||||
|
m_actionbarUpEnabled = false;
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
|
initMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
if (m_slidingMenu != null)
|
||||||
|
m_slidingMenu.showMenu();
|
||||||
|
|
||||||
if (intent.getParcelableExtra("feed") != null || intent.getParcelableExtra("category") != null ||
|
/* if (intent.getParcelableExtra("article") != null) {
|
||||||
intent.getParcelableExtra("article") != null) {
|
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
m_actionbarUpEnabled = true;
|
m_actionbarUpEnabled = true;
|
||||||
@ -79,27 +101,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
ap.setSearchQuery(intent.getStringExtra("searchQuery"));
|
ap.setSearchQuery(intent.getStringExtra("searchQuery"));
|
||||||
|
|
||||||
setTitle(feed.title);
|
setTitle(feed.title);
|
||||||
} else {
|
|
||||||
if (feed != null) {
|
|
||||||
HeadlinesFragment hf = new HeadlinesFragment();
|
|
||||||
hf.initialize(feed);
|
|
||||||
ft.replace(R.id.feeds_fragment, hf, FRAG_HEADLINES);
|
|
||||||
|
|
||||||
setTitle(feed.title);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cat != null) {
|
|
||||||
FeedsFragment ff = new FeedsFragment();
|
|
||||||
ff.initialize(cat);
|
|
||||||
ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS);
|
|
||||||
|
|
||||||
setTitle(cat.title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
} else {
|
} else { */
|
||||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
|
||||||
if (m_prefs.getBoolean("enable_cats", false)) {
|
if (m_prefs.getBoolean("enable_cats", false)) {
|
||||||
@ -116,11 +122,14 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
AppRater.appLaunched(this);
|
AppRater.appLaunched(this);
|
||||||
checkTrial(true);
|
checkTrial(true);
|
||||||
}
|
//}
|
||||||
} else { // savedInstanceState != null
|
} else { // savedInstanceState != null
|
||||||
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
|
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
|
||||||
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
|
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
|
||||||
|
|
||||||
|
if (m_slidingMenu != null && savedInstanceState.getBoolean("slidingMenuVisible"))
|
||||||
|
m_slidingMenu.showMenu();
|
||||||
|
|
||||||
if (!isSmallScreen()) {
|
if (!isSmallScreen()) {
|
||||||
// temporary hack because FeedsActivity doesn't track whether active feed is open
|
// temporary hack because FeedsActivity doesn't track whether active feed is open
|
||||||
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
|
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
|
||||||
@ -146,22 +155,27 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
if (m_menu != null && getSessionId() != null) {
|
if (m_menu != null && getSessionId() != null) {
|
||||||
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
//ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
|
if (m_slidingMenu != null) {
|
||||||
|
m_menu.setGroupVisible(R.id.menu_group_feeds, m_slidingMenu.isMenuShowing());
|
||||||
|
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing());
|
||||||
|
} else {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
|
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
|
||||||
|
//m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
|
||||||
m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
|
|
||||||
|
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
|
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
|
||||||
|
|
||||||
if (isSmallScreen()) {
|
|
||||||
m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded());
|
|
||||||
} else {
|
|
||||||
m_menu.findItem(R.id.update_headlines).setVisible(false);
|
m_menu.findItem(R.id.update_headlines).setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (af != null) {
|
/* if (isSmallScreen()) {
|
||||||
|
m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded());
|
||||||
|
} else {
|
||||||
|
m_menu.findItem(R.id.update_headlines).setVisible(false);
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* if (af != null) {
|
||||||
if (af.getSelectedArticle() != null && af.getSelectedArticle().attachments != null && af.getSelectedArticle().attachments.size() > 0) {
|
if (af.getSelectedArticle() != null && af.getSelectedArticle().attachments != null && af.getSelectedArticle().attachments.size() > 0) {
|
||||||
if (!isCompatMode()) {
|
if (!isCompatMode()) {
|
||||||
m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
@ -173,7 +187,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
}
|
}
|
||||||
m_menu.findItem(R.id.toggle_attachments).setVisible(false);
|
m_menu.findItem(R.id.toggle_attachments).setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
||||||
|
|
||||||
@ -188,19 +202,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
public void onFeedSelected(Feed feed) {
|
public void onFeedSelected(Feed feed) {
|
||||||
GlobalState.getInstance().m_loadedArticles.clear();
|
GlobalState.getInstance().m_loadedArticles.clear();
|
||||||
|
|
||||||
if (isSmallScreen()) {
|
|
||||||
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
|
|
||||||
intent.putExtra("feed", feed);
|
|
||||||
|
|
||||||
startActivityForResult(intent, 0);
|
|
||||||
} else {
|
|
||||||
FragmentTransaction ft = getSupportFragmentManager()
|
FragmentTransaction ft = getSupportFragmentManager()
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
|
|
||||||
ft.replace(R.id.headlines_fragment, new LoadingFragment(), null);
|
ft.replace(R.id.headlines_fragment, new LoadingFragment(), null);
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
if (!isCompatMode()) {
|
if (!isCompatMode() && !isSmallScreen()) {
|
||||||
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
|
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
|
||||||
float wSum = container.getWeightSum();
|
float wSum = container.getWeightSum();
|
||||||
if (wSum <= 2.0f) {
|
if (wSum <= 2.0f) {
|
||||||
@ -223,6 +231,12 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
|
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
|
||||||
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
|
if (m_slidingMenu != null) {
|
||||||
|
m_slidingMenu.showContent();
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
m_actionbarUpEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
@ -234,14 +248,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
refresh(false);
|
refresh(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
|
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
|
||||||
FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
|
|
||||||
if (!openAsFeed) {
|
if (!openAsFeed) {
|
||||||
|
|
||||||
if (isSmallScreen()) {
|
if (false && isSmallScreen()) {
|
||||||
|
|
||||||
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
|
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
|
||||||
intent.putExtra("category", cat);
|
intent.putExtra("category", cat);
|
||||||
@ -282,6 +295,15 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
onCatSelected(cat, m_prefs.getBoolean("browse_cats_like_feeds", false));
|
onCatSelected(cat, m_prefs.getBoolean("browse_cats_like_feeds", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
|
||||||
|
m_slidingMenu.showMenu();
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
@ -293,6 +315,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
|
||||||
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
} else if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
|
||||||
|
m_slidingMenu.showMenu();
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -314,7 +338,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
@Override
|
@Override
|
||||||
protected void loginSuccess(boolean refresh) {
|
protected void loginSuccess(boolean refresh) {
|
||||||
setLoadingStatus(R.string.blank, false);
|
setLoadingStatus(R.string.blank, false);
|
||||||
findViewById(R.id.loading_container).setVisibility(View.GONE);
|
//findViewById(R.id.loading_container).setVisibility(View.GONE);
|
||||||
initMenu();
|
initMenu();
|
||||||
|
|
||||||
if (refresh) refresh();
|
if (refresh) refresh();
|
||||||
@ -327,6 +351,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
|
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
|
||||||
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
|
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
|
||||||
|
|
||||||
|
if (m_slidingMenu != null )
|
||||||
|
out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
|
||||||
|
|
||||||
GlobalState.getInstance().save(out);
|
GlobalState.getInstance().save(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +369,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openFeedArticles(Feed feed) {
|
public void openFeedArticles(Feed feed) {
|
||||||
if (isSmallScreen()) {
|
/* if (isSmallScreen()) {
|
||||||
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
|
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
|
||||||
|
|
||||||
GlobalState.getInstance().m_activeFeed = feed;
|
GlobalState.getInstance().m_activeFeed = feed;
|
||||||
@ -351,7 +378,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
intent.putExtra("feed", feed);
|
intent.putExtra("feed", feed);
|
||||||
intent.putExtra("article", new Article());
|
intent.putExtra("article", new Article());
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
} else {
|
} else { */
|
||||||
GlobalState.getInstance().m_loadedArticles.clear();
|
GlobalState.getInstance().m_loadedArticles.clear();
|
||||||
|
|
||||||
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
||||||
@ -361,7 +388,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
startActivityForResult(intent, HEADLINES_REQUEST);
|
startActivityForResult(intent, HEADLINES_REQUEST);
|
||||||
overridePendingTransition(R.anim.right_slide_in, 0);
|
overridePendingTransition(R.anim.right_slide_in, 0);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onArticleSelected(Article article, boolean open) {
|
public void onArticleSelected(Article article, boolean open) {
|
||||||
@ -373,7 +400,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
if (open) {
|
if (open) {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
if (isSmallScreen()) {
|
/* if (isSmallScreen()) {
|
||||||
|
|
||||||
//GlobalState.getInstance().m_loadedArticles.clear();
|
//GlobalState.getInstance().m_loadedArticles.clear();
|
||||||
|
|
||||||
@ -385,7 +412,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else { */
|
||||||
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
|
||||||
intent.putExtra("feed", hf.getFeed());
|
intent.putExtra("feed", hf.getFeed());
|
||||||
intent.putExtra("article", article);
|
intent.putExtra("article", article);
|
||||||
@ -393,7 +420,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
|
|
||||||
startActivityForResult(intent, HEADLINES_REQUEST);
|
startActivityForResult(intent, HEADLINES_REQUEST);
|
||||||
overridePendingTransition(R.anim.right_slide_in, 0);
|
overridePendingTransition(R.anim.right_slide_in, 0);
|
||||||
}
|
//}
|
||||||
} else {
|
} else {
|
||||||
initMenu();
|
initMenu();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.headlines);
|
setContentView(R.layout.headlines_articles);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
|
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && hf != null && hf.isAdded());
|
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && hf != null && hf.isAdded() && hf.isVisible());
|
||||||
|
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user