Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-3.29] Nmc/1922 Files #238

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ object NextcloudExoPlayer {
.setMediaSourceFactory(mediaSourceFactory)
.setAudioAttributes(AudioAttributes.DEFAULT, true)
.setHandleAudioBecomingNoisy(true)
.setSeekForwardIncrementMs(FIVE_SECONDS_IN_MILLIS)
// NMC-3192 Fix
.setSeekBackIncrementMs(2 * FIVE_SECONDS_IN_MILLIS)
.setSeekForwardIncrementMs(2 * FIVE_SECONDS_IN_MILLIS)
.build()
}
}
21 changes: 21 additions & 0 deletions app/src/main/java/com/nmc/android/utils/KeyboardUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.nmc.android.utils;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class KeyboardUtils {

public static void showSoftKeyboard(Context context, View view) {
view.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}

public static void hideKeyboardFrom(Context context, View view) {
view.clearFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
public class MediaControlView extends LinearLayout implements OnClickListener, OnSeekBarChangeListener {
private static final String TAG = MediaControlView.class.getSimpleName();
private static final int SHOW_PROGRESS = 1;
// NMC-3192 Fix
private static final int FIVE_SECONDS_IN_MILLIS = 5000;

private MediaPlayerControl playerControl;
private final MediaControlBinding binding;
Expand Down Expand Up @@ -276,15 +278,17 @@ public void onClick(View v) {
doPauseResume();
} else if (id == R.id.rewindBtn) {
pos = playerControl.getCurrentPosition();
pos -= 5000;
// NMC-3192 Fix
pos -= 2 * FIVE_SECONDS_IN_MILLIS;
playerControl.seekTo(pos);
if (!playing) {
playerControl.pause(); // necessary in some 2.3.x devices
}
setProgress();
} else if (id == R.id.forwardBtn) {
pos = playerControl.getCurrentPosition();
pos += 15000;
// NMC-3192 Fix
pos += 2 * FIVE_SECONDS_IN_MILLIS;
playerControl.seekTo(pos);
if (!playing) {
playerControl.pause(); // necessary in some 2.3.x devices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.PushUtils;
import com.nmc.android.utils.KeyboardUtils;
import com.owncloud.android.utils.StringUtils;
import com.owncloud.android.utils.theme.CapabilityUtils;

Expand Down Expand Up @@ -1053,6 +1054,8 @@ private void resetSearchAction() {
private void popBack() {
binding.fabMain.setImageResource(R.drawable.ic_plus);
resetScrolling(true);
// hide the keyboard on back press if showing
KeyboardUtils.hideKeyboardFrom(this, binding.getRoot());
showSortListGroup(false);
super.onBackPressed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import java.util.Calendar;
import java.util.List;
import java.util.Stack;
import java.util.stream.Collectors;

import javax.inject.Inject;

Expand Down Expand Up @@ -733,6 +734,10 @@ private void populateDirectoryList() {
if (mFile != null) {
List<OCFile> files = getStorageManager().getFolderContent(mFile, false);

// NMC-2893 Task
// Filtering and showing only files which are folder
files = files.stream().filter(OCFile::isFolder).collect(Collectors.toList());

if (files.isEmpty()) {
setMessageForEmptyList(R.string.file_list_empty_headline, R.string.empty,
R.drawable.uploads);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.nextcloud.client.account.CurrentAccountProvider
import com.nextcloud.client.core.AsyncRunner
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.di.ViewModelFactory
import com.nmc.android.utils.KeyboardUtils
import com.nextcloud.client.network.ClientFactory
import com.owncloud.android.R
import com.owncloud.android.databinding.ListFragmentBinding
Expand Down Expand Up @@ -208,6 +209,8 @@ class UnifiedSearchFragment :
private fun showFile(file: OCFile, showFileActions: Boolean) {
activity.let {
if (activity is FileDisplayActivity) {
// NMC: hide keyboard when user taps on any file to view
KeyboardUtils.hideKeyboardFrom(requireContext(), binding.root)
val fda = activity as FileDisplayActivity
fda.file = file

Expand Down Expand Up @@ -267,6 +270,7 @@ class UnifiedSearchFragment :
}

override fun onQueryTextSubmit(query: String): Boolean {
KeyboardUtils.hideKeyboardFrom(requireContext(), binding.root)
vm.setQuery(query)
vm.initialQuery()
return true
Expand Down