Restored wide screen display

This commit is contained in:
2017-12-06 23:18:55 +01:00
parent 66bd2c327a
commit 206c8710ac
4 changed files with 9 additions and 20 deletions

View File

@@ -126,7 +126,7 @@ public class MainActivity extends AppCompatActivity {
String title = getString(R.string.action_new_task);
FragmentManager fragmentManager = getSupportFragmentManager();
if (!getResources().getBoolean(R.bool.large_layout))
if (getResources().getBoolean(R.bool.large_layout))
taskDialogFragment.show(fragmentManager, title);
else {
// The device is smaller, so show the fragment fullscreen

View File

@@ -106,15 +106,15 @@ public class MainFragment extends Fragment implements TasksFragment.TaskChangedA
startActivity(intent);
}
else {
// Set up the ViewPager with the sections adapter.
mViewPager = mView.findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Open last opened tab
int lastOpenedList = sharedPref.getInt("last_opened_tab", 0);
mViewPager.setCurrentItem(lastOpenedList);
if (!getResources().getBoolean(R.bool.large_layout)) {
// Set up the ViewPager with the sections adapter.
mViewPager = mView.findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Open last opened tab
mViewPager.setCurrentItem(lastOpenedList);
tabLayout = mView.findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
@@ -134,6 +134,7 @@ public class MainFragment extends Fragment implements TasksFragment.TaskChangedA
ListView listView = mView.findViewById(R.id.list);
//listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, taskLists));
listView.setAdapter(new ArrayAdapter<>(activity, R.layout.list_tasklist_item, taskLists));
listView.setSelection(lastOpenedList);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

View File

@@ -2,11 +2,9 @@
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.MainActivity">
tools:context="com.wismna.geoffroy.donext.fragments.MainFragment">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
@@ -35,13 +33,4 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.percent.PercentRelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:onClick="onNewTaskClick"
android:src="@drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"