mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 18:59:18 +03:00
Reduce extend of FileActivity, use DrawerActivity instead
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
6b80669000
commit
2a0f14231a
12 changed files with 33 additions and 104 deletions
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue