diff --git a/src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java b/src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java index 69690d2f8c..b17ad209ea 100644 --- a/src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java +++ b/src/main/java/com/owncloud/android/ui/activities/ActivitiesActivity.java @@ -38,7 +38,7 @@ import com.owncloud.android.lib.resources.activities.model.RichObject; import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository; import com.owncloud.android.ui.activities.data.files.FilesRepository; -import com.owncloud.android.ui.activity.FileActivity; +import com.owncloud.android.ui.activity.DrawerActivity; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.adapter.ActivityListAdapter; import com.owncloud.android.ui.interfaces.ActivityListInterface; @@ -60,7 +60,10 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class ActivitiesActivity extends FileActivity implements ActivityListInterface, ActivitiesContract.View { +import static com.owncloud.android.ui.activity.FileActivity.EXTRA_ACCOUNT; +import static com.owncloud.android.ui.activity.FileActivity.EXTRA_FILE; + +public class ActivitiesActivity extends DrawerActivity implements ActivityListInterface, ActivitiesContract.View { private static final String TAG = ActivitiesActivity.class.getSimpleName(); private static final int UNDEFINED = -1; @@ -141,14 +144,6 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte unbinder.unbind(); } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent i = new Intent(getApplicationContext(), FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - } - /** * sets up the UI elements and loads all activity items. */ diff --git a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java index ca6f926b61..33cf06a2e7 100644 --- a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java @@ -21,7 +21,6 @@ */ package com.owncloud.android.ui.activity; -import android.content.Intent; import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; @@ -37,7 +36,7 @@ import com.owncloud.android.utils.ThemeUtils; /** * Activity providing information about ways to participate in the app's development. */ -public class CommunityActivity extends FileActivity { +public class CommunityActivity extends DrawerActivity { @Override protected void onCreate(Bundle savedInstanceState) { @@ -132,15 +131,6 @@ public class CommunityActivity extends FileActivity { return retval; } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent fileDisplayActivity = new Intent(getApplicationContext(), - FileDisplayActivity.class); - fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(fileDisplayActivity); - } - @Override protected void onResume() { super.onResume(); diff --git a/src/main/java/com/owncloud/android/ui/activity/ContactsPreferenceActivity.java b/src/main/java/com/owncloud/android/ui/activity/ContactsPreferenceActivity.java index 9a4751ce69..44bfe9ae73 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ContactsPreferenceActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ContactsPreferenceActivity.java @@ -117,14 +117,6 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag } } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent fileDisplayActivity = new Intent(getApplicationContext(), FileDisplayActivity.class); - fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(fileDisplayActivity); - } - @Override public void showDetails(OCFile file) { // not needed diff --git a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index fd1746a5f6..4fb8be5fbf 100644 --- a/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -472,14 +472,6 @@ public abstract class DrawerActivity extends ToolbarActivity } } - /** - * show the file list to the user. - * - * @param onDeviceOnly flag to decide if all files or only the ones on the device should be shown - */ - public abstract void showFiles(boolean onDeviceOnly); - - /** * sets the new/current account and restarts. In case the given account equals the actual/current account the call * will be ignored. @@ -947,7 +939,26 @@ public abstract class DrawerActivity extends ToolbarActivity /** * restart helper method which is called after a changing the current account. */ - protected abstract void restart(); + private void restart() { + Intent i = new Intent(this, FileDisplayActivity.class); + i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + i.setAction(FileDisplayActivity.RESTART); + startActivity(i); + + fetchExternalLinks(false); + } + + /** + * show the file list to the user. + * + * @param onDeviceOnly flag to decide if all files or only the ones on the device should be shown + */ + public void showFiles(boolean onDeviceOnly) { + MainApp.showOnlyFilesOnDevice(onDeviceOnly); + Intent fileDisplayActivity = new Intent(getApplicationContext(), FileDisplayActivity.class); + fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(fileDisplayActivity); + } @Override public void avatarGenerated(Drawable avatarDrawable, Object callContext) { diff --git a/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java b/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java index e55687d1c1..b7b5e758bf 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java +++ b/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java @@ -22,7 +22,6 @@ package com.owncloud.android.ui.activity; import android.annotation.SuppressLint; -import android.content.Intent; import android.content.pm.ApplicationInfo; import android.os.Build; import android.os.Bundle; @@ -220,14 +219,6 @@ public class ExternalSiteWebView extends FileActivity { return retval; } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent fileDisplayActivity = new Intent(getApplicationContext(), FileDisplayActivity.class); - fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(fileDisplayActivity); - } - @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); diff --git a/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index f8bc5cfd53..2e6d5330c9 100644 --- a/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -608,16 +608,6 @@ public abstract class FileActivity extends DrawerActivity return mUploaderBinder; } - @Override - public void restart() { - Intent i = new Intent(this, FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - i.setAction(FileDisplayActivity.RESTART); - startActivity(i); - - fetchExternalLinks(false); - } - public OCFile getCurrentDir() { OCFile file = getFile(); if (file != null) { diff --git a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java index ead43be630..0259589bbd 100644 --- a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java @@ -24,7 +24,6 @@ package com.owncloud.android.ui.activity; -import android.content.Intent; import android.graphics.PorterDuff; import android.os.Bundle; import android.view.Menu; @@ -72,7 +71,7 @@ import butterknife.Unbinder; /** * Activity displaying all server side stored notification items. */ -public class NotificationsActivity extends FileActivity implements NotificationsContract.View { +public class NotificationsActivity extends DrawerActivity implements NotificationsContract.View { private static final String TAG = NotificationsActivity.class.getSimpleName(); @@ -226,14 +225,6 @@ public class NotificationsActivity extends FileActivity implements Notifications unbinder.unbind(); } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent i = new Intent(getApplicationContext(), FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - } - /** * sets up the UI elements and loads all notification items. */ diff --git a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java index 72afbb9d7b..4f0579838f 100644 --- a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java @@ -601,21 +601,6 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA return result; } - @Override - public void restart() { - Intent i = new Intent(this, FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - } - - @Override - public void showFiles(boolean onDeviceOnly) { - MainApp.showOnlyFilesOnDevice(onDeviceOnly); - Intent fileDisplayActivity = new Intent(getApplicationContext(), FileDisplayActivity.class); - fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(fileDisplayActivity); - } - @Override public void onSyncStatusToggleClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) { if (syncedFolderDisplayItem.getId() > UNPERSISTED_ID) { diff --git a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 6b6de71978..bb81db5883 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -67,10 +67,12 @@ import androidx.fragment.app.DialogFragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; +import static com.owncloud.android.ui.activity.FileActivity.EXTRA_ACCOUNT; + /** * Displays local files and let the user choose what of them wants to upload to the current ownCloud account. */ -public class UploadFilesActivity extends FileActivity implements LocalFileListFragment.ContainerActivity, +public class UploadFilesActivity extends DrawerActivity implements LocalFileListFragment.ContainerActivity, OnClickListener, ConfirmationDialogFragmentListener, SortingOrderDialogFragment.OnSortingOrderListener, CheckAvailableSpaceTask.CheckAvailableSpaceListener, StoragePathAdapter.StoragePathAdapterListener, Injectable { diff --git a/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java b/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java index 9a5eae3117..de50e71f1c 100755 --- a/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java @@ -108,14 +108,6 @@ public class UploadListActivity extends FileActivity { return intent; } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent i = new Intent(getApplicationContext(), FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java index b53d0a7ccf..c6b55bf487 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java @@ -90,7 +90,7 @@ import butterknife.Unbinder; /** * This Activity presents the user information. */ -public class UserInfoActivity extends FileActivity implements Injectable { +public class UserInfoActivity extends DrawerActivity implements Injectable { public static final String KEY_ACCOUNT = "ACCOUNT"; private static final String TAG = UserInfoActivity.class.getSimpleName(); diff --git a/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java b/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java index c4ff7b9749..0f84d44e65 100644 --- a/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java +++ b/src/main/java/com/owncloud/android/ui/trashbin/TrashbinActivity.java @@ -23,7 +23,6 @@ */ package com.owncloud.android.ui.trashbin; -import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; @@ -41,8 +40,7 @@ import com.owncloud.android.R; import com.owncloud.android.databinding.TrashbinActivityBinding; import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile; import com.owncloud.android.ui.EmptyRecyclerView; -import com.owncloud.android.ui.activity.FileActivity; -import com.owncloud.android.ui.activity.FileDisplayActivity; +import com.owncloud.android.ui.activity.DrawerActivity; import com.owncloud.android.ui.adapter.TrashbinListAdapter; import com.owncloud.android.ui.dialog.SortingOrderDialogFragment; import com.owncloud.android.ui.interfaces.TrashbinActivityInterface; @@ -63,7 +61,7 @@ import static com.owncloud.android.utils.DisplayUtils.openSortingOrderDialogFrag /** * Presenting trashbin data, received from presenter */ -public class TrashbinActivity extends FileActivity implements +public class TrashbinActivity extends DrawerActivity implements TrashbinActivityInterface, SortingOrderDialogFragment.OnSortingOrderListener, TrashbinContract.View, @@ -144,14 +142,6 @@ public class TrashbinActivity extends FileActivity implements trashbinPresenter.loadFolder(); } - @Override - public void showFiles(boolean onDeviceOnly) { - super.showFiles(onDeviceOnly); - Intent i = new Intent(getApplicationContext(), FileDisplayActivity.class); - i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - } - @Override public boolean onOptionsItemSelected(MenuItem item) { boolean retval = true;