Skip to content

Commit

Permalink
Merge pull request #516 from luk1337/patch-67
Browse files Browse the repository at this point in the history
Add long press to copy URL in media stats fragment
  • Loading branch information
wax911 authored Dec 12, 2022
2 parents e0ef89f + 92af1ef commit 9b1663c
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package com.mxt.anitrend.view.fragment.detail;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -36,6 +41,7 @@
import com.mxt.anitrend.util.ChartUtil;
import com.mxt.anitrend.util.CompatUtil;
import com.mxt.anitrend.util.KeyUtil;
import com.mxt.anitrend.util.NotifyUtil;
import com.mxt.anitrend.util.graphql.GraphUtil;
import com.mxt.anitrend.util.media.MediaBrowseUtil;
import com.mxt.anitrend.util.media.MediaUtil;
Expand All @@ -55,6 +61,7 @@ public class MediaStatsFragment extends FragmentBase<Media, MediaPresenter, Medi

private FragmentSeriesStatsBinding binding;
private Media model;
private ClipboardManager clipboardManager;

private RankAdapter rankAdapter;
private LinkAdapter linkAdapter;
Expand All @@ -75,6 +82,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
mediaId = getArguments().getLong(KeyUtil.arg_id);
mediaType = getArguments().getString(KeyUtil.arg_mediaType);
}
clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
isMenuDisabled = true; mColumnSize = R.integer.grid_list_x2;
setPresenter(new MediaPresenter(getContext()));
setViewModel(true);
Expand Down Expand Up @@ -165,7 +173,11 @@ public void onItemClick(View target, IntPair<ExternalLink> data) {

@Override
public void onItemLongClick(View target, IntPair<ExternalLink> data) {

clipboardManager.setPrimaryClip(ClipData.newPlainText("", data.getSecond().getUrl()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
// Android 13 shows a clipboard editor overlay, thus we don't need a toast msg for it.
NotifyUtil.INSTANCE.makeText(getContext(), R.string.text_url_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@

<string name="text_confirm_exit">اضغط على زر العودة مرة اخرى للخروج من التطبيق</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">جارٍ تطبيق التعديلات..</string>

<string name="text_filter_restriction">لايمكن استخدام الفلاتر في هذه الصفحة</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ Another message using a bit of html the p tags represent new paragraphs -->
<string name="text_permission_write">"AniTrend benötigt die Erlaubnis, Dateien in das Downloadverzeichnis zu speichern. Fortfahren?"</string>
<string name="init_youtube_missing">"Um sich Trailer anzuschauen, benötigst du die YouTube App!"</string>
<string name="text_confirm_exit">"Tippe erneut, um die App zu beenden"</string>
<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>
<string name="text_filter_applying">"Änderungen anwenden.."</string>
<string name="text_filter_restriction">"Filter sind auf dieser Seite nicht verfügbar"</string>
<string name="text_quality_changed">"Qualität der Liste wurde verändert!"</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ elementos de tus favoritos al presionar en el icono del corazón .

<string name="text_confirm_exit">Presiona nuevamente para salir de la app</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Aplicando cambios...</string>

<string name="text_filter_restriction">Los filtros no pueden ser aplicados en esta página</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@

<string name="text_confirm_exit">Appuyez à nouveau sur "Retour" pour quitter l\'application</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Application des Modifications…</string>

<string name="text_filter_restriction">Les Filtres ne sont pas applicables sur cette page !</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@

<string name="text_confirm_exit">Premi ancora indietro per uscire dall\' app</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Applico i filtri</string>

<string name="text_filter_restriction">I filtri non sono applicabili in questa pagina</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@

<string name="text_confirm_exit">Druk nogmaals terug om terug te gaan</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Veranderingen Doorvoeren..</string>

<string name="text_filter_restriction">Filters niet van toepassing op deze pagina</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@

<string name="text_confirm_exit">Naciśnij ponownie, aby zamknąć aplikację</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Stosowanie zmian…</string>

<string name="text_filter_restriction">Filtry nie mają zastosowania na tej stronie</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@

<string name="text_confirm_exit">Pressione voltar novamente para sair do aplicativo</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Aplicando Alterações..</string>

<string name="text_filter_restriction">Filtros não aplicáveis nesta página</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@

<string name="text_confirm_exit">Tryck tillbaka igen för att lämna appen</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Använda ändringar...</string>

<string name="text_filter_restriction">Filter som inte är tillämpliga på den här sidan</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@

<string name="text_confirm_exit">Press back again to exit the app</string>

<string name="text_url_copied_to_clipboard">Copied URL to clipboard</string>

<string name="text_filter_applying">Applying Changes..</string>

<string name="text_filter_restriction">Filters not applicable on this page</string>
Expand Down

0 comments on commit 9b1663c

Please sign in to comment.