|
|
@ -34,6 +34,7 @@ import android.content.Intent;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.res.Configuration;
|
|
|
|
import android.content.res.Configuration;
|
|
|
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
@ -87,7 +88,11 @@ import javax.net.ssl.HttpsURLConnection;
|
|
|
|
|
|
|
|
|
|
|
|
public class ActivityView extends ActivityBilling implements FragmentManager.OnBackStackChangedListener {
|
|
|
|
public class ActivityView extends ActivityBilling implements FragmentManager.OnBackStackChangedListener {
|
|
|
|
private String startup;
|
|
|
|
private String startup;
|
|
|
|
|
|
|
|
private boolean nav_pinned;
|
|
|
|
|
|
|
|
private boolean nav_expanded;
|
|
|
|
|
|
|
|
private int colorDrawerScrim;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int layoutId;
|
|
|
|
private View view;
|
|
|
|
private View view;
|
|
|
|
|
|
|
|
|
|
|
|
private View content_separator;
|
|
|
|
private View content_separator;
|
|
|
@ -97,6 +102,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
private DrawerLayoutEx drawerLayout;
|
|
|
|
private DrawerLayoutEx drawerLayout;
|
|
|
|
private ActionBarDrawerToggle drawerToggle;
|
|
|
|
private ActionBarDrawerToggle drawerToggle;
|
|
|
|
private NestedScrollView drawerContainer;
|
|
|
|
private NestedScrollView drawerContainer;
|
|
|
|
|
|
|
|
private ImageButton ibPin;
|
|
|
|
private ImageButton ibExpanderNav;
|
|
|
|
private ImageButton ibExpanderNav;
|
|
|
|
private ImageButton ibExpanderAccount;
|
|
|
|
private ImageButton ibExpanderAccount;
|
|
|
|
private RecyclerView rvAccount;
|
|
|
|
private RecyclerView rvAccount;
|
|
|
@ -109,8 +115,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
private ImageButton ibExpanderExtra;
|
|
|
|
private ImageButton ibExpanderExtra;
|
|
|
|
private RecyclerView rvMenuExtra;
|
|
|
|
private RecyclerView rvMenuExtra;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean nav_fixed;
|
|
|
|
|
|
|
|
private boolean expanded;
|
|
|
|
|
|
|
|
private AdapterNavAccount adapterNavAccount;
|
|
|
|
private AdapterNavAccount adapterNavAccount;
|
|
|
|
private AdapterNavUnified adapterNavUnified;
|
|
|
|
private AdapterNavUnified adapterNavUnified;
|
|
|
|
private AdapterNavFolder adapterNavFolder;
|
|
|
|
private AdapterNavFolder adapterNavFolder;
|
|
|
@ -174,27 +178,28 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
if (savedInstanceState != null)
|
|
|
|
if (savedInstanceState != null)
|
|
|
|
searching = savedInstanceState.getBoolean("fair:searching");
|
|
|
|
searching = savedInstanceState.getBoolean("fair:searching");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
colorDrawerScrim = Helper.resolveColor(this, R.attr.colorDrawerScrim);
|
|
|
|
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
startup = prefs.getString("startup", "unified");
|
|
|
|
startup = prefs.getString("startup", "unified");
|
|
|
|
|
|
|
|
nav_pinned = getDrawerPinned();
|
|
|
|
|
|
|
|
nav_expanded = prefs.getBoolean("nav_expanded", true);
|
|
|
|
|
|
|
|
|
|
|
|
Configuration config = getResources().getConfiguration();
|
|
|
|
Configuration config = getResources().getConfiguration();
|
|
|
|
final boolean portrait2 = prefs.getBoolean("portrait2", false);
|
|
|
|
boolean portrait2 = prefs.getBoolean("portrait2", false);
|
|
|
|
final boolean portrait2c = prefs.getBoolean("portrait2c", false);
|
|
|
|
boolean portrait2c = prefs.getBoolean("portrait2c", false);
|
|
|
|
final boolean portrait3 = prefs.getBoolean("portrait3", false);
|
|
|
|
boolean landscape = prefs.getBoolean("landscape", true);
|
|
|
|
final boolean landscape = prefs.getBoolean("landscape", true);
|
|
|
|
|
|
|
|
final boolean landscape3 = prefs.getBoolean("landscape3", true);
|
|
|
|
|
|
|
|
Log.i("Orientation=" + config.orientation +
|
|
|
|
Log.i("Orientation=" + config.orientation +
|
|
|
|
" portrait 2=" + portrait2 + " 2c=" + portrait2c + " nav=" + portrait3 +
|
|
|
|
" portrait rows=" + portrait2 + " cols=" + portrait2c + " landscape cols=" + landscape);
|
|
|
|
" landscape 2=" + landscape + " nav=" + landscape3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int viewId;
|
|
|
|
|
|
|
|
if (config.orientation == ORIENTATION_PORTRAIT && portrait2c)
|
|
|
|
if (config.orientation == ORIENTATION_PORTRAIT && portrait2c)
|
|
|
|
viewId = R.layout.activity_view_landscape_split;
|
|
|
|
layoutId = R.layout.activity_view_landscape_split;
|
|
|
|
else if (config.orientation == ORIENTATION_PORTRAIT || !landscape)
|
|
|
|
else if (config.orientation == ORIENTATION_PORTRAIT || !landscape)
|
|
|
|
viewId = (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait);
|
|
|
|
layoutId = (portrait2 ? R.layout.activity_view_portrait_split : R.layout.activity_view_portrait);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
viewId = R.layout.activity_view_landscape_split;
|
|
|
|
layoutId = R.layout.activity_view_landscape_split;
|
|
|
|
view = LayoutInflater.from(this).inflate(viewId, null);
|
|
|
|
|
|
|
|
|
|
|
|
view = LayoutInflater.from(this).inflate(layoutId, null);
|
|
|
|
setContentView(view);
|
|
|
|
setContentView(view);
|
|
|
|
|
|
|
|
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
@ -237,10 +242,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
Log.i("Drawer opened");
|
|
|
|
Log.i("Drawer opened");
|
|
|
|
owner.start();
|
|
|
|
owner.start();
|
|
|
|
|
|
|
|
|
|
|
|
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
|
|
|
if (nav_pinned) {
|
|
|
|
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE))) {
|
|
|
|
|
|
|
|
drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_OPEN);
|
|
|
|
drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_OPEN);
|
|
|
|
childContent.setPaddingRelative(childDrawer.getLayoutParams().width, 0, 0, 0);
|
|
|
|
int padding = childDrawer.getLayoutParams().width;
|
|
|
|
|
|
|
|
childContent.setPaddingRelative(padding, 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -253,69 +258,73 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
else
|
|
|
|
else
|
|
|
|
owner.stop();
|
|
|
|
owner.stop();
|
|
|
|
|
|
|
|
|
|
|
|
if (((portrait3 && config.orientation == Configuration.ORIENTATION_PORTRAIT) ||
|
|
|
|
if (nav_pinned) {
|
|
|
|
(landscape3 && config.orientation == Configuration.ORIENTATION_LANDSCAPE)))
|
|
|
|
int padding = Math.round(slideOffset * childDrawer.getLayoutParams().width);
|
|
|
|
childContent.setPaddingRelative(
|
|
|
|
childContent.setPaddingRelative(padding, 0, 0, 0);
|
|
|
|
Math.round(slideOffset * childDrawer.getLayoutParams().width), 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
drawerLayout.addDrawerListener(drawerToggle);
|
|
|
|
drawerLayout.addDrawerListener(drawerToggle);
|
|
|
|
|
|
|
|
|
|
|
|
drawerContainer = findViewById(R.id.drawer_container);
|
|
|
|
drawerContainer = findViewById(R.id.drawer_container);
|
|
|
|
|
|
|
|
|
|
|
|
int drawerWidth;
|
|
|
|
ViewGroup.LayoutParams lparam = drawerContainer.getLayoutParams();
|
|
|
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
|
lparam.width = getDrawerWidth();
|
|
|
|
if (viewId == R.layout.activity_view_landscape_split && landscape3) {
|
|
|
|
drawerContainer.setLayoutParams(lparam);
|
|
|
|
drawerWidth = Helper.dp2pixels(this, 300);
|
|
|
|
|
|
|
|
nav_fixed = true;
|
|
|
|
|
|
|
|
} else if (viewId != R.layout.activity_view_landscape_split && portrait3) {
|
|
|
|
|
|
|
|
drawerWidth = Math.min(Helper.dp2pixels(this, 300), dm.widthPixels / 2);
|
|
|
|
|
|
|
|
nav_fixed = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
int actionBarHeight;
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
|
|
|
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
|
|
|
|
|
|
|
|
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, dm);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
actionBarHeight = Helper.dp2pixels(this, 56);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int screenWidth = Math.min(dm.widthPixels, dm.heightPixels);
|
|
|
|
ibPin = drawerContainer.findViewById(R.id.ibPin);
|
|
|
|
int dp320 = Helper.dp2pixels(this, 320);
|
|
|
|
ibPin.setOnClickListener(new View.OnClickListener() {
|
|
|
|
drawerWidth = Math.min(screenWidth - actionBarHeight, dp320);
|
|
|
|
@Override
|
|
|
|
}
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
nav_pinned = !nav_pinned;
|
|
|
|
|
|
|
|
if (config.orientation == ORIENTATION_PORTRAIT)
|
|
|
|
|
|
|
|
prefs.edit().putBoolean("portrait3", nav_pinned).apply();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
prefs.edit().putBoolean("landscape3", nav_pinned).apply();
|
|
|
|
|
|
|
|
|
|
|
|
int dp48 = Helper.dp2pixels(this, 48);
|
|
|
|
drawerLayout.setDrawerLockMode(nav_pinned ? LOCK_MODE_LOCKED_OPEN : LOCK_MODE_UNLOCKED);
|
|
|
|
expanded = (!nav_fixed || prefs.getBoolean("nav_expanded", true));
|
|
|
|
drawerLayout.setScrimColor(nav_pinned ? Color.TRANSPARENT : colorDrawerScrim);
|
|
|
|
|
|
|
|
drawerLayout.openDrawer(drawerContainer, false);
|
|
|
|
|
|
|
|
|
|
|
|
ViewGroup.LayoutParams lparam = drawerContainer.getLayoutParams();
|
|
|
|
ViewGroup.LayoutParams lparam = drawerContainer.getLayoutParams();
|
|
|
|
lparam.width = (expanded ? drawerWidth : dp48);
|
|
|
|
lparam.width = getDrawerWidth();
|
|
|
|
drawerContainer.setLayoutParams(lparam);
|
|
|
|
drawerContainer.setLayoutParams(lparam);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int padding = (nav_pinned ? childDrawer.getLayoutParams().width : 0);
|
|
|
|
|
|
|
|
childContent.setPaddingRelative(padding, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibPin.setImageLevel(nav_pinned ? 1 : 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
ibPin.setImageLevel(nav_pinned ? 1 : 0);
|
|
|
|
|
|
|
|
ibPin.setVisibility(nav_expanded ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
// Navigation expander
|
|
|
|
// Navigation expander
|
|
|
|
ibExpanderNav = drawerContainer.findViewById(R.id.ibExpanderNav);
|
|
|
|
ibExpanderNav = drawerContainer.findViewById(R.id.ibExpanderNav);
|
|
|
|
ibExpanderNav.setOnClickListener(new View.OnClickListener() {
|
|
|
|
ibExpanderNav.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
expanded = !expanded;
|
|
|
|
nav_expanded = !nav_expanded;
|
|
|
|
prefs.edit().putBoolean("nav_expanded", expanded).apply();
|
|
|
|
prefs.edit().putBoolean("nav_expanded", nav_expanded).apply();
|
|
|
|
|
|
|
|
|
|
|
|
lparam.width = (expanded ? drawerWidth : dp48);
|
|
|
|
ViewGroup.LayoutParams lparam = drawerContainer.getLayoutParams();
|
|
|
|
|
|
|
|
lparam.width = getDrawerWidth();
|
|
|
|
drawerContainer.setLayoutParams(lparam);
|
|
|
|
drawerContainer.setLayoutParams(lparam);
|
|
|
|
|
|
|
|
|
|
|
|
if (nav_fixed)
|
|
|
|
int padding = (nav_pinned ? childDrawer.getLayoutParams().width : 0);
|
|
|
|
childContent.setPaddingRelative(childDrawer.getLayoutParams().width, 0, 0, 0);
|
|
|
|
childContent.setPaddingRelative(padding, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
ibExpanderNav.setImageLevel(expanded ? 0 : 1);
|
|
|
|
ibPin.setVisibility(nav_expanded ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
ibExpanderNav.setImageLevel(nav_expanded ? 0 : 1);
|
|
|
|
|
|
|
|
|
|
|
|
adapterNavAccount.setExpanded(expanded);
|
|
|
|
adapterNavAccount.setExpanded(nav_expanded);
|
|
|
|
adapterNavUnified.setExpanded(expanded);
|
|
|
|
adapterNavUnified.setExpanded(nav_expanded);
|
|
|
|
adapterNavFolder.setExpanded(expanded);
|
|
|
|
adapterNavFolder.setExpanded(nav_expanded);
|
|
|
|
adapterNavMenu.setExpanded(expanded);
|
|
|
|
adapterNavMenu.setExpanded(nav_expanded);
|
|
|
|
adapterNavMenuExtra.setExpanded(expanded);
|
|
|
|
adapterNavMenuExtra.setExpanded(nav_expanded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
ibExpanderNav.setImageLevel(expanded ? 0 : 1);
|
|
|
|
ibExpanderNav.setImageLevel(nav_expanded ? 0 : 1);
|
|
|
|
ibExpanderNav.setVisibility(nav_fixed ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Accounts
|
|
|
|
// Accounts
|
|
|
|
ibExpanderAccount = drawerContainer.findViewById(R.id.ibExpanderAccount);
|
|
|
|
ibExpanderAccount = drawerContainer.findViewById(R.id.ibExpanderAccount);
|
|
|
@ -560,7 +569,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
adapterNavMenu.set(menus, expanded);
|
|
|
|
adapterNavMenu.set(menus, nav_expanded);
|
|
|
|
|
|
|
|
|
|
|
|
// Collapsible menus
|
|
|
|
// Collapsible menus
|
|
|
|
|
|
|
|
|
|
|
@ -663,7 +672,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).setExternal(true));
|
|
|
|
}).setExternal(true));
|
|
|
|
|
|
|
|
|
|
|
|
adapterNavMenuExtra.set(extra, expanded);
|
|
|
|
adapterNavMenuExtra.set(extra, nav_expanded);
|
|
|
|
|
|
|
|
|
|
|
|
// Live data
|
|
|
|
// Live data
|
|
|
|
|
|
|
|
|
|
|
@ -674,7 +683,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
public void onChanged(@Nullable List<TupleAccountEx> accounts) {
|
|
|
|
public void onChanged(@Nullable List<TupleAccountEx> accounts) {
|
|
|
|
if (accounts == null)
|
|
|
|
if (accounts == null)
|
|
|
|
accounts = new ArrayList<>();
|
|
|
|
accounts = new ArrayList<>();
|
|
|
|
adapterNavAccount.set(accounts, expanded);
|
|
|
|
adapterNavAccount.set(accounts, nav_expanded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -683,7 +692,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
public void onChanged(List<TupleFolderUnified> folders) {
|
|
|
|
public void onChanged(List<TupleFolderUnified> folders) {
|
|
|
|
if (folders == null)
|
|
|
|
if (folders == null)
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
adapterNavUnified.set(folders, expanded);
|
|
|
|
adapterNavUnified.set(folders, nav_expanded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -692,7 +701,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
public void onChanged(List<TupleFolderNav> folders) {
|
|
|
|
public void onChanged(List<TupleFolderNav> folders) {
|
|
|
|
if (folders == null)
|
|
|
|
if (folders == null)
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
folders = new ArrayList<>();
|
|
|
|
adapterNavFolder.set(folders, expanded);
|
|
|
|
adapterNavFolder.set(folders, nav_expanded);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -708,7 +717,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
Log.i("Drawer start");
|
|
|
|
Log.i("Drawer start");
|
|
|
|
owner.start();
|
|
|
|
owner.start();
|
|
|
|
|
|
|
|
|
|
|
|
drawerLayout.setup(getResources().getConfiguration(), drawerContainer, drawerToggle);
|
|
|
|
setupDrawer();
|
|
|
|
drawerToggle.syncState();
|
|
|
|
drawerToggle.syncState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -762,14 +771,58 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
drawerLayout.setup(newConfig, drawerContainer, drawerToggle);
|
|
|
|
nav_pinned = getDrawerPinned();
|
|
|
|
|
|
|
|
setupDrawer();
|
|
|
|
drawerToggle.onConfigurationChanged(newConfig);
|
|
|
|
drawerToggle.onConfigurationChanged(newConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setupDrawer() {
|
|
|
|
|
|
|
|
if (nav_pinned) {
|
|
|
|
|
|
|
|
drawerLayout.setScrimColor(Color.TRANSPARENT);
|
|
|
|
|
|
|
|
drawerLayout.openDrawer(drawerContainer, false);
|
|
|
|
|
|
|
|
drawerToggle.onDrawerOpened(drawerContainer);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
drawerLayout.setScrimColor(colorDrawerScrim);
|
|
|
|
|
|
|
|
drawerLayout.closeDrawer(drawerContainer, false);
|
|
|
|
|
|
|
|
drawerToggle.onDrawerClosed(drawerContainer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean getDrawerPinned() {
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
|
|
|
|
boolean portrait3 = prefs.getBoolean("portrait3", false);
|
|
|
|
|
|
|
|
boolean landscape3 = prefs.getBoolean("landscape3", true);
|
|
|
|
|
|
|
|
Configuration config = getResources().getConfiguration();
|
|
|
|
|
|
|
|
return (config.orientation == ORIENTATION_PORTRAIT ? portrait3 : landscape3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getDrawerWidth() {
|
|
|
|
|
|
|
|
if (!nav_expanded)
|
|
|
|
|
|
|
|
return Helper.dp2pixels(this, 48);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
|
|
|
|
|
if (layoutId == R.layout.activity_view_landscape_split && nav_pinned)
|
|
|
|
|
|
|
|
return Helper.dp2pixels(this, 300);
|
|
|
|
|
|
|
|
else if (layoutId != R.layout.activity_view_landscape_split && nav_pinned)
|
|
|
|
|
|
|
|
return Math.min(Helper.dp2pixels(this, 300), dm.widthPixels / 2);
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
int actionBarHeight;
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
|
|
|
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
|
|
|
|
|
|
|
|
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, dm);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
actionBarHeight = Helper.dp2pixels(this, 56);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int screenWidth = Math.min(dm.widthPixels, dm.heightPixels);
|
|
|
|
|
|
|
|
int dp320 = Helper.dp2pixels(this, 320);
|
|
|
|
|
|
|
|
return Math.min(screenWidth - actionBarHeight, dp320);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
|
|
|
public void onBackPressed() {
|
|
|
|
int count = getSupportFragmentManager().getBackStackEntryCount();
|
|
|
|
int count = getSupportFragmentManager().getBackStackEntryCount();
|
|
|
|
if (!nav_fixed &&
|
|
|
|
if (!nav_pinned &&
|
|
|
|
drawerLayout.isDrawerOpen(drawerContainer) &&
|
|
|
|
drawerLayout.isDrawerOpen(drawerContainer) &&
|
|
|
|
(!drawerLayout.isLocked(drawerContainer) || count == 1))
|
|
|
|
(!drawerLayout.isLocked(drawerContainer) || count == 1))
|
|
|
|
drawerLayout.closeDrawer(drawerContainer);
|
|
|
|
drawerLayout.closeDrawer(drawerContainer);
|
|
|
|