From 3830dd0ead2974c24ea64054ac92d8249ac43800 Mon Sep 17 00:00:00 2001 From: Aurel_Chiper Date: Sat, 30 Mar 2019 14:13:23 +0200 Subject: [PATCH 1/3] Fix #79 Add phone number prefix --- app/build.gradle | 2 + app/src/main/AndroidManifest.xml | 6 +- .../code4/monitorizarevot/LoginActivity.java | 9 +- app/src/main/res/layout/activity_login.xml | 114 ++++++++++++------ 4 files changed, 89 insertions(+), 42 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f7c97e6..890d1d6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -83,6 +83,8 @@ dependencies { implementation 'org.greenrobot:eventbus:3.0.0' implementation 'net.hockeyapp.android:HockeySDK:4.1.1' + implementation 'com.hbb20:ccp:2.2.6' + testImplementation 'junit:junit:' + rootProject.junitVersion testImplementation 'org.mockito:mockito-core:' + rootProject.mockitoVersion } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b81339e..e5bfdc7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> @@ -23,7 +24,8 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" - android:allowBackup="false"> + android:allowBackup="false" + tools:replace="android:allowBackup"> { + + @BindView(R.id.country_code) + CountryCodePicker countryCodePicker; + @BindView(R.id.phone) EditText username; @@ -92,10 +98,11 @@ boolean onDoneEditPassword(TextView textView, int i, KeyEvent keyEvent) { } private void login() { + String countryCode = countryCodePicker.getSelectedCountryCodeWithPlus(); String phoneNumber = username.getText().toString(); String pin = password.getText().toString(); String udid = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); - viewModel.login(phoneNumber, pin, udid); + viewModel.login(countryCode + phoneNumber, pin, udid); } private void showErrorDialog(String message) { diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index db9a234..4e9fbc6 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -1,29 +1,32 @@ + android:layout_height="match_parent" + android:background="@drawable/ic_login_bkg"> + + android:paddingTop="2dp" + android:paddingBottom="2dp"> + + android:text="@string/developed_by" /> + + android:layout_marginTop="36dp" + android:orientation="vertical" + android:paddingStart="@dimen/activity_horizontal_margin" + android:paddingEnd="@dimen/activity_horizontal_margin"> + android:layout_weight="1" + android:orientation="horizontal"> + + android:textSize="14sp" + tools:text="V0.00" /> + + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:orientation="horizontal"> - + + + + + - + + + + + + android:textColorHint="@color/textPrimary"> + android:inputType="textPassword" /> + +