A bunch of crash fixes
This commit is contained in:
parent
66489d79be
commit
85d4c1fc24
|
@ -76,7 +76,7 @@ dependencies {
|
||||||
implementation 'me.grishka.litex:viewpager:1.0.0'
|
implementation 'me.grishka.litex:viewpager:1.0.0'
|
||||||
implementation 'me.grishka.litex:viewpager2:1.0.0'
|
implementation 'me.grishka.litex:viewpager2:1.0.0'
|
||||||
implementation 'me.grishka.litex:palette: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 'com.google.code.gson:gson:2.8.9'
|
||||||
implementation 'org.jsoup:jsoup:1.14.3'
|
implementation 'org.jsoup:jsoup:1.14.3'
|
||||||
implementation 'com.squareup:otto:1.3.8'
|
implementation 'com.squareup:otto:1.3.8'
|
||||||
|
|
|
@ -252,7 +252,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
selfAvatar=view.findViewById(R.id.avatar);
|
selfAvatar=view.findViewById(R.id.avatar);
|
||||||
HtmlParser.setTextWithCustomEmoji(selfName, self.displayName, self.emojis);
|
HtmlParser.setTextWithCustomEmoji(selfName, self.displayName, self.emojis);
|
||||||
selfUsername.setText('@'+self.username+'@'+instanceDomain);
|
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(){
|
ViewOutlineProvider roundCornersOutline=new ViewOutlineProvider(){
|
||||||
@Override
|
@Override
|
||||||
public void getOutline(View view, Outline outline){
|
public void getOutline(View view, Outline outline){
|
||||||
|
@ -960,6 +961,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVisibilityIcon(){
|
private void updateVisibilityIcon(){
|
||||||
|
if(getActivity()==null)
|
||||||
|
return;
|
||||||
if(statusVisibility==null){ // TODO find out why this happens
|
if(statusVisibility==null){ // TODO find out why this happens
|
||||||
statusVisibility=StatusPrivacy.PUBLIC;
|
statusVisibility=StatusPrivacy.PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMarkAllReadButton(){
|
private void updateMarkAllReadButton(){
|
||||||
markAllReadItem.setEnabled(!data.isEmpty() && !realUnreadMarker.equals(data.get(0).id));
|
markAllReadItem.setEnabled(!data.isEmpty() && realUnreadMarker!=null && !realUnreadMarker.equals(data.get(0).id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
private boolean tabBarIsAtTop;
|
private boolean tabBarIsAtTop;
|
||||||
private Animator tabBarColorAnim;
|
private Animator tabBarColorAnim;
|
||||||
private MenuItem editSaveMenuItem;
|
private MenuItem editSaveMenuItem;
|
||||||
|
private boolean savingEdits;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
|
@ -866,10 +867,12 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
if(!isInEditMode)
|
if(!isInEditMode)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
setActionProgressVisible(true);
|
setActionProgressVisible(true);
|
||||||
|
savingEdits=true;
|
||||||
new UpdateAccountCredentials(nameEdit.getText().toString(), bioEdit.getText().toString(), editNewAvatar, editNewCover, aboutFragment.getFields())
|
new UpdateAccountCredentials(nameEdit.getText().toString(), bioEdit.getText().toString(), editNewAvatar, editNewCover, aboutFragment.getFields())
|
||||||
.setCallback(new Callback<>(){
|
.setCallback(new Callback<>(){
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Account result){
|
public void onSuccess(Account result){
|
||||||
|
savingEdits=false;
|
||||||
account=result;
|
account=result;
|
||||||
AccountSessionManager.getInstance().updateAccountInfo(accountID, account);
|
AccountSessionManager.getInstance().updateAccountInfo(accountID, account);
|
||||||
exitEditMode();
|
exitEditMode();
|
||||||
|
@ -878,6 +881,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(ErrorResponse error){
|
public void onError(ErrorResponse error){
|
||||||
|
savingEdits=false;
|
||||||
error.showToast(getActivity());
|
error.showToast(getActivity());
|
||||||
setActionProgressVisible(false);
|
setActionProgressVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -901,6 +905,8 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||||
@Override
|
@Override
|
||||||
public boolean onBackPressed(){
|
public boolean onBackPressed(){
|
||||||
if(isInEditMode){
|
if(isInEditMode){
|
||||||
|
if(savingEdits)
|
||||||
|
return true;
|
||||||
if(editDirty || aboutFragment.isEditDirty()){
|
if(editDirty || aboutFragment.isEditDirty()){
|
||||||
new M3AlertDialogBuilder(getActivity())
|
new M3AlertDialogBuilder(getActivity())
|
||||||
.setTitle(R.string.discard_changes)
|
.setTitle(R.string.discard_changes)
|
||||||
|
|
|
@ -279,7 +279,7 @@ public class SearchQueryFragment extends MastodonRecyclerFragment<SearchResultVi
|
||||||
@Override
|
@Override
|
||||||
protected void onShown(){
|
protected void onShown(){
|
||||||
super.onShown();
|
super.onShown();
|
||||||
getActivity().getSystemService(InputMethodManager.class).showSoftInput(getActivity().getCurrentFocus(), 0);
|
getActivity().getSystemService(InputMethodManager.class).showSoftInput(searchViewHelper.getSearchEdit(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class AccountActivationFragment extends ToolbarFragment{
|
||||||
private APIRequest currentRequest;
|
private APIRequest currentRequest;
|
||||||
private Runnable resendTimer=this::updateResendTimer;
|
private Runnable resendTimer=this::updateResendTimer;
|
||||||
private long lastResendTime;
|
private long lastResendTime;
|
||||||
|
private boolean visible;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
|
@ -111,12 +112,14 @@ public class AccountActivationFragment extends ToolbarFragment{
|
||||||
@Override
|
@Override
|
||||||
protected void onShown(){
|
protected void onShown(){
|
||||||
super.onShown();
|
super.onShown();
|
||||||
|
visible=true;
|
||||||
tryGetAccount();
|
tryGetAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHidden(){
|
protected void onHidden(){
|
||||||
super.onHidden();
|
super.onHidden();
|
||||||
|
visible=false;
|
||||||
if(currentRequest!=null){
|
if(currentRequest!=null){
|
||||||
currentRequest.cancel();
|
currentRequest.cancel();
|
||||||
currentRequest=null;
|
currentRequest=null;
|
||||||
|
@ -229,6 +232,8 @@ public class AccountActivationFragment extends ToolbarFragment{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void proceed(){
|
private void proceed(){
|
||||||
|
if(!visible)
|
||||||
|
return;
|
||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
// Nav.goClearingStack(getActivity(), HomeFragment.class, args);
|
// Nav.goClearingStack(getActivity(), HomeFragment.class, args);
|
||||||
|
|
|
@ -228,7 +228,7 @@ abstract class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInsta
|
||||||
}
|
}
|
||||||
loadingInstanceDomain=null;
|
loadingInstanceDomain=null;
|
||||||
showInstanceInfoLoadError(domain, error);
|
showInstanceInfoLoadError(domain, error);
|
||||||
if(fakeInstance!=null){
|
if(fakeInstance!=null && getActivity()!=null){
|
||||||
fakeInstance.description=getString(R.string.error);
|
fakeInstance.description=getString(R.string.error);
|
||||||
if(filteredData.size()>0 && filteredData.get(0)==fakeInstance){
|
if(filteredData.size()>0 && filteredData.get(0)==fakeInstance){
|
||||||
if(list.findViewHolderForAdapterPosition(1) instanceof BindableViewHolder<?> ivh){
|
if(list.findViewHolderForAdapterPosition(1) instanceof BindableViewHolder<?> ivh){
|
||||||
|
|
|
@ -255,7 +255,8 @@ public class AccountSwitcherSheet extends BottomSheet{
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AccountSessionManager.getInstance().setLastActiveAccountID(item.getID());
|
if(AccountSessionManager.getInstance().tryGetAccount(item.getID())!=null)
|
||||||
|
AccountSessionManager.getInstance().setLastActiveAccountID(item.getID());
|
||||||
activity.finish();
|
activity.finish();
|
||||||
activity.startActivity(new Intent(activity, MainActivity.class));
|
activity.startActivity(new Intent(activity, MainActivity.class));
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,4 +126,8 @@ public class SearchViewHelper{
|
||||||
public View getDivider(){
|
public View getDivider(){
|
||||||
return divider;
|
return divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EditText getSearchEdit(){
|
||||||
|
return searchEdit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOptionsMenu(){
|
private void updateOptionsMenu(){
|
||||||
|
if(item.parentFragment.getActivity()==null)
|
||||||
|
return;
|
||||||
Account account=item.user;
|
Account account=item.user;
|
||||||
Menu menu=optionsMenu.getMenu();
|
Menu menu=optionsMenu.getMenu();
|
||||||
boolean isOwnPost=AccountSessionManager.getInstance().isSelf(item.parentFragment.getAccountID(), account);
|
boolean isOwnPost=AccountSessionManager.getInstance().isSelf(item.parentFragment.getAccountID(), account);
|
||||||
|
|
Loading…
Reference in New Issue