From 52343b6ab2bacd5034059b52dadf3ed62ca2030e Mon Sep 17 00:00:00 2001 From: Zachary Epps Date: Wed, 12 Apr 2017 16:21:48 -0400 Subject: [PATCH 01/20] changed the share button menu to allow for sharing either the link, or the actual content of the post added values into @string file to accommodate for the change added the new share submenu into the status_more layout xml --- .../com/keylesspalace/tusky/SFragment.java | 21 +++++++++++++++---- app/src/main/res/menu/status_more.xml | 11 +++++++++- app/src/main/res/values/strings.xml | 5 ++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java index f18f07f0..45217324 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java @@ -182,8 +182,8 @@ public class SFragment extends BaseFragment { callList.add(call); } - protected void more(Status status, View view, final AdapterItemRemover adapter, - final int position) { + protected void more(final Status status, View view, final AdapterItemRemover adapter, + final int position) { final String id = status.getActionableId(); final String accountId = status.getActionableStatus().account.id; final String accountUsename = status.getActionableStatus().account.username; @@ -201,12 +201,25 @@ public class SFragment extends BaseFragment { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { - case R.id.status_share: { + case R.id.status_share_content: { + StringBuilder sb = new StringBuilder(); + sb.append(status.account.username); + sb.append(" - "); + sb.append(status.content.toString()); + + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, sb.toString()); + sendIntent.setType("text/plain"); + startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_content_to))); + return true; + } + case R.id.status_share_link: { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, statusUrl); sendIntent.setType("text/plain"); - startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_to))); + startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_status_link_to))); return true; } case R.id.status_block: { diff --git a/app/src/main/res/menu/status_more.xml b/app/src/main/res/menu/status_more.xml index 33617c9d..48159d7b 100644 --- a/app/src/main/res/menu/status_more.xml +++ b/app/src/main/res/menu/status_more.xml @@ -2,7 +2,16 @@ + android:title="@string/action_share"> + + + + + NSFW Options - Share toot URL to… + Share toot URL to… + Share toot to… Search accounts… @@ -137,5 +138,7 @@ %d new interactions Locked Account + Share content of toot + Share link to toot From a5c31b2477761bb744b591411621613c8afc9d67 Mon Sep 17 00:00:00 2001 From: "BOSCH, Cedric" Date: Thu, 13 Apr 2017 15:13:50 +0200 Subject: [PATCH 02/20] Traduction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traduction vers le français --- app/src/main/res/values-fr/strings.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 05fa8750..52f4eeae 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -123,5 +123,15 @@ %1$s, %2$s, et %3$s %1$s et %2$s %d nouvelles interactions + Plus + Répondre + Compte bloqué + Navigateur + Cacher le bouton de suivi lors du défilement + Modifier la notification + Media + Favori + Option + Nettoyer From b1a2761eae9b530c60bbdad15547b022cdf8ea70 Mon Sep 17 00:00:00 2001 From: "BOSCH, Cedric" Date: Fri, 14 Apr 2017 07:33:51 +0200 Subject: [PATCH 03/20] Traduction fr Ajout de "Boost" --- app/src/main/res/values-fr/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 52f4eeae..427ab252 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -133,5 +133,6 @@ Favori Option Nettoyer + Boost From 3aa10233e019205412cc8a875eb9c85a9eeebdcf Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Fri, 14 Apr 2017 10:06:47 +0200 Subject: [PATCH 04/20] Correct mistake and add new translation --- app/src/main/res/values-fr/strings.xml | 60 +++++++++++++++----------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 05fa8750..6e58a419 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,8 +1,8 @@ Une erreur s\'est produite. - Le domaine est invalide - L\'application n\'a pu s\'authentifier avec l\'instance. + Le domaine n\'est pas valide + Impossible de s\'authentifier avec l\'instance. Impossible de trouver un navigateur web. Une erreur d\'authorisation inconnu s\'est produite. Vous ne pouvez pas vous authentifier. @@ -39,24 +39,24 @@ fin des notifications fin des comptes - %s à boosté votre pouet - %s à ajouter votre pouet en favoris + %s a boosté votre pouet + %s a ajouter votre pouet en favoris %s vous suit Signaler @%s Plus de commentaire ? - Écrire + Répondre Se connecter avec Mastodon Deconnexion - Follow - Unfollow + S\'abonner + Se désabonner Bloquer Débloquer Signaler Supprimer POUET - POUET! + POUET ! Ré-essayer Définir le média comme sensible Masquer le texte par une mise en garde @@ -76,21 +76,24 @@ Redonner la parole Mention NSFW + Options + Ouvrir le menu + Effacer Partager l\'URL de votre pouet avec… Rechercher un compte… - Toot! - Envoyer! + Pouet ! + Envoyer ! - Quelle instance? + Quelle instance ? Quoi de neuf ? - Contenu mis en garde + Contenu sensible Qu\'est ce qu\'une instance? - L\'adresse ou le domaine d\'une instance peut être entré + L\'adresse ou le domaine d\'une instance peut être entrée Ici, comme mastodon.social, icosahedron.website, social.tchncs.de, et plus (en anglais)! \n\nSi vous n\'avez pas de compte, Vous pouvez entrer le nom de l\'instance que vous voulez rejoindre et créer un compte ici.\n\n Une instance est l\'endroit où votre compte est @@ -98,25 +101,29 @@ \n\nPlus d\'info mastodon.social (anglais). Média uploadé avec succès - Téléversement… + Envoie... - Tout le monde peut voir - Tout le monde peut voir, mais cela ne sera pas listé sur votre timeline public - Uniquement les followers et les mentionnés peuvent voir + Afficher dans les fils publics + Ne pas afficher dans les fils publics + N’afficher que pour vos abonné⋅e⋅s Notifications + Paramètre des notifications Notifications push Alertes - Sonner pour notifier - Vibrer pour notifier - Notifier avec une LED - Me notifier quand - mentionné - suivit - mes pouets boostés - mes pouets mis en favoris + Son + Vibreur + LED + Me notifier + Quand je suis mentionné + Lorsque quelqu'un suivit + Lorsque mes pouets boostés + Lorsque mes pouets sont boosté Apparence Utiliser le thème clair + Navigateur + Utiliser le navigateur intégré + Cacher le bouton "s\'abonner" lorsque je parcours un profil %s vous ont mentionnés %1$s, %2$s, %3$s et %4$d plus @@ -124,4 +131,5 @@ %1$s et %2$s %d nouvelles interactions - + Compte bloqué + From 8a6aa19f41d1083f484f88f8b75def3334704a7b Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Fri, 14 Apr 2017 10:22:08 +0200 Subject: [PATCH 05/20] Update traduction and use some #153 sentences --- app/src/main/res/values-fr/strings.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 6e58a419..e836309c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -79,7 +79,12 @@ Options Ouvrir le menu Effacer - + Boost + Favoris + Média + Plus ++ Répondre + Partager l\'URL de votre pouet avec… Rechercher un compte… @@ -123,7 +128,7 @@ Utiliser le thème clair Navigateur Utiliser le navigateur intégré - Cacher le bouton "s\'abonner" lorsque je parcours un profil + Cacher le bouton "s\'abonner" lors du défillement %s vous ont mentionnés %1$s, %2$s, %3$s et %4$d plus From bb9bc42a589aa791a4fc7dcb218c89a4ea172e55 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Fri, 14 Apr 2017 10:31:21 +0200 Subject: [PATCH 06/20] mistake --- app/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e836309c..b1b05cbe 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -40,7 +40,7 @@ fin des comptes %s a boosté votre pouet - %s a ajouter votre pouet en favoris + %s a ajouté votre pouet en favoris %s vous suit Signaler @%s From 424968ff4f138ab208090dbf70236c20188c8428 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Fri, 14 Apr 2017 10:59:59 +0200 Subject: [PATCH 07/20] Mistake (again...) --- app/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index b1b05cbe..a177d00f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -40,7 +40,7 @@ fin des comptes %s a boosté votre pouet - %s a ajouté votre pouet en favoris + %s a ajouté votre pouet à ses favoris %s vous suit Signaler @%s From 96c43697531150d474b94853c2fc11362018c32e Mon Sep 17 00:00:00 2001 From: goofy-bz Date: Fri, 14 Apr 2017 22:20:38 +0200 Subject: [PATCH 08/20] Update strings.xml various typo fix + changing escaping apostrophes for French typographic apostrophes which are xml compliant. --- app/src/main/res/values-fr/strings.xml | 59 +++++++++++++------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 05fa8750..6f05f188 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,30 +1,29 @@ - - Une erreur s\'est produite. + Une erreur s’est produite. Le domaine est invalide - L\'application n\'a pu s\'authentifier avec l\'instance. + L’application n’a pu s’authentifier avec l’instance. Impossible de trouver un navigateur web. - Une erreur d\'authorisation inconnu s\'est produite. + Une erreur d’autorisation inconnue s’est produite. Vous ne pouvez pas vous authentifier. - Impossible de récupérer le jeton d\'authentification. + Impossible de récupérer le jeton d’authentification. Votre pouet est trop long! Le fichier doit faire moins de 4Mo. - Ce type de fichier n\'est pas accepté. + Ce type de fichier n’est pas accepté. Le fichier ne peut être ouvert. - Une permision pour lire ce média est requis pour l\'uploader. + Une permission pour lire ce média est requis pour le mettre en ligne. Impossible de mettre une vidéo et une image sur le même pouet. - Ce média ne peut être uploadé. + Ce média ne peut être mis en ligne. Au moins un pouet a été reporté. Accueil Notifications Local Fédéré - Thread + Fil #%s Pouets - Follows - Followers + Abonnements + Abonnés Favoris Utilisateur bloqués @@ -40,24 +39,24 @@ fin des comptes %s à boosté votre pouet - %s à ajouter votre pouet en favoris + %s a ajouté votre pouet dans ses favoris %s vous suit Signaler @%s - Plus de commentaire ? + Davantage de commentaires ? Écrire Se connecter avec Mastodon Deconnexion - Follow - Unfollow + Suivre + Ne plus suivre Bloquer Débloquer Signaler Supprimer POUET - POUET! - Ré-essayer + POUET ! + Essayer encore Définir le média comme sensible Masquer le texte par une mise en garde Ok @@ -77,28 +76,28 @@ Mention NSFW - Partager l\'URL de votre pouet avec… + Partager l’URL de votre pouet avec… Rechercher un compte… Toot! - Envoyer! + Envoyer ! - Quelle instance? + Quelle instance ? Quoi de neuf ? Contenu mis en garde - Qu\'est ce qu\'une instance? + Qu’est ce qu’une instance ? - L\'adresse ou le domaine d\'une instance peut être entré + L’adresse ou le domaine d’une instance peut être entré Ici, comme mastodon.social, icosahedron.website, social.tchncs.de, et plus (en anglais)! - \n\nSi vous n\'avez pas de compte, Vous pouvez entrer le nom de l\'instance que vous voulez rejoindre et créer un compte ici.\n\n Une instance est l\'endroit où votre compte est - stocké, mais vous pouvez facilement communiquer et suivre d\'autre personne sur d\'autre instance bien que vous soyez sur le même site - \n\nPlus d\'info mastodon.social (anglais). + \n\nSi vous n’avez pas de compte, Vous pouvez entrer le nom de l’instance que vous voulez rejoindre et créer un compte ici.\n\n Une instance est l’endroit où votre compte est + stocké, mais vous pouvez facilement communiquer et suivre d’autre personne sur d’autres instances bien que vous soyez sur le même site + \n\nPlus d’info mastodon.social (anglais). - Média uploadé avec succès - Téléversement… + Média mis en ligne avec succès + Mise en ligne… Tout le monde peut voir Tout le monde peut voir, mais cela ne sera pas listé sur votre timeline public @@ -107,18 +106,18 @@ Notifications Notifications push Alertes - Sonner pour notifier + Émettre un son pour notifier Vibrer pour notifier Notifier avec une LED Me notifier quand mentionné - suivit + suivi mes pouets boostés mes pouets mis en favoris Apparence Utiliser le thème clair - %s vous ont mentionnés + %s vous ont mentionné⋅e %1$s, %2$s, %3$s et %4$d plus %1$s, %2$s, et %3$s %1$s et %2$s From 597b696d7004a7452e14cdbf5078289340ffce93 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sat, 15 Apr 2017 00:14:16 +0200 Subject: [PATCH 09/20] fixed German translation --- app/src/main/res/values-de/strings.xml | 45 ++++++++++++++++++-------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8804868a..169b67bb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -10,16 +10,22 @@ Bilder und Videos können beide nicht an den Beitrag angehängt werden. Die Mediendatei konnte nicht hochgeladen werden. Mindestens ein Beitrag muss berichtet werden. + Autorisierung fehlgeschlagen. + Ein Fehler ist aufgetreten. + Kein Webbrowser gefunden. + Es konnte kein Login-Token abgerufen werden. Start Benachrichtigungen + Lokal + Föderiert Unterhaltung #%s Beiträge Folgt Folgende Favoriten - Blockierte Nutzer + Blockierte Accounts \@%s %s teilte @@ -68,6 +74,16 @@ Stummschalten Lautschalten Erwähnen + Antworten + Teilen + Favorisieren + Mehr + Thread + Medien + Einstellungen + Drawer öffnen + Löschen + NSFW Teile Toot-URL zu… @@ -104,22 +120,23 @@ Aussehen Benutze helles Theme + Benachrichtigungen + Benachrichtigungseinstellungen + Jemandem meine Posts gefallen + Benachrichtigen wenn + Mir jemand folgt + Ich erwähnt werde + Jemand meine Posts teilt + Browser + Öffne Links in der App + Verstecke Button bei Bildlauf + %s hat dich erwähnt %1$s, %2$s, %3$s und %4$d andere %1$s, %2$s, und %3$s %1$s und %2$s %d neue Interaktionen - Lokal - Föderiert - Benachrichtigungen - Jemandem meine Posts gefallen - Benachrichtigen wenn - Mir jemand folgt - Ich erwähnt werde - Jemand meine Posts boostet - Autorisierung fehlgeschlagen. - Ein Fehler ist aufgetreten. - Kein Webbrowser gefunden. - Es konnte kein Login-Token abgerufen werden. - + Gesperrter Account + + \ No newline at end of file From 3e5eb47dcf2e39369cbefc3e6603e158334bc302 Mon Sep 17 00:00:00 2001 From: ButterflyOfFire Date: Sat, 15 Apr 2017 11:01:18 +0100 Subject: [PATCH 10/20] Create strings.xml Preparing file to arabic translation from "en" source file. --- app/src/main/res/values-ar/strings.xml | 144 +++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 app/src/main/res/values-ar/strings.xml diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml new file mode 100644 index 00000000..7d053474 --- /dev/null +++ b/app/src/main/res/values-ar/strings.xml @@ -0,0 +1,144 @@ + + + An error occurred. + Invalid domain entered + Failed authenticating with that instance. + Couldn\'t find a web browser to use. + An unidentified authorization error occurred. + Authorization was denied. + Failed getting a login token. + The status is too long! + The file must be less than 4MB. + That type of file cannot be uploaded. + That file could not be opened. + Permission to read media is required. + Images and videos cannot both be attached to the same status. + The upload failed. + At least one status must be reported. + + Home + Notifications + Local + Federated + Thread + #%s + Posts + Follows + Followers + Favourites + Blocked users + + \@%s + %s boosted + Sensitive Media + Click to view + Show More + Show Less + + end of the statuses + end of the notifications + end of the accounts + + %s boosted your toot + %s favourited your toot + %s followed you + + Report @%s + Additional comments? + + Reply + Boost + Favourite + More + Compose + Login with Mastodon + Log Out + Follow + Unfollow + Block + Unblock + Report + Delete + TOOT + TOOT! + Retry + Mark media sensitive + Hide text behind warning + Ok + Cancel + Close + Back + Profile + Preferences + Favourites + Blocked users + Thread + Media + Open in browser + Submit + Add media + Share + Mute + Unmute + Mention + NSFW + Options + Open drawer + Clear + + Share toot URL to… + + Search accounts… + + Toot! + Sent! + + Which instance? + What\'s happening? + Content warning + + What\'s an instance? + + The address or domain of any instance can be entered + here, such as mastodon.social, icosahedron.website, social.tchncs.de, and + more! + \n\nIf you don\'t yet have an account, you can enter the name of the instance you\'d like to + join and create an account there.\n\nAn instance is a single place where your account is + hosted, but you can easily communicate with and follow folks on other instances as though + you were on the same site. + \n\nMore info can be found at mastodon.social. + + Finishing Media Upload + Uploading… + + Everyone can view + Everyone can view, but not on public timelines + Only followers and mentions can view + + Notifications + Edit Notifications + Push notifications + Alerts + Notify with a sound + Notify with vibration + Notify with light + Notify me when + mentioned + followed + my posts are boosted + my posts are favourited + Appearance + Use the Light Theme + Browser + Use Chrome Custom Tabs + Hide follow button while scrolling + + %s mentioned you + %1$s, %2$s, %3$s and %4$d others + %1$s, %2$s, and %3$s + %1$s and %2$s + %d new interactions + + Locked Account + + From f4109f38a84192e8f0085c4bc8fb5663deaa7f16 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 15 Apr 2017 12:28:22 +0200 Subject: [PATCH 11/20] Allow pull-to-refresh in thread view (closes #73) --- .../keylesspalace/tusky/ThreadAdapter.java | 31 ++++++++++++++++--- .../tusky/ViewThreadFragment.java | 20 +++++++++--- .../main/res/layout/fragment_view_thread.xml | 14 ++++++--- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java b/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java index fea02455..7af6d13f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java @@ -65,20 +65,43 @@ class ThreadAdapter extends RecyclerView.Adapter implements AdapterItemRemover { notifyItemRemoved(position); } - int insertStatus(Status status) { + int setStatus(Status status) { + if (statuses.size() > 0 && statuses.get(statusIndex).equals(status)) { + // Do not add this status on refresh, it's already in there. + statuses.set(statusIndex, status); + return statusIndex; + } int i = statusIndex; statuses.add(i, status); notifyItemInserted(i); return i; } - void addAncestors(List ancestors) { + void setContext(List ancestors, List descendants) { + Status mainStatus = null; + + // In case of refresh, remove old ancestors and descendants first. We'll remove all blindly, + // as we have no guarantee on their order to be the same as before + int old_size = statuses.size(); + if (old_size > 0) { + mainStatus = statuses.get(statusIndex); + statuses.clear(); + notifyItemRangeRemoved(0, old_size); + } + + // Insert newly fetched ancestors statusIndex = ancestors.size(); statuses.addAll(0, ancestors); notifyItemRangeInserted(0, statusIndex); - } - void addDescendants(List descendants) { + if (mainStatus != null) { + // In case we needed to delete everything (which is way easier than deleting + // everything except one), re-insert the remaining status here. + statuses.add(statusIndex, mainStatus); + notifyItemInserted(statusIndex); + } + + // Insert newly fetched descendants int end = statuses.size(); statuses.addAll(descendants); notifyItemRangeInserted(end, descendants.size()); diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java index 4101b44a..67952669 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java @@ -21,6 +21,7 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; +import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; @@ -34,9 +35,11 @@ import com.keylesspalace.tusky.entity.StatusContext; import retrofit2.Call; import retrofit2.Callback; -public class ViewThreadFragment extends SFragment implements StatusActionListener { +public class ViewThreadFragment extends SFragment implements + SwipeRefreshLayout.OnRefreshListener, StatusActionListener { private static final String TAG = "ViewThreadFragment"; + private SwipeRefreshLayout swipeRefreshLayout; private RecyclerView recyclerView; private ThreadAdapter adapter; private String thisThreadsStatusId; @@ -56,6 +59,9 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene View rootView = inflater.inflate(R.layout.fragment_view_thread, container, false); Context context = getContext(); + swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout); + swipeRefreshLayout.setOnRefreshListener(this); + recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(context); @@ -86,7 +92,7 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene @Override public void onResponse(Call call, retrofit2.Response response) { if (response.isSuccessful()) { - int position = adapter.insertStatus(response.body()); + int position = adapter.setStatus(response.body()); recyclerView.scrollToPosition(position); } else { onThreadRequestFailure(id); @@ -109,10 +115,10 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene @Override public void onResponse(Call call, retrofit2.Response response) { if (response.isSuccessful()) { + swipeRefreshLayout.setRefreshing(false); StatusContext context = response.body(); - adapter.addAncestors(context.ancestors); - adapter.addDescendants(context.descendants); + adapter.setContext(context.ancestors, context.descendants); } else { onThreadRequestFailure(id); } @@ -128,6 +134,7 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene private void onThreadRequestFailure(final String id) { View view = getView(); + swipeRefreshLayout.setRefreshing(false); if (view != null) { Snackbar.make(view, R.string.error_generic, Snackbar.LENGTH_LONG) .setAction(R.string.action_retry, new View.OnClickListener() { @@ -143,6 +150,11 @@ public class ViewThreadFragment extends SFragment implements StatusActionListene } } + public void onRefresh() { + sendStatusRequest(thisThreadsStatusId); + sendThreadRequest(thisThreadsStatusId); + } + public void onReply(int position) { super.reply(adapter.getItem(position)); } diff --git a/app/src/main/res/layout/fragment_view_thread.xml b/app/src/main/res/layout/fragment_view_thread.xml index 732fbb63..3616a48f 100644 --- a/app/src/main/res/layout/fragment_view_thread.xml +++ b/app/src/main/res/layout/fragment_view_thread.xml @@ -1,7 +1,13 @@ - \ No newline at end of file + android:layout_height="match_parent"> + + \ No newline at end of file From 13c1136e1fa406ce15467a5e0f12da2a22fe2d13 Mon Sep 17 00:00:00 2001 From: ButterflyOfFire Date: Sat, 15 Apr 2017 16:40:37 +0100 Subject: [PATCH 12/20] Update strings.xml Localisation was made here : https://www.transifex.com/opendz/tusky-in-arabic/ --- app/src/main/res/values-ar/strings.xml | 225 +++++++++++-------------- 1 file changed, 101 insertions(+), 124 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 7d053474..c06ceaf0 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1,144 +1,121 @@ - An error occurred. - Invalid domain entered - Failed authenticating with that instance. - Couldn\'t find a web browser to use. - An unidentified authorization error occurred. - Authorization was denied. - Failed getting a login token. - The status is too long! - The file must be less than 4MB. - That type of file cannot be uploaded. - That file could not be opened. - Permission to read media is required. - Images and videos cannot both be attached to the same status. - The upload failed. - At least one status must be reported. - - Home - Notifications - Local - Federated - Thread + وقع هناك خطأ. + اسم النطاق غير صالح + اخفقت المصادقة مع مثيل الخادم هذا. + لم يتم العثور على متصفح قابل للإستعمال. + تم رفض التصريح. + يجب أن يكون حجم الملف أقل من 4 ميغابايت. + لا يمكن رفع هذا النوع من الملفات. + تعذر فتح ذاك الملف. + اخفقت عملية الرفع. + الرئيسية + الاشعارات + المحلية + الفدرالية + الخيط #%s - Posts - Follows - Followers - Favourites - Blocked users + المشاركات + يتبع + المتابعون + المفضلة + المستخدمون المحظورون \@%s - %s boosted - Sensitive Media - Click to view - Show More - Show Less + %s عزز + محتوى حساس + اضغط للعرض + اعرض أكثر + اعرض أقل - end of the statuses - end of the notifications - end of the accounts + نهاية الحالات + نهاية الاشعارات + نهاية الحسابات - %s boosted your toot - %s favourited your toot - %s followed you + %s عزز تبويقك + %s أعجب بتبويقك + %s يتبعك - Report @%s - Additional comments? + أبلغ عن @%s + تعليقات إضافية ؟ - Reply - Boost - Favourite - More - Compose - Login with Mastodon - Log Out - Follow - Unfollow - Block - Unblock - Report - Delete - TOOT - TOOT! - Retry - Mark media sensitive - Hide text behind warning - Ok - Cancel - Close - Back - Profile - Preferences - Favourites - Blocked users - Thread - Media - Open in browser - Submit - Add media - Share - Mute - Unmute - Mention + أجب + عزز + تفضيل + المزيد + حرر + التسجيل بواسطة ماستدون + خروج + إتبع + إلغاء التتبع + حضر + إلغاء الحظر + أبلغ + إحذف + تبويق + بَوِّق + إعادة المحاولة + اخفي النص وراء تحذير + موافق + إلغاء + إغلاق + عودة + الملف الشخصي + التفضيلات + المفضلة + المستخدمون المحظورون + الخيط + وسائط + إفتح في متصفح + ارسل + إضافة وسائط + شارك + أكتم + إلغاء الكتم + أذكر NSFW - Options - Open drawer - Clear + خيارات + إفتح الدرج + إمسح - Share toot URL to… + شارك رابط التبويق إلى ... - Search accounts… + ابحث عن حسابات ... - Toot! - Sent! + بَوِّق + تم الإرسال ! - Which instance? - What\'s happening? - Content warning + أي سيرفر ؟ + ما الجديد ؟ + تحذير عن المحتوى - What\'s an instance? + ماذا نعني بمثيل الخادم ؟ - The address or domain of any instance can be entered - here, such as mastodon.social, icosahedron.website, social.tchncs.de, and - more! - \n\nIf you don\'t yet have an account, you can enter the name of the instance you\'d like to - join and create an account there.\n\nAn instance is a single place where your account is - hosted, but you can easily communicate with and follow folks on other instances as though - you were on the same site. - \n\nMore info can be found at mastodon.social. - - Finishing Media Upload - Uploading… + تتمة رفع الوسائط + جاري الرفع ... - Everyone can view - Everyone can view, but not on public timelines - Only followers and mentions can view + الاشعارات + تعديل الاشعارات + دفع الإخطارات + التنبيهات + إعلام بالصوت + إعلام بالاهتزار + إعلام بالضوء + أخطرني عندما + يشار إلي + يتبعني أحد + تعزز وتدفع منشوراتي + يعجب أحد ما بمنشوراتي + المظهر + إستخدم سمةً فاتحة اللون + المتصفح + إخفاء زر المتابعة أثناء تمرير الصفحة + %s أشار إليك + %1$s, %2$s, %3$s و %4$d أخرى + %1$s, %2$s, و %3$s + %1$s و %2$s + %d تفاعلات جديدة - Notifications - Edit Notifications - Push notifications - Alerts - Notify with a sound - Notify with vibration - Notify with light - Notify me when - mentioned - followed - my posts are boosted - my posts are favourited - Appearance - Use the Light Theme - Browser - Use Chrome Custom Tabs - Hide follow button while scrolling - - %s mentioned you - %1$s, %2$s, %3$s and %4$d others - %1$s, %2$s, and %3$s - %1$s and %2$s - %d new interactions - - Locked Account + حساب مقفل From ee4d0739db824efb54cd4bad952f8d5aff0da93d Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 15 Apr 2017 17:52:21 +0200 Subject: [PATCH 13/20] Re-enable controls after failed toot --- .../keylesspalace/tusky/ComposeActivity.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 5be683a2..9d68596d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -122,6 +122,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag private ImageButton pickBtn; private Button nsfwBtn; private ProgressBar postProgress; + private ImageButton visibilityBtn; private static class QueuedMedia { enum Type { @@ -341,15 +342,12 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag floatingBtn = (Button) findViewById(R.id.floating_btn); pickBtn = (ImageButton) findViewById(R.id.compose_photo_pick); nsfwBtn = (Button) findViewById(R.id.action_toggle_nsfw); - final ImageButton visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility); + visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility); floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - pickBtn.setClickable(false); - nsfwBtn.setClickable(false); - visibilityBtn.setClickable(false); - floatingBtn.setEnabled(false); + disableButtons(); postProgress.setVisibility(View.VISIBLE); sendStatus(); @@ -567,6 +565,20 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } } + private void disableButtons() { + pickBtn.setClickable(false); + nsfwBtn.setClickable(false); + visibilityBtn.setClickable(false); + floatingBtn.setEnabled(false); + } + + private void enableButtons() { + pickBtn.setClickable(true); + nsfwBtn.setClickable(true); + visibilityBtn.setClickable(true); + floatingBtn.setEnabled(true); + } + private void setStatusVisibility(String visibility) { statusVisibility = visibility; switch (visibility) { @@ -823,6 +835,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag postProgress.setVisibility(View.INVISIBLE); textEditor.setError(getString(R.string.error_generic)); statusAlreadyInFlight = false; + enableButtons(); } private void readyStatus(final String content, final String visibility, final boolean sensitive, From d732c5d0a76621ab41fcff1799f360c97d06116d Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 15 Apr 2017 19:25:39 +0200 Subject: [PATCH 14/20] Timeline footer improvements --- .../keylesspalace/tusky/FooterViewHolder.java | 4 ++- .../tusky/NotificationsAdapter.java | 36 +++++++++++++++++-- .../tusky/NotificationsFragment.java | 9 +++++ .../keylesspalace/tusky/TimelineAdapter.java | 35 ++++++++++++++++-- .../keylesspalace/tusky/TimelineFragment.java | 9 +++++ app/src/main/res/layout/item_footer_empty.xml | 25 +++++++++++++ app/src/main/res/layout/item_footer_end.xml | 9 +++++ app/src/main/res/values/strings.xml | 1 + 8 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/layout/item_footer_empty.xml create mode 100644 app/src/main/res/layout/item_footer_end.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java index 6ebe217f..e39ca44a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java @@ -23,6 +23,8 @@ class FooterViewHolder extends RecyclerView.ViewHolder { FooterViewHolder(View itemView) { super(itemView); ProgressBar progressBar = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar); - progressBar.setIndeterminate(true); + if (progressBar != null) { + progressBar.setIndeterminate(true); + } } } \ No newline at end of file diff --git a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java index ea45b078..64ecb722 100644 --- a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java @@ -42,9 +42,16 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe private static final int VIEW_TYPE_STATUS_NOTIFICATION = 2; private static final int VIEW_TYPE_FOLLOW = 3; + enum FooterState { + EMPTY, + END, + LOADING + } + private List notifications; private StatusActionListener statusListener; private NotificationActionListener notificationActionListener; + private FooterState footerState = FooterState.END; NotificationsAdapter(StatusActionListener statusListener, NotificationActionListener notificationActionListener) { @@ -54,6 +61,15 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe this.notificationActionListener = notificationActionListener; } + + public void setFooterState(FooterState newFooterState) { + FooterState oldValue = footerState; + footerState = newFooterState; + if (footerState != oldValue) { + notifyItemChanged(notifications.size()); + } + } + @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { @@ -64,8 +80,24 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe return new StatusViewHolder(view); } case VIEW_TYPE_FOOTER: { - View view = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.item_footer, parent, false); + View view; + switch (footerState) { + default: + case LOADING: + view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.item_footer, parent, false); + break; + case END: { + view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.item_footer_end, parent, false); + break; + } + case EMPTY: { + view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.item_footer_empty, parent, false); + break; + } + } return new FooterViewHolder(view); } case VIEW_TYPE_STATUS_NOTIFICATION: { diff --git a/app/src/main/java/com/keylesspalace/tusky/NotificationsFragment.java b/app/src/main/java/com/keylesspalace/tusky/NotificationsFragment.java index 152a67ee..b754e6c4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/NotificationsFragment.java @@ -144,6 +144,10 @@ public class NotificationsFragment extends SFragment implements private void sendFetchNotificationsRequest(final String fromId, String uptoId) { MastodonAPI api = ((BaseActivity) getActivity()).mastodonAPI; + if (fromId != null || adapter.getItemCount() <= 1) { + adapter.setFooterState(NotificationsAdapter.FooterState.LOADING); + } + listCall = api.notifications(fromId, uptoId, null); listCall.enqueue(new Callback>() { @@ -192,6 +196,11 @@ public class NotificationsFragment extends SFragment implements } else { adapter.update(notifications); } + if (notifications.size() == 0 && adapter.getItemCount() == 1) { + adapter.setFooterState(NotificationsAdapter.FooterState.EMPTY); + } else if (fromId != null) { + adapter.setFooterState(NotificationsAdapter.FooterState.END); + } swipeRefreshLayout.setRefreshing(false); } diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java index 8f8fc546..a6c1367e 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java @@ -30,8 +30,15 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover private static final int VIEW_TYPE_STATUS = 0; private static final int VIEW_TYPE_FOOTER = 1; + enum FooterState { + EMPTY, + END, + LOADING + } + private List statuses; private StatusActionListener statusListener; + private FooterState footerState = FooterState.END; TimelineAdapter(StatusActionListener statusListener) { super(); @@ -49,13 +56,37 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover return new StatusViewHolder(view); } case VIEW_TYPE_FOOTER: { - View view = LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_footer, viewGroup, false); + View view; + switch (footerState) { + default: + case LOADING: + view = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.item_footer, viewGroup, false); + break; + case END: { + view = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.item_footer_end, viewGroup, false); + break; + } + case EMPTY: { + view = LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.item_footer_empty, viewGroup, false); + break; + } + } return new FooterViewHolder(view); } } } + public void setFooterState(FooterState newFooterState) { + FooterState oldValue = footerState; + footerState = newFooterState; + if (footerState != oldValue) { + notifyItemChanged(statuses.size()); + } + } + @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { if (position < statuses.size()) { diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java index 4f1b6e20..be220cfe 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java @@ -214,6 +214,10 @@ public class TimelineFragment extends SFragment implements private void sendFetchTimelineRequest(@Nullable final String fromId, @Nullable String uptoId) { MastodonAPI api = ((BaseActivity) getActivity()).mastodonAPI; + if (fromId != null || adapter.getItemCount() <= 1) { + adapter.setFooterState(TimelineAdapter.FooterState.LOADING); + } + Callback> cb = new Callback>() { @Override public void onResponse(Call> call, retrofit2.Response> response) { @@ -282,6 +286,11 @@ public class TimelineFragment extends SFragment implements } else { adapter.update(statuses); } + if (statuses.size() == 0 && adapter.getItemCount() == 1) { + adapter.setFooterState(TimelineAdapter.FooterState.EMPTY); + } else if(fromId != null) { + adapter.setFooterState(TimelineAdapter.FooterState.END); + } swipeRefreshLayout.setRefreshing(false); } diff --git a/app/src/main/res/layout/item_footer_empty.xml b/app/src/main/res/layout/item_footer_empty.xml new file mode 100644 index 00000000..1c5606d2 --- /dev/null +++ b/app/src/main/res/layout/item_footer_empty.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_footer_end.xml b/app/src/main/res/layout/item_footer_end.xml new file mode 100644 index 00000000..584de324 --- /dev/null +++ b/app/src/main/res/layout/item_footer_end.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d053474..534693ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,6 +38,7 @@ end of the statuses end of the notifications end of the accounts + There are no toots here so far. Pull down to refresh! %s boosted your toot %s favourited your toot From fce573f1eca899f4a28811583b4dfbc072a871a0 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 15 Apr 2017 19:44:29 +0200 Subject: [PATCH 15/20] Update thread view after sent reply (closes #74) --- .../keylesspalace/tusky/ComposeActivity.java | 2 ++ .../com/keylesspalace/tusky/MainActivity.java | 14 +++++++++++++- .../com/keylesspalace/tusky/SFragment.java | 19 ++++++++++++++++--- .../keylesspalace/tusky/TimelineFragment.java | 8 ++++++++ .../tusky/TimelinePagerAdapter.java | 15 +++++++++++++++ .../tusky/ViewThreadFragment.java | 6 ++++++ 6 files changed, 60 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 5be683a2..cfd1eb6f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -101,6 +101,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag private static final int MEDIA_PICK_RESULT = 1; private static final int PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1; private static final int MEDIA_SIZE_UNKNOWN = -1; + private static final int COMPOSE_SUCCESS = -1; private String inReplyToId; private EditText textEditor; @@ -816,6 +817,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag private void onSendSuccess() { Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose), getString(R.string.confirmation_send), Snackbar.LENGTH_SHORT); bar.show(); + setResult(COMPOSE_SUCCESS); finish(); } diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index 43415269..8a2b7bc6 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -66,6 +66,7 @@ import retrofit2.Response; public class MainActivity extends BaseActivity { private static final String TAG = "MainActivity"; // logging tag and Volley request tag + protected static int COMPOSE_RESULT = 1; private String loggedInAccountId; private String loggedInAccountUsername; @@ -99,7 +100,7 @@ public class MainActivity extends BaseActivity { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), ComposeActivity.class); - startActivity(intent); + startActivityForResult(intent, COMPOSE_RESULT); } }); @@ -474,6 +475,17 @@ public class MainActivity extends BaseActivity { Log.e(TAG, "Failed to fetch user info. " + exception.getMessage()); } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == COMPOSE_RESULT && resultCode == ComposeActivity.RESULT_OK) { + TimelinePagerAdapter adapter = (TimelinePagerAdapter) viewPager.getAdapter(); + if (adapter.getCurrentFragment() instanceof SFragment) { + ((SFragment) adapter.getCurrentFragment()).onSuccessfulStatus(); + } + } + super.onActivityResult(requestCode, resultCode, data); + } + @Override public void onBackPressed() { if(drawer != null && drawer.isDrawerOpen()) { diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java index f18f07f0..54d897a0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java @@ -44,9 +44,10 @@ import retrofit2.Callback; * adapters. I feel like the profile pages and thread viewer, which I haven't made yet, will also * overlap functionality. So, I'm momentarily leaving it and hopefully working on those will clear * up what needs to be where. */ -public class SFragment extends BaseFragment { +public abstract class SFragment extends BaseFragment { protected String loggedInAccountId; protected String loggedInUsername; + protected static int COMPOSE_RESULT = 1; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -79,11 +80,23 @@ public class SFragment extends BaseFragment { intent.putExtra("reply_visibility", replyVisibility); intent.putExtra("content_warning", contentWarning); intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0])); - startActivity(intent); + startActivityForResult(intent, COMPOSE_RESULT); + } + + public void onSuccessfulStatus() { + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == COMPOSE_RESULT && resultCode == ComposeActivity.RESULT_OK) { + onSuccessfulStatus(); + } else { + super.onActivityResult(requestCode, resultCode, data); + } } protected void reblog(final Status status, final boolean reblog, - final RecyclerView.Adapter adapter, final int position) { + final RecyclerView.Adapter adapter, final int position) { String id = status.getActionableId(); Callback cb = new Callback() { diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java index 4f1b6e20..825411e8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineFragment.java @@ -299,6 +299,14 @@ public class TimelineFragment extends SFragment implements } } + @Override + public void onSuccessfulStatus() { + if (kind == Kind.HOME || kind == Kind.PUBLIC_FEDERATED || kind == Kind.PUBLIC_LOCAL) { + onRefresh(); + } + super.onSuccessfulStatus(); + } + public void onReply(int position) { super.reply(adapter.getItem(position)); } diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java b/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java index af9bc639..2e81adc3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelinePagerAdapter.java @@ -18,12 +18,27 @@ package com.keylesspalace.tusky; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; +import android.view.ViewGroup; class TimelinePagerAdapter extends FragmentPagerAdapter { + private Fragment currentFragment; + TimelinePagerAdapter(FragmentManager manager) { super(manager); } + public Fragment getCurrentFragment() { + return currentFragment; + } + + @Override + public void setPrimaryItem(ViewGroup container, int position, Object object) { + if (getCurrentFragment() != object) { + currentFragment = ((Fragment) object); + } + super.setPrimaryItem(container, position, object); + } + @Override public Fragment getItem(int i) { switch (i) { diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java index 67952669..39baf8ee 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/ViewThreadFragment.java @@ -155,6 +155,12 @@ public class ViewThreadFragment extends SFragment implements sendThreadRequest(thisThreadsStatusId); } + @Override + public void onSuccessfulStatus() { + onRefresh(); + super.onSuccessfulStatus(); + } + public void onReply(int position) { super.reply(adapter.getItem(position)); } From 1701ef67d9a94aaa0ddd4092e9cd73624c2775a3 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 15 Apr 2017 20:36:21 +0200 Subject: [PATCH 16/20] Margins in account tab --- app/src/main/res/layout/tab_account.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/tab_account.xml b/app/src/main/res/layout/tab_account.xml index 0f314fd4..957bbe3c 100644 --- a/app/src/main/res/layout/tab_account.xml +++ b/app/src/main/res/layout/tab_account.xml @@ -9,6 +9,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/title" + android:layout_marginTop="8dp" android:layout_centerHorizontal="true" android:textAllCaps="true" android:textStyle="normal|bold" /> From 60b3d4bb97bb16e8d994f7a84a890509fae7baef Mon Sep 17 00:00:00 2001 From: in_dow Date: Mon, 17 Apr 2017 00:09:58 +0900 Subject: [PATCH 17/20] Add translation (japanese) Signed-off-by: in_dow --- app/src/main/res/values-ja/strings.xml | 142 +++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 app/src/main/res/values-ja/strings.xml diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml new file mode 100644 index 00000000..902fb0a3 --- /dev/null +++ b/app/src/main/res/values-ja/strings.xml @@ -0,0 +1,142 @@ + + + エラーが発生しました。 + 不正なドメイン名が入力されました + そのインスタンスでの認証が失敗しました + 使用するブラウザを見つけることができません。 + 未定義の認証エラーが発生しました。 + 認証は拒否されました。 + ログイントークンの取得に失敗しました。 + ステータスが非常に長い! + ファイルは4MB未満にしてください。 + このファイル種別はアップロードできません。 + このファイルは開けません。 + メディアの読み込み権限が必要です。 + 同一のステータスに画像とビデオを一緒にすることはできません。 + アップロードに失敗しました。 + 少なくとも1つのステータスを報告してください。 + + ホーム + 通知 + ローカル + 連合 + スレッド + #%s + 投稿 + フォロー + フォロワー + お気に入り + ブロックしたユーザー + + \@%s + %s 加速されました + 不適切なメディア + タップして表示 + さらに表示 + 省略表示 + + これ以降にステータスはありません + これ以降に通知はありません + これ以降にアカウントはありません + + %s があたなのトゥートをブーストしました + %s があなたのトゥートをお気に入りに追加しました + %s があなたをフォローしました + + \@%s を通報 + コメントを追加しますか? + + 返信 + ブースト + お気に入り + もっと読む + 作成 + Mastodonにログイン + ログアウト + フォロー + フォロー解除 + ブロック + ブロック解除 + 報告 + 削除 + トゥート + トゥート! + リトライ + 不適切なメディアとする + 警告のあるテキストを隠す + Ok + キャンセル + 閉じる + 戻る + プロファイル + 設定 + お気に入り + ブロックしたユーザー + スレッド + メディア + ブラウザで開く + 投稿 + メディアを追加 + 共有 + ミュート + ミュート解除 + メンション + NSFW + オプション + ドローワを開く + クリア + + トゥートURLを共通… + + アカウントを検索… + + トゥート! + 送信しました! + + どのインスタンス? + 今何してる? + コンテンツの警告 + + インスタンスって? + + インスタンスのアドレスもしくはドメインをここに入力してください。 + 例えば mastodon.social, mstdn.jp, pawoo.net, や + などです! + \n\nもしアカウントを持っていない場合は、参加したいインスタンスの名前を入力してください。\n\n + インスタンスはあなたのアカウントを単一の場所で管理(ホスト)しますが、ほかのインスタンスと同じサイトであるかのように人をフォローしたり連絡することができます。 + \n\n詳しくはmastodon.socialを見てください。 + + メディアのアップロードが完了 + アップロード中… + + すべての人が表示可能 + すべての人が表示可能だが公開タイムラインには載せない + フォロワーとメンションのみ表示可能 + + 通知 + 通知を編集 + プッシュ通知 + アラート + 音で通知 + バイブレーションで通知 + ライトで通知 + 通知する状態 + メンションがありました + フォローされた + 私の投稿がブーストされました + 私の投稿がお気に入りに追加されました + 表示 + 明るいテーマを使用 + ブラウザ + Chromeカスタムタブを使用 + スクロール中にフォローボタンを非表示 + + %s があなたにメンションを送信しました + %1$s、%2$s、%3$s と他に%4$d件 + %1$s、%2$s、と %3$s + %1$s と %2$s + %d 新しいお知らせ + + ロックされたアカウント + + From 73ed3d0852381c464f9a05fce5ba53e534c94899 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Sun, 16 Apr 2017 19:23:18 -0400 Subject: [PATCH 18/20] Fixes merge errors. --- app/src/main/res/values-fr/strings.xml | 27 ++++++++------------------ 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4d589323..4fc59a9f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -76,14 +76,14 @@ Redonner la parole Mention NSFW - Options + Option Ouvrir le menu - Effacer + Nettoyer Boost - Favoris - Média + Favori + Media Plus -+ Répondre + Répondre Partager l\'URL de votre pouet avec… @@ -113,7 +113,7 @@ N’afficher que pour vos abonné⋅e⋅s Notifications - Paramètre des notifications + Modifier la notification Notifications push Alertes Son @@ -121,31 +121,20 @@ LED Me notifier Quand je suis mentionné - Lorsque quelqu'un suivit + Lorsque quelqu\'un suivit Lorsque mes pouets boostés Lorsque mes pouets sont boosté Apparence Utiliser le thème clair Navigateur Utiliser le navigateur intégré - Cacher le bouton "s\'abonner" lors du défillement + Cacher le bouton de suivi lors du défilement %s vous ont mentionnés %1$s, %2$s, %3$s et %4$d plus %1$s, %2$s, et %3$s %1$s et %2$s %d nouvelles interactions - Plus - Répondre - Compte bloqué - Navigateur - Cacher le bouton de suivi lors du défilement - Modifier la notification - Media - Favori - Option - Nettoyer - Boost Compte bloqué From cc0aaf61628ca439ece0af4ce44553e78bfb8639 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Mon, 17 Apr 2017 00:18:55 -0400 Subject: [PATCH 19/20] Fixes a couple cases in the composer where buttons enabled are out of sync with whether a status is already in flight. --- .../java/com/keylesspalace/tusky/ComposeActivity.java | 10 +++++++--- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 403b9b0a..36330bcc 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -348,8 +348,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - disableButtons(); - postProgress.setVisibility(View.VISIBLE); sendStatus(); } @@ -637,9 +635,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag if (statusHideText) { spoilerText = contentWarningEditor.getText().toString(); } - if (contentText.length() + spoilerText.length() <= STATUS_CHARACTER_LIMIT) { + int characterCount = contentText.length() + spoilerText.length(); + if (characterCount > 0 && characterCount <= STATUS_CHARACTER_LIMIT) { statusAlreadyInFlight = true; + disableButtons(); readyStatus(contentText, statusVisibility, statusMarkSensitive, spoilerText); + } else if (characterCount <= 0) { + textEditor.setError(getString(R.string.error_empty)); } else { textEditor.setError(getString(R.string.error_compose_character_limit)); } @@ -873,6 +875,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag protected void onCancelled() { removeAllMediaFromQueue(); statusAlreadyInFlight = false; + enableButtons(); super.onCancelled(); } }; @@ -898,6 +901,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } }); statusAlreadyInFlight = false; + enableButtons(); } private void onMediaPick() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 42bb3fa7..345d1c01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ An error occurred. + This can\'t be empty. Invalid domain entered Failed authenticating with that instance. Couldn\'t find a web browser to use. From a33c2597608faabb41e9769440a557ce6e80799b Mon Sep 17 00:00:00 2001 From: Vavassor Date: Mon, 17 Apr 2017 00:29:47 -0400 Subject: [PATCH 20/20] Ties composer readying state and control states together. --- .../keylesspalace/tusky/ComposeActivity.java | 26 ++++++++++++------- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 36330bcc..79547e49 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -348,7 +348,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - postProgress.setVisibility(View.VISIBLE); sendStatus(); } }); @@ -626,6 +625,18 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag updateVisibleCharactersLeft(); } + void setStateToReadying() { + statusAlreadyInFlight = true; + disableButtons(); + postProgress.setVisibility(View.VISIBLE); + } + + void setStateToNotReadying() { + postProgress.setVisibility(View.INVISIBLE); + statusAlreadyInFlight = false; + enableButtons(); + } + private void sendStatus() { if (statusAlreadyInFlight) { return; @@ -637,8 +648,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } int characterCount = contentText.length() + spoilerText.length(); if (characterCount > 0 && characterCount <= STATUS_CHARACTER_LIMIT) { - statusAlreadyInFlight = true; - disableButtons(); + setStateToReadying(); readyStatus(contentText, statusVisibility, statusMarkSensitive, spoilerText); } else if (characterCount <= 0) { textEditor.setError(getString(R.string.error_empty)); @@ -836,10 +846,8 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } private void onSendFailure() { - postProgress.setVisibility(View.INVISIBLE); textEditor.setError(getString(R.string.error_generic)); - statusAlreadyInFlight = false; - enableButtons(); + setStateToNotReadying(); } private void readyStatus(final String content, final String visibility, final boolean sensitive, @@ -874,8 +882,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag @Override protected void onCancelled() { removeAllMediaFromQueue(); - statusAlreadyInFlight = false; - enableButtons(); + setStateToNotReadying(); super.onCancelled(); } }; @@ -900,8 +907,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag readyStatus(content, visibility, sensitive, spoilerText); } }); - statusAlreadyInFlight = false; - enableButtons(); + setStateToNotReadying(); } private void onMediaPick() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 345d1c01..626172db 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ An error occurred. - This can\'t be empty. + This cannot be empty. Invalid domain entered Failed authenticating with that instance. Couldn\'t find a web browser to use.