work around crash onHidden

re: mastodon#512
This commit is contained in:
sk 2023-01-21 15:24:33 -03:00 committed by LucasGGamerM
parent 7939380172
commit 9df738831f
3 changed files with 22 additions and 20 deletions

View File

@ -160,7 +160,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
case FOLLOW -> builder.setSmallIcon(R.drawable.ic_fluent_person_add_24_filled); case FOLLOW -> builder.setSmallIcon(R.drawable.ic_fluent_person_add_24_filled);
case MENTION -> builder.setSmallIcon(R.drawable.ic_fluent_mention_24_filled); case MENTION -> builder.setSmallIcon(R.drawable.ic_fluent_mention_24_filled);
case POLL -> builder.setSmallIcon(R.drawable.ic_fluent_poll_24_filled); case POLL -> builder.setSmallIcon(R.drawable.ic_fluent_poll_24_filled);
case STATUS -> R.drawable.ic_fluent_chat_24_filled; case STATUS -> builder.setSmallIcon(R.drawable.ic_fluent_chat_24_filled);
default -> builder.setSmallIcon(R.drawable.ic_ntf_logo); default -> builder.setSmallIcon(R.drawable.ic_ntf_logo);
} }

View File

@ -98,24 +98,26 @@ public class HomeTimelineFragment extends FabStatusListFragment {
@Override @Override
protected void onHidden(){ protected void onHidden(){
super.onHidden(); super.onHidden();
// if(!data.isEmpty()){ // workaround for mastodon#512. revert if fixed otherwise
// String topPostID=displayItems.get(list.getChildAdapterPosition(list.getChildAt(0))-getMainAdapterOffset()).parentID; int position = list.getChildAdapterPosition(list.getChildAt(0))-getMainAdapterOffset();
// if(!topPostID.equals(lastSavedMarkerID)){ if(!data.isEmpty() && position >= 0 && position < displayItems.size()){
// lastSavedMarkerID=topPostID; String topPostID=displayItems.get(position).parentID;
// new SaveMarkers(topPostID, null) if(!topPostID.equals(lastSavedMarkerID)){
// .setCallback(new Callback<>(){ lastSavedMarkerID=topPostID;
// @Override new SaveMarkers(topPostID, null)
// public void onSuccess(SaveMarkers.Response result){ .setCallback(new Callback<>(){
// } @Override
// public void onSuccess(SaveMarkers.Response result){
// @Override }
// public void onError(ErrorResponse error){
// lastSavedMarkerID=null; @Override
// } public void onError(ErrorResponse error){
// }) lastSavedMarkerID=null;
// .exec(accountID); }
// } })
// } .exec(accountID);
}
}
} }
public void onStatusCreated(StatusCreatedEvent ev){ public void onStatusCreated(StatusCreatedEvent ev){

View File

@ -1,3 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:pathData="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10c-1.64 0-3.225-0.396-4.644-1.142l-4.29 1.117c-0.455 0.119-0.92-0.154-1.037-0.608-0.037-0.14-0.037-0.288 0-0.428l1.116-4.289C2.397 15.23 2 13.643 2 12 2 6.477 6.477 2 12 2zm1.252 11H8.75l-0.102 0.007C8.282 13.057 8 13.37 8 13.75s0.282 0.694 0.648 0.743L8.75 14.5h4.502l0.101-0.007c0.367-0.05 0.649-0.363 0.649-0.743s-0.282-0.694-0.649-0.743L13.252 13zm1.998-3.5h-6.5L8.648 9.507C8.282 9.557 8 9.87 8 10.25s0.282 0.694 0.648 0.743L8.75 11h6.5l0.102-0.007C15.718 10.943 16 10.63 16 10.25s-0.282-0.694-0.648-0.743L15.25 9.5z" android:fillColor="@color/fluent_default_icon_tint"/> <path android:pathData="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10c-1.64 0-3.225-0.396-4.644-1.142l-4.29 1.117c-0.455 0.119-0.92-0.154-1.037-0.608-0.037-0.14-0.037-0.288 0-0.428l1.116-4.289C2.397 15.23 2 13.643 2 12 2 6.477 6.477 2 12 2zm1.252 11H8.75l-0.102 0.007C8.282 13.057 8 13.37 8 13.75s0.282 0.694 0.648 0.743L8.75 14.5h4.502l0.101-0.007c0.367-0.05 0.649-0.363 0.649-0.743s-0.282-0.694-0.649-0.743L13.252 13zm1.998-3.5h-6.5L8.648 9.507C8.282 9.557 8 9.87 8 10.25s0.282 0.694 0.648 0.743L8.75 11h6.5l0.102-0.007C15.718 10.943 16 10.63 16 10.25s-0.282-0.694-0.648-0.743L15.25 9.5z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector> </vector>