mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 08:58:30 +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,6 +224,9 @@ public final class ThemeUtils {
|
|||
public static String getDefaultDisplayNameForRootFolder(Context context) {
|
||||
OCCapability capability = getCapability(context);
|
||||
|
||||
if (MainApp.isOnlyOnDevice()) {
|
||||
return MainApp.getAppContext().getString(R.string.drawer_item_on_device);
|
||||
} else {
|
||||
if (capability.getServerName() == null || capability.getServerName().isEmpty()) {
|
||||
return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
|
||||
} else {
|
||||
|
@ -231,6 +234,8 @@ public final class ThemeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setStatusBarColor(Activity activity, @ColorInt int color) {
|
||||
if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
activity.getWindow().setStatusBarColor(color);
|
||||
|
|
Loading…
Reference in a new issue