diff --git a/mastodon/build.gradle b/mastodon/build.gradle index 68b677b6..a0996dca 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -76,7 +76,7 @@ dependencies { implementation 'me.grishka.litex:viewpager:1.0.0' implementation 'me.grishka.litex:viewpager2:1.0.0' implementation 'me.grishka.litex:palette:1.0.0' - implementation 'me.grishka.appkit:appkit:1.2.8' + implementation 'me.grishka.appkit:appkit:1.2.9' implementation 'com.google.code.gson:gson:2.8.9' implementation 'org.jsoup:jsoup:1.14.3' implementation 'com.squareup:otto:1.3.8' diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index de5412d5..7fb4c517 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -252,7 +252,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr selfAvatar=view.findViewById(R.id.avatar); HtmlParser.setTextWithCustomEmoji(selfName, self.displayName, self.emojis); selfUsername.setText('@'+self.username+'@'+instanceDomain); - ViewImageLoader.load(selfAvatar, null, new UrlImageLoaderRequest(self.avatar)); + if(self.avatar!=null) + ViewImageLoader.load(selfAvatar, null, new UrlImageLoaderRequest(self.avatar)); ViewOutlineProvider roundCornersOutline=new ViewOutlineProvider(){ @Override public void getOutline(View view, Outline outline){ @@ -960,6 +961,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr } private void updateVisibilityIcon(){ + if(getActivity()==null) + return; if(statusVisibility==null){ // TODO find out why this happens statusVisibility=StatusPrivacy.PUBLIC; } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java index 8d4209ea..12b05a9b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java @@ -349,7 +349,7 @@ public class NotificationsListFragment extends BaseStatusListFragment(){ @Override public void onSuccess(Account result){ + savingEdits=false; account=result; AccountSessionManager.getInstance().updateAccountInfo(accountID, account); exitEditMode(); @@ -878,6 +881,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList @Override public void onError(ErrorResponse error){ + savingEdits=false; error.showToast(getActivity()); setActionProgressVisible(false); } @@ -901,6 +905,8 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList @Override public boolean onBackPressed(){ if(isInEditMode){ + if(savingEdits) + return true; if(editDirty || aboutFragment.isEditDirty()){ new M3AlertDialogBuilder(getActivity()) .setTitle(R.string.discard_changes) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java index 4b183cfe..d455ee47 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java @@ -279,7 +279,7 @@ public class SearchQueryFragment extends MastodonRecyclerFragment0 && filteredData.get(0)==fakeInstance){ if(list.findViewHolderForAdapterPosition(1) instanceof BindableViewHolder ivh){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java b/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java index 3d3bc147..23e93823 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/AccountSwitcherSheet.java @@ -255,7 +255,8 @@ public class AccountSwitcherSheet extends BottomSheet{ } return; } - AccountSessionManager.getInstance().setLastActiveAccountID(item.getID()); + if(AccountSessionManager.getInstance().tryGetAccount(item.getID())!=null) + AccountSessionManager.getInstance().setLastActiveAccountID(item.getID()); activity.finish(); activity.startActivity(new Intent(activity, MainActivity.class)); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/SearchViewHelper.java b/mastodon/src/main/java/org/joinmastodon/android/ui/SearchViewHelper.java index 3a6a85c4..d816b715 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/SearchViewHelper.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/SearchViewHelper.java @@ -126,4 +126,8 @@ public class SearchViewHelper{ public View getDivider(){ return divider; } + + public EditText getSearchEdit(){ + return searchEdit; + } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java index 86bdac1c..f8055c22 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java @@ -280,6 +280,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{ } private void updateOptionsMenu(){ + if(item.parentFragment.getActivity()==null) + return; Account account=item.user; Menu menu=optionsMenu.getMenu(); boolean isOwnPost=AccountSessionManager.getInstance().isSelf(item.parentFragment.getAccountID(), account);