Fixed table layout bug
This commit is contained in:
parent
9097d25863
commit
25be6f27f9
|
@ -16,36 +16,36 @@ public class MainActivity extends ActionBarActivity implements EventFragment.Cal
|
|||
private static final String DETAILFRAGMENT_TAG = "DFTAG";
|
||||
|
||||
private boolean mTwoPane;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.activity_main);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
// if (findViewById(R.id.weather_detail_container) != null) {
|
||||
// // The detail container view will be present only in the large-screen layouts
|
||||
// // (res/layout-sw600dp). If this view is present, then the activity should be
|
||||
// // in two-pane mode.
|
||||
// mTwoPane = true;
|
||||
// // In two-pane mode, show the detail view in this activity by
|
||||
// // adding or replacing the detail fragment using a
|
||||
// // fragment transaction.
|
||||
// if (savedInstanceState == null) {
|
||||
// getSupportFragmentManager().beginTransaction()
|
||||
// .replace(R.id.weather_detail_container, new DetailFragment(), DETAILFRAGMENT_TAG)
|
||||
// .commit();
|
||||
// }
|
||||
// } else {
|
||||
mTwoPane = false;
|
||||
getSupportActionBar().setElevation(0f);
|
||||
if (findViewById(R.id.event_detail_container) != null) {
|
||||
// The detail container view will be present only in the large-screen layouts
|
||||
// (res/layout-sw600dp). If this view is present, then the activity should be
|
||||
// in two-pane mode.
|
||||
mTwoPane = true;
|
||||
// In two-pane mode, show the detail view in this activity by
|
||||
// adding or replacing the detail fragment using a
|
||||
// fragment transaction.
|
||||
if (savedInstanceState == null) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.event_detail_container, new DetailFragment(), DETAILFRAGMENT_TAG)
|
||||
.commit();
|
||||
}
|
||||
} else {
|
||||
mTwoPane = false;
|
||||
getSupportActionBar().setElevation(0f);
|
||||
|
||||
// EventFragment eventFragment = ((EventFragment)getSupportFragmentManager()
|
||||
// .findFragmentById(R.id.fragment_forecast));
|
||||
// eventFragment.setUseTodayLayout(!mTwoPane);
|
||||
EventFragment eventFragment = ((EventFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.event_fragment));
|
||||
|
||||
UibEventsSyncAdapter.initializeSyncAdapter(this);
|
||||
UibEventsSyncAdapter.syncImmediately(this);
|
||||
UibEventsSyncAdapter.initializeSyncAdapter(this);
|
||||
UibEventsSyncAdapter.syncImmediately(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,22 +72,23 @@ public class MainActivity extends ActionBarActivity implements EventFragment.Cal
|
|||
|
||||
@Override
|
||||
public void onItemSelected(Uri contentUri) {
|
||||
// if (mTwoPane) {
|
||||
// // In two-pane mode, show the detail view in this activity by
|
||||
// // adding or replacing the detail fragment using a
|
||||
// // fragment transaction.
|
||||
// Bundle args = new Bundle();
|
||||
// args.putParcelable(DetailFragment.DETAIL_URI, contentUri);
|
||||
//
|
||||
// DetailFragment fragment = new DetailFragment();
|
||||
// fragment.setArguments(args);
|
||||
//
|
||||
// getSupportFragmentManager().beginTransaction()
|
||||
// .replace(R.id.weather_detail_container, fragment, DETAILFRAGMENT_TAG)
|
||||
// .commit();
|
||||
// } else {
|
||||
Intent intent = new Intent(this, DetailActivity.class)
|
||||
.setData(contentUri);
|
||||
startActivity(intent);
|
||||
if (mTwoPane) {
|
||||
// In two-pane mode, show the detail view in this activity by
|
||||
// adding or replacing the detail fragment using a
|
||||
// fragment transaction.
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(DetailFragment.DETAIL_URI, contentUri);
|
||||
|
||||
DetailFragment fragment = new DetailFragment();
|
||||
fragment.setArguments(args);
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.event_detail_container, fragment, DETAILFRAGMENT_TAG)
|
||||
.commit();
|
||||
} else {
|
||||
Intent intent = new Intent(this, DetailActivity.class)
|
||||
.setData(contentUri);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
28
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
28
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:baselineAligned="false"
|
||||
android:divider="?android:attr/dividerHorizontal"
|
||||
android:orientation="horizontal"
|
||||
tools:context="no.nilsnh.uibevents.MainActivity">
|
||||
|
||||
<!--
|
||||
This layout is a two-pane layout for the Items master/detail flow.
|
||||
-->
|
||||
|
||||
<fragment
|
||||
android:id="@+id/event_fragment"
|
||||
android:name="no.nilsnh.uibevents.EventFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
tools:layout="@android:layout/list_content" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/event_detail_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="4" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,6 +1,6 @@
|
|||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragment_event"
|
||||
android:id="@+id/event_fragment"
|
||||
android:name="no.nilsnh.uibevents.EventFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:id="@+id/list_item_title_textview"
|
||||
android:text="@string/list_item_title_textview"
|
||||
android:padding="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -22,15 +23,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/list_item_details_textview"
|
||||
android:text="@string/list_item_details_textview"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_weight="1.1" />
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
|
@ -45,6 +46,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/list_item_date_from_textview"
|
||||
android:text="@string/list_item_date_from_textview"
|
||||
android:padding="10dp"
|
||||
android:gravity="center_vertical|right" />
|
||||
|
||||
|
@ -53,6 +55,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/list_item_date_to_textview"
|
||||
android:text="@string/list_item_date_to_textview"
|
||||
android:padding="10dp"
|
||||
android:gravity="center_vertical|right" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue