mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 10:18:59 +03:00
Allow 3rd party apps to open the trashbin for a specific account
This commit is contained in:
parent
6239e608ae
commit
0472fb0759
2 changed files with 18 additions and 2 deletions
|
@ -346,6 +346,7 @@
|
|||
<activity android:name=".ui.activity.UploadListActivity" />
|
||||
<activity
|
||||
android:name=".ui.trashbin.TrashbinActivity"
|
||||
android:exported="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"/>
|
||||
<activity android:name="com.nextcloud.client.onboarding.WhatsNewActivity"
|
||||
android:theme="@style/Theme.ownCloud.noActionBar.Login" />
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package com.owncloud.android.ui.trashbin;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -67,11 +68,15 @@ public class TrashbinActivity extends DrawerActivity implements
|
|||
TrashbinContract.View,
|
||||
Injectable {
|
||||
|
||||
private static final String TAG = TrashbinActivity.class.getSimpleName();
|
||||
private static final String ARG_TARGET_ACCOUNT_NAME = "TARGET_ACCOUNT_NAME";
|
||||
|
||||
public static final int EMPTY_LIST_COUNT = 1;
|
||||
@Inject AppPreferences preferences;
|
||||
@Inject CurrentAccountProvider accountProvider;
|
||||
@Inject ClientFactory clientFactory;
|
||||
private TrashbinListAdapter trashbinListAdapter;
|
||||
private User user;
|
||||
|
||||
@VisibleForTesting
|
||||
TrashbinPresenter trashbinPresenter;
|
||||
|
@ -82,7 +87,17 @@ public class TrashbinActivity extends DrawerActivity implements
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final User user = accountProvider.getUser();
|
||||
user = accountProvider.getUser();
|
||||
final String targetAccount = getIntent().getStringExtra(ARG_TARGET_ACCOUNT_NAME);
|
||||
if (!user.getAccountName().equals(targetAccount)) {
|
||||
final boolean accountSwitchSuccessful = getUserAccountManager().setCurrentOwnCloudAccount(targetAccount);
|
||||
if (accountSwitchSuccessful) {
|
||||
user = getUserAccountManager().getUser(targetAccount).orElse(user);
|
||||
} else {
|
||||
Log.w(TAG, "Tried to switch current account to \"" + targetAccount + "\", but could not be found.");
|
||||
}
|
||||
}
|
||||
|
||||
final RemoteTrashbinRepository trashRepository = new RemoteTrashbinRepository(user, clientFactory);
|
||||
trashbinPresenter = new TrashbinPresenter(trashRepository, this);
|
||||
|
||||
|
@ -118,7 +133,7 @@ public class TrashbinActivity extends DrawerActivity implements
|
|||
getStorageManager(),
|
||||
preferences,
|
||||
this,
|
||||
getUserAccountManager().getUser()
|
||||
user
|
||||
);
|
||||
recyclerView.setAdapter(trashbinListAdapter);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
|
|
Loading…
Reference in a new issue