X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/6b84d83b3544f8de4e56186f6ecbccd3d612702b..13a73dd56872b6fcbc12ab8c62806cbfd48dc93b:/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 f1508c28..3edd40c9 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -363,12 +363,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); @@ -435,6 +430,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. @@ -510,7 +520,7 @@ public class FileActivity extends AppCompatActivity */ private void swapToDefaultAccount() { // default to the most recently used account - Account newAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext()); + Account newAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext()); if (newAccount == null) { /// no account available: force account creation createFirstAccount(); @@ -602,7 +612,7 @@ public class FileActivity extends AppCompatActivity } /** - * @return 'True' when the Activity is finishing to enforce the setup of a new account. + * @return 'True' when the Activity is finishing to enforce the setup of a new account. */ protected boolean isRedirectingToSetupAccount() { return mRedirectingToSetupAccount; @@ -752,6 +762,7 @@ public class FileActivity extends AppCompatActivity } + private void onCreateShareOperationFinish(CreateShareOperation operation, RemoteOperationResult result) { dismissLoadingDialog(); @@ -857,7 +868,7 @@ public class FileActivity extends AppCompatActivity /** * Dismiss loading dialog */ - public void dismissLoadingDialog(){ + public void dismissLoadingDialog() { Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG); if (frag != null) { LoadingDialog loading = (LoadingDialog) frag;