X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/3e87ca193dd87bb3377441967a70ea9903d802ff..abb6e2dbd56c0d076ad7fdbcea69ac92afe76bae:/src/com/owncloud/android/ui/activity/FileActivity.java diff --git a/src/com/owncloud/android/ui/activity/FileActivity.java b/src/com/owncloud/android/ui/activity/FileActivity.java index 4d55e6bb..154aa7d6 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -349,12 +349,7 @@ public class FileActivity extends AppCompatActivity // } // Display username in drawer - Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext()); - if (account != null) { - TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username); - int lastAtPos = account.name.lastIndexOf("@"); - username.setText(account.name.substring(0, lastAtPos)); - } + setUsernameInDrawer(navigationDrawerLayout, AccountUtils.getCurrentOwnCloudAccount(getApplicationContext())); // load slide menu items mDrawerTitles = getResources().getStringArray(R.array.drawer_items); @@ -411,13 +406,6 @@ public class FileActivity extends AppCompatActivity invalidateOptionsMenu(); } }; - - mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Log.i("IT WORKS :)",""); - } - }); // Set the list's click listener mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); @@ -428,6 +416,21 @@ public class FileActivity extends AppCompatActivity } /** + * sets the given account name in the drawer in case the drawer is available. The account name + * is shortened beginning from the @-sign in the username. + * + * @param navigationDrawerLayout the drawer layout to be used + * @param account the account to be set in the drawer + */ + protected void setUsernameInDrawer(RelativeLayout navigationDrawerLayout, Account account) { + if (navigationDrawerLayout != null && getAccount() != null) { + TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username); + int lastAtPos = account.name.lastIndexOf("@"); + username.setText(account.name.substring(0, lastAtPos)); + } + } + + /** * Updates title bar and home buttons (state and icon). * * Assumes that navigation drawer is NOT visible. @@ -813,14 +816,15 @@ public class FileActivity extends AppCompatActivity i.putExtra(ConflictsResolveActivity.EXTRA_FILE, syncedFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, getAccount()); startActivity(i); - } + } else { if (!operation.transferWasRequested()) { Toast msg = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), Toast.LENGTH_LONG); msg.show(); } + invalidateOptionsMenu(); } }