diff --git a/android/app/src/main/cpp/native.cpp b/android/app/src/main/cpp/native.cpp
index 518c958f26..12a7af622e 100644
--- a/android/app/src/main/cpp/native.cpp
+++ b/android/app/src/main/cpp/native.cpp
@@ -266,6 +266,14 @@ Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeCancelLogin(JNIE
}
+JNIEXPORT void JNICALL
+Java_io_highfidelity_hifiinterface_fragment_SignupFragment_nativeCancelLogin(JNIEnv *env,
+ jobject instance) {
+
+ Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeCancelLogin(env, instance);
+}
+
+
JNIEXPORT void JNICALL
Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(JNIEnv *env, jobject instance,
jstring username_, jstring password_,
@@ -307,6 +315,15 @@ Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(JNIEnv *en
Q_ARG(const QString&, username), Q_ARG(const QString&, password));
}
+JNIEXPORT void JNICALL
+Java_io_highfidelity_hifiinterface_fragment_SignupFragment_nativeLogin(JNIEnv *env,
+ jobject instance,
+ jstring username_,
+ jstring password_,
+ jobject usernameChangedListener) {
+ Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(env, instance, username_, password_, usernameChangedListener);
+}
+
JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeInitAfterAppLoaded(JNIEnv* env, jobject obj) {
AndroidHelper::instance().moveToThread(qApp->thread());
}
diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/MainActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/MainActivity.java
index ab85852ed0..aecbb3fc2f 100644
--- a/android/app/src/main/java/io/highfidelity/hifiinterface/MainActivity.java
+++ b/android/app/src/main/java/io/highfidelity/hifiinterface/MainActivity.java
@@ -25,7 +25,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
-import android.widget.Toast;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
@@ -34,6 +33,7 @@ import io.highfidelity.hifiinterface.fragment.FriendsFragment;
import io.highfidelity.hifiinterface.fragment.HomeFragment;
import io.highfidelity.hifiinterface.fragment.LoginFragment;
import io.highfidelity.hifiinterface.fragment.PolicyFragment;
+import io.highfidelity.hifiinterface.fragment.SignedInFragment;
import io.highfidelity.hifiinterface.fragment.SignupFragment;
import io.highfidelity.hifiinterface.task.DownloadProfileImageTask;
@@ -41,7 +41,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
LoginFragment.OnLoginInteractionListener,
HomeFragment.OnHomeInteractionListener,
FriendsFragment.OnHomeInteractionListener,
- SignupFragment.OnSignupInteractionListener {
+ SignupFragment.OnSignupInteractionListener,
+ SignedInFragment.OnSignedInInteractionListener {
private static final int PROFILE_PICTURE_PLACEHOLDER = R.drawable.default_profile_avatar;
public static final String DEFAULT_FRAGMENT = "Home";
@@ -138,10 +139,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private void loadLoginFragment() {
Fragment fragment = LoginFragment.newInstance();
-
loadFragment(fragment, getString(R.string.login), getString(R.string.tagFragmentLogin), true);
}
+ private void loadSignedInFragment() {
+ Fragment fragment = SignedInFragment.newInstance();
+ loadFragment(fragment, getString(R.string.welcome), getString(R.string.tagFragmentSignedIn), true);
+ }
+
private void loadSignupFragment() {
Fragment fragment = SignupFragment.newInstance();
@@ -316,6 +321,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
+ @Override
+ public void onGettingStarted() {
+ loadHomeFragment(false);
+ if (backToScene) {
+ backToScene = false;
+ goToLastLocation();
+ }
+ }
+
@Override
public void onLoginRequested() {
loadLoginFragment();
@@ -328,8 +342,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
@Override
public void onSignupCompleted() {
- Toast.makeText(this, "Sign up succeeded", Toast.LENGTH_SHORT).show();
- loadLoginFragment();
+ loadSignedInFragment();
+ updateLoginMenu();
}
public void handleUsernameChanged(String username) {
diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/LoginFragment.java b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/LoginFragment.java
index 764e0c8ed5..f22e5cd6bb 100644
--- a/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/LoginFragment.java
+++ b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/LoginFragment.java
@@ -59,7 +59,7 @@ public class LoginFragment extends Fragment {
mError = rootView.findViewById(R.id.error);
mLoginButton = rootView.findViewById(R.id.loginButton);
mForgotPassword = rootView.findViewById(R.id.forgotPassword);
- mSignup = rootView.findViewById(R.id.signup);
+ mSignup = rootView.findViewById(R.id.signupButton);
mLoginButton.setOnClickListener(view -> login());
diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java
new file mode 100644
index 0000000000..9ed2f1c7f5
--- /dev/null
+++ b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java
@@ -0,0 +1,73 @@
+package io.highfidelity.hifiinterface.fragment;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.Html;
+import android.text.Spanned;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import io.highfidelity.hifiinterface.R;
+
+public class SignedInFragment extends Fragment {
+
+ private Button mGetStartedButton;
+ private OnSignedInInteractionListener mListener;
+
+ public SignedInFragment() {
+ // Required empty public constructor
+ }
+
+ public static SignedInFragment newInstance() {
+ SignedInFragment fragment = new SignedInFragment();
+ return fragment;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_signedin, container, false);
+ mGetStartedButton = rootView.findViewById(R.id.getStarted);
+
+ mGetStartedButton.setOnClickListener(view -> {
+ getStarted();
+ });
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ if (context instanceof SignedInFragment.OnSignedInInteractionListener) {
+ mListener = (SignedInFragment.OnSignedInInteractionListener) context;
+ } else {
+ throw new RuntimeException(context.toString()
+ + " must implement OnSignedInInteractionListener");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mListener = null;
+ }
+
+ public void getStarted() {
+ if (mListener != null) {
+ mListener.onGettingStarted();
+ }
+ }
+
+ public interface OnSignedInInteractionListener {
+ void onGettingStarted();
+ }
+
+}
diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignupFragment.java b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignupFragment.java
index eb3a20b449..33644e5bda 100644
--- a/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignupFragment.java
+++ b/android/app/src/main/java/io/highfidelity/hifiinterface/fragment/SignupFragment.java
@@ -1,5 +1,6 @@
package io.highfidelity.hifiinterface.fragment;
+import android.app.Activity;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.content.Context;
@@ -26,7 +27,7 @@ public class SignupFragment extends Fragment {
private EditText mUsername;
private EditText mPassword;
private TextView mError;
- private TextView mLogin;
+ private TextView mCancelButton;
private Button mSignupButton;
@@ -34,6 +35,8 @@ public class SignupFragment extends Fragment {
public native void nativeSignup(String email, String username, String password); // move to SignupFragment
public native void nativeCancelSignup();
+ public native void nativeLogin(String username, String password, Activity usernameChangedListener);
+ public native void nativeCancelLogin();
private SignupFragment.OnSignupInteractionListener mListener;
@@ -56,10 +59,10 @@ public class SignupFragment extends Fragment {
mPassword = rootView.findViewById(R.id.password);
mError = rootView.findViewById(R.id.error);
mSignupButton = rootView.findViewById(R.id.signupButton);
- mLogin = rootView.findViewById(R.id.login);
+ mCancelButton = rootView.findViewById(R.id.cancelButton);
mSignupButton.setOnClickListener(view -> signup());
- mLogin.setOnClickListener(view -> login());
+ mCancelButton.setOnClickListener(view -> login());
mPassword.setOnEditorActionListener(
(textView, actionId, keyEvent) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
@@ -168,14 +171,19 @@ public class SignupFragment extends Fragment {
}
public void handleSignupCompleted() {
- getActivity().runOnUiThread(() -> {
- mSignupButton.setEnabled(true);
+ String username = mUsername.getText().toString().trim();
+ String password = mPassword.getText().toString();
+ mDialog.setMessage(getString(R.string.logging_in));
+ mDialog.setCancelable(true);
+ mDialog.setOnCancelListener(dialogInterface -> {
+ nativeCancelLogin();
cancelActivityIndicator();
if (mListener != null) {
- mListener.onSignupCompleted();
+ mListener.onLoginRequested();
}
- mError.setText("handleSignupCompleted");
});
+ mDialog.show();
+ nativeLogin(username, password, getActivity());
}
public void handleSignupFailed(String error) {
@@ -187,4 +195,23 @@ public class SignupFragment extends Fragment {
});
}
+ public void handleLoginCompleted(boolean success) {
+ getActivity().runOnUiThread(() -> {
+ mSignupButton.setEnabled(true);
+ cancelActivityIndicator();
+
+ if (success) {
+ if (mListener != null) {
+ mListener.onSignupCompleted();
+ }
+ } else {
+ // Registration was successful but login failed.
+ // Let the user to login manually
+ mListener.onLoginRequested();
+ }
+ });
+ }
+
+
+
}
diff --git a/android/app/src/main/res/drawable/rounded_secondary_button.xml b/android/app/src/main/res/drawable/rounded_secondary_button.xml
new file mode 100644
index 0000000000..6230885b30
--- /dev/null
+++ b/android/app/src/main/res/drawable/rounded_secondary_button.xml
@@ -0,0 +1,24 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/fragment_login.xml b/android/app/src/main/res/layout/fragment_login.xml
index 6066c46a10..e5a16b453f 100644
--- a/android/app/src/main/res/layout/fragment_login.xml
+++ b/android/app/src/main/res/layout/fragment_login.xml
@@ -21,10 +21,12 @@
android:id="@+id/error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
+ android:layout_marginBottom="25dp"
+ android:layout_marginLeft="9dp"
+ android:layout_marginRight="9dp"
android:fontFamily="@font/raleway"
android:textColor="@color/colorLoginError"
- android:textSize="12sp"
+ android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/username"
app:layout_constraintLeft_toLeftOf="@id/username"
android:visibility="invisible"/>
@@ -95,45 +97,47 @@
android:background="@drawable/rounded_button"
android:fontFamily="@font/raleway_semibold"
android:paddingBottom="0dp"
- android:paddingLeft="55dp"
- android:paddingRight="55dp"
+ android:paddingLeft="25dp"
+ android:paddingRight="25dp"
android:paddingTop="0dp"
android:text="@string/login"
android:textColor="@color/white_opaque"
android:textAllCaps="false"
- android:textSize="15sp"
+ android:textSize="18sp"
app:layout_constraintRight_toRightOf="@id/username"
- app:layout_constraintTop_toBottomOf="@id/passwordLayout"
+ app:layout_constraintTop_toBottomOf="@id/forgotPassword"
app:layout_goneMarginTop="4dp"/>
-
+ app:layout_constraintTop_toTopOf="@id/loginButton"
+ app:layout_goneMarginTop="4dp"/>
diff --git a/android/app/src/main/res/layout/fragment_signedin.xml b/android/app/src/main/res/layout/fragment_signedin.xml
new file mode 100644
index 0000000000..1c982b0e0d
--- /dev/null
+++ b/android/app/src/main/res/layout/fragment_signedin.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/layout/fragment_signup.xml b/android/app/src/main/res/layout/fragment_signup.xml
index 09e9ec352f..f83c8abd81 100644
--- a/android/app/src/main/res/layout/fragment_signup.xml
+++ b/android/app/src/main/res/layout/fragment_signup.xml
@@ -22,9 +22,11 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
+ android:layout_marginLeft="9dp"
+ android:layout_marginRight="9dp"
android:fontFamily="@font/raleway"
android:textColor="@color/colorLoginError"
- android:textSize="12sp"
+ android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/email"
app:layout_constraintLeft_toLeftOf="@id/email"
app:layout_constraintRight_toRightOf="@id/email"
@@ -71,7 +73,7 @@
android:textColorHint="@color/editTextColor"
android:gravity="left|center_vertical"
app:layout_constraintTop_toBottomOf="@id/email"
- android:layout_marginTop="13dp"
+ android:layout_marginTop="7dp"
android:hint="@string/username" />
@@ -87,7 +89,7 @@
app:passwordToggleDrawable="@drawable/selector_show_password"
app:hintEnabled="false"
app:layout_constraintTop_toBottomOf="@id/username"
- android:layout_marginTop="13dp"
+ android:layout_marginTop="7dp"
>
-
+ app:layout_goneMarginTop="4dp"/>
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
index 216b3491d8..fad2c98fb8 100644
--- a/android/app/src/main/res/values/colors.xml
+++ b/android/app/src/main/res/values/colors.xml
@@ -9,6 +9,7 @@
#3D3D3D
#1EB5EC
#00B4EF
+ #828282
#333333
#4F4F4F
#33999999
@@ -23,4 +24,6 @@
#FBD92A
#8A8A8A
#40000000
+ #F2F2F2
+
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 09057d40fd..1d9be76774 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -16,7 +16,7 @@
Password
Login
Logout
- Forgot password?\u00A0
+ Forgot password?\u00A0
Username or password incorrect.
Logging into High Fidelity
Search for a place by name\u00A0
@@ -25,9 +25,13 @@
Privacy Policy
Your Last Location
Online
- Sign up
+ Sign Up
Creating your High Fidelity account
Email, username or password incorrect.
+ You are now signed into High Fidelity
+ Welcome
+ Cancel
+ Get Started
tagFragmentHome
@@ -35,4 +39,5 @@
tagFragmentSignup
tagFragmentPolicy
tagFragmentPeople
+ tagFragmentSignedIn