xlarge layout fixes

This commit is contained in:
Andrew Dolgov 2012-06-19 21:06:16 +04:00
parent bd937be784
commit ff6f103900
5 changed files with 154 additions and 115 deletions

View File

@ -1,36 +1,64 @@
<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">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/loading_container"
<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="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
android:id="@+id/linearLayout2"
android:layout_height="match_parent" android:orientation="vertical" android:layout_width="match_parent">
<FrameLayout android:layout_weight="0.5" android:id="@+id/headlines_fragment" android:layout_width="match_parent" android:layout_height="0dp"></FrameLayout>
<FrameLayout android:layout_weight="0.5" android:id="@+id/article_fragment" android:layout_width="match_parent" android:layout_height="0dp"></FrameLayout>
</LinearLayout>
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_weight="0" >
</FrameLayout>
<LinearLayout
android:id="@+id/vertical_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" >
</FrameLayout>
<FrameLayout
android:id="@+id/article_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5" >
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -1,8 +1,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
>
<LinearLayout
android:id="@+id/loading_container"
@ -24,35 +24,34 @@
android:gravity="center_horizontal"
android:text="@string/loading_message"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3" >
</FrameLayout>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/cats_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3" >
</FrameLayout>
<FrameLayout
android:id="@+id/feeds_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3" >
</FrameLayout>
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5" >
</FrameLayout>
<FrameLayout
android:id="@+id/headlines_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5" >
</FrameLayout>
<FrameLayout
android:id="@+id/article_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5" >
</FrameLayout>
<FrameLayout
android:id="@+id/article_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5" >
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -96,6 +96,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_feed = feed;
}
public HeadlinesFragment() {
//
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {

View File

@ -491,12 +491,14 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
Log.d(TAG, "m_compatMode=" + m_compatMode);
if (!m_compatMode) {
//if (android.os.Build.VERSION.SDK_INT < 14 || android.os.Build.VERSION.SDK_INT == 15) {
//if (!m_smallScreenMode) {
LayoutTransition transitioner = new LayoutTransition();
((ViewGroup) findViewById(R.id.fragment_container)).setLayoutTransition(transitioner);
//}
//}
if (!m_smallScreenMode) {
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null ? View.GONE : View.VISIBLE);
findViewById(R.id.article_fragment).setVisibility(m_selectedArticle != null ? View.VISIBLE : View.GONE);
}
LayoutTransition transitioner = new LayoutTransition();
((ViewGroup) findViewById(R.id.fragment_container)).setLayoutTransition(transitioner);
m_headlinesActionModeCallback = new HeadlinesActionModeCallback();
}
@ -762,12 +764,10 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
closeArticle();
} else if (m_activeCategory != null) {
closeCategory();
} else if (m_activeFeed != null) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, new FeedsFragment(m_activeCategory), FRAG_FEEDS);
ft.commit();
initMainMenu();
/* } else if (m_activeFeed != null) {
m_activeFeed = null;
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
initMainMenu(); */
} else if (allowQuit) {
finish();
@ -1150,8 +1150,15 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
m_selectedArticle = null;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.remove(getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE));
ft.show(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
if (m_smallScreenMode) {
ft.remove(getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE));
ft.show(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
} else {
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
findViewById(R.id.article_fragment).setVisibility(View.GONE);
ft.replace(R.id.article_fragment, new DummyFragment(), FRAG_ARTICLE);
}
ft.commit();
initMainMenu();
@ -1249,11 +1256,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
getActionBar().setTitle(R.string.app_name);
}
if (!m_smallScreenMode) {
getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null || m_activeCategory != null);
} else {
getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null || m_activeFeed != null || m_activeCategory != null);
}
getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null || m_activeCategory != null);
if (android.os.Build.VERSION.SDK_INT >= 14) {
ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider();
@ -1381,10 +1384,19 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
if (m_enableCats) {
FeedCategoriesFragment frag = new FeedCategoriesFragment();
ft.replace(R.id.fragment_container, frag, FRAG_CATS);
if (m_smallScreenMode) {
ft.replace(R.id.fragment_container, frag, FRAG_CATS);
} else {
ft.replace(R.id.feeds_fragment, frag, FRAG_CATS);
}
} else {
FeedsFragment frag = new FeedsFragment();
ft.replace(R.id.fragment_container, frag, FRAG_FEEDS);
if (m_smallScreenMode) {
ft.replace(R.id.fragment_container, frag, FRAG_FEEDS);
} else {
ft.replace(R.id.feeds_fragment, frag, FRAG_FEEDS);
}
}
try {
@ -1482,7 +1494,13 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
ft.replace(R.id.fragment_container, hf, FRAG_HEADLINES);
if (m_smallScreenMode) {
ft.replace(R.id.fragment_container, hf, FRAG_HEADLINES);
} else {
findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
}
ft.commit();
} else {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager()
@ -1504,7 +1522,12 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
ft.replace(R.id.fragment_container, frag, FRAG_FEEDS);
if (m_smallScreenMode) {
ft.replace(R.id.fragment_container, frag, FRAG_FEEDS);
} else {
ft.replace(R.id.feeds_fragment, frag, FRAG_FEEDS);
}
ft.commit();
@ -1524,7 +1547,12 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
ft.replace(R.id.fragment_container, frag, FRAG_HEADLINES);
if (m_smallScreenMode) {
ft.replace(R.id.fragment_container, frag, FRAG_HEADLINES);
} else {
findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
ft.replace(R.id.headlines_fragment, frag, FRAG_HEADLINES);
}
ft.commit();
}
@ -1558,8 +1586,14 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
}
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
if (m_smallScreenMode) {
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
} else {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
}
ft.commit();
}

View File

@ -153,7 +153,7 @@ public class OfflineActivity extends FragmentActivity implements
findViewById(R.id.loading_container).setVisibility(View.GONE);
if (m_smallScreenMode) {
/* if (m_smallScreenMode) {
if (m_selectedArticleId != 0) {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
@ -166,34 +166,18 @@ public class OfflineActivity extends FragmentActivity implements
//findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
// findViewById(R.id.article_fragment).setVisibility(View.GONE);
/*
* if (m_enableCats && m_activeCategory == null) {
* findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
* findViewById(R.id.cats_fragment).setVisibility(View.VISIBLE);
* } else {
* findViewById(R.id.cats_fragment).setVisibility(View.GONE); }
*/
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
}
} else {
if (m_selectedArticleId == 0) {
findViewById(R.id.article_fragment).setVisibility(View.GONE);
/*
* if (!m_enableCats || m_activeCategory != null)
* findViewById(R.id.cats_fragment).setVisibility(View.GONE);
* else
* findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
*/
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
} else {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
}
}
} */
if (m_activeFeedId == 0) {
FragmentTransaction ft = getSupportFragmentManager()
@ -1205,16 +1189,6 @@ public class OfflineActivity extends FragmentActivity implements
findViewById(R.id.main).setAnimation(
AnimationUtils.loadAnimation(this, compatAnimation));
}
if (m_smallScreenMode) {
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.cats_fragment).setVisibility(View.GONE);
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
}
}
@Override