mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
d69cdbb506
commit
3f228fc559
|
@ -420,6 +420,8 @@ public class FragmentAccount extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnAdvanced.getTop());
|
scroll.smoothScrollTo(0, btnAdvanced.getTop());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -781,6 +783,8 @@ public class FragmentAccount extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, cbIdentity.getBottom());
|
scroll.smoothScrollTo(0, cbIdentity.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1371,6 +1375,8 @@ public class FragmentAccount extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
if (provider != null && provider.documentation != null)
|
if (provider != null && provider.documentation != null)
|
||||||
scroll.smoothScrollTo(0, tvInstructions.getBottom());
|
scroll.smoothScrollTo(0, tvInstructions.getBottom());
|
||||||
else
|
else
|
||||||
|
@ -1695,6 +1701,8 @@ public class FragmentAccount extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, (save ? btnSave : btnCheck).getBottom());
|
scroll.smoothScrollTo(0, (save ? btnSave : btnCheck).getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -579,6 +579,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
getMainHandler().postDelayed(new Runnable() {
|
getMainHandler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
if (styling != selection) {
|
if (styling != selection) {
|
||||||
styling = selection;
|
styling = selection;
|
||||||
media_bar.getMenu().clear();
|
media_bar.getMenu().clear();
|
||||||
|
@ -1688,6 +1690,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
if (grpAddresses.getVisibility() == View.GONE)
|
if (grpAddresses.getVisibility() == View.GONE)
|
||||||
etSubject.requestFocus();
|
etSubject.requestFocus();
|
||||||
else
|
else
|
||||||
|
@ -6255,6 +6259,9 @@ public class FragmentCompose extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
|
|
||||||
if (target instanceof EditText) {
|
if (target instanceof EditText) {
|
||||||
EditText et = (EditText) target;
|
EditText et = (EditText) target;
|
||||||
int len = et.length();
|
int len = et.length();
|
||||||
|
|
|
@ -60,6 +60,7 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
import androidx.core.net.MailTo;
|
import androidx.core.net.MailTo;
|
||||||
import androidx.core.util.PatternsCompat;
|
import androidx.core.util.PatternsCompat;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
@ -344,6 +345,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
||||||
ApplicationEx.getMainHandler().post(new Runnable() {
|
ApplicationEx.getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
dview.scrollTo(0, tvOwner.getBottom());
|
dview.scrollTo(0, tvOwner.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -382,6 +382,8 @@ public class FragmentFolder extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnSave.getBottom());
|
scroll.smoothScrollTo(0, btnSave.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -55,6 +55,7 @@ import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -270,6 +271,8 @@ public class FragmentGmail extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
etName.requestFocus();
|
etName.requestFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -335,6 +338,8 @@ public class FragmentGmail extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, tvError.getBottom());
|
scroll.smoothScrollTo(0, tvError.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -565,6 +570,8 @@ public class FragmentGmail extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, tvError.getBottom());
|
scroll.smoothScrollTo(0, tvError.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -371,6 +371,8 @@ public class FragmentIdentity extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnAdvanced.getTop());
|
scroll.smoothScrollTo(0, btnAdvanced.getTop());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1071,6 +1073,8 @@ public class FragmentIdentity extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
if (provider != null && provider.documentation != null)
|
if (provider != null && provider.documentation != null)
|
||||||
scroll.smoothScrollTo(0, tvInstructions.getBottom());
|
scroll.smoothScrollTo(0, tvInstructions.getBottom());
|
||||||
else
|
else
|
||||||
|
@ -1361,6 +1365,8 @@ public class FragmentIdentity extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnSave.getBottom());
|
scroll.smoothScrollTo(0, btnSave.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,6 +50,7 @@ import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import net.openid.appauth.AppAuthConfiguration;
|
import net.openid.appauth.AppAuthConfiguration;
|
||||||
|
@ -929,6 +930,8 @@ public class FragmentOAuth extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, tvError.getBottom());
|
scroll.smoothScrollTo(0, tvError.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -447,13 +447,13 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
tvNetworkMetered.setText(networkState.isUnmetered() ? R.string.title_legend_unmetered : R.string.title_legend_metered);
|
return;
|
||||||
tvNetworkInfo.setText(sb.toString());
|
tvNetworkMetered.setText(networkState.isUnmetered() ? R.string.title_legend_unmetered : R.string.title_legend_metered);
|
||||||
tvNetworkMetered.setVisibility(networkState.isConnected() ? View.VISIBLE : View.GONE);
|
tvNetworkInfo.setText(sb.toString());
|
||||||
tvNetworkRoaming.setVisibility(networkState.isRoaming() ? View.VISIBLE : View.GONE);
|
tvNetworkMetered.setVisibility(networkState.isConnected() ? View.VISIBLE : View.GONE);
|
||||||
cardDebug.setVisibility(sb.length() == 0 ? View.GONE : View.VISIBLE);
|
tvNetworkRoaming.setVisibility(networkState.isRoaming() ? View.VISIBLE : View.GONE);
|
||||||
}
|
cardDebug.setVisibility(sb.length() == 0 ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,6 +529,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
ApplicationEx.getMainHandler().post(new Runnable() {
|
ApplicationEx.getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
etPin.requestFocus();
|
etPin.requestFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -677,6 +677,8 @@ public class FragmentPop extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, tvError.getBottom());
|
scroll.smoothScrollTo(0, tvError.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -854,6 +856,8 @@ public class FragmentPop extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnSave.getBottom());
|
scroll.smoothScrollTo(0, btnSave.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,6 +47,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
|
@ -546,6 +547,8 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnSupport.getBottom());
|
scroll.smoothScrollTo(0, btnSupport.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -575,6 +578,8 @@ public class FragmentQuickSetup extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, btnSupport.getBottom());
|
scroll.smoothScrollTo(0, btnSupport.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,6 +56,7 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
@ -483,6 +484,8 @@ public class FragmentRule extends FragmentBase {
|
||||||
getMainHandler().post(new Runnable() {
|
getMainHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||||
|
return;
|
||||||
scroll.smoothScrollTo(0, content.getBottom());
|
scroll.smoothScrollTo(0, content.getBottom());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue