mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +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.lib.resources.files.FileUtils;
|
||||||
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
|
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
|
||||||
import com.owncloud.android.ui.activities.data.files.FilesRepository;
|
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.activity.FileDisplayActivity;
|
||||||
import com.owncloud.android.ui.adapter.ActivityListAdapter;
|
import com.owncloud.android.ui.adapter.ActivityListAdapter;
|
||||||
import com.owncloud.android.ui.interfaces.ActivityListInterface;
|
import com.owncloud.android.ui.interfaces.ActivityListInterface;
|
||||||
|
@ -60,7 +60,10 @@ import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.Unbinder;
|
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 String TAG = ActivitiesActivity.class.getSimpleName();
|
||||||
private static final int UNDEFINED = -1;
|
private static final int UNDEFINED = -1;
|
||||||
|
|
||||||
|
@ -141,14 +144,6 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
|
||||||
unbinder.unbind();
|
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.
|
* sets up the UI elements and loads all activity items.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
package com.owncloud.android.ui.activity;
|
package com.owncloud.android.ui.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
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.
|
* Activity providing information about ways to participate in the app's development.
|
||||||
*/
|
*/
|
||||||
public class CommunityActivity extends FileActivity {
|
public class CommunityActivity extends DrawerActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -132,15 +131,6 @@ public class CommunityActivity extends FileActivity {
|
||||||
return retval;
|
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
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.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
|
@Override
|
||||||
public void showDetails(OCFile file) {
|
public void showDetails(OCFile file) {
|
||||||
// not needed
|
// 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
|
* sets the new/current account and restarts. In case the given account equals the actual/current account the call
|
||||||
* will be ignored.
|
* 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.
|
* 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
|
@Override
|
||||||
public void avatarGenerated(Drawable avatarDrawable, Object callContext) {
|
public void avatarGenerated(Drawable avatarDrawable, Object callContext) {
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
package com.owncloud.android.ui.activity;
|
package com.owncloud.android.ui.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -220,14 +219,6 @@ public class ExternalSiteWebView extends FileActivity {
|
||||||
return retval;
|
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
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
|
@ -608,16 +608,6 @@ public abstract class FileActivity extends DrawerActivity
|
||||||
return mUploaderBinder;
|
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() {
|
public OCFile getCurrentDir() {
|
||||||
OCFile file = getFile();
|
OCFile file = getFile();
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package com.owncloud.android.ui.activity;
|
package com.owncloud.android.ui.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -72,7 +71,7 @@ import butterknife.Unbinder;
|
||||||
/**
|
/**
|
||||||
* Activity displaying all server side stored notification items.
|
* 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();
|
private static final String TAG = NotificationsActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
@ -226,14 +225,6 @@ public class NotificationsActivity extends FileActivity implements Notifications
|
||||||
unbinder.unbind();
|
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.
|
* sets up the UI elements and loads all notification items.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -601,21 +601,6 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
||||||
return result;
|
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
|
@Override
|
||||||
public void onSyncStatusToggleClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) {
|
public void onSyncStatusToggleClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) {
|
||||||
if (syncedFolderDisplayItem.getId() > UNPERSISTED_ID) {
|
if (syncedFolderDisplayItem.getId() > UNPERSISTED_ID) {
|
||||||
|
|
|
@ -67,10 +67,12 @@ import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
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.
|
* 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,
|
OnClickListener, ConfirmationDialogFragmentListener, SortingOrderDialogFragment.OnSortingOrderListener,
|
||||||
CheckAvailableSpaceTask.CheckAvailableSpaceListener, StoragePathAdapter.StoragePathAdapterListener, Injectable {
|
CheckAvailableSpaceTask.CheckAvailableSpaceListener, StoragePathAdapter.StoragePathAdapterListener, Injectable {
|
||||||
|
|
||||||
|
|
|
@ -108,14 +108,6 @@ public class UploadListActivity extends FileActivity {
|
||||||
return intent;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
|
@ -90,7 +90,7 @@ import butterknife.Unbinder;
|
||||||
/**
|
/**
|
||||||
* This Activity presents the user information.
|
* 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";
|
public static final String KEY_ACCOUNT = "ACCOUNT";
|
||||||
|
|
||||||
private static final String TAG = UserInfoActivity.class.getSimpleName();
|
private static final String TAG = UserInfoActivity.class.getSimpleName();
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package com.owncloud.android.ui.trashbin;
|
package com.owncloud.android.ui.trashbin;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -41,8 +40,7 @@ import com.owncloud.android.R;
|
||||||
import com.owncloud.android.databinding.TrashbinActivityBinding;
|
import com.owncloud.android.databinding.TrashbinActivityBinding;
|
||||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||||
import com.owncloud.android.ui.EmptyRecyclerView;
|
import com.owncloud.android.ui.EmptyRecyclerView;
|
||||||
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.TrashbinListAdapter;
|
import com.owncloud.android.ui.adapter.TrashbinListAdapter;
|
||||||
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
|
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
|
||||||
import com.owncloud.android.ui.interfaces.TrashbinActivityInterface;
|
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
|
* Presenting trashbin data, received from presenter
|
||||||
*/
|
*/
|
||||||
public class TrashbinActivity extends FileActivity implements
|
public class TrashbinActivity extends DrawerActivity implements
|
||||||
TrashbinActivityInterface,
|
TrashbinActivityInterface,
|
||||||
SortingOrderDialogFragment.OnSortingOrderListener,
|
SortingOrderDialogFragment.OnSortingOrderListener,
|
||||||
TrashbinContract.View,
|
TrashbinContract.View,
|
||||||
|
@ -144,14 +142,6 @@ public class TrashbinActivity extends FileActivity implements
|
||||||
trashbinPresenter.loadFolder();
|
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
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
boolean retval = true;
|
boolean retval = true;
|
||||||
|
|
Loading…
Reference in a new issue