mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #10556 from nextcloud/fixReceiveFile
Fix receive file
This commit is contained in:
commit
a36699d7df
4 changed files with 65 additions and 21 deletions
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2022 Tobias Kaminsky
|
||||
* Copyright (C) 2022 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class ReceiveExternalFilesActivityIT : AbstractIT() {
|
||||
@get:Rule
|
||||
val activityRule = IntentsTestRule(ReceiveExternalFilesActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut: Activity = activityRule.launchActivity(null)
|
||||
screenshot(sut)
|
||||
}
|
||||
}
|
|
@ -54,8 +54,6 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -63,11 +61,11 @@ import android.widget.Toast;
|
|||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.ReceiveExternalFilesBinding;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.files.services.FileUploader;
|
||||
import com.owncloud.android.files.services.NameCollisionPolicy;
|
||||
|
@ -121,6 +119,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||
import androidx.appcompat.app.AlertDialog.Builder;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
@ -165,11 +164,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
|
||||
private final static Charset FILENAME_ENCODING = Charset.forName("UTF-8");
|
||||
|
||||
private LinearLayout mEmptyListContainer;
|
||||
private NestedScrollView mEmptyListContainer;
|
||||
private TextView mEmptyListMessage;
|
||||
private TextView mEmptyListHeadline;
|
||||
private ImageView mEmptyListIcon;
|
||||
private MaterialButton sortButton;
|
||||
private ReceiveExternalFilesBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -187,10 +187,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ReceiveExternalFilesBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// Listen for sync messages
|
||||
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.
|
||||
EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
|
||||
EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
|
||||
syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
|
||||
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
|
||||
localBroadcastManager.registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
|
||||
|
@ -716,16 +718,13 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
private void populateDirectoryList() {
|
||||
setContentView(R.layout.receive_external_files);
|
||||
setupEmptyList();
|
||||
setupToolbar();
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
setupActionBarSubtitle();
|
||||
|
||||
ListView mListView = findViewById(android.R.id.list);
|
||||
|
||||
findViewById(R.id.sort_list_button_group).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.switch_grid_view_button).setVisibility(View.GONE);
|
||||
binding.toolbarLayout.sortListButtonGroup.setVisibility(View.VISIBLE);
|
||||
binding.toolbarLayout.switchGridViewButton.setVisibility(View.GONE);
|
||||
|
||||
String current_dir = mParents.peek();
|
||||
boolean notRoot = mParents.size() > 1;
|
||||
|
@ -774,9 +773,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
themeColorUtils,
|
||||
themeDrawableUtils);
|
||||
|
||||
mListView.setAdapter(sa);
|
||||
binding.list.setAdapter(sa);
|
||||
}
|
||||
MaterialButton btnChooseFolder = findViewById(R.id.uploader_choose_folder);
|
||||
MaterialButton btnChooseFolder = binding.uploaderChooseFolder;
|
||||
themeButtonUtils.colorPrimaryButton(btnChooseFolder, this, themeColorUtils);
|
||||
btnChooseFolder.setOnClickListener(this);
|
||||
|
||||
|
@ -792,13 +791,13 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
|
||||
themeToolbarUtils.tintBackButton(actionBar, this);
|
||||
|
||||
Button btnNewFolder = findViewById(R.id.uploader_cancel);
|
||||
Button btnNewFolder = binding.uploaderCancel;
|
||||
btnNewFolder.setTextColor(themeColorUtils.primaryColor(this, true));
|
||||
btnNewFolder.setOnClickListener(this);
|
||||
|
||||
mListView.setOnItemClickListener(this);
|
||||
binding.list.setOnItemClickListener(this);
|
||||
|
||||
sortButton = findViewById(R.id.sort_button);
|
||||
sortButton = binding.toolbarLayout.sortButton;
|
||||
FileSortOrder sortOrder = preferences.getSortOrderByFolder(mFile);
|
||||
sortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder));
|
||||
sortButton.setOnClickListener(l -> openSortingOrderDialogFragment(getSupportFragmentManager(), sortOrder));
|
||||
|
@ -806,10 +805,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
protected void setupEmptyList() {
|
||||
mEmptyListContainer = findViewById(R.id.empty_list_view);
|
||||
mEmptyListMessage = findViewById(R.id.empty_list_view_text);
|
||||
mEmptyListHeadline = findViewById(R.id.empty_list_view_headline);
|
||||
mEmptyListIcon = findViewById(R.id.empty_list_icon);
|
||||
mEmptyListContainer = binding.emptyView.emptyListView;
|
||||
mEmptyListMessage = binding.emptyView.emptyListViewText;
|
||||
mEmptyListHeadline = binding.emptyView.emptyListViewHeadline;
|
||||
mEmptyListIcon = binding.emptyView.emptyListIcon;
|
||||
}
|
||||
|
||||
public void setMessageForEmptyList(@StringRes final int headline, @StringRes final int message,
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar_standard" />
|
||||
<include
|
||||
android:id="@+id/toolbar_layout"
|
||||
layout="@layout/toolbar_standard" />
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/list_fragment_layout"
|
||||
|
@ -42,7 +44,9 @@
|
|||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<include layout="@layout/empty_list" />
|
||||
<include
|
||||
android:id="@+id/empty_view"
|
||||
layout="@layout/empty_list" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue