Merge pull request #1708 from apicellaj/action_bar

Prevent action bar title from being overwritten
This commit is contained in:
Tobias Kaminsky 2018-10-25 10:02:38 +02:00 committed by GitHub
commit b48fbb2e06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View file

@ -2501,9 +2501,23 @@ public class FileDisplayActivity extends HookActivity
browseToRoot();
}
public void setActionBarTitle(@StringRes final int title) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (getSupportActionBar() != null) {
ThemeUtils.setColoredTitle(getSupportActionBar(), title, getBaseContext());
}
}
});
}
@Override
public void showFiles(boolean onDeviceOnly) {
super.showFiles(onDeviceOnly);
if (onDeviceOnly) {
setActionBarTitle(R.string.drawer_item_on_device);
}
getListOfFilesFragment().refreshDirectory();
}

View file

@ -1435,6 +1435,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
remoteOperationAsyncTask = new AsyncTask() {
@Override
protected Object doInBackground(Object[] params) {
setTitle();
if (getContext() != null && !isCancelled()) {
RemoteOperationResult remoteOperationResult = remoteOperation.execute(currentAccount, getContext());

View file

@ -224,11 +224,16 @@ public final class ThemeUtils {
public static String getDefaultDisplayNameForRootFolder(Context context) {
OCCapability capability = getCapability(context);
if (capability.getServerName() == null || capability.getServerName().isEmpty()) {
return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
if (MainApp.isOnlyOnDevice()) {
return MainApp.getAppContext().getString(R.string.drawer_item_on_device);
} else {
return capability.getServerName();
if (capability.getServerName() == null || capability.getServerName().isEmpty()) {
return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
} else {
return capability.getServerName();
}
}
}
public static void setStatusBarColor(Activity activity, @ColorInt int color) {