Refactoring

pull/189/head
M66B 5 years ago
parent 692c7deb4f
commit 051f2eb124

@ -171,10 +171,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Log.i("Orientation=" + config.orientation + " normal=" + normal + Log.i("Orientation=" + config.orientation + " normal=" + normal +
" landscape=" + landscape + "/" + landscape3); " landscape=" + landscape + "/" + landscape3);
boolean portrait = (config.orientation == ORIENTATION_PORTRAIT || !normal || !landscape); int viewId;
view = LayoutInflater.from(this).inflate(portrait if (config.orientation == ORIENTATION_PORTRAIT || !normal || !landscape)
? (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait) viewId = (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait);
: R.layout.activity_view_landscape, null); else
viewId = R.layout.activity_view_landscape_split;
view = LayoutInflater.from(this).inflate(viewId, null);
setContentView(view); setContentView(view);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -184,7 +186,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
content_separator = findViewById(R.id.content_separator); content_separator = findViewById(R.id.content_separator);
content_pane = findViewById(R.id.content_pane); content_pane = findViewById(R.id.content_pane);
if ((portrait ? portrait2 : !landscape3) && Helper.isFoldable()) { if (Helper.isFoldable() &&
(viewId == R.layout.activity_view_portrait_split ||
viewId == R.layout.activity_view_landscape_split)) {
View content_frame = findViewById(R.id.content_frame); View content_frame = findViewById(R.id.content_frame);
ViewGroup.LayoutParams lparam = content_frame.getLayoutParams(); ViewGroup.LayoutParams lparam = content_frame.getLayoutParams();
if (lparam instanceof LinearLayout.LayoutParams) { if (lparam instanceof LinearLayout.LayoutParams) {
@ -243,7 +247,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
int drawerWidth; int drawerWidth;
DisplayMetrics dm = getResources().getDisplayMetrics(); DisplayMetrics dm = getResources().getDisplayMetrics();
if (portrait || !landscape3) { if (viewId != R.layout.activity_view_landscape_split || !landscape3) {
int actionBarHeight; int actionBarHeight;
TypedValue tv = new TypedValue(); TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))

Loading…
Cancel
Save