Fix jumps in drawer when open for all items(icons, user data) (#639)

Fix drawer jumps when open for all items

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/639
This commit is contained in:
M M Arif 2020-08-09 10:23:19 +02:00
parent d9cd04facf
commit a92969a47f
1 changed files with 9 additions and 8 deletions

View File

@ -197,6 +197,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
@Override @Override
public void onDrawerOpened(@NonNull View drawerView) { public void onDrawerOpened(@NonNull View drawerView) {
}
@Override
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
if(tinyDb.getBoolean("noConnection")) { if(tinyDb.getBoolean("noConnection")) {
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection)); Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
tinyDb.putBoolean("noConnection", false); tinyDb.putBoolean("noConnection", false);
@ -216,11 +221,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
userEmail.setTypeface(myTypeface); userEmail.setTypeface(myTypeface);
userFullName.setTypeface(myTypeface); userFullName.setTypeface(myTypeface);
String currentVersion = tinyDb.getString("giteaVersion");
navigationView.getMenu().findItem(R.id.nav_administration).setVisible(tinyDb.getBoolean("userIsAdmin"));
navigationView.getMenu().findItem(R.id.nav_notifications).setVisible(new Version(currentVersion).higherOrEqual("1.12.3"));
if(!userEmailNav.equals("")) { if(!userEmailNav.equals("")) {
userEmail.setText(userEmailNav); userEmail.setText(userEmailNav);
} }
@ -271,10 +271,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
drawer.closeDrawers(); drawer.closeDrawers();
}); });
} String currentVersion = tinyDb.getString("giteaVersion");
@Override navigationView.getMenu().findItem(R.id.nav_administration).setVisible(tinyDb.getBoolean("userIsAdmin"));
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {} navigationView.getMenu().findItem(R.id.nav_notifications).setVisible(new Version(currentVersion).higherOrEqual("1.12.3"));
}
@Override @Override
public void onDrawerClosed(@NonNull View drawerView) {} public void onDrawerClosed(@NonNull View drawerView) {}