mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Merge pull request #11965 from nextcloud/unintended-UI-elements-showing
Unintended UI elements showing
This commit is contained in:
commit
9c12aec929
4 changed files with 270 additions and 404 deletions
File diff suppressed because it is too large
Load diff
|
@ -197,7 +197,6 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
/**
|
/**
|
||||||
* checks if the given file is the root folder.
|
* checks if the given file is the root folder.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param file file to be checked if it is the root folder
|
* @param file file to be checked if it is the root folder
|
||||||
* @return <code>true</code> if it is <code>null</code> or the root folder, else returns <code>false</code>
|
* @return <code>true</code> if it is <code>null</code> or the root folder, else returns <code>false</code>
|
||||||
*/
|
*/
|
||||||
|
@ -243,6 +242,9 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
findViewById(R.id.sort_list_button_group).setVisibility(show ? View.VISIBLE : View.GONE);
|
findViewById(R.id.sort_list_button_group).setVisibility(show ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean sortListGroupVisibility(){
|
||||||
|
return findViewById(R.id.sort_list_button_group).getVisibility() == View.VISIBLE;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Change the bitmap for the toolbar's preview image.
|
* Change the bitmap for the toolbar's preview image.
|
||||||
*
|
*
|
||||||
|
|
|
@ -144,12 +144,12 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public factory method to create new FileDetailFragment instances.
|
* Public factory method to create new FileDetailFragment instances.
|
||||||
*
|
* <p>
|
||||||
* When 'fileToDetail' or 'ocAccount' are null, creates a dummy layout (to use when a file wasn't tapped before).
|
* When 'fileToDetail' or 'ocAccount' are null, creates a dummy layout (to use when a file wasn't tapped before).
|
||||||
*
|
*
|
||||||
* @param fileToDetail An {@link OCFile} to show in the fragment
|
* @param fileToDetail An {@link OCFile} to show in the fragment
|
||||||
* @param user Currently active user
|
* @param user Currently active user
|
||||||
* @param activeTab to be active tab
|
* @param activeTab to be active tab
|
||||||
* @return New fragment with arguments set
|
* @return New fragment with arguments set
|
||||||
*/
|
*/
|
||||||
public static FileDetailFragment newInstance(OCFile fileToDetail, User user, int activeTab) {
|
public static FileDetailFragment newInstance(OCFile fileToDetail, User user, int activeTab) {
|
||||||
|
@ -224,7 +224,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
user = savedInstanceState.getParcelable(ARG_USER);
|
user = savedInstanceState.getParcelable(ARG_USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
binding = FileDetailsFragmentBinding.inflate(inflater,container,false);
|
binding = FileDetailsFragmentBinding.inflate(inflater, container, false);
|
||||||
view = binding.getRoot();
|
view = binding.getRoot();
|
||||||
|
|
||||||
if (getFile() == null || user == null) {
|
if (getFile() == null || user == null) {
|
||||||
|
@ -373,8 +373,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (toolbarActivity != null) {
|
if (toolbarActivity != null) {
|
||||||
toolbarActivity.showSortListGroup(false);
|
|
||||||
|
|
||||||
if (previewLoaded) {
|
if (previewLoaded) {
|
||||||
toolbarActivity.setPreviewImageVisibility(true);
|
toolbarActivity.setPreviewImageVisibility(true);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +475,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the fragment was created with an empty layout. An empty fragment can't show file details, must be replaced.
|
* Check if the fragment was created with an empty layout. An empty fragment can't show file details, must be
|
||||||
|
* replaced.
|
||||||
*
|
*
|
||||||
* @return True when the fragment was created with the empty layout.
|
* @return True when the fragment was created with the empty layout.
|
||||||
*/
|
*/
|
||||||
|
@ -498,11 +497,11 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the view with all relevant details about that file.
|
* Updates the view with all relevant details about that file.
|
||||||
*
|
* <p>
|
||||||
* TODO Remove parameter when the transferring state of files is kept in database.
|
* TODO Remove parameter when the transferring state of files is kept in database.
|
||||||
*
|
*
|
||||||
* @param transferring Flag signaling if the file should be considered as downloading or uploading,
|
* @param transferring Flag signaling if the file should be considered as downloading or uploading, although
|
||||||
* although {@link FileDownloaderBinder#isDownloading(User, OCFile)} and
|
* {@link FileDownloaderBinder#isDownloading(User, OCFile)} and
|
||||||
* {@link FileUploaderBinder#isUploading(User, OCFile)} return false.
|
* {@link FileUploaderBinder#isUploading(User, OCFile)} return false.
|
||||||
* @param refresh If 'true', try to refresh the whole file from the database
|
* @param refresh If 'true', try to refresh the whole file from the database
|
||||||
*/
|
*/
|
||||||
|
@ -537,8 +536,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder();
|
FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder();
|
||||||
FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder();
|
FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder();
|
||||||
if (transferring
|
if (transferring
|
||||||
|| (downloaderBinder != null && downloaderBinder.isDownloading(user, file))
|
|| (downloaderBinder != null && downloaderBinder.isDownloading(user, file))
|
||||||
|| (uploaderBinder != null && uploaderBinder.isUploading(user, file))) {
|
|| (uploaderBinder != null && uploaderBinder.isUploading(user, file))) {
|
||||||
setButtonsForTransferring();
|
setButtonsForTransferring();
|
||||||
|
|
||||||
} else if (file.isDown()) {
|
} else if (file.isDown()) {
|
||||||
|
@ -567,7 +566,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
binding.lastModificationTimestamp.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));
|
binding.lastModificationTimestamp.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));
|
||||||
} else {
|
} else {
|
||||||
binding.lastModificationTimestamp.setText(DisplayUtils.getRelativeTimestamp(getContext(),
|
binding.lastModificationTimestamp.setText(DisplayUtils.getRelativeTimestamp(getContext(),
|
||||||
file.getModificationTimestamp()));
|
file.getModificationTimestamp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,8 +575,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_star, null));
|
binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_star, null));
|
||||||
} else {
|
} else {
|
||||||
binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
|
binding.favorite.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
|
||||||
R.drawable.ic_star_outline,
|
R.drawable.ic_star_outline,
|
||||||
null));
|
null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +617,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
// generate new resized image
|
// generate new resized image
|
||||||
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(getFile(), toolbarActivity.getPreviewImageView()) &&
|
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(getFile(), toolbarActivity.getPreviewImageView()) &&
|
||||||
containerActivity.getStorageManager() != null) {
|
containerActivity.getStorageManager() != null) {
|
||||||
final ThumbnailsCacheManager.ResizedImageGenerationTask task =
|
final ThumbnailsCacheManager.ResizedImageGenerationTask task =
|
||||||
new ThumbnailsCacheManager.ResizedImageGenerationTask(this,
|
new ThumbnailsCacheManager.ResizedImageGenerationTask(this,
|
||||||
toolbarActivity.getPreviewImageView(),
|
toolbarActivity.getPreviewImageView(),
|
||||||
|
@ -635,11 +634,11 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
final ThumbnailsCacheManager.AsyncResizedImageDrawable asyncDrawable =
|
final ThumbnailsCacheManager.AsyncResizedImageDrawable asyncDrawable =
|
||||||
new ThumbnailsCacheManager.AsyncResizedImageDrawable(
|
new ThumbnailsCacheManager.AsyncResizedImageDrawable(
|
||||||
MainApp.getAppContext().getResources(),
|
MainApp.getAppContext().getResources(),
|
||||||
resizedImage,
|
resizedImage,
|
||||||
task
|
task
|
||||||
);
|
);
|
||||||
|
|
||||||
toolbarActivity.setPreviewImageDrawable(asyncDrawable);
|
toolbarActivity.setPreviewImageDrawable(asyncDrawable);
|
||||||
previewLoaded = true;
|
previewLoaded = true;
|
||||||
|
@ -664,8 +663,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
//if (getFile().isDownloading()) {
|
//if (getFile().isDownloading()) {
|
||||||
if (downloaderBinder != null && downloaderBinder.isDownloading(user, getFile())) {
|
if (downloaderBinder != null && downloaderBinder.isDownloading(user, getFile())) {
|
||||||
binding.progressText.setText(R.string.downloader_download_in_progress_ticker);
|
binding.progressText.setText(R.string.downloader_download_in_progress_ticker);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (uploaderBinder != null && uploaderBinder.isUploading(user, getFile())) {
|
if (uploaderBinder != null && uploaderBinder.isUploading(user, getFile())) {
|
||||||
binding.progressText.setText(R.string.uploader_upload_in_progress_ticker);
|
binding.progressText.setText(R.string.uploader_upload_in_progress_ticker);
|
||||||
}
|
}
|
||||||
|
@ -701,7 +699,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
}
|
}
|
||||||
if (containerActivity.getFileUploaderBinder() != null) {
|
if (containerActivity.getFileUploaderBinder() != null) {
|
||||||
containerActivity.getFileUploaderBinder().
|
containerActivity.getFileUploaderBinder().
|
||||||
addDatatransferProgressListener(progressListener, user, getFile());
|
addDatatransferProgressListener(progressListener, user, getFile());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log_OC.d(TAG, "progressListener == null");
|
Log_OC.d(TAG, "progressListener == null");
|
||||||
|
@ -716,7 +714,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
}
|
}
|
||||||
if (containerActivity.getFileUploaderBinder() != null) {
|
if (containerActivity.getFileUploaderBinder() != null) {
|
||||||
containerActivity.getFileUploaderBinder().
|
containerActivity.getFileUploaderBinder().
|
||||||
removeDatatransferProgressListener(progressListener, user, getFile());
|
removeDatatransferProgressListener(progressListener, user, getFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,6 +731,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open the sharing process fragment for creating new share
|
* open the sharing process fragment for creating new share
|
||||||
|
*
|
||||||
* @param shareeName
|
* @param shareeName
|
||||||
* @param shareType
|
* @param shareType
|
||||||
*/
|
*/
|
||||||
|
@ -749,6 +748,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method will handle the views need to be hidden when sharing process fragment shows
|
* method will handle the views need to be hidden when sharing process fragment shows
|
||||||
|
*
|
||||||
* @param isFragmentReplaced
|
* @param isFragmentReplaced
|
||||||
*/
|
*/
|
||||||
public void showHideFragmentView(boolean isFragmentReplaced) {
|
public void showHideFragmentView(boolean isFragmentReplaced) {
|
||||||
|
@ -765,6 +765,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open the new sharing screen process to modify the created share
|
* open the new sharing screen process to modify the created share
|
||||||
|
*
|
||||||
* @param share
|
* @param share
|
||||||
* @param screenTypePermission
|
* @param screenTypePermission
|
||||||
* @param isReshareShown
|
* @param isReshareShown
|
||||||
|
@ -816,7 +817,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
||||||
@Override
|
@Override
|
||||||
public void onTransferProgress(long progressRate, long totalTransferredSoFar,
|
public void onTransferProgress(long progressRate, long totalTransferredSoFar,
|
||||||
long totalToTransfer, String filename) {
|
long totalToTransfer, String filename) {
|
||||||
int percent = (int)(100.0*((double)totalTransferredSoFar)/((double)totalToTransfer));
|
int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer));
|
||||||
if (percent != lastPercent) {
|
if (percent != lastPercent) {
|
||||||
ProgressBar pb = progressBarReference.get();
|
ProgressBar pb = progressBarReference.get();
|
||||||
if (pb != null) {
|
if (pb != null) {
|
||||||
|
|
|
@ -73,7 +73,6 @@ import com.owncloud.android.lib.common.OwnCloudClient;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
import com.owncloud.android.ui.activity.DrawerActivity;
|
import com.owncloud.android.ui.activity.DrawerActivity;
|
||||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
|
||||||
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
|
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
|
||||||
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
|
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
|
||||||
import com.owncloud.android.ui.fragment.FileFragment;
|
import com.owncloud.android.ui.fragment.FileFragment;
|
||||||
|
@ -101,8 +100,8 @@ import kotlin.jvm.functions.Function0;
|
||||||
/**
|
/**
|
||||||
* This fragment shows a preview of a downloaded media file (audio or video).
|
* This fragment shows a preview of a downloaded media file (audio or video).
|
||||||
* <p>
|
* <p>
|
||||||
* Trying to get an instance with NULL {@link OCFile} or ownCloud {@link User} values will produce an {@link
|
* Trying to get an instance with NULL {@link OCFile} or ownCloud {@link User} values will produce an
|
||||||
* IllegalStateException}.
|
* {@link IllegalStateException}.
|
||||||
* <p>
|
* <p>
|
||||||
* By now, if the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on
|
* By now, if the {@link OCFile} passed is not downloaded, an {@link IllegalStateException} is generated on
|
||||||
* instantiation too.
|
* instantiation too.
|
||||||
|
@ -116,7 +115,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
||||||
public static final String EXTRA_USER = "USER";
|
public static final String EXTRA_USER = "USER";
|
||||||
public static final String EXTRA_AUTOPLAY = "AUTOPLAY";
|
public static final String EXTRA_AUTOPLAY = "AUTOPLAY";
|
||||||
public static final String EXTRA_START_POSITION = "START_POSITION";
|
public static final String EXTRA_START_POSITION = "START_POSITION";
|
||||||
|
|
||||||
private static final String EXTRA_PLAY_POSITION = "PLAY_POSITION";
|
private static final String EXTRA_PLAY_POSITION = "PLAY_POSITION";
|
||||||
private static final String EXTRA_PLAYING = "PLAYING";
|
private static final String EXTRA_PLAYING = "PLAYING";
|
||||||
private static final double MIN_DENSITY_RATIO = 24.0;
|
private static final double MIN_DENSITY_RATIO = 24.0;
|
||||||
|
@ -365,7 +364,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
||||||
Executors.newSingleThreadExecutor().execute(() -> {
|
Executors.newSingleThreadExecutor().execute(() -> {
|
||||||
try {
|
try {
|
||||||
nextcloudClient = clientFactory.createNextcloudClient(accountManager.getUser());
|
nextcloudClient = clientFactory.createNextcloudClient(accountManager.getUser());
|
||||||
handler.post(() ->{
|
handler.post(() -> {
|
||||||
exoPlayer = NextcloudExoPlayer.createNextcloudExoplayer(requireContext(), nextcloudClient);
|
exoPlayer = NextcloudExoPlayer.createNextcloudExoplayer(requireContext(), nextcloudClient);
|
||||||
|
|
||||||
exoPlayer.addListener(new ExoplayerListener(requireContext(), binding.exoplayerView, exoPlayer, () -> {
|
exoPlayer.addListener(new ExoplayerListener(requireContext(), binding.exoplayerView, exoPlayer, () -> {
|
||||||
|
@ -619,9 +618,6 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if(getActivity() instanceof FileDisplayActivity){
|
|
||||||
((FileDisplayActivity) getActivity()).configureToolbarForMediaPreview(getFile());
|
|
||||||
}
|
|
||||||
Log_OC.v(TAG, "onResume");
|
Log_OC.v(TAG, "onResume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue