mirror of https://github.com/M66B/FairEmail.git
Added tablet landscape two column layout
This commit is contained in:
parent
3fee71b289
commit
d56296eda3
|
@ -81,7 +81,9 @@ import javax.net.ssl.HttpsURLConnection;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
@ -92,6 +94,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|||
public class ActivityView extends ActivityBilling implements FragmentManager.OnBackStackChangedListener {
|
||||
private View view;
|
||||
private DrawerLayout drawerLayout;
|
||||
private Group grpPane;
|
||||
private ListView drawerList;
|
||||
private ActionBarDrawerToggle drawerToggle;
|
||||
|
||||
|
@ -135,6 +138,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
drawerLayout = findViewById(R.id.drawer_layout);
|
||||
drawerLayout.setScrimColor(Helper.resolveColor(this, R.attr.colorDrawerScrim));
|
||||
|
||||
grpPane = findViewById(R.id.grpPane);
|
||||
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.app_name, R.string.app_name) {
|
||||
public void onDrawerClosed(View view) {
|
||||
super.onDrawerClosed(view);
|
||||
|
@ -422,6 +427,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (drawerLayout.isDrawerOpen(drawerList))
|
||||
drawerLayout.closeDrawer(drawerList);
|
||||
drawerToggle.setDrawerIndicatorEnabled(count == 1);
|
||||
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_pane);
|
||||
grpPane.setVisibility(fragment == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -862,8 +870,16 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
FragmentMessages fragment = new FragmentMessages();
|
||||
fragment.setArguments(args);
|
||||
|
||||
int pane;
|
||||
if (findViewById(R.id.content_pane) == null)
|
||||
pane = R.id.content_frame;
|
||||
else {
|
||||
pane = R.id.content_pane;
|
||||
grpPane.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("thread");
|
||||
fragmentTransaction.replace(pane, fragment).addToBackStack("thread");
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ActivityView">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_frame"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/content_separator"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_pane"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
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>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/drawer_list"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="?attr/colorDrawerBackground"
|
||||
android:choiceMode="singleChoice"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
Loading…
Reference in New Issue