summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout-sw600dp-land/headlines.xml (renamed from res/layout-sw600dp/headlines.xml)6
-rw-r--r--res/layout-sw600dp-land/headlines_articles.xml (renamed from res/layout-sw600dp/headlines_articles.xml)0
-rw-r--r--res/layout-sw600dp-port/headlines.xml35
-rw-r--r--res/layout-sw700dp/headlines.xml55
-rw-r--r--res/layout-sw700dp/headlines_articles.xml49
-rw-r--r--src/org/fox/ttrss/CommonActivity.java18
-rw-r--r--src/org/fox/ttrss/FeedsActivity.java44
-rw-r--r--src/org/fox/ttrss/offline/OfflineFeedsActivity.java28
8 files changed, 211 insertions, 24 deletions
diff --git a/res/layout-sw600dp/headlines.xml b/res/layout-sw600dp-land/headlines.xml
index 7e7f0e52..93324ebb 100644
--- a/res/layout-sw600dp/headlines.xml
+++ b/res/layout-sw600dp-land/headlines.xml
@@ -32,14 +32,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
- android:weightSum="1.3"
+ android:weightSum="1.1"
android:orientation="horizontal" >
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1.1"
+ android:layout_weight="1"
android:background="?feedlistBackground" >
</FrameLayout>
@@ -47,7 +47,7 @@
android:id="@+id/headlines_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1.9"
+ android:layout_weight="2"
android:background="?headlinesBackground" >
</FrameLayout>
</LinearLayout>
diff --git a/res/layout-sw600dp/headlines_articles.xml b/res/layout-sw600dp-land/headlines_articles.xml
index b6cb1c38..b6cb1c38 100644
--- a/res/layout-sw600dp/headlines_articles.xml
+++ b/res/layout-sw600dp-land/headlines_articles.xml
diff --git a/res/layout-sw600dp-port/headlines.xml b/res/layout-sw600dp-port/headlines.xml
new file mode 100644
index 00000000..866c31a6
--- /dev/null
+++ b/res/layout-sw600dp-port/headlines.xml
@@ -0,0 +1,35 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/headlines"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <FrameLayout
+ android:id="@+id/sw600dp_port_anchor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ </FrameLayout>
+
+ <LinearLayout
+ android:id="@+id/loading_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:visibility="gone" >
+
+ <TextView
+ android:id="@+id/loading_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </LinearLayout>
+
+ <FrameLayout
+ android:id="@+id/headlines_fragment"
+ android:background="?smallScreenBackground"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </FrameLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-sw700dp/headlines.xml b/res/layout-sw700dp/headlines.xml
new file mode 100644
index 00000000..93324ebb
--- /dev/null
+++ b/res/layout-sw700dp/headlines.xml
@@ -0,0 +1,55 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/main"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="?headlinesBackgroundSolid"
+ android:orientation="vertical" >
+
+ <FrameLayout
+ android:id="@+id/sw600dp_anchor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" >
+
+ </FrameLayout>
+
+ <LinearLayout
+ android:id="@+id/loading_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:visibility="gone" >
+
+ <TextView
+ android:id="@+id/loading_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:baselineAligned="false"
+ android:weightSum="1.1"
+ 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
+ android:id="@+id/headlines_fragment"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="2"
+ android:background="?headlinesBackground" >
+ </FrameLayout>
+ </LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-sw700dp/headlines_articles.xml b/res/layout-sw700dp/headlines_articles.xml
new file mode 100644
index 00000000..b6cb1c38
--- /dev/null
+++ b/res/layout-sw700dp/headlines_articles.xml
@@ -0,0 +1,49 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/headlines"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:id="@+id/loading_container"
+ 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_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/loading_message"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/fragment_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:baselineAligned="false"
+ android:orientation="horizontal" >
+
+ <FrameLayout
+ android:id="@+id/headlines_fragment"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0.4"
+ android:background="?feedlistBackground" >
+ </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>
+ </LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java
index 78d1937c..0b41e3ab 100644
--- a/src/org/fox/ttrss/CommonActivity.java
+++ b/src/org/fox/ttrss/CommonActivity.java
@@ -7,6 +7,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -151,7 +152,7 @@ public class CommonActivity extends SherlockFragmentActivity {
return width < height;
}
- @SuppressLint("NewApi")
+ @SuppressLint({ "NewApi", "ServiceCast" })
@SuppressWarnings("deprecation")
public void copyToClipboard(String str) {
if (android.os.Build.VERSION.SDK_INT < 11) {
@@ -186,4 +187,19 @@ public class CommonActivity extends SherlockFragmentActivity {
setTheme(R.style.LightTheme);
}
}
+
+ @SuppressWarnings("deprecation")
+ @SuppressLint("NewApi")
+ protected int getScreenWidthInPixel() {
+ Display display = getWindowManager().getDefaultDisplay();
+
+ if (android.os.Build.VERSION.SDK_INT >= 13) {
+ Point size = new Point();
+ display.getSize(size);
+ int width = size.x;
+ return width;
+ } else {
+ return display.getWidth();
+ }
+ }
}
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java
index 3ba96c4f..47781cce 100644
--- a/src/org/fox/ttrss/FeedsActivity.java
+++ b/src/org/fox/ttrss/FeedsActivity.java
@@ -37,6 +37,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
+ private boolean m_feedIsSelected = false;
@SuppressLint("NewApi")
@Override
@@ -49,18 +50,23 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onCreate(savedInstanceState);
setContentView(R.layout.headlines);
- setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
+ setSmallScreen(findViewById(R.id.sw600dp_anchor) == null &&
+ findViewById(R.id.sw600dp_port_anchor) == null);
GlobalState.getInstance().load(savedInstanceState);
- if (isSmallScreen()) {
+ if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
-
+
+ if (findViewById(R.id.sw600dp_port_anchor) != null) {
+ m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
+ }
+
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.setSlidingEnabled(true);
m_slidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
@Override
@@ -94,14 +100,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
+ m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
- if (m_slidingMenu != null && savedInstanceState.getBoolean("slidingMenuVisible"))
+ if (m_slidingMenu != null && m_feedIsSelected == false)
m_slidingMenu.showMenu();
if (!isSmallScreen()) {
// temporary hack because FeedsActivity doesn't track whether active feed is open
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
- container.setWeightSum(3f);
+
+ if (container != null)
+ container.setWeightSum(3f);
}
if (m_actionbarUpEnabled) {
@@ -109,10 +118,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
}
- if (!isCompatMode() && !isSmallScreen()) {
+ /* if (!isCompatMode() && !isSmallScreen()) {
((ViewGroup)findViewById(R.id.headlines_fragment)).setLayoutTransition(new LayoutTransition());
((ViewGroup)findViewById(R.id.feeds_fragment)).setLayoutTransition(new LayoutTransition());
- }
+ } */
}
@@ -156,11 +165,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (!isCompatMode() && !isSmallScreen()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
- float wSum = container.getWeightSum();
- if (wSum <= 2.0f) {
- ObjectAnimator anim = ObjectAnimator.ofFloat(container, "weightSum", wSum, 3.0f);
- anim.setDuration(200);
- anim.start();
+ if (container != null) {
+ float wSum = container.getWeightSum();
+ if (wSum <= 2.0f) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(container, "weightSum", wSum, 3.0f);
+ anim.setDuration(200);
+ anim.start();
+ }
}
}
@@ -177,6 +188,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
ft.commit();
+
+ m_feedIsSelected = true;
if (m_slidingMenu != null) {
m_slidingMenu.showContent();
@@ -284,9 +297,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
+ out.putBoolean("feedIsSelected", m_feedIsSelected);
- if (m_slidingMenu != null )
- out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
+ //if (m_slidingMenu != null )
+ // out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
GlobalState.getInstance().save(out);
}
diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
index bfc4485d..507e08ef 100644
--- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
@@ -27,6 +27,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
private boolean m_actionbarUpEnabled = false;
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
+ private boolean m_feedIsSelected = false;
@SuppressLint("NewApi")
@Override
@@ -39,13 +40,18 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
super.onCreate(savedInstanceState);
setContentView(R.layout.headlines);
- setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
+ setSmallScreen(findViewById(R.id.sw600dp_anchor) == null &&
+ findViewById(R.id.sw600dp_port_anchor) == null);
GlobalState.getInstance().load(savedInstanceState);
- if (isSmallScreen()) {
+ if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
-
+
+ if (findViewById(R.id.sw600dp_port_anchor) != null) {
+ m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
+ }
+
m_slidingMenu.setMode(SlidingMenu.LEFT);
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
m_slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
@@ -68,6 +74,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
+ m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
+
+ if (!m_feedIsSelected && m_slidingMenu != null)
+ m_slidingMenu.showMenu();
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -148,6 +158,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
+ out.putBoolean("feedIsSelected", m_feedIsSelected);
+
+ //if (m_slidingMenu != null )
+ // out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
GlobalState.getInstance().save(out);
}
@@ -222,7 +236,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (open) {
if (!isSmallScreen()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
- container.setWeightSum(3f);
+ if (container != null) {
+ container.setWeightSum(3f);
+ }
}
new Handler().postDelayed(new Runnable() {
@@ -236,7 +252,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
ft.commit();
-
+
+ m_feedIsSelected = true;
+
if (m_slidingMenu != null) {
m_slidingMenu.showContent();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);