summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout-xlarge-port/main.xml36
-rw-r--r--res/layout-xlarge/main.xml7
-rw-r--r--src/org/fox/ttrss/MainActivity.java78
-rw-r--r--src/org/fox/ttrss/OfflineActivity.java30
4 files changed, 102 insertions, 49 deletions
diff --git a/res/layout-xlarge-port/main.xml b/res/layout-xlarge-port/main.xml
index 571f1ad5..c5629508 100644
--- a/res/layout-xlarge-port/main.xml
+++ b/res/layout-xlarge-port/main.xml
@@ -1,11 +1,29 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:id="@+id/main_flipper">
- <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:id="@+id/loading_container">
- <ProgressBar android:id="@+id/loading_progress" android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge"></ProgressBar>
- <TextView android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/loading_message" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/loading_message"></TextView>
- </LinearLayout>
- <LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
+
+ <LinearLayout
+ android:id="@+id/loading_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <ProgressBar
+ android:id="@+id/loading_progress"
+ style="?android:attr/progressBarStyleLarge"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <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"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </LinearLayout>
+
<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
@@ -16,5 +34,3 @@
</LinearLayout>
</LinearLayout>
-
-</FrameLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/main.xml b/res/layout-xlarge/main.xml
index a07f70d4..1254cc79 100644
--- a/res/layout-xlarge/main.xml
+++ b/res/layout-xlarge/main.xml
@@ -8,7 +8,8 @@
android:id="@+id/loading_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center" >
+ android:gravity="center"
+ android:orientation="vertical" >
<ProgressBar
android:id="@+id/loading_progress"
@@ -18,10 +19,12 @@
<TextView
android:id="@+id/loading_message"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
+
</LinearLayout>
<FrameLayout
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java
index 51c40e67..df419a41 100644
--- a/src/org/fox/ttrss/MainActivity.java
+++ b/src/org/fox/ttrss/MainActivity.java
@@ -754,6 +754,35 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@Override
public void onBackPressed() {
+ goBack(true);
+ }
+
+ private void closeCategory() {
+
+ findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
+ findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
+
+ m_activeCategory = null;
+
+ initMainMenu();
+ refreshCategories();
+ }
+
+ private void deselectAllArticles() {
+ HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.headlines_fragment);
+
+ if (hf != null) {
+ ArticleList selected = hf.getSelectedArticles();
+ if (selected.size() > 0) {
+ selected.clear();
+ initMainMenu();
+ hf.notifyUpdated();
+ }
+ }
+ }
+
+ private void goBack(boolean allowQuit) {
if (m_smallScreenMode) {
if (m_selectedArticle != null) {
closeArticle();
@@ -792,7 +821,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
closeCategory();
- } else {
+ } else if (allowQuit) {
finish();
}
} else {
@@ -800,38 +829,21 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
closeArticle();
} else if (m_activeCategory != null) {
closeCategory();
- } else {
- finish();
- }
- }
- }
-
- private void closeCategory() {
-
- findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
- findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
-
- m_activeCategory = null;
-
- initMainMenu();
- refreshCategories();
- }
-
- private void deselectAllArticles() {
- HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager()
- .findFragmentById(R.id.headlines_fragment);
-
- if (hf != null) {
- ArticleList selected = hf.getSelectedArticles();
- if (selected.size() > 0) {
- selected.clear();
+ } else if (m_activeFeed != null) {
+ findViewById(R.id.headlines_fragment).setVisibility(
+ View.INVISIBLE);
+
+ m_activeFeed = null;
+
+ refreshFeeds();
initMainMenu();
- hf.notifyUpdated();
+
+ } else if (allowQuit) {
+ finish();
}
}
}
-
@SuppressWarnings("unchecked")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@@ -840,7 +852,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
switch (item.getItemId()) {
case android.R.id.home:
- closeArticle();
+ goBack(false);
return true;
case R.id.preferences:
Intent intent = new Intent(MainActivity.this,
@@ -1199,7 +1211,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
}
if (!m_compatMode) {
- getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null);
+ if (!m_smallScreenMode) {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null || m_activeCategory != null);
+ } else {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null || m_activeFeed != null || m_activeCategory != null);
+ }
}
m_menu.findItem(R.id.set_labels).setEnabled(m_apiLevel >= 1);
@@ -1398,6 +1414,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
if (m_smallScreenMode) {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
+ } else {
+ findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
}
if (!append) {
diff --git a/src/org/fox/ttrss/OfflineActivity.java b/src/org/fox/ttrss/OfflineActivity.java
index ca69623c..74968893 100644
--- a/src/org/fox/ttrss/OfflineActivity.java
+++ b/src/org/fox/ttrss/OfflineActivity.java
@@ -305,8 +305,7 @@ public class OfflineActivity extends FragmentActivity implements
}
}
- @Override
- public void onBackPressed() {
+ private void goBack(boolean allowQuit) {
if (m_smallScreenMode) {
if (m_selectedArticleId != 0) {
closeArticle();
@@ -332,17 +331,28 @@ public class OfflineActivity extends FragmentActivity implements
refreshViews();
initMainMenu();
- } else {
+ } else if (allowQuit) {
finish();
}
} else {
if (m_selectedArticleId != 0) {
closeArticle();
- } else {
+ } else if (m_activeFeedId != 0) {
+ findViewById(R.id.headlines_fragment).setVisibility(View.INVISIBLE);
+ m_activeFeedId = 0;
+
+ refreshViews();
+ initMainMenu();
+
+ } else if (allowQuit) {
finish();
}
}
-
+ }
+
+ @Override
+ public void onBackPressed() {
+ goBack(true);
}
/*
@@ -426,7 +436,7 @@ public class OfflineActivity extends FragmentActivity implements
switch (item.getItemId()) {
case android.R.id.home:
- closeArticle();
+ goBack(false);
return true;
case R.id.preferences:
Intent intent = new Intent(this, PreferencesActivity.class);
@@ -668,7 +678,11 @@ public class OfflineActivity extends FragmentActivity implements
}
if (!m_compatMode) {
- getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0);
+ if (!m_smallScreenMode) {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0);
+ } else {
+ getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticleId != 0 || m_activeFeedId != 0);
+ }
}
}
}
@@ -953,6 +967,8 @@ public class OfflineActivity extends FragmentActivity implements
if (m_smallScreenMode) {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
+ } else {
+ findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
}
deselectAllArticles();