Corrects number localization and adjusts the padding of the reblog avatars in right-to-left layout direction.

This commit is contained in:
Vavassor 2017-07-14 18:18:29 -04:00
parent 68e3ec67c5
commit 8559a6d75c
5 changed files with 14 additions and 5 deletions

View file

@ -345,6 +345,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
setStatusVisibility(startingVisibility);
postProgress.setVisibility(View.INVISIBLE);
updateHideMediaToggleColor();
updateVisibleCharactersLeft();
final ParserUtils parser = new ParserUtils(this);

View file

@ -17,6 +17,7 @@ package com.keylesspalace.tusky.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
@ -129,7 +130,12 @@ public class StatusViewHolder extends RecyclerView.ViewHolder {
Context context = avatar.getContext();
boolean hasReblog = rebloggedUrl != null && !rebloggedUrl.isEmpty();
int padding = hasReblog ? Utils.dpToPx(context, 12) : 0;
avatar.setPadding(0, 0, padding, padding);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
avatar.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
avatar.setPadding(padding, 0, 0, padding);
} else {
avatar.setPadding(0, 0, padding, padding);
}
if (url.isEmpty()) {
avatar.setImageResource(R.drawable.avatar_default);

View file

@ -15,6 +15,8 @@
package com.keylesspalace.tusky.util;
import java.text.NumberFormat;
public class DateUtils {
/* This is a rough duplicate of android.text.format.DateUtils.getRelativeTimeSpanString,
* but even with the FORMAT_ABBREV_RELATIVE flag it wasn't abbreviating enough. */
@ -45,6 +47,6 @@ public class DateUtils {
span /= YEAR;
unit = "y";
}
return prefix + span + unit;
return prefix + NumberFormat.getIntegerInstance().format(span) + unit;
}
}

View file

@ -152,7 +152,6 @@
android:id="@+id/characters_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="500"
android:textColor="?android:textColorPrimary" />
<Button

View file

@ -52,7 +52,7 @@
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:contentDescription="@string/action_view_profile"
tools:src="@drawable/avatar_default"/>
tools:src="@drawable/avatar_default" />
<ImageView
android:id="@+id/status_avatar_reblog"
@ -61,9 +61,10 @@
android:layout_alignBottom="@+id/status_avatar"
android:layout_alignEnd="@id/status_avatar"
android:layout_alignRight="@id/status_avatar"
android:contentDescription="@null"
android:visibility="gone"
tools:src="@color/accent"
tools:visibility="visible"/>
tools:visibility="visible" />
<RelativeLayout
android:layout_height="wrap_content"