From 2d27f48f2146c1dbd191ad9871c0122602163379 Mon Sep 17 00:00:00 2001 From: Kosh Date: Sun, 12 Mar 2017 23:53:58 +0800 Subject: [PATCH] fixed an error in login when progress doesn't disappear onerror. releasing 1.1.1 --- .../data/dao/FragmentPagerAdapterModel.java | 4 ++-- .../tasks/git/GithubActionService.java | 4 ++-- .../notification/ReadNotificationService.java | 4 ++-- .../ui/modules/login/LoginPresenter.java | 5 +++- .../ui/modules/login/LoginView.java | 23 ++++++++----------- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java b/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java index 5e0624f7c..177101536 100644 --- a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java +++ b/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java @@ -108,9 +108,9 @@ public static List buildForRepoCode(@NonNull Context @NonNull public static List buildForRepoIssue(@NonNull Context context, @NonNull String login, @NonNull String repoId) { return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.opened), - RepoOpenedIssuesView.newInstance(repoId, login, IssueState.open)), + RepoOpenedIssuesView.newInstance(repoId, login)), new FragmentPagerAdapterModel(context.getString(R.string.closed), - RepoClosedIssuesView.newInstance(repoId, login, IssueState.closed))) + RepoClosedIssuesView.newInstance(repoId, login))) .collect(Collectors.toList()); } diff --git a/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java b/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java index 2cd7fdc5e..f77c99fea 100644 --- a/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java +++ b/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java @@ -46,7 +46,7 @@ public class GithubActionService extends IntentService { public static void startForRepo(@NonNull Context context, @NonNull String login, @NonNull String repo, @GitActionType int type) { - Intent intent = new Intent(context, GithubActionService.class); + Intent intent = new Intent(context.getApplicationContext(), GithubActionService.class); intent.putExtras(Bundler.start() .put(BundleConstant.ID, repo) .put(BundleConstant.EXTRA, login) @@ -56,7 +56,7 @@ public static void startForRepo(@NonNull Context context, @NonNull String login, } public static void startForGist(@NonNull Context context, @NonNull String id, @GitActionType int type) { - Intent intent = new Intent(context, GithubActionService.class); + Intent intent = new Intent(context.getApplicationContext(), GithubActionService.class); intent.putExtras(Bundler.start() .put(BundleConstant.ID, id) .put(BundleConstant.EXTRA_TYPE, type) diff --git a/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java b/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java index 03b475012..4d298d89f 100644 --- a/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java +++ b/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java @@ -24,7 +24,7 @@ public class ReadNotificationService extends IntentService { public static final int READ_ALL = 2; public static void start(@NonNull Context context, long id) { - Intent intent = new Intent(context, ReadNotificationService.class); + Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); intent.putExtras(Bundler.start() .put(BundleConstant.EXTRA_TYPE, READ_SINGLE) .put(BundleConstant.ID, id) @@ -33,7 +33,7 @@ public static void start(@NonNull Context context, long id) { } public static void start(@NonNull Context context, @NonNull long[] ids) { - Intent intent = new Intent(context, ReadNotificationService.class); + Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); intent.putExtras(Bundler.start() .put(BundleConstant.EXTRA_TYPE, READ_ALL) .put(BundleConstant.ID, ids) diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java index 1b3c8b7e5..b9b579292 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java +++ b/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java @@ -89,7 +89,10 @@ class LoginPresenter extends BasePresenter implements LoginMvp.Pr sendToView(LoginMvp.View::onRequire2Fa); return; } else { - sendToView(LoginMvp.View::onRequireLogin); + sendToView(view -> { + view.hideProgress(); + view.onRequireLogin(); + }); return; } } diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/LoginView.java b/app/src/main/java/com/fastaccess/ui/modules/login/LoginView.java index cec18b1af..5c5d880d1 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/login/LoginView.java +++ b/app/src/main/java/com/fastaccess/ui/modules/login/LoginView.java @@ -93,23 +93,18 @@ public class LoginView extends BaseActivity imple super.showMessage(titleRes, msgRes); } - @Override public void showProgress(@StringRes int resId) { - AnimHelper.animateVisibility(login, false, new AnimHelper.AnimationCallback() { - @Override public void onAnimationEnd() { - AnimHelper.animateVisibility(progress, true); - } + @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { + hideProgress(); + super.showMessage(titleRes, msgRes); + } - @Override public void onAnimationStart() {} - }); + @Override public void showProgress(@StringRes int resId) { + login.hide(); + AnimHelper.animateVisibility(progress, true); } @Override public void hideProgress() { - AnimHelper.animateVisibility(progress, false, new AnimHelper.AnimationCallback() { - @Override public void onAnimationEnd() { - AnimHelper.animateVisibility(login, true); - } - - @Override public void onAnimationStart() {} - }); + progress.setVisibility(View.GONE); + login.show(); } }