Skip to content

Commit

Permalink
🐛 fix crash (login page)
Browse files Browse the repository at this point in the history
  • Loading branch information
ourfor committed Dec 10, 2024
1 parent 221319d commit 612f7a1
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import top.ourfor.app.iplayx.R;
import top.ourfor.app.iplayx.action.DispatchAction;
import top.ourfor.app.iplayx.action.SiteUpdateAction;
import top.ourfor.app.iplayx.api.alist.AlistApi;
import top.ourfor.app.iplayx.api.cloud189.Cloud189Api;
Expand Down Expand Up @@ -83,7 +82,7 @@ public class LoginPage extends BottomSheetDialogFragment implements OneDriveActi
);

LoginPageBinding binding = null;
boolean isFragment = false;
boolean isPage = false;
@Setter
public boolean isDialogModel = false;
@Setter
Expand All @@ -101,7 +100,7 @@ public class LoginPage extends BottomSheetDialogFragment implements OneDriveActi
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
binding = LoginPageBinding.inflate(inflater, container, false);
isFragment = container != null;
isPage = false;
val actionBar = XGET(ActionBar.class);
if (!isDialogModel) {
XGET(NavigationTitleBar.class).setNavTitle(R.string.login);
Expand All @@ -120,7 +119,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c

void setup(LayoutInflater inflater, ViewGroup container) {
binding = LoginPageBinding.inflate(inflater, container, false);
isFragment = container != null;
val actionBar = XGET(ActionBar.class);
if (!isDialogModel) {
XGET(NavigationTitleBar.class).setNavTitle(R.string.login);
Expand Down Expand Up @@ -303,7 +301,7 @@ private void loginToEmby(String remake, String server, String username, String p
val action = XGET(SiteUpdateAction.class);
action.onSiteUpdate();
Toast.makeText(context, "Login success", Toast.LENGTH_SHORT).show();
if (isFragment) {
if (isPage) {
XGET(Navigator.class).popPage();
} else {
dismiss();
Expand Down Expand Up @@ -343,7 +341,7 @@ private void loginToJellyfin(String remake, String server, String username, Stri
val action = XGET(SiteUpdateAction.class);
action.onSiteUpdate();
Toast.makeText(context, "Login success", Toast.LENGTH_SHORT).show();
if (isFragment) {
if (isPage) {
XGET(Navigator.class).popPage();
} else {
dismiss();
Expand Down Expand Up @@ -587,7 +585,7 @@ public View view() {
@Override
public void create(Context context, Map<String, Object> params) {
this.context = context;
this.isFragment = true;
this.isPage = true;
setup(LayoutInflater.from(context), null);
}
}

0 comments on commit 612f7a1

Please sign in to comment.