summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-11-30 13:43:02 +0300
committerAndrew Dolgov <[email protected]>2011-11-30 13:43:02 +0300
commit918235592ada25cab9da734b109921dcd7e87a85 (patch)
treefa6162da18f8a6859ff9a70bd5ce601a2cdfb1ae
parent450deb1756350a4a099eb90dc3c826be751469bf (diff)
handle layout selection by android means
-rw-r--r--res/layout-xlarge-port/main.xml (renamed from res/layout-port/main.xml)0
-rw-r--r--res/layout-xlarge/headlines_row.xml (renamed from res/layout-land/headlines_row.xml)0
-rw-r--r--res/layout-xlarge/headlines_row_selected.xml (renamed from res/layout-land/headlines_row_selected.xml)0
-rw-r--r--res/layout-xlarge/headlines_row_unread.xml (renamed from res/layout-land/headlines_row_unread.xml)0
-rw-r--r--res/layout-xlarge/main.xml16
-rw-r--r--res/layout/headlines_row.xml (renamed from res/layout-large/headlines_row.xml)0
-rw-r--r--res/layout/headlines_row_selected.xml (renamed from res/layout-large/headlines_row_selected.xml)0
-rw-r--r--res/layout/headlines_row_unread.xml (renamed from res/layout-large/headlines_row_unread.xml)0
-rw-r--r--res/layout/main.xml70
-rw-r--r--res/layout/main_small.xml56
-rw-r--r--src/org/fox/ttrss/MainActivity.java25
11 files changed, 79 insertions, 88 deletions
diff --git a/res/layout-port/main.xml b/res/layout-xlarge-port/main.xml
index 571f1ad5..571f1ad5 100644
--- a/res/layout-port/main.xml
+++ b/res/layout-xlarge-port/main.xml
diff --git a/res/layout-land/headlines_row.xml b/res/layout-xlarge/headlines_row.xml
index 4b66b747..4b66b747 100644
--- a/res/layout-land/headlines_row.xml
+++ b/res/layout-xlarge/headlines_row.xml
diff --git a/res/layout-land/headlines_row_selected.xml b/res/layout-xlarge/headlines_row_selected.xml
index fa7e7ad0..fa7e7ad0 100644
--- a/res/layout-land/headlines_row_selected.xml
+++ b/res/layout-xlarge/headlines_row_selected.xml
diff --git a/res/layout-land/headlines_row_unread.xml b/res/layout-xlarge/headlines_row_unread.xml
index e0aa00cf..e0aa00cf 100644
--- a/res/layout-land/headlines_row_unread.xml
+++ b/res/layout-xlarge/headlines_row_unread.xml
diff --git a/res/layout-xlarge/main.xml b/res/layout-xlarge/main.xml
new file mode 100644
index 00000000..e0a8394c
--- /dev/null
+++ b/res/layout-xlarge/main.xml
@@ -0,0 +1,16 @@
+<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">
+ <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>
+
+
+</FrameLayout> \ No newline at end of file
diff --git a/res/layout-large/headlines_row.xml b/res/layout/headlines_row.xml
index 4b66b747..4b66b747 100644
--- a/res/layout-large/headlines_row.xml
+++ b/res/layout/headlines_row.xml
diff --git a/res/layout-large/headlines_row_selected.xml b/res/layout/headlines_row_selected.xml
index fa7e7ad0..fa7e7ad0 100644
--- a/res/layout-large/headlines_row_selected.xml
+++ b/res/layout/headlines_row_selected.xml
diff --git a/res/layout-large/headlines_row_unread.xml b/res/layout/headlines_row_unread.xml
index e0aa00cf..e0aa00cf 100644
--- a/res/layout-large/headlines_row_unread.xml
+++ b/res/layout/headlines_row_unread.xml
diff --git a/res/layout/main.xml b/res/layout/main.xml
index e0a8394c..0215f270 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -1,16 +1,56 @@
-<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">
- <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>
-
-
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/main_flipper"
+ android:layout_width="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" >
+
+ <ProgressBar
+ android:id="@+id/loading_progress"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" >
+ </ProgressBar>
+
+ <TextView
+ android:id="@+id/loading_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/loading_message" >
+ </TextView>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/main"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <FrameLayout
+ android:id="@+id/feeds_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/cats_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/headlines_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/article_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </FrameLayout>
+ </LinearLayout>
+
</FrameLayout> \ No newline at end of file
diff --git a/res/layout/main_small.xml b/res/layout/main_small.xml
deleted file mode 100644
index 0215f270..00000000
--- a/res/layout/main_small.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/main_flipper"
- android:layout_width="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" >
-
- <ProgressBar
- android:id="@+id/loading_progress"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" >
- </ProgressBar>
-
- <TextView
- android:id="@+id/loading_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/loading_message" >
- </TextView>
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/main"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
-
- <FrameLayout
- android:id="@+id/feeds_fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- </FrameLayout>
-
- <FrameLayout
- android:id="@+id/cats_fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- </FrameLayout>
-
- <FrameLayout
- android:id="@+id/headlines_fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- </FrameLayout>
-
- <FrameLayout
- android:id="@+id/article_fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- </FrameLayout>
- </LinearLayout>
-
-</FrameLayout> \ No newline at end of file
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java
index f51ef307..ab2f59b1 100644
--- a/src/org/fox/ttrss/MainActivity.java
+++ b/src/org/fox/ttrss/MainActivity.java
@@ -310,22 +310,17 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
m_enableCats = m_prefs.getBoolean("enable_cats", false);
Display display = getWindowManager().getDefaultDisplay();
- int orientation = display.getOrientation();
- int minWidth = orientation % 2 == 0 ? 1024 : 600;
- int minHeight = orientation % 2 == 0 ? 600 : 1024;
- if (display.getWidth() > minWidth && display.getHeight() >= minHeight) {
- m_smallScreenMode = false;
-
- setContentView(R.layout.main);
- } else {
- m_smallScreenMode = true;
+ int width = display.getWidth();
+ int height = display.getHeight();
+
+ if (height > width) { int tmp = height; width = tmp; height = width; }
+
+ m_smallScreenMode = width < 960 || height < 720;
+
+ setContentView(R.layout.main);
- setContentView(R.layout.main_small);
- }
-
Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode);
- Log.d(TAG, "orientation=" + display.getOrientation());
Log.d(TAG, "m_compatMode=" + m_compatMode);
if (!m_compatMode) {
@@ -1291,8 +1286,4 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
Log.d(TAG, "onCatSelected");
viewCategory(cat, m_prefs.getBoolean("browse_cats_like_feeds", false));
}
-
- public boolean getSmallScreenMode() {
- return m_smallScreenMode;
- }
} \ No newline at end of file