mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 13:08:59 -04:00
Fix behaviour of Login Dialogs
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
package com.dragons.aurora.activities;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -45,14 +44,6 @@ public class DetailsActivity extends AuroraActivity implements OnAppInstalledLis
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachFragment(Fragment fragment) {
|
||||
super.onAttachFragment(fragment);
|
||||
if (fragment instanceof OnAppInstalledListener) {
|
||||
mListener = (OnAppInstalledListener) fragment;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@@ -103,7 +103,6 @@ public class AccountsFragment extends BaseFragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
myEmail = Prefs.getString(getActivity(), Aurora.PREFERENCE_EMAIL);
|
||||
isSecAvailable = Prefs.getBoolean(getActivity(), Aurora.SEC_ACCOUNT);
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,7 +117,7 @@ public class AccountsFragment extends BaseFragment {
|
||||
else if (Accountant.isLoggedIn(getContext()) && Accountant.isDummy(getContext()))
|
||||
drawDummy();
|
||||
else
|
||||
getContext().startActivity(new Intent(getContext(), LoginActivity.class));
|
||||
askLogin();
|
||||
|
||||
chipTOS.setChipStrokeWidth(2);
|
||||
chipAdd.setChipStrokeWidth(2);
|
||||
@@ -248,5 +247,21 @@ public class AccountsFragment extends BaseFragment {
|
||||
mDialog.show(ft, "login");
|
||||
}
|
||||
|
||||
|
||||
private void askLogin() {
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
Fragment prev = getFragmentManager().findFragmentByTag("login");
|
||||
if (prev != null) {
|
||||
ft.remove(prev);
|
||||
}
|
||||
ft.addToBackStack(null);
|
||||
GenericDialog mDialog = new GenericDialog();
|
||||
mDialog.setDialogTitle(getString(R.string.action_login));
|
||||
mDialog.setDialogMessage(getString(R.string.header_usr_noEmail));
|
||||
mDialog.setPositiveButton(getString(R.string.action_login), v -> {
|
||||
mDialog.dismiss();
|
||||
getContext().startActivity(new Intent(getContext(), LoginActivity.class));
|
||||
});
|
||||
mDialog.setNegativeButton("Not now", v -> getActivity().finishAndRemoveTask());
|
||||
mDialog.show(ft, "login");
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,7 @@ public class ContainerFragment extends Fragment implements UpdatableAppsFragment
|
||||
|
||||
private void askLogin() {
|
||||
if (!Prefs.getBoolean(getContext(), Aurora.LOGIN_PROMPTED)) {
|
||||
Prefs.putBoolean(getContext(), Aurora.LOGIN_PROMPTED, true);
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
Fragment prev = getFragmentManager().findFragmentByTag("login");
|
||||
if (prev != null) {
|
||||
@@ -132,11 +133,11 @@ public class ContainerFragment extends Fragment implements UpdatableAppsFragment
|
||||
mDialog.setDialogTitle(getString(R.string.action_login));
|
||||
mDialog.setDialogMessage(getString(R.string.header_usr_noEmail));
|
||||
mDialog.setPositiveButton(getString(R.string.action_login), v -> {
|
||||
getContext().startActivity(new Intent(getContext(), LoginActivity.class));
|
||||
Prefs.putBoolean(getContext(), Aurora.LOGIN_PROMPTED, false);
|
||||
mDialog.dismiss();
|
||||
getContext().startActivity(new Intent(getContext(), LoginActivity.class));
|
||||
});
|
||||
mDialog.show(ft, "login");
|
||||
Prefs.putBoolean(getContext(), Aurora.LOGIN_PROMPTED, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user