Switch to lineair layout for two column mode

This commit is contained in:
M66B 2019-08-30 07:31:22 +02:00
parent ddbe3e8b37
commit e58a6019a6
2 changed files with 25 additions and 28 deletions

View File

@ -82,7 +82,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private String startup;
private View view;
private Group grpPane;
private View content_separator;
private View content_pane;
private DrawerLayout drawerLayout;
private ActionBarDrawerToggle drawerToggle;
private ScrollView drawerContainer;
@ -135,7 +138,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
grpPane = findViewById(R.id.grpPane);
content_separator = findViewById(R.id.content_separator);
content_pane = findViewById(R.id.content_pane);
drawerLayout = findViewById(R.id.drawer_layout);
drawerLayout.setScrimColor(Helper.resolveColor(this, R.attr.colorDrawerScrim));
@ -422,6 +426,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
// Initialize
if (content_pane != null) {
content_separator.setVisibility(View.GONE);
content_pane.setVisibility(View.GONE);
}
if (getSupportFragmentManager().getFragments().size() == 0 &&
!getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT))
init();
@ -608,9 +617,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer);
drawerToggle.setDrawerIndicatorEnabled(count == 1);
if (grpPane != null) {
if (content_pane != null) {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_pane);
grpPane.setVisibility(fragment == null ? View.GONE : View.VISIBLE);
content_separator.setVisibility(fragment == null ? View.GONE : View.VISIBLE);
content_pane.setVisibility(fragment == null ? View.GONE : View.VISIBLE);
}
}
}
@ -1029,11 +1039,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
fragment.setArguments(args);
int pane;
if (grpPane == null)
if (content_pane == null)
pane = R.id.content_frame;
else {
pane = R.id.content_pane;
grpPane.setVisibility(View.VISIBLE);
content_separator.setVisibility(View.VISIBLE);
content_pane.setVisibility(View.VISIBLE);
args.putBoolean("pane", true);
}

View File

@ -6,44 +6,30 @@
android:layout_height="match_parent"
tools:context=".ActivityView">
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintEnd_toStartOf="@+id/content_separator"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_weight="1"
app:layout_constraintEnd_toStartOf="@+id/content_separator" />
<View
android:id="@+id/content_separator"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toStartOf="@+id/content_pane"
app:layout_constraintStart_toEndOf="@id/content_frame"
app:layout_constraintTop_toTopOf="parent" />
android:background="?attr/colorSeparator" />
<FrameLayout
android:id="@+id/content_pane"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toEndOf="@id/content_separator"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpPane"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:constraint_referenced_ids="content_separator,content_pane" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_weight="1" />
</LinearLayout>
<ScrollView
android:id="@+id/drawer_container"