mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Merge pull request #1708 from apicellaj/action_bar
Prevent action bar title from being overwritten
This commit is contained in:
commit
b48fbb2e06
3 changed files with 23 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue