Skip to content

Commit

Permalink
Merge branch 'authentication-without-background'
Browse files Browse the repository at this point in the history
  • Loading branch information
arturdryomov committed Jul 22, 2014
2 parents 02a6c2f + ad1fc8f commit 7cc7b82
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 34 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dependencies {
compile "com.android.support:support-v4:20.+"
compile "com.android.support:support-v13:20.+"
compile "com.crashlytics.android:crashlytics:1.+"
compile "com.github.dmytrodanylyk.android-process-button:library:1.0.+"
compile "com.jakewharton.timber:timber:2.3.+"
compile "com.squareup.dagger:dagger:1.2.+"
compile "com.squareup.okhttp:okhttp:1.5.+"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import android.widget.TextView;
import android.widget.ViewAnimator;

import com.dd.processbutton.iml.ActionProcessButton;
import com.squareup.otto.Subscribe;

import org.amahi.anywhere.AmahiApplication;
Expand Down Expand Up @@ -83,8 +84,8 @@ private String getPassword() {
return getPasswordEdit().getText().toString();
}

private Button getAuthenticationButton() {
return (Button) findViewById(R.id.button_authentication);
private ActionProcessButton getAuthenticationButton() {
return (ActionProcessButton) findViewById(R.id.button_authentication);
}

private void setUpAuthenticationMessages() {
Expand Down Expand Up @@ -158,8 +159,10 @@ private void hideAuthenticationText() {
}

private void showProgress() {
ViewAnimator animator = (ViewAnimator) findViewById(R.id.animator_button);
animator.setDisplayedChild(animator.indexOfChild(findViewById(android.R.id.progress)));
ActionProcessButton authenticationButton = getAuthenticationButton();

authenticationButton.setMode(ActionProcessButton.Mode.ENDLESS);
authenticationButton.setProgress(1);
}

private void startAuthentication() {
Expand All @@ -185,8 +188,7 @@ private void showAuthenticationText() {
}

private void hideProgress() {
ViewAnimator animator = (ViewAnimator) findViewById(R.id.animator_button);
animator.setDisplayedChild(animator.indexOfChild(findViewById(R.id.button_authentication)));
getAuthenticationButton().setProgress(0);
}

private void showAuthenticationFailureMessage() {
Expand Down
Binary file added src/main/res/drawable-nodpi/ic_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 16 additions & 22 deletions src/main/res/layout/layout_authentication.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView
android:src="@drawable/ic_banner"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<Space
android:layout_width="match_parent"
android:layout_height="8dp"/>

<EditText
android:id="@+id/edit_username"
android:hint="Username"
android:singleLine="true"
android:background="@android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

Expand All @@ -43,35 +53,19 @@
android:hint="Password"
android:inputType="textPassword"
android:fontFamily="sans-serif"
android:background="@android:drawable/editbox_background_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<Space
android:layout_width="match_parent"
android:layout_height="16dp"/>

<ViewAnimator
android:id="@+id/animator_button"
android:inAnimation="@android:anim/fade_in"
android:outAnimation="@android:anim/fade_out"
<com.dd.processbutton.iml.ActionProcessButton
android:id="@+id/button_authentication"
android:text="Sign in"
android:textColor="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:id="@+id/button_authentication"
android:text="Sign in"
android:background="@android:drawable/btn_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<ProgressBar
android:id="@android:id/progress"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</ViewAnimator>
android:layout_height="wrap_content"/>

<Space
android:layout_width="match_parent"
Expand Down
7 changes: 1 addition & 6 deletions src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@
</style>

<style name="Theme.Amahi.Authentication" parent="@style/Theme.Amahi">
<item name="android:actionBarStyle">@style/Theme.Amahi.Authentication.ActionBar</item>
<item name="android:windowBackground">@drawable/bg_authentication</item>
</style>

<style name="Theme.Amahi.Authentication.ActionBar" parent="@style/Theme.Amahi.ActionBar">
<item name="android:displayOptions">showHome|showTitle</item>
<item name="android:windowNoTitle">true</item>
</style>

</resources>

0 comments on commit 7cc7b82

Please sign in to comment.