mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 13:08:59 -04:00
Implement Login Activity
+ Small Modifications
This commit is contained in:
3
app/src/main/AndroidManifest.xml
Normal file → Executable file
3
app/src/main/AndroidManifest.xml
Normal file → Executable file
@@ -181,6 +181,9 @@
|
||||
<activity
|
||||
android:name=".activities.AboutActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".activities.LoginActivity"
|
||||
android:theme="@style/LoginTheme" />
|
||||
|
||||
<provider
|
||||
android:name="in.dragons.galaxy.FileProvider"
|
||||
|
||||
3
app/src/main/java/in/dragons/galaxy/activities/GalaxyActivity.java
Normal file → Executable file
3
app/src/main/java/in/dragons/galaxy/activities/GalaxyActivity.java
Normal file → Executable file
@@ -53,6 +53,9 @@ public class GalaxyActivity extends BaseActivity implements View.OnClickListener
|
||||
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
|
||||
if (!isLoggedIn()) {
|
||||
startActivity(new Intent(this, LoginActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
package in.dragons.galaxy.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.widget.ImageViewCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.yeriomin.playstoreapi.AuthException;
|
||||
import com.percolate.caffeine.PhoneUtils;
|
||||
import com.percolate.caffeine.ViewUtils;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import in.dragons.galaxy.CircleTransform;
|
||||
import in.dragons.galaxy.ContextUtil;
|
||||
import in.dragons.galaxy.CredentialsEmptyException;
|
||||
import in.dragons.galaxy.GoogleAccountInfo;
|
||||
import in.dragons.galaxy.PlayStoreApiAuthenticator;
|
||||
import in.dragons.galaxy.R;
|
||||
import in.dragons.galaxy.Util;
|
||||
import in.dragons.galaxy.builders.AccountTypeDialogBuilder;
|
||||
import in.dragons.galaxy.builders.CredentialsDialogBuilder;
|
||||
import in.dragons.galaxy.builders.UserProvidedAccountDialogBuilder;
|
||||
import in.dragons.galaxy.fragment.PreferenceFragment;
|
||||
import in.dragons.galaxy.fragment.UtilFragment;
|
||||
import in.dragons.galaxy.task.playstore.PlayStoreTask;
|
||||
|
||||
import static java.lang.Thread.sleep;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private SharedPreferences sharedPreferences;
|
||||
protected PlayStoreTask playStoreTask;
|
||||
private AutoCompleteTextView editEmail;
|
||||
private String Email;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
if (isConnected()) {
|
||||
init();
|
||||
}
|
||||
if (isLoggedIn()) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Email = sharedPreferences.getString(PlayStoreApiAuthenticator.PREFERENCE_EMAIL, "");
|
||||
Button login_anonymous = findViewById(R.id.btn_ok_anm);
|
||||
editEmail = findViewById(R.id.emailg);
|
||||
login_anonymous.setOnClickListener(v -> {
|
||||
LoginTask task = new LoginTask();
|
||||
task.setCaller(playStoreTask);
|
||||
task.setContext(this);
|
||||
task.prepareDialog(R.string.dialog_message_logging_in_predefined, R.string.dialog_title_logging_in);
|
||||
task.execute();
|
||||
});
|
||||
EditText editPassword = findViewById(R.id.passwordg);
|
||||
Button login_google = findViewById(R.id.button_okg);
|
||||
login_google.setOnClickListener(view -> {
|
||||
Context c = view.getContext();
|
||||
String email = editEmail.getText().toString();
|
||||
String password = editPassword.getText().toString();
|
||||
if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) {
|
||||
ContextUtil.toast(c.getApplicationContext(), R.string.error_credentials_empty);
|
||||
return;
|
||||
}
|
||||
getUserCredentialsTask().execute(email, password);
|
||||
});
|
||||
ImageView toggle_password = findViewById(R.id.toggle_password_visibility);
|
||||
toggle_password.setOnClickListener(v -> {
|
||||
boolean passwordVisible = !TextUtils.isEmpty((String) v.getTag());
|
||||
v.setTag(passwordVisible ? null : "tag");
|
||||
((ImageView) v).setImageResource(passwordVisible ? R.drawable.ic_visibility_on : R.drawable.ic_visibility_off);
|
||||
editPassword.setInputType(passwordVisible ? InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD : InputType.TYPE_CLASS_TEXT);
|
||||
});
|
||||
}
|
||||
|
||||
private UserProvidedCredentialsTask getUserCredentialsTask() {
|
||||
UserProvidedCredentialsTask task = new UserProvidedCredentialsTask();
|
||||
task.setCaller(playStoreTask);
|
||||
task.setContext(this);
|
||||
task.prepareDialog(R.string.dialog_message_logging_in_provided_by_user, R.string.dialog_title_logging_in);
|
||||
return task;
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class UserProvidedCredentialsTask extends CredentialsDialogBuilder.CheckCredentialsTask {
|
||||
|
||||
private String previousEmail;
|
||||
private String UNKNOWN = "Unknown user.";
|
||||
private String PICASAWEB = "picasaweb";
|
||||
private String Name, Url;
|
||||
|
||||
@Override
|
||||
protected CredentialsDialogBuilder getDialogBuilder() {
|
||||
return new UserProvidedAccountDialogBuilder(context).setPreviousEmail(previousEmail);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(String[] params) {
|
||||
if (params.length < 2
|
||||
|| params[0] == null
|
||||
|| params[1] == null
|
||||
|| TextUtils.isEmpty(params[0])
|
||||
|| TextUtils.isEmpty(params[1])
|
||||
) {
|
||||
exception = new CredentialsEmptyException();
|
||||
return null;
|
||||
}
|
||||
previousEmail = params[0];
|
||||
try {
|
||||
new PlayStoreApiAuthenticator(context).login(params[0], params[1]);
|
||||
addUsedEmail(params[0]);
|
||||
} catch (Throwable e) {
|
||||
if (e instanceof AuthException && null != ((AuthException) e).getTwoFactorUrl()) {
|
||||
addUsedEmail(params[0]);
|
||||
}
|
||||
exception = e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addUsedEmail(String email) {
|
||||
Set<String> emailsSet = Util.getStringSet(context, "USED_EMAILS_SET");
|
||||
emailsSet.add(email);
|
||||
Util.putStringSet(context, "USED_EMAILS_SET", emailsSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
if (success()) {
|
||||
PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().putBoolean("LOGGED_IN", true).apply();
|
||||
PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().putBoolean("GOOGLE_ACC", true).apply();
|
||||
PreferenceManager.getDefaultSharedPreferences(LoginActivity.this).edit().putBoolean("DUMMY_ACC", false).apply();
|
||||
setUser();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private void setUser() {
|
||||
Email = PreferenceFragment.getString(LoginActivity.this, PlayStoreApiAuthenticator.PREFERENCE_EMAIL);
|
||||
new GoogleAccountInfo(Email) {
|
||||
@Override
|
||||
public void onPostExecute(String result) {
|
||||
parseRAW(result);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void parseRAW(String rawData) {
|
||||
if (rawData.contains(PICASAWEB) && !rawData.contains(UNKNOWN)) {
|
||||
Name = rawData.substring(rawData.indexOf("<name>") + 6, rawData.indexOf("</name>"));
|
||||
Url = rawData.substring(rawData.indexOf("<gphoto:thumbnail>") + 18, rawData.lastIndexOf("</gphoto:thumbnail>"));
|
||||
} else {
|
||||
Name = Email;
|
||||
Url = "I dont fucking care";
|
||||
}
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("GOOGLE_NAME", Name).commit();
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("GOOGLE_URL", Url).commit();
|
||||
if (!Url.isEmpty()) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class LoginTask extends AccountTypeDialogBuilder.AppProvidedCredentialsTask {
|
||||
|
||||
@Override
|
||||
protected void payload() throws IOException {
|
||||
new PlayStoreApiAuthenticator(context).login();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("LOGGED_IN", true).apply();
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("DUMMY_ACC", true).apply();
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("GOOGLE_ACC", false).apply();
|
||||
LoginActivity.this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setText(int viewId, String text) {
|
||||
TextView textView = ViewUtils.findViewById(this, viewId);
|
||||
if (null != textView)
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
protected void setText(int viewId, int stringId, Object... text) {
|
||||
setText(viewId, this.getString(stringId, text));
|
||||
}
|
||||
|
||||
protected boolean isGoogle() {
|
||||
return PreferenceFragment.getBoolean(this, "GOOGLE_ACC");
|
||||
}
|
||||
|
||||
protected boolean isLoggedIn() {
|
||||
return PreferenceFragment.getBoolean(this, "LOGGED_IN");
|
||||
}
|
||||
|
||||
protected boolean isConnected() {
|
||||
return PhoneUtils.isNetworkAvailable(this);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package in.dragons.galaxy.fragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
@@ -21,6 +22,7 @@ import com.squareup.picasso.Picasso;
|
||||
import in.dragons.galaxy.CircleTransform;
|
||||
import in.dragons.galaxy.PlayStoreApiAuthenticator;
|
||||
import in.dragons.galaxy.R;
|
||||
import in.dragons.galaxy.activities.LoginActivity;
|
||||
|
||||
public class AccountsFragment extends UtilFragment {
|
||||
|
||||
@@ -52,7 +54,6 @@ public class AccountsFragment extends UtilFragment {
|
||||
drawGoogle();
|
||||
} else if (isLoggedIn() && isDummy())
|
||||
drawDummy();
|
||||
|
||||
setFab();
|
||||
|
||||
return v;
|
||||
|
||||
@@ -53,9 +53,7 @@ public class CategoryListFragment extends CategoryListTaskHelper {
|
||||
setupAllCategories();
|
||||
setupTopCategories();
|
||||
}
|
||||
} else
|
||||
LoginFirst();
|
||||
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
6
app/src/main/java/in/dragons/galaxy/fragment/UtilFragment.java
Normal file → Executable file
6
app/src/main/java/in/dragons/galaxy/fragment/UtilFragment.java
Normal file → Executable file
@@ -30,6 +30,7 @@ import in.dragons.galaxy.PlayStoreApiAuthenticator;
|
||||
import in.dragons.galaxy.R;
|
||||
import in.dragons.galaxy.Util;
|
||||
import in.dragons.galaxy.activities.AccountsActivity;
|
||||
import in.dragons.galaxy.activities.LoginActivity;
|
||||
import in.dragons.galaxy.builders.AccountTypeDialogBuilder;
|
||||
import in.dragons.galaxy.builders.CredentialsDialogBuilder;
|
||||
import in.dragons.galaxy.builders.UserProvidedAccountDialogBuilder;
|
||||
@@ -108,9 +109,8 @@ public abstract class UtilFragment extends Fragment {
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle("Logged Out ?")
|
||||
.setMessage(R.string.header_usr_noEmail)
|
||||
.setPositiveButton("Login", (dialogInterface, i) -> startActivity(new Intent(getActivity(), AccountsActivity.class)))
|
||||
.setNegativeButton("Dismiss", (dialogInterface, i) -> {
|
||||
})
|
||||
.setPositiveButton("Login", (dialogInterface, i) -> startActivity(new Intent(getActivity(), LoginActivity.class)))
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
208
app/src/main/res/layout-land/activity_login.xml
Normal file
208
app/src/main/res/layout-land/activity_login.xml
Normal file
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="5">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/topView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="2"
|
||||
android:background="?android:attr/colorAccent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:padding="10dp"
|
||||
android:text="@string/action_welcome_msg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/selectAccount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/welcome"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:text="@string/action_select"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/lightGray"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:background="@color/white"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/warn_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
android:visibility="gone"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="12dp"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:text="@string/credentials_message"
|
||||
android:textColor="?android:attr/colorAccent" />
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:srcCompat="@drawable/ic_google" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/imageView4"
|
||||
android:layout_alignTop="@+id/imageView4"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/imageView4"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/acc_google"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<android.support.v7.widget.AppCompatAutoCompleteTextView
|
||||
android:id="@+id/emailg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/imageView4"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:autofillHints="emailAddress"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:completionThreshold="1"
|
||||
android:hint="@string/credentials_hint_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:textColorHint="?android:attr/textColorPrimaryInverse" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/password_layoutg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/emailg"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:autofillHints="password"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:fontFamily="normal"
|
||||
android:hint="@string/credentials_hint_password"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:textColorHint="?android:attr/textColorPrimaryInverse" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toggle_password_visibility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/passwordg"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/ic_visibility_on"
|
||||
android:tint="?android:attr/textColorPrimaryInverse" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/password_layout_extg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/password_layoutg"
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_okg"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@+id/password_layout_extg"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/button_login"
|
||||
android:text="@string/action_login" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/anonymous_holder"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_below="@+id/or_txt"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:srcCompat="@drawable/ic_dummy_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/or_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/button_okg"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/action_or"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/anonymous_holder"
|
||||
android:layout_alignTop="@+id/anonymous_holder"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/anonymous_holder"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/acc_dummy"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_ok_anm"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_alignBottom="@+id/textView4"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignTop="@+id/textView4"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:background="@drawable/button_uninstall"
|
||||
android:text="@android:string/ok" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
208
app/src/main/res/layout/activity_login.xml
Normal file
208
app/src/main/res/layout/activity_login.xml
Normal file
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="3">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/topView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/colorAccent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:padding="10dp"
|
||||
android:text="@string/action_welcome_msg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/selectAccount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/welcome"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:text="@string/action_select"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/lightGray"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:background="@color/white"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/warn_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="24dp"
|
||||
android:visibility="gone"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="12dp"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:text="@string/credentials_message"
|
||||
android:textColor="?android:attr/colorAccent" />
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:srcCompat="@drawable/ic_google" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/imageView4"
|
||||
android:layout_alignTop="@+id/imageView4"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/imageView4"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/acc_google"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<android.support.v7.widget.AppCompatAutoCompleteTextView
|
||||
android:id="@+id/emailg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/imageView4"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:autofillHints="emailAddress"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:completionThreshold="1"
|
||||
android:hint="@string/credentials_hint_email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:textColorHint="?android:attr/textColorPrimaryInverse" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/password_layoutg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/emailg"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:autofillHints="password"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:fontFamily="normal"
|
||||
android:hint="@string/credentials_hint_password"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:textColorHint="?android:attr/textColorPrimaryInverse" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toggle_password_visibility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/passwordg"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/ic_visibility_on"
|
||||
android:tint="?android:attr/textColorPrimaryInverse" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/password_layout_extg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/password_layoutg"
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_okg"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@+id/password_layout_extg"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/button_login"
|
||||
android:text="@string/action_login" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/anonymous_holder"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_below="@+id/or_txt"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="24dp"
|
||||
app:srcCompat="@drawable/ic_dummy_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/or_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/button_okg"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/edit_text_login"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:text="@string/action_or"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/anonymous_holder"
|
||||
android:layout_alignTop="@+id/anonymous_holder"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/anonymous_holder"
|
||||
android:fontFamily="@font/google_sans_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/acc_dummy"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_ok_anm"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_alignBottom="@+id/textView4"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignTop="@+id/textView4"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:background="@drawable/button_uninstall"
|
||||
android:text="@string/action_ok" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
2
app/src/main/res/layout/app_updatable_inc.xml
Normal file → Executable file
2
app/src/main/res/layout/app_updatable_inc.xml
Normal file → Executable file
@@ -12,6 +12,8 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
app:layout_scrollFlags="scroll|enterAlways|snap">
|
||||
|
||||
|
||||
8
app/src/main/res/layout/fragment_home.xml
Normal file → Executable file
8
app/src/main/res/layout/fragment_home.xml
Normal file → Executable file
@@ -42,11 +42,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/account_avatar"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/avatar_ring"
|
||||
app:srcCompat="@drawable/ic_dummy_avatar" />
|
||||
|
||||
|
||||
5
app/src/main/res/values-v23/style.xml
Normal file → Executable file
5
app/src/main/res/values-v23/style.xml
Normal file → Executable file
@@ -14,4 +14,9 @@
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:toolbarStyle">@style/ThemeOverlay.AppCompat.Light</item>
|
||||
</style>
|
||||
|
||||
<style name="LoginTheme" parent="AppTheme">
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
12
app/src/main/res/values/strings.xml
Normal file → Executable file
12
app/src/main/res/values/strings.xml
Normal file → Executable file
@@ -36,15 +36,19 @@
|
||||
<string name="action_filter_category">"Category: %1$s"</string>
|
||||
<string name="action_filter_rating">"Rating: %1$s"</string>
|
||||
<string name="action_filter_downloads">"Downloads: %1$s"</string>
|
||||
<string name="action_welcome">Welcome</string>
|
||||
<string name="action_welcome">Welcome,</string>
|
||||
<string name="action_welcome_msg">Welcome to Aurora</string>
|
||||
<string name="action_apps">"My apps"</string>
|
||||
<string name="action_logout">Log out</string>
|
||||
<string name="action_login">Log in</string>
|
||||
<string name="action_login">Login</string>
|
||||
<string name="action_ok">OK</string>
|
||||
<string name="action_or">OR</string>
|
||||
<string name="action_select">Select an account to login</string>
|
||||
<string name="action_usedummy">Use Dummy</string>
|
||||
<string name="action_usegoogle">Use Google</string>
|
||||
<string name="acc_dummy_name">Anonymous</string>
|
||||
<string name="acc_dummy">Login using Dummy Account</string>
|
||||
<string name="acc_google">Login using Google Account</string>
|
||||
<string name="acc_dummy">Login as Anonymous</string>
|
||||
<string name="acc_google">Login with Google</string>
|
||||
<string name="action_switch">Switch Dummy</string>
|
||||
<string name="action_accounts">Accounts</string>
|
||||
<string name="action_search">Search</string>
|
||||
|
||||
4
app/src/main/res/values/style.xml
Normal file → Executable file
4
app/src/main/res/values/style.xml
Normal file → Executable file
@@ -14,6 +14,10 @@
|
||||
<item name="android:toolbarStyle">@style/ThemeOverlay.AppCompat.Light</item>
|
||||
</style>
|
||||
|
||||
<style name="LoginTheme" parent="AppTheme">
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowAnimationStyle">@style/CustomActivityAnimation</item>
|
||||
<item name="android:windowDisablePreview">true</item>
|
||||
|
||||
Reference in New Issue
Block a user