compatibility fixes for ICS (galaxy nexus)

This commit is contained in:
Andrew Dolgov 2012-01-17 12:54:52 +03:00
parent 87e736462a
commit 70da910846
4 changed files with 46 additions and 49 deletions

View File

@ -1,5 +1,5 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_flipper" android:id="@+id/main"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" > android:layout_height="fill_parent" >
@ -12,45 +12,37 @@
<ProgressBar <ProgressBar
android:id="@+id/loading_progress" android:id="@+id/loading_progress"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" > android:layout_height="wrap_content" />
</ProgressBar>
<TextView <TextView
android:id="@+id/loading_message" android:id="@+id/loading_message"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/loading_message" > android:text="@string/loading_message" />
</TextView>
</LinearLayout> </LinearLayout>
<LinearLayout <FrameLayout
android:id="@+id/main" android:id="@+id/feeds_fragment"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" > android:layout_height="match_parent" >
</FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/feeds_fragment" android:id="@+id/cats_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/cats_fragment" android:id="@+id/headlines_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/headlines_fragment" android:id="@+id/article_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/article_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
</FrameLayout> </FrameLayout>

View File

@ -38,6 +38,7 @@ import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -473,12 +474,14 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
int width = display.getWidth(); int width = display.getWidth();
int height = display.getHeight(); int height = display.getHeight();
Log.d(TAG, "WxH=" + width + "x" + height);
if (height > width) { /* if (height > width) {
int tmp = width; int tmp = width;
width = height; width = height;
height = tmp; height = tmp;
} } */
m_smallScreenMode = m_compatMode || (width < 960 || height < 720); m_smallScreenMode = m_compatMode || (width < 960 || height < 720);
@ -500,8 +503,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
Log.d(TAG, "m_compatMode=" + m_compatMode); Log.d(TAG, "m_compatMode=" + m_compatMode);
if (!m_compatMode) { if (!m_compatMode) {
new TransitionHelper((LinearLayout) findViewById(R.id.main)); new TransitionHelper((ViewGroup) findViewById(R.id.main));
m_headlinesActionModeCallback = new HeadlinesActionModeCallback(); m_headlinesActionModeCallback = new HeadlinesActionModeCallback();
} }
@ -522,10 +524,6 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
} }
} }
if (!m_compatMode && !m_smallScreenMode) {
// getActionBar().setDisplayHomeAsUpEnabled(true); TODO
}
if (m_smallScreenMode) { if (m_smallScreenMode) {
if (m_selectedArticle != null) { if (m_selectedArticle != null) {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE); findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
@ -537,10 +535,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
findViewById(R.id.article_fragment) findViewById(R.id.article_fragment)
.setVisibility(View.GONE); .setVisibility(View.GONE);
findViewById(R.id.cats_fragment).setVisibility(View.GONE); findViewById(R.id.cats_fragment).setVisibility(View.GONE);
} else { } else {
findViewById(R.id.headlines_fragment).setVisibility( //findViewById(R.id.headlines_fragment).setVisibility(
View.GONE); // View.GONE);
// findViewById(R.id.article_fragment).setVisibility(View.GONE);
//findViewById(R.id.article_fragment).setVisibility(View.GONE);
if (m_enableCats && m_activeCategory == null) { if (m_enableCats && m_activeCategory == null) {
findViewById(R.id.feeds_fragment).setVisibility( findViewById(R.id.feeds_fragment).setVisibility(
@ -550,6 +549,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
} else { } else {
findViewById(R.id.cats_fragment).setVisibility( findViewById(R.id.cats_fragment).setVisibility(
View.GONE); View.GONE);
//findViewById(R.id.feeds_fragment).setVisibility(
// View.VISIBLE);
} }
} }
} else { } else {

View File

@ -26,6 +26,7 @@ import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -124,12 +125,14 @@ public class OfflineActivity extends FragmentActivity implements
int width = display.getWidth(); int width = display.getWidth();
int height = display.getHeight(); int height = display.getHeight();
if (height > width) { Log.d(TAG, "WxH=" + width + "x" + height);
/* if (height > width) {
int tmp = width; int tmp = width;
width = height; width = height;
height = tmp; height = tmp;
} } */
m_smallScreenMode = m_compatMode || (width < 960 || height < 720); m_smallScreenMode = m_compatMode || (width < 960 || height < 720);
setContentView(R.layout.main); setContentView(R.layout.main);
@ -138,7 +141,7 @@ public class OfflineActivity extends FragmentActivity implements
Log.d(TAG, "m_compatMode=" + m_compatMode); Log.d(TAG, "m_compatMode=" + m_compatMode);
if (!m_compatMode) { if (!m_compatMode) {
new TransitionHelper((LinearLayout) findViewById(R.id.main)); new TransitionHelper((ViewGroup) findViewById(R.id.main));
m_headlinesActionModeCallback = new HeadlinesActionModeCallback(); m_headlinesActionModeCallback = new HeadlinesActionModeCallback();
} }
@ -158,7 +161,7 @@ public class OfflineActivity extends FragmentActivity implements
findViewById(R.id.article_fragment).setVisibility(View.GONE); findViewById(R.id.article_fragment).setVisibility(View.GONE);
findViewById(R.id.cats_fragment).setVisibility(View.GONE); findViewById(R.id.cats_fragment).setVisibility(View.GONE);
} else { } else {
findViewById(R.id.headlines_fragment).setVisibility(View.GONE); //findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
// findViewById(R.id.article_fragment).setVisibility(View.GONE); // findViewById(R.id.article_fragment).setVisibility(View.GONE);
/* /*

View File

@ -1,10 +1,11 @@
package org.fox.ttrss; package org.fox.ttrss;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
public class TransitionHelper { public class TransitionHelper {
public TransitionHelper(LinearLayout layout) { public TransitionHelper(ViewGroup layout) {
LayoutTransition transitioner = new LayoutTransition(); LayoutTransition transitioner = new LayoutTransition();
layout.setLayoutTransition(transitioner); layout.setLayoutTransition(transitioner);
} }