add a vertical mainactivity layout

This commit is contained in:
Andrew Dolgov 2011-09-11 13:25:28 +04:00
parent 550cce4116
commit 9b8de7c539
3 changed files with 64 additions and 33 deletions

42
res/layout-land/main.xml Normal file
View File

@ -0,0 +1,42 @@
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/main_flipper">
<FrameLayout android:layout_gravity="center_vertical" android:id="@+id/sync_splash" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:gravity="center" android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent">
<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:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/loading_message" android:text="@string/loading_message"></TextView>
</LinearLayout>
</FrameLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:id="@+id/main">
<LinearLayout android:layout_weight="1.5" android:layout_height="match_parent" android:id="@+id/linearLayout4" android:layout_width="match_parent">
<LinearLayout android:layout_height="match_parent" android:id="@+id/feeds_container"
android:layout_weight="1"
android:layout_width="match_parent">
</LinearLayout>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?feedlistDivider"
android:paddingLeft="2dip" android:paddingRight="2dip"
android:layout_width="wrap_content" android:layout_height="match_parent"></ImageView>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" android:id="@+id/headlines_wrapper">
<LinearLayout android:layout_width="match_parent" android:layout_weight="1" android:id="@+id/headlines_container" android:layout_height="match_parent">
</LinearLayout>
<ImageView android:paddingRight="2dip" android:layout_height="match_parent" android:background="?feedlistDivider" android:layout_width="wrap_content" android:paddingLeft="2dip"></ImageView>
<LinearLayout android:layout_weight="1" android:visibility="gone" android:layout_width="match_parent" android:id="@+id/article_container" android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
</LinearLayout>
</ViewFlipper>

View File

@ -1,41 +1,22 @@
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/main_flipper">
<FrameLayout android:layout_gravity="center_vertical" android:id="@+id/sync_splash" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:gravity="center" android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent">
<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:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/loading_message" android:text="@string/loading_message"></TextView>
<FrameLayout android:id="@+id/sync_splash" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_width="match_parent">
<LinearLayout android:gravity="center" android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent">
<ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/loading_progress" style="?android:attr/progressBarStyleLarge"></ProgressBar>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/loading_message" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/loading_message"></TextView>
</LinearLayout>
</FrameLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:id="@+id/main">
<LinearLayout android:layout_weight="1.5" android:layout_height="match_parent" android:id="@+id/linearLayout4" android:layout_width="match_parent">
<LinearLayout android:layout_height="match_parent" android:id="@+id/feeds_container"
android:layout_weight="1"
android:layout_width="match_parent">
</LinearLayout>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?feedlistDivider"
android:paddingLeft="2dip" android:paddingRight="2dip"
android:layout_width="wrap_content" android:layout_height="match_parent"></ImageView>
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" android:id="@+id/headlines_wrapper">
<LinearLayout android:layout_width="match_parent" android:layout_weight="1" android:id="@+id/headlines_container" android:layout_height="match_parent">
</LinearLayout>
<ImageView android:paddingRight="2dip" android:layout_height="match_parent" android:background="?feedlistDivider" android:layout_width="wrap_content" android:paddingLeft="2dip"></ImageView>
<LinearLayout android:layout_weight="1" android:visibility="gone" android:layout_width="match_parent" android:id="@+id/article_container" android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
<LinearLayout android:layout_height="fill_parent" android:id="@+id/main" android:layout_width="fill_parent" android:orientation="horizontal">
<LinearLayout android:layout_weight="1.5" android:id="@+id/linearLayout4" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_weight="1" android:id="@+id/feeds_container" android:layout_width="match_parent" android:layout_height="match_parent"></LinearLayout>
<ImageView android:background="?feedlistDivider" android:paddingLeft="2dip" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingRight="2dip"></ImageView>
</LinearLayout>
<LinearLayout android:layout_weight="0.5" android:id="@+id/headlines_wrapper" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<LinearLayout android:layout_weight="1" android:id="@+id/headlines_container" android:layout_width="match_parent" android:layout_height="match_parent"></LinearLayout>
<!-- <ImageView android:background="?feedlistDivider" android:paddingLeft="2dip" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingRight="2dip"></ImageView> -->
<LinearLayout android:visibility="gone" android:layout_weight="1" android:id="@+id/article_container" android:layout_width="match_parent" android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -7,6 +7,7 @@ import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.OpenableColumns;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -23,12 +24,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
protected SharedPreferences m_prefs;
protected Cursor m_cursor;
protected SimpleCursorAdapter m_adapter;
protected int m_articleId;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (savedInstanceState != null) {
m_feedId = savedInstanceState.getInt("feedId");
m_articleId = savedInstanceState.getInt("articleId");
}
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
@ -47,6 +50,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
list.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
}
if (m_articleId != 0) viewArticle(m_articleId);
return view;
}
@ -108,6 +113,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
getActivity().findViewById(R.id.article_container).setVisibility(View.VISIBLE);
m_articleId = articleId;
//m_adapter.notifyDataSetChanged();
}
@ -117,6 +124,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
super.onSaveInstanceState(out);
out.putInt("feedId", m_feedId);
out.putInt("articleId", m_articleId);
}
}