code and ui refactoring in the Password activity, encapsulation and wrappers.

This commit is contained in:
Ernir Erlingsson
2015-12-08 23:56:34 +01:00
parent 6d13c4e095
commit 43f562a7bc
9 changed files with 208 additions and 86 deletions

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/margin_activity_vertical"
android:paddingEnd="@dimen/margin_activity_horizontal"
android:paddingStart="@dimen/margin_activity_horizontal"
android:paddingTop="@dimen/margin_activity_vertical">
<TextView
android:id="@+id/title_password"
style="@style/BriarTextTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="@dimen/margin_large"
android:text="@string/enter_password" />
<EditText
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title_password"
android:hint="@string/password_hint"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:lines="1"
android:maxLines="1" />
<Button
android:id="@+id/btn_sign_in"
style="@style/BriarButton.Default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edit_password"
android:layout_marginTop="@dimen/margin_xlarge"
android:onClick="onSignInClick"
android:text="@string/sign_in_button" />
<ProgressBar
android:id="@+id/progress_wheel"
style="?android:attr/progressBarStyleInverse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/btn_sign_in"
android:visibility="invisible" />
<TextView
style="@style/BriarTextBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_sign_in"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/margin_large"
android:clickable="true"
android:onClick="onForgottenPasswordClick"
android:text="@string/forgotten_password"
android:textColor="?android:attr/textColorLink" />
</RelativeLayout>

View File

@@ -9,4 +9,9 @@
<item name="android:textColor">@color/action_bar_text</item>
<item name="android:background">@color/action_bar_background</item>
</style>
<style name="BriarButton.Default">
<item name="android:textAllCaps">true</item>
</style>
</resources>

View File

@@ -14,4 +14,6 @@
<color name="no_posts">#AAAAAA</color>
<color name="settings_title_text">#2D3E50</color>
<color name="settings_title_underline">#2D3E50</color>
<color name="text_link">#2D3E50</color>
</resources>

View File

@@ -0,0 +1,21 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="margin_activity_horizontal">16dp</dimen>
<dimen name="margin_activity_vertical">16dp</dimen>
<dimen name="margin_seperator">1dp</dimen>
<dimen name="margin_tiny">2dp</dimen>
<dimen name="margin_small">4dp</dimen>
<dimen name="margin_medium">8dp</dimen>
<dimen name="margin_large">16dp</dimen>
<dimen name="margin_xlarge">32dp</dimen>
<!-- v2 dimens -->
<dimen name="text_size_tiny">12sp</dimen>
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">16sp</dimen>
<dimen name="text_size_large">20sp</dimen>
<dimen name="text_size_xlarge">34sp</dimen>
</resources>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Briar</string>
<string name="crash_report_title">Briar Crash Report</string>
<string name="ongoing_notification_title">Signed into Briar</string>
@@ -13,6 +15,8 @@
<string name="passwords_do_not_match">Passwords do not match</string>
<string name="create_account_button">Create Account</string>
<string name="enter_password">Enter your password:</string>
<string name="password_hint">Password</string>
<string name="forgotten_password">I have forgotten my password</string>
<string name="try_again">Wrong password, try again:</string>
<string name="sign_in_button">Sign In</string>
<string name="startup_failed_notification_title">Briar could not start</string>

View File

@@ -12,4 +12,21 @@
<style name="WindowTitleBackground">
<item name="android:background">@color/action_bar_background</item>
</style>
<style name="BriarButton">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:padding">@dimen/margin_large</item>
</style>
<style name="BriarButton.Default"/>
<style name="BriarTextTitle">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
<style name="BriarTextBody">
<item name="android:textSize">@dimen/text_size_small</item>
<item name="android:textColor">@android:color/primary_text_light</item>
</style>
</resources>