Skip to content
Merged
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 @@ -10,7 +10,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.snackbar.Snackbar
import com.owncloud.android.R
Expand Down Expand Up @@ -49,10 +48,9 @@ class ShowErrorActivity : AppCompatActivity() {
private fun createErrorTitle() = String.format(getString(R.string.error_crash_title), getString(R.string.app_name))

private fun reportIssue() {
ClipboardUtil.copyToClipboard(this, binding.textViewError.text.toString(), false)
ClipboardUtil.copyToClipboard(this, binding.textViewError.text.toString(), true)
val issueLink = getString(R.string.report_issue_link)
DisplayUtils.startLinkIntent(this, issueLink)
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_LONG).show()
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,6 @@ default void onDarkThemeModeChanged(DarkMode mode) {

void setGlobalUploadPaused(boolean globalPausedState);

void setPdfZoomTipShownCount(int count);

int getPdfZoomTipShownCount();

boolean isStoragePermissionRequested();

void setStoragePermissionRequested(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public final class AppPreferencesImpl implements AppPreferences {

private static final String PREF__GLOBAL_PAUSE_STATE = "global_pause_state";

private static final String PREF__PDF_ZOOM_TIP_SHOWN = "pdf_zoom_tip_shown";
private static final String PREF__MEDIA_FOLDER_LAST_PATH = "media_folder_last_path";
private static final String PREF__STORAGE_PERMISSION_REQUESTED = "storage_permission_requested";
private static final String PREF__IN_APP_REVIEW_DATA = "in_app_review_data";
Expand Down Expand Up @@ -755,16 +754,6 @@ public void setGlobalUploadPaused(boolean globalPausedState) {
preferences.edit().putBoolean(PREF__GLOBAL_PAUSE_STATE, globalPausedState).apply();
}

@Override
public void setPdfZoomTipShownCount(int count) {
preferences.edit().putInt(PREF__PDF_ZOOM_TIP_SHOWN, count).apply();
}

@Override
public int getPdfZoomTipShownCount() {
return preferences.getInt(PREF__PDF_ZOOM_TIP_SHOWN, 0);
}

@Override
public boolean isStoragePermissionRequested() {
return preferences.getBoolean(PREF__STORAGE_PERMISSION_REQUESTED, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ protected void onPostExecute(Boolean result) {

if (result) {
// nothing else to do in this activity
DisplayUtils.showSnackMessage(findViewById(android.R.id.content), R.string.foreign_files_success);
finish();
} else {
DisplayUtils.showSnackMessage(findViewById(android.R.id.content), R.string.foreign_files_fail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ class FileDisplayActivity :

intent?.let {
handleCommonIntents(it)
handleAccountSwitchIntent(it)
}

loadSavedInstanceState(savedInstanceState)
Expand Down Expand Up @@ -598,17 +597,6 @@ class FileDisplayActivity :
startActivity(intent)
}

private fun handleAccountSwitchIntent(intent: Intent) {
if (intent.action != RESTART) {
return
}

val accountName = accountManager.user.accountName
val message = getString(R.string.logged_in_as)
val snackBarMessage = String.format(message, accountName)
DisplayUtils.showSnackMessage(this, snackBarMessage)
}

private fun handleSearchIntent(intent: Intent) {
val searchEvent = intent.getParcelableArgument(
OCFileListFragment.SEARCH_EVENT,
Expand Down Expand Up @@ -2100,13 +2088,6 @@ class FileDisplayActivity :
private fun onRemoveFileOperationFinish(operation: RemoveFileOperation, result: RemoteOperationResult<*>) {
deleteBatchTracker.onSingleDeleteFinished()

if (!operation.isInBackground) {
DisplayUtils.showSnackMessage(
this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources())
)
}

if (result.isSuccess) {
val removedFile = operation.file
tryStopPlaying(removedFile)
Expand Down Expand Up @@ -2165,8 +2146,6 @@ class FileDisplayActivity :
if (leftFragment is FileDetailFragment) {
leftFragment.getFileDetailActivitiesFragment().reload()
}

DisplayUtils.showSnackMessage(this, R.string.file_version_restored_successfully)
} else {
DisplayUtils.showSnackMessage(this, R.string.file_version_restored_error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,15 +1043,6 @@ public void exportFiles(Collection<OCFile> files,
Context context,
View view,
BackgroundJobManager backgroundJobManager) {
if (context != null && view != null) {
DisplayUtils.showSnackMessage(view,
context.getResources().getQuantityString(
R.plurals.export_start,
files.size(),
files.size()
));
}

backgroundJobManager.startImmediateFilesExportJob(files);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,10 @@ class PreviewMediaActivity :
override fun onRemoteOperationFinish(operation: RemoteOperation<*>?, result: RemoteOperationResult<*>?) {
super.onRemoteOperationFinish(operation, result)
if (operation is RemoveFileOperation) {
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(result, operation, resources)
DisplayUtils.showSnackMessage(this, errorMessage)
if (result?.isSuccess == false) {
val errorMessage = ErrorMessageAdapter.getErrorCauseMessage(result, operation, resources)
DisplayUtils.showSnackMessage(this, errorMessage)
}

val removedFile = operation.file
val fileAvailable: Boolean = storageManager.fileExists(removedFile.fileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ class PreviewPdfFragment :
requireContext().startActivity(intent)
}
}
viewModel.showZoomTip.observe(viewLifecycleOwner) { shouldShow ->
if (shouldShow) {
snack = DisplayUtils.showSnackMessage(binding.root, R.string.pdf_zoom_tip)
viewModel.onZoomTipShown()
}
}
}

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import javax.inject.Inject

class PreviewPdfViewModel @Inject constructor(val appPreferences: AppPreferences) : ViewModel() {

companion object {
private const val SHOW_ZOOM_TIP_TIMES = 3
}

private var _pdfRenderer = MutableLiveData<PdfRenderer>()
val pdfRenderer: LiveData<PdfRenderer>
get() = _pdfRenderer
Expand All @@ -35,10 +31,6 @@ class PreviewPdfViewModel @Inject constructor(val appPreferences: AppPreferences
val previewImagePath: LiveData<String>
get() = _previewImagePath

private var _showZoomTip = MutableLiveData<Boolean>()
val showZoomTip: LiveData<Boolean>
get() = _showZoomTip

override fun onCleared() {
super.onCleared()
closeRenderer()
Expand All @@ -59,9 +51,6 @@ class PreviewPdfViewModel @Inject constructor(val appPreferences: AppPreferences
closeRenderer()
_pdfRenderer.value =
PdfRenderer(ParcelFileDescriptor.open(File(file.storagePath), ParcelFileDescriptor.MODE_READ_ONLY))
if (appPreferences.pdfZoomTipShownCount < SHOW_ZOOM_TIP_TIMES) {
_showZoomTip.value = true
}
}

fun onClickPage(page: Bitmap) {
Expand All @@ -72,9 +61,4 @@ class PreviewPdfViewModel @Inject constructor(val appPreferences: AppPreferences

_previewImagePath.value = file.path
}

fun onZoomTipShown() {
appPreferences.pdfZoomTipShownCount++
_showZoomTip.value = false
}
}
7 changes: 3 additions & 4 deletions app/src/main/java/com/owncloud/android/utils/ClipboardUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import android.content.Context
import android.os.Build
import android.os.PersistableBundle
import android.text.TextUtils
import android.widget.Toast
import androidx.work.Data
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
Expand All @@ -38,7 +37,7 @@ object ClipboardUtil {
}

if (TextUtils.isEmpty(text)) {
Toast.makeText(activity, R.string.clipboard_no_text_to_copy, Toast.LENGTH_SHORT).show()
DisplayUtils.showSnackMessage(activity, R.string.clipboard_no_text_to_copy)
return
}

Expand All @@ -49,12 +48,12 @@ object ClipboardUtil {
clipboardManager.setPrimaryClip(clip)

if (showToast) {
Toast.makeText(activity, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show()
DisplayUtils.showSnackMessage(activity, R.string.copied)
}

scheduleClipboardClearWorker(activity, text)
} catch (e: Exception) {
Toast.makeText(activity, R.string.clipboard_unexpected_error, Toast.LENGTH_SHORT).show()
DisplayUtils.showSnackMessage(activity, R.string.clipboard_unexpected_error)
Log_OC.e(TAG, "Exception caught while copying to clipboard", e)
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@
<string name="activity_chooser_send_file_title">Send</string>

<string name="copy_link">Copy link</string>
<string name="copied">Copied</string>
<string name="clipboard_text_copied">Link copied</string>
<string name="clipboard_no_text_to_copy">Received no text to copy to clipboard</string>
<string name="clipboard_unexpected_error">Unexpected error while copying to clipboard</string>
Expand Down Expand Up @@ -1148,7 +1149,6 @@
<string name="error_report_issue_text">Report issue to tracker? (requires a GitHub account)</string>
<string name="error_report_issue_action">Report</string>
<string name="error_crash_title">%1$s crashed</string>
<string name="copied_to_clipboard">Copied to clipboard</string>
<string name="download_latest_dev_version">Download latest dev version</string>
<string name="changelog_dev_version">Changelog dev version</string>
<string name="could_not_download_image">Could not download full image</string>
Expand Down Expand Up @@ -1312,7 +1312,6 @@
<string name="file_list_empty_gallery">Found no images or videos</string>
<string name="error_creating_file_from_template">Error creating file from template</string>
<string name="no_send_app">No app available for sending the selected files</string>
<string name="pdf_zoom_tip">Tap on a page to zoom in</string>
<string name="storage_permission_all_files_access">All files access</string>
<string name="storage_permission_media_read_only">Media read-only</string>
<string name="storage_permission_dont_ask">Don\'t ask</string>
Expand Down
Loading