Commit 2824b15b authored by Yusuke Iwaki's avatar Yusuke Iwaki

add WaitingView on Login screen.

parent 1e92423d
...@@ -42,6 +42,7 @@ public class LoginFragment extends AbstractServerConfigFragment { ...@@ -42,6 +42,7 @@ public class LoginFragment extends AbstractServerConfigFragment {
final View btnEmail = rootView.findViewById(R.id.btn_login_with_email); final View btnEmail = rootView.findViewById(R.id.btn_login_with_email);
final TextView txtUsername = (TextView) rootView.findViewById(R.id.editor_username); final TextView txtUsername = (TextView) rootView.findViewById(R.id.editor_username);
final TextView txtPasswd = (TextView) rootView.findViewById(R.id.editor_passwd); final TextView txtPasswd = (TextView) rootView.findViewById(R.id.editor_passwd);
final View waitingView = rootView.findViewById(R.id.waiting);
btnEmail.setOnClickListener(view -> { btnEmail.setOnClickListener(view -> {
final CharSequence username = txtUsername.getText(); final CharSequence username = txtUsername.getText();
final CharSequence passwd = txtPasswd.getText(); final CharSequence passwd = txtPasswd.getText();
...@@ -49,6 +50,7 @@ public class LoginFragment extends AbstractServerConfigFragment { ...@@ -49,6 +50,7 @@ public class LoginFragment extends AbstractServerConfigFragment {
return; return;
} }
view.setEnabled(false); view.setEnabled(false);
waitingView.setVisibility(View.VISIBLE);
new MethodCallHelper(getContext(), serverConfigId) new MethodCallHelper(getContext(), serverConfigId)
.loginWithEmail(username.toString(), passwd.toString()) .loginWithEmail(username.toString(), passwd.toString())
...@@ -56,6 +58,7 @@ public class LoginFragment extends AbstractServerConfigFragment { ...@@ -56,6 +58,7 @@ public class LoginFragment extends AbstractServerConfigFragment {
if (task.isFaulted()) { if (task.isFaulted()) {
showError(task.getError().getMessage()); showError(task.getError().getMessage());
view.setEnabled(true); view.setEnabled(true);
waitingView.setVisibility(View.GONE);
} }
return null; return null;
}); });
......
...@@ -120,5 +120,12 @@ ...@@ -120,5 +120,12 @@
app:fabSize="normal" app:fabSize="normal"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp" /> app:srcCompat="@drawable/ic_arrow_forward_white_24dp" />
</FrameLayout> </FrameLayout>
<chat.rocket.android.widget.WaitingView
android:id="@+id/waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment