Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Feb 22, 2022
2 parents ac02117 + 8f6e8f4 commit aaa6504
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 51 deletions.
2 changes: 1 addition & 1 deletion scripts/analysis/findbugs-results.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
641
642
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
import com.owncloud.android.ui.preview.PreviewImageActivity;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.ui.preview.pdf.PreviewPdfFragment;
import com.owncloud.android.ui.preview.PreviewTextFileFragment;
import com.owncloud.android.ui.preview.PreviewTextFragment;
import com.owncloud.android.ui.preview.PreviewTextStringFragment;
import com.owncloud.android.ui.preview.PreviewVideoActivity;
import com.owncloud.android.ui.preview.pdf.PreviewPdfFragment;
import com.owncloud.android.utils.DataHolderUtil;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
Expand Down Expand Up @@ -1646,6 +1646,9 @@ public void showDetails(OCFile file) {
*/
public void showDetails(OCFile file, int activeTab) {
User currentUser = getUser().orElseThrow(RuntimeException::new);

resetHeaderScrollingState();

Fragment detailFragment = FileDetailFragment.newInstance(file, currentUser, activeTab);
setLeftFragment(detailFragment);

Expand All @@ -1654,6 +1657,8 @@ public void showDetails(OCFile file, int activeTab) {
}

private void resetHeaderScrollingState() {
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) findViewById(R.id.root_layout).getLayoutParams();
params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
AppBarLayout appBarLayout = findViewById(R.id.appbar);

if (appBarLayout != null) {
Expand Down Expand Up @@ -2225,9 +2230,7 @@ public void startMediaPreview(OCFile file,
showSortListGroup(false);
Fragment mediaFragment = PreviewMediaFragment.newInstance(file, user.get(), startPlaybackPosition, autoplay);
setLeftFragment(mediaFragment);
binding.rightFragmentContainer.setVisibility(View.GONE);
((CoordinatorLayout.LayoutParams) binding.rootLayout.getLayoutParams()).setBehavior(null);
super.updateActionBarTitleAndHomeButton(file);
configureToolbarForMediaPreview(file);
} else {
Intent previewIntent = new Intent();
previewIntent.putExtra(EXTRA_FILE, file);
Expand All @@ -2240,6 +2243,13 @@ public void startMediaPreview(OCFile file,
}
}

public void configureToolbarForMediaPreview(OCFile file) {
showSortListGroup(false);
binding.rightFragmentContainer.setVisibility(View.GONE);
((CoordinatorLayout.LayoutParams) binding.rootLayout.getLayoutParams()).setBehavior(null);
super.updateActionBarTitleAndHomeButton(file);
}

/**
* Starts the preview of a text file {@link OCFile}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,63 +106,42 @@ public void put(String key, Bitmap data) {

public Bitmap getScaledBitmap(String key, int width, int height) {
Bitmap bitmap = null;
DiskLruCache.Snapshot snapshot = null;
InputStream inputStream = null;
BufferedInputStream buffIn = null;
String validKey = convertToValidKey(key);

try {
snapshot = mDiskCache.get(validKey);
try (DiskLruCache.Snapshot snapshot = mDiskCache.get(validKey)) {
if (snapshot == null) {
return null;
}
inputStream = snapshot.getInputStream(0);
if (inputStream != null) {
buffIn = new BufferedInputStream(inputStream, IO_BUFFER_SIZE);

InputStream inputStream = snapshot.getInputStream(0);
if (inputStream != null) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = true;
options.inPurgeable = true;
options.inPreferQualityOverSpeed = false;
options.inMutable = false;
options.inJustDecodeBounds = true;

BitmapFactory.decodeStream(buffIn, null, options);
try (BufferedInputStream buffIn = new BufferedInputStream(inputStream, IO_BUFFER_SIZE)) {
options.inScaled = true;
options.inPurgeable = true;
options.inPreferQualityOverSpeed = false;
options.inMutable = false;
options.inJustDecodeBounds = true;

BitmapFactory.decodeStream(buffIn, null, options);
}

snapshot = mDiskCache.get(validKey);
inputStream = snapshot.getInputStream(0);
buffIn = new BufferedInputStream(inputStream, IO_BUFFER_SIZE);
try (DiskLruCache.Snapshot snapshot2 = mDiskCache.get(validKey)) {
inputStream = snapshot2.getInputStream(0);

// Calculate inSampleSize
options.inSampleSize = BitmapUtils.calculateSampleFactor(options, width, height);
try (BufferedInputStream buffIn = new BufferedInputStream(inputStream, IO_BUFFER_SIZE)) {
// Calculate inSampleSize
options.inSampleSize = BitmapUtils.calculateSampleFactor(options, width, height);

// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
bitmap = BitmapFactory.decodeStream(buffIn, null, options);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
bitmap = BitmapFactory.decodeStream(buffIn, null, options);
}
}
}
} catch (Exception e) {
Log_OC.e(TAG, e.getMessage(), e);
} finally {
if (snapshot != null) {
snapshot.close();
}

if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
// nothing to do
}
}

if (buffIn != null) {
try {
buffIn.close();
} catch (IOException e) {
// nothing to do
}
}
}

if (BuildConfig.DEBUG) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.DrawerActivity;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.ToolbarActivity;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
Expand Down Expand Up @@ -180,7 +182,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,

emptyListView = binding.emptyView.emptyListView;

getActivity().findViewById(R.id.sort_list_button_group).setVisibility(View.GONE);
if(getActivity() instanceof FileDisplayActivity){
((FileDisplayActivity) getActivity()).configureToolbarForMediaPreview(getFile());
}

setLoadingView();
return view;
Expand Down
2 changes: 2 additions & 0 deletions src/main/res/values-cs-rCZ/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
<string name="error_retrieving_file">Chyba při získávání souboru</string>
<string name="error_retrieving_templates">Chyba při získávání šablon</string>
<string name="error_starting_direct_camera_upload">Chyba při spouštění kamery</string>
<string name="error_starting_scan_doc">Chyb při použití skenování dokumentů</string>
<string name="etm_accounts">Účty</string>
<string name="etm_background_job_name">Název úlohy</string>
<string name="etm_background_job_progress">Průběh</string>
Expand Down Expand Up @@ -813,6 +814,7 @@ Jak vývojová tak produkční verze je k dispozici na F-droid a mohou být nain
<string name="upload_lock_failed">Uzamčení složky se nezdařilo</string>
<string name="upload_old_android">Šifrování je možné pouze pro systém Android verze 5.0 a novější</string>
<string name="upload_query_move_foreign_files">Pro zkopírování vybraných souborů do složky %1$s není dostatek volného místa. Chcete je tam namísto toho přesunout?</string>
<string name="upload_scan_doc_upload">Naskenovat dokument kamerou</string>
<string name="upload_sync_conflict">Konflikt synchronizace, vyřešte ručně</string>
<string name="upload_unknown_error">Neznámá chyba</string>
<string name="uploader_btn_alternative_text">Vybrat</string>
Expand Down
6 changes: 6 additions & 0 deletions src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@
<string name="error_crash_title">%1$s krakket</string>
<string name="error_creating_file_from_template">Fejl ved oprettelse af fil fra skabelon</string>
<string name="error_report_issue_action">Rapporter</string>
<string name="error_report_issue_text">Rapportere problem til tracker? (kræver en GitHub-konto)</string>
<string name="error_retrieving_file">Fejl ved modtagelse af fil</string>
<string name="error_retrieving_templates">Fejl ved indlæsning af modeller</string>
<string name="error_starting_direct_camera_upload">Fejl ved start af kamera</string>
<string name="error_starting_scan_doc">Fejl ved brug af dokumentscanning</string>
<string name="etm_accounts">Konti</string>
<string name="etm_background_job_name">Job navn</string>
<string name="etm_background_job_progress">Progress</string>
Expand Down Expand Up @@ -460,6 +462,7 @@
<string name="no_email_app_available">Ingen app tilgængelig til at håndtere mailadresser</string>
<string name="no_mutliple_accounts_allowed">kun en konto tilladt</string>
<string name="no_pdf_app_available">Ingen App tilgængelig til håndtering af PDF</string>
<string name="no_send_app">Der er ingen tilgængelig app til at sende de valgte filer</string>
<string name="no_share_permission_selected">Vælg mindst én tilladelse til at dele.</string>
<string name="note_confirm">Send</string>
<string name="note_could_not_sent">Kunne ikke sende note</string>
Expand Down Expand Up @@ -495,6 +498,7 @@
<string name="pass_code_removed">Passcode slettet</string>
<string name="pass_code_stored">Passcode blev gendannet</string>
<string name="pass_code_wrong">Ukorrekt passcode</string>
<string name="pdf_zoom_tip">Tryk på en side for at zoome ind</string>
<string name="permission_allow">Tillad</string>
<string name="permission_deny">Afvis</string>
<string name="permission_storage_access">Yderligere tilladelser nødvendige for at hente og sende filer.</string>
Expand Down Expand Up @@ -550,6 +554,7 @@ Enheds legitimationsoplysninger er sat op
<string name="prefs_lock_using_device_credentials">Enheds legitimationsoplysninger</string>
<string name="prefs_lock_using_passcode">Adgangskode</string>
<string name="prefs_manage_accounts">Administrer konti</string>
<string name="prefs_recommend">Foreslå til en ven</string>
<string name="prefs_show_hidden_files">Vis skjulte filer</string>
<string name="prefs_sourcecode">Hent kildetekst</string>
<string name="prefs_storage_path">Lagringsmappe for data</string>
Expand Down Expand Up @@ -790,6 +795,7 @@ Enheds legitimationsoplysninger er sat op
<string name="upload_lock_failed">Lås på mappe fejlede</string>
<string name="upload_old_android">Kryptering kun mulig med &gt;= Android 5.0</string>
<string name="upload_query_move_foreign_files">Utilstrækkelig plads til, at kopiere de valgte filer ind i %1$s mappen. Vil du flytte dem i stedet?</string>
<string name="upload_scan_doc_upload">Scan dokument fra kamera</string>
<string name="upload_sync_conflict">Synkroniserings konflikt, udred venligst manuelt</string>
<string name="upload_unknown_error">Ukendt fejl</string>
<string name="uploader_btn_alternative_text">Vælg</string>
Expand Down
2 changes: 2 additions & 0 deletions src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
<string name="error_retrieving_file">Fehler beim Abruf der Datei</string>
<string name="error_retrieving_templates">Fehler beim Laden der Vorlagen</string>
<string name="error_starting_direct_camera_upload">Fehler beim Starten der Kamera</string>
<string name="error_starting_scan_doc">Fehler beim Scannen von Dokumenten</string>
<string name="etm_accounts">Konten</string>
<string name="etm_background_job_name">Aufgabenname</string>
<string name="etm_background_job_progress">Fortschritt</string>
Expand Down Expand Up @@ -793,6 +794,7 @@
<string name="upload_lock_failed">Fehler beim Sperren des Ordners</string>
<string name="upload_old_android">Verschlüsselung ist nur möglich mit &gt;= Android 5.0</string>
<string name="upload_query_move_foreign_files">Es steht nicht genügend Speicherplatz zur Verfügung, um die ausgewählten Dateien in das Verzeichnis %1$s zu kopieren. Sollen diese stattdessen verschoben werden?</string>
<string name="upload_scan_doc_upload">Dokument von der Kamera scannen</string>
<string name="upload_sync_conflict">Synchronisierungskonflikt, bitte manuell beheben</string>
<string name="upload_unknown_error">Unbekannter Fehler</string>
<string name="uploader_btn_alternative_text">Auswählen</string>
Expand Down
2 changes: 2 additions & 0 deletions src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
<string name="error_comment_file">Σφάλμα σχολιασμού αρχείου</string>
<string name="error_crash_title">%1$sκαταστράφηκε</string>
<string name="error_report_issue_action">Αναφορά</string>
<string name="error_report_issue_text">Αναφορά προβλήματος στο tracker; (απαιτείται λογαριασμός GitHub)</string>
<string name="error_retrieving_file">Σφάλμα ανάκτησης αρχείου</string>
<string name="error_retrieving_templates">Σφάλμα λήψης προτύπων</string>
<string name="error_starting_direct_camera_upload">Σφάλμα κατά την εκκίνηση της κάμερας</string>
Expand Down Expand Up @@ -513,6 +514,7 @@
<string name="prefs_lock_using_device_credentials">Διαπιστευτήρια συσκευής</string>
<string name="prefs_lock_using_passcode">Κωδικός πρόσβασης</string>
<string name="prefs_manage_accounts">Διαχείριση λογαριασμών</string>
<string name="prefs_recommend">Σύστησε σε ένα φίλο</string>
<string name="prefs_show_hidden_files">Εμφάνιση κρυφών αρχείων</string>
<string name="prefs_sourcecode">Λήψη πηγαίου κώδικα</string>
<string name="prefs_storage_path">Φάκελος αποθήκευσης δεδομένων</string>
Expand Down
6 changes: 5 additions & 1 deletion src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@
<string name="error_crash_title">%1$s se bloqueó</string>
<string name="error_creating_file_from_template">Error al crear el archivo desde la plantilla</string>
<string name="error_report_issue_action">Informe</string>
<string name="error_report_issue_text">¿Informar del problema al tracker? (requiere una cuenta de GitHub)</string>
<string name="error_retrieving_file">Error al recuperar el archivo</string>
<string name="error_retrieving_templates">Error al recuperar plantillas</string>
<string name="error_starting_direct_camera_upload">Error al iniciar la cámara</string>
<string name="error_starting_scan_doc">Error al usar el escaner de documentos</string>
<string name="etm_accounts">Cuentas</string>
<string name="etm_background_job_name">Nombre del trabajo</string>
<string name="etm_background_job_progress">Progreso</string>
Expand Down Expand Up @@ -460,7 +462,7 @@
<string name="no_email_app_available">No hay ninguna app disponible para manejar direciones de correo electrónico</string>
<string name="no_mutliple_accounts_allowed">Sólo se permite una cuenta</string>
<string name="no_pdf_app_available">No hay apps disponibles para manejar PDF</string>
<string name="no_send_app">No hay disponible aplicación para el envío</string>
<string name="no_send_app">No hay una app disponible para el envío de los archivos seleccionados</string>
<string name="no_share_permission_selected">Por favor, selecciona al menos un permiso para compartir.</string>
<string name="note_confirm">Enviar</string>
<string name="note_could_not_sent">No se puede enviar la nota</string>
Expand Down Expand Up @@ -496,6 +498,7 @@
<string name="pass_code_removed">Código de acceso borrado</string>
<string name="pass_code_stored">Código de acceso almacenado</string>
<string name="pass_code_wrong">Código de acceso incorrecto</string>
<string name="pdf_zoom_tip">Toca sobre una página para hacer zoom</string>
<string name="permission_allow">Permitir</string>
<string name="permission_deny">Denegar</string>
<string name="permission_storage_access">Se necesitan permisos adicionales para subir y descargar archivos.</string>
Expand Down Expand Up @@ -790,6 +793,7 @@
<string name="upload_lock_failed">Fallo al bloquear la carpeta</string>
<string name="upload_old_android">El cifrado solo es posible con &gt;= Android 5.0</string>
<string name="upload_query_move_foreign_files">No hay suficiente espacio para copiar los archivos seleccionados en la carpeta %1$s. En su lugar, ¿le gustaría moverlos?</string>
<string name="upload_scan_doc_upload">Escanear un documento desde la cámara</string>
<string name="upload_sync_conflict">Conflicto al sincronizar. Por favor, resuélvelo manualmente</string>
<string name="upload_unknown_error">Error desconocido</string>
<string name="uploader_btn_alternative_text">Selecciona</string>
Expand Down
4 changes: 4 additions & 0 deletions src/main/res/values-eu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
<string name="error_retrieving_file">Errorea fitxategia berreskuratzean</string>
<string name="error_retrieving_templates">Errorea txantiloiak berreskuratzean</string>
<string name="error_starting_direct_camera_upload">Errorea kamera abiaraztean</string>
<string name="error_starting_scan_doc">Errorea dokumentu eskaneatzailea erabiltzerakoan</string>
<string name="etm_accounts">Kontuak</string>
<string name="etm_background_job_name">Lanaren izena</string>
<string name="etm_background_job_progress">Aurrerapena</string>
Expand Down Expand Up @@ -461,6 +462,7 @@
<string name="no_email_app_available">Ez dago aplikaziorik helbide elektronikoak kudeatzeko</string>
<string name="no_mutliple_accounts_allowed">Kontu bat onartzen da soilik</string>
<string name="no_pdf_app_available">Ez dago eskuragarri PDFak kudeatzeko aplikaziorik</string>
<string name="no_send_app">Hautatutako fitxategiak bidaltzeko app-ik ez dago eskuragarri</string>
<string name="no_share_permission_selected">Mesedez hautatu partekatzeko baimen bat gutxienez.</string>
<string name="note_confirm">Bidali</string>
<string name="note_could_not_sent">Ezin izan da bidali oharra</string>
Expand Down Expand Up @@ -496,6 +498,7 @@
<string name="pass_code_removed">Pasahitza ezabatuta</string>
<string name="pass_code_stored">Pasahitza gordeta</string>
<string name="pass_code_wrong">Okerreko pasahitza</string>
<string name="pdf_zoom_tip">Ukitu orrialdean handitzeko</string>
<string name="permission_allow">Baimendu</string>
<string name="permission_deny">Ukatu</string>
<string name="permission_storage_access">Fitxategiak kargatu eta deskargatzeko baimen gehigarriak behar dira</string>
Expand Down Expand Up @@ -790,6 +793,7 @@
<string name="upload_lock_failed">Karpeta blokeatzeak huts egin du</string>
<string name="upload_old_android">Zifratzea &gt;= Android 5.0 bertsioarekin soilik da posible</string>
<string name="upload_query_move_foreign_files">Hautatutako fitxategiak ezin dira %1$sra kopiatu ez dagoelako toki nahikorik. Kopiatu ordez bertara mugitu nahi dituzu?</string>
<string name="upload_scan_doc_upload">Eskaneatu dokumentua kamararekin</string>
<string name="upload_sync_conflict">Sinkronizazio gatazka, ebatzi eskuz</string>
<string name="upload_unknown_error">Akats ezezaguna</string>
<string name="uploader_btn_alternative_text">Aukeratu</string>
Expand Down
Loading

0 comments on commit aaa6504

Please sign in to comment.