Moves the translation button.

This commit is contained in:
tom79 2017-09-08 18:20:02 +02:00
parent 5a33e32113
commit e55c982808
24 changed files with 20 additions and 21 deletions

View File

@ -14,6 +14,7 @@ package fr.gouv.etalab.mastodon.drawers;
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
import android.graphics.Paint;
import android.support.v7.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
@ -198,7 +199,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
holder.status_prev4_container = (RelativeLayout) convertView.findViewById(R.id.status_prev4_container);
holder.status_reply = (ImageView) convertView.findViewById(R.id.status_reply);
holder.status_privacy = (ImageView) convertView.findViewById(R.id.status_privacy);
holder.status_translate = (Button) convertView.findViewById(R.id.status_translate);
holder.status_translate = (TextView) convertView.findViewById(R.id.status_translate);
holder.status_content_translated_container = (LinearLayout) convertView.findViewById(R.id.status_content_translated_container);
holder.main_container = (LinearLayout) convertView.findViewById(R.id.main_container);
holder.status_spoiler_container = (LinearLayout) convertView.findViewById(R.id.status_spoiler_container);
@ -303,6 +304,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
statusListAdapter.notifyDataSetChanged();
}
});
holder.status_translate.setPaintFlags(holder.status_translate.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
if( currentLocale != null && status.getLanguage() != null && !status.getLanguage().trim().equals(currentLocale) && !status.getLanguage().trim().equals("null")){
if (translator != Helper.TRANS_NONE)
holder.status_translate.setVisibility(View.VISIBLE);
@ -995,6 +997,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
statuses.get(position).setContent_translated(aJsonString);
statusListAdapter.notifyDataSetChanged();
} catch (JSONException | UnsupportedEncodingException | IllegalArgumentException e) {
e.printStackTrace();
Toast.makeText(context, R.string.toast_error_translate, Toast.LENGTH_LONG).show();
}
}
@ -1038,7 +1041,8 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
But, pre-planning might save some time later...
*/
aJsonString = aJsonString.replaceAll("__ (u|t)(\\d+)__", "__$1$2__").replaceAll("__(u|t)(\\d+) __", "__$1$2__");
aJsonString = aJsonString.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
aJsonString = aJsonString.replaceAll("\\+", "%2B");
aJsonString = URLDecoder.decode(aJsonString, "UTF-8");
return aJsonString;
}
@ -1077,7 +1081,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
RelativeLayout status_prev4_container;
ImageView status_reply;
ImageView status_privacy;
Button status_translate;
TextView status_translate;
LinearLayout status_container2;
LinearLayout status_container3;
LinearLayout main_container;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -71,22 +71,6 @@
style="?attr/shapeBorder"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/status_translate"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:scaleType="center"
android:drawablePadding="0dp"
android:paddingStart="17dp"
android:paddingLeft="17dp"
android:drawableStart="@drawable/ic_translate"
android:drawableLeft="@drawable/ic_translate"
tools:ignore="ContentDescription" />
</RelativeLayout>
<LinearLayout
android:layout_marginStart="5dp"
@ -338,6 +322,16 @@
</LinearLayout>
</LinearLayout>
<TextView
android:visibility="gone"
android:text="@string/translate_toot"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_vertical|end"
android:id="@+id/status_translate"
android:textColor="@color/mastodonC4"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/status_action_container"
android:layout_width="match_parent"

View File

@ -44,7 +44,7 @@
<string name="speech_prompt">Bitte sag etwas</string>
<string name="speech_not_supported">Sorry! Dein Gerät unterstützt keine Spracheingabe!</string>
<string name="delete_all">Alles löschen</string>
<string name="translate_toot">Übersetzen toot.</string>
<string name="schedule">Planen</string>
<string name="text_size">Text- und Symbolgröße</string>

View File

@ -44,6 +44,7 @@
<string name="speech_prompt">Veuillez dire quelque chose</string>
<string name="speech_not_supported">Désolé ! Votre appareil ne supporte pas la commande vocale !</string>
<string name="delete_all">Tout effacer</string>
<string name="translate_toot">Traduire ce pouet.</string>
<string name="schedule">Programmer</string>
<string name="text_size">Taille du texte et des icônes</string>
<string name="text_size_change">Modifier la taille du texte :</string>

View File

@ -44,7 +44,7 @@
<string name="speech_prompt">Please, say something</string>
<string name="speech_not_supported">Sorry! Your device does not support the voice input!</string>
<string name="delete_all">Delete all</string>
<string name="translate_toot">Translate this toot.</string>
<string name="schedule">Schedule</string>
<string name="text_size">Text and icon sizes</string>
<string name="text_size_change">Change the current text size:</string>