Fix pinned

This commit is contained in:
tom79 2019-11-10 17:10:07 +01:00
parent d1a51264a9
commit f8b91ac0bf
13 changed files with 32 additions and 25 deletions

View File

@ -318,7 +318,6 @@ public abstract class BaseMainActivity extends BaseActivity
}
}
//For old Mastodon releases that can't pin, this support could be removed
Helper.canPin = false;
Helper.fillMapEmoji(getApplicationContext());
//Here, the user is authenticated
appBar = findViewById(R.id.appBar);
@ -2005,7 +2004,6 @@ public abstract class BaseMainActivity extends BaseActivity
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.INSTANCE_VERSION + userId + instance, apiResponse.getInstance().getVersion());
editor.apply();
Helper.canPin = (currentVersion.compareTo(minVersion) == 1 || currentVersion.equals(minVersion));
}
@Override

View File

@ -669,9 +669,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
.inflate(R.menu.option_filter_toots_account, popup.getMenu());
Menu menu = popup.getMenu();
if (!Helper.canPin) {
popup.getMenu().findItem(R.id.action_show_pinned).setVisible(false);
}
popup.getMenu().findItem(R.id.action_show_pinned).setVisible(false);
final MenuItem itemShowPined = menu.findItem(R.id.action_show_pinned);
final MenuItem itemShowMedia = menu.findItem(R.id.action_show_media);
final MenuItem itemShowBoosts = menu.findItem(R.id.action_show_boosts);

View File

@ -1379,7 +1379,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Helper.changeDrawableColor(context, holder.status_privacy, iconColor);
Helper.changeDrawableColor(context, R.drawable.ic_repeat, iconColor);
Helper.changeDrawableColor(context, R.drawable.ic_plus_one, iconColor);
Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, iconColor);
holder.status_reply_count.setTextColor(iconColor);
holder.status_favorite_count.setTextColor(iconColor);
@ -2372,13 +2371,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
final boolean isOwner = status.getReblog() != null ? status.getReblog().getAccount().getId().equals(userId) : status.getAccount().getId().equals(userId);
// Pinning toots is only available on Mastodon 1._6_.0 instances.
if (isOwner && Helper.canPin && (status.getVisibility().equals("public") || status.getVisibility().equals("unlisted")) && status.getReblog() == null) {
if (isOwner && (status.getVisibility().equals("public") || status.getVisibility().equals("unlisted")) && status.getReblog() == null) {
Drawable imgPin;
if (status.isPinned() || (status.getReblog() != null && status.getReblog().isPinned())) {
Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, R.color.marked_icon);
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop);
Helper.changeDrawableColor(context, holder.status_pin, R.color.marked_icon);
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop_p);
} else {
Helper.changeDrawableColor(context, R.drawable.ic_pin_drop, iconColor);
Helper.changeDrawableColor(context, holder.status_pin, iconColor);
imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop);
}
assert imgPin != null;

View File

@ -523,7 +523,6 @@ public class Helper {
private static boolean menuAccountsOpened = false;
public static boolean canPin;
private static final Pattern SHORTNAME_PATTERN = Pattern.compile(":( |)([-+\\w]+):");

View File

@ -7,6 +7,6 @@
android:fillColor="#ffffff"
android:pathData="M3 8h18v9H3z" />
<path
android:fillColor="#FF2b90d9"
android:fillColor="?colorAccent"
android:pathData="M20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM8.5,15L7.3,15l-2.55,-3.5L4.75,15L3.5,15L3.5,9h1.25l2.5,3.5L7.25,9L8.5,9v6zM13.5,10.26L11,10.26v1.12h2.5v1.26L11,12.64v1.11h2.5L13.5,15h-4L9.5,9h4v1.26zM20.5,14c0,0.55 -0.45,1 -1,1h-4c-0.55,0 -1,-0.45 -1,-1L14.5,9h1.25v4.51h1.13L16.88,9.99h1.25v3.51h1.12L19.25,9h1.25v5z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#14161B"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18,8c0,-3.31 -2.69,-6 -6,-6S6,4.69 6,8c0,4.5 6,11 6,11s6,-6.5 6,-11zM10,8c0,-1.1 0.9,-2 2,-2s2,0.9 2,2 -0.89,2 -2,2c-1.1,0 -2,-0.9 -2,-2zM5,20v2h14v-2L5,20z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/iconColor"
android:pathData="m3,2v18h6l3,3 3,-3h6v-18zM4.8008,3.8008h14.4v14.398h-4.9473l-2.2539,2.2539 -2.2539,-2.2539h-4.9453zM7.4121,5.7793a0.7621,0.7621 0,0 0,-0.7617 0.7617v8.918a0.7621,0.7621 0,0 0,1.248 0.5859l1.9473,-1.6133h6.7422a0.7621,0.7621 0,0 0,0.7617 -0.7617v-7.1289a0.7621,0.7621 0,0 0,-0.7617 -0.7617zM8.1758,7.3027h7.6484v5.6035h-6.2539a0.7621,0.7621 0,0 0,-0.4863 0.1758l-0.9082,0.7539z"
/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#ca8f04"
android:pathData="m3,2v18h6l3,3 3,-3h6v-18h-18zM7.4121,5.7793h9.1758a0.7621,0.7621 0,0 1,0.7617 0.7617v7.1289a0.7621,0.7621 0,0 1,-0.7617 0.7617h-6.7422l-1.9473,1.6133a0.7621,0.7621 0,0 1,-1.248 -0.5859v-8.918a0.7621,0.7621 0,0 1,0.7617 -0.7617zM8.1758,7.3027v6.5332l0.9082,-0.7539a0.7621,0.7621 0,0 1,0.4863 -0.1758h6.2539v-5.6035h-7.6484z"/>
</vector>

View File

@ -988,8 +988,8 @@
<ImageView
android:id="@+id/status_pin"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="15dp"
android:contentDescription="@string/pin_add"
android:src="@drawable/ic_pin_drop"

View File

@ -955,8 +955,8 @@
<ImageView
android:id="@+id/status_pin"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="15dp"
android:contentDescription="@string/pin_add"
android:src="@drawable/ic_pin_drop"

View File

@ -878,8 +878,8 @@
<ImageView
android:id="@+id/status_pin"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="15dp"
android:contentDescription="@string/pin_add"
android:src="@drawable/ic_pin_drop"

View File

@ -875,13 +875,12 @@
<ImageView
android:id="@+id/status_pin"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:contentDescription="@string/pin_add"
android:src="@drawable/ic_pin_drop"
android:tint="?attr/iconColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/status_remove"
app:layout_constraintTop_toTopOf="parent" />