make status and navbar transparent for intro and login

This commit is contained in:
Phillip Thelen 2017-04-04 17:45:24 +02:00
parent 166a9fb496
commit 158acea5a1
12 changed files with 290 additions and 218 deletions

View file

@ -48,12 +48,13 @@
<activity
android:name=".ui.activities.LoginActivity"
android:label="@string/LoginActivityName"
android:theme="@style/AppThemeWithActionBarBlackText"
android:theme="@style/AppTheme.NoActionBar.Transparent"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".ui.activities.IntroActivity"
android:theme="@style/AppTheme.NoActionBar.Transparent"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
</activity>

View file

@ -1,45 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.viewpagerindicator.IconPageIndicator
android:id="@+id/view_pager_indicator"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp" />
<RelativeLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.viewpagerindicator.IconPageIndicator
android:id="@+id/view_pager_indicator"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/skip_button"
android:id="@+id/skipButton"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_alignParentTop="true"
android:layout_marginTop="6dp"
android:textColor="@android:color/white"
android:background="@color/transparent" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/skip_button"
android:id="@+id/skipButton"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_alignParentTop="true"
android:layout_marginTop="6dp"
android:textColor="@android:color/white"
android:background="@color/transparent" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/intro_finish_button"
android:id="@+id/finishButton"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="6dp"
android:background="@color/transparent"
android:textColor="@android:color/white"
android:visibility="gone" />
</RelativeLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/intro_finish_button"
android:id="@+id/finishButton"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="6dp"
android:background="@color/transparent"
android:textColor="@android:color/white"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>

View file

@ -1,61 +1,63 @@
<FrameLayout 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"
xmlns:tools="http://schemas.android.com/tools">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<com.habitrpg.android.habitica.ui.views.login.LockableScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/background_container"
>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/background_container"
android:scrollIndicators="none"
android:scrollbars="none"
>
<com.habitrpg.android.habitica.ui.views.login.LoginBackgroundView
android:id="@+id/background_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_gradient"
android:clipChildren="false"
android:clipToPadding="false"
>
android:id="@+id/background_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_gradient"
android:clipChildren="false"
android:clipToPadding="false"
>
<ImageView
android:id="@+id/city_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:srcCompat="@drawable/login_background"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop" />
android:id="@+id/city_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:srcCompat="@drawable/login_background"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop" />
<Space android:id="@+id/cloud_anchor"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:layout_below="@id/city_view" />
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:layout_below="@id/city_view" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/cloud_1"
android:id="@+id/left_cloud_view"
android:layout_toLeftOf="@id/cloud_anchor"
android:layout_marginRight="150dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:scaleType="centerCrop"
android:layout_marginTop="150dp"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/cloud_1"
android:id="@+id/left_cloud_view"
android:layout_toLeftOf="@id/cloud_anchor"
android:layout_marginRight="150dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:scaleType="centerCrop"
android:layout_marginTop="150dp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/cloud_2"
android:id="@+id/right_cloud_view"
android:layout_toRightOf="@id/cloud_anchor"
android:layout_marginLeft="170dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:scaleType="centerCrop"
android:layout_marginTop="240dp"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/cloud_2"
android:id="@+id/right_cloud_view"
android:layout_toRightOf="@id/cloud_anchor"
android:layout_marginLeft="170dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:scaleType="centerCrop"
android:layout_marginTop="240dp"
/>
</com.habitrpg.android.habitica.ui.views.login.LoginBackgroundView>
@ -63,7 +65,11 @@
</com.habitrpg.android.habitica.ui.views.login.LockableScrollView>
<LinearLayout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/spacing_large"
@ -72,14 +78,16 @@
android:background="@color/transparent"
>
<ImageView
<ImageView
android:id="@+id/logo_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/login_logo"
android:layout_margin="24dp"/>
android:layout_margin="24dp"
android:contentDescription="@string/brand_name" />
<Button
<Button
android:id="@+id/new_game_button"
android:layout_width="@dimen/login_intro_button_size"
android:layout_height="@dimen/login_intro_button_size"
@ -89,7 +97,7 @@
android:layout_marginTop="@dimen/spacing_large"
android:background="@drawable/login_begin_button"/>
<Button
<Button
android:id="@+id/show_login_button"
android:layout_width="@dimen/login_intro_button_size"
android:layout_height="@dimen/login_intro_button_size"
@ -99,7 +107,7 @@
android:layout_marginTop="@dimen/spacing_large"
android:background="@drawable/login_begin_button"/>
<ScrollView
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
@ -109,7 +117,7 @@
tools:visibility="visible"
>
<LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/spacing_large"
@ -117,7 +125,7 @@
android:orientation="vertical"
android:background="@color/transparent">
<EditText
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -131,7 +139,7 @@
android:textColor="@color/white_75_alpha"
android:textColorHighlight="@color/white"/>
<EditText
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -145,7 +153,7 @@
android:theme="@style/LoginEditTextTheme"
/>
<EditText
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -158,7 +166,7 @@
android:textColor="@color/white_75_alpha"
android:theme="@style/LoginEditTextTheme"/>
<EditText
<EditText
android:id="@+id/confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -170,7 +178,7 @@
android:textColor="@color/white_75_alpha"
android:theme="@style/LoginEditTextTheme"/>
<ProgressBar
<ProgressBar
android:id="@+id/PB_AsyncTask"
android:indeterminate="true"
android:visibility="gone"
@ -178,7 +186,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<Button
<Button
android:id="@+id/login_btn"
android:layout_width="match_parent"
android:layout_height="42dp"
@ -186,7 +194,7 @@
android:layout_marginTop="@dimen/spacing_xlarge"
style="@style/LoginButton"/>
<Button
<Button
android:id="@+id/fb_login_button"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_xlarge"
@ -195,16 +203,16 @@
android:drawableLeft="@drawable/facebook_icon"
style="@style/LoginButton"/>
<Button
android:id="@+id/google_login_button"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_large"
android:layout_height="@dimen/diamond_button_height"
android:text="@string/login_btn_google"
android:drawableLeft="@drawable/google_icon"
style="@style/LoginButton"/>
<Button
android:id="@+id/google_login_button"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_large"
android:layout_height="@dimen/diamond_button_height"
android:text="@string/login_btn_google"
android:drawableLeft="@drawable/google_icon"
style="@style/LoginButton"/>
<TextView
<TextView
android:id="@+id/forgot_pw_tv"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_xlarge"
@ -214,13 +222,13 @@
android:layout_gravity="center_horizontal"
android:textColor="@color/white_50_alpha"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
</LinearLayout>
</LinearLayout>
<Button
<Button
android:id="@+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -228,5 +236,6 @@
android:background="@color/transparent"
android:paddingLeft="12dp"
android:alpha="0" />
</FrameLayout>
</FrameLayout>

View file

@ -1,61 +1,64 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="@color/brand_300"
android:id="@+id/container_view">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="@color/brand_300"
android:id="@+id/container_view"
android:fitsSystemWindows="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subtitleTextView"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
style="@style/Body2"
android:textSize="17sp"
android:textColor="@color/white"
tools:text="@string/intro_2_subtitle"
android:layout_marginBottom="4dp" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subtitleTextView"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
style="@style/Body2"
android:textSize="17sp"
android:textColor="@color/white"
tools:text="@string/intro_2_subtitle"
android:layout_marginBottom="4dp" />
<ImageView
android:id="@+id/titleImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
android:id="@+id/titleImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/brand_name" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/titleTextView"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
style="@style/Title1"
android:textSize="30sp"
android:textColor="@color/white"
tools:text="@string/intro_2_title"
android:layout_marginBottom="28dp" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/titleTextView"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
style="@style/Title1"
android:textSize="30sp"
android:textColor="@color/white"
tools:text="@string/intro_2_title"
android:layout_marginBottom="28dp" />
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_gravity="center_horizontal"
android:src="@drawable/intro_2"
app:srcCompat="@drawable/intro_2" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_gravity="center_horizontal"
android:src="@drawable/intro_2"
app:srcCompat="@drawable/intro_2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/descriptionTextView"
android:layout_gravity="center_horizontal"
style="@style/Body2"
android:textColor="@android:color/white"
android:layout_margin="28dp"
android:gravity="center_horizontal"
tools:text="@string/intro_2_description"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/descriptionTextView"
android:layout_gravity="center_horizontal"
style="@style/Body2"
android:textColor="@android:color/white"
android:layout_margin="28dp"
android:gravity="center_horizontal"
android:lineSpacingExtra="4dp"
android:maxWidth="350dp"
tools:text="@string/intro_2_description"/>
</LinearLayout>

View file

@ -10,4 +10,14 @@
<item name="android:drawablePadding">4dp</item>
</style>
<style name="AppTheme.ActionBar.Transparent">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<style name="AppTheme.NoActionBar.Transparent">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
</resources>

View file

@ -116,6 +116,7 @@
<color name="white_75_alpha">#bfffffff</color>
<color name="white_50_alpha">#7fffffff</color>
<color name="white_15_alpha">#26ffffff</color>
<color name="black_20_alpha">#33000000</color>
<color name="light_gray_bg">#F6F4F8</color>
<color name="skin_ddc994">#ddc994</color>

View file

@ -19,4 +19,5 @@
<string name="qr_album_name" translatable="false">habitica</string>
<string name="qr_file_name" translatable="false"> habitrpg-qr-code.jpg</string>
<string name="habitica_user_count" translatable="false">2,000,000</string>
<string name="brand_name" translatable="false">Habitica</string>
</resources>

View file

@ -556,4 +556,5 @@ To start, which parts of your life do you want to improve?</string>
<string name="gray">Gray</string>
<string name="dated">Dated</string>
<string name="completed">Complated</string>
<string name="setuP_group_other">Other</string>
</resources>

View file

@ -41,13 +41,23 @@
<item name="alertDialogTheme">@style/AlertDialogTheme</item>
</style>
<style name="AppThemeWithActionBar" parent="AppTheme">
<style name="AppTheme.ActionBar" parent="AppTheme">
<item name="windowActionBar">true</item>
<item name="windowNoTitle">false</item>
</style>
<style name="AppThemeWithActionBarBlackText" parent="AppThemeWithActionBar">
<style name="AppTheme.ActionBar.Transparent">
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.NoActionBar.Transparent">
</style>
<style name="AppThemeWithActionBarBlackText" parent="AppTheme.ActionBar">
<item name="android:textColorPrimary">@android:color/black</item>
</style>

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.activities;
import com.habitrpg.android.habitica.HabiticaBaseApplication;
import com.magicmicky.habitrpgwrapper.lib.api.ApiClient;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.components.AppComponent;
@ -9,6 +10,7 @@ import com.viewpagerindicator.IconPageIndicator;
import com.viewpagerindicator.IconPagerAdapter;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -17,6 +19,8 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import javax.inject.Inject;
@ -45,7 +49,7 @@ public class IntroActivity extends BaseActivity implements View.OnClickListener,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getHabiticaApplication().getComponent().inject(this);
HabiticaBaseApplication.getComponent().inject(this);
setupIntro();
indicator.setViewPager(pager);
@ -55,6 +59,13 @@ public class IntroActivity extends BaseActivity implements View.OnClickListener,
apiClient.getContent()
.subscribe(contentResult -> {}, throwable -> {});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
@Override

View file

@ -1,38 +1,5 @@
package com.habitrpg.android.habitica.ui.activities;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.AccountPicker;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.Scopes;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.habitrpg.android.habitica.BuildConfig;
import com.magicmicky.habitrpgwrapper.lib.api.ApiClient;
import com.habitrpg.android.habitica.HostConfig;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.callbacks.HabitRPGUserCallback;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.helpers.AmplitudeManager;
import com.habitrpg.android.habitica.prefs.scanner.IntentIntegrator;
import com.habitrpg.android.habitica.prefs.scanner.IntentResult;
import com.habitrpg.android.habitica.ui.views.login.LockableScrollView;
import com.habitrpg.android.habitica.ui.views.login.LoginBackgroundView;
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
import org.json.JSONException;
import org.json.JSONObject;
import android.accounts.AccountManager;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@ -45,28 +12,60 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.PreferenceManager;
import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.AccelerateInterpolator;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.AccountPicker;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.Scopes;
import com.habitrpg.android.habitica.BuildConfig;
import com.habitrpg.android.habitica.HostConfig;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.callbacks.HabitRPGUserCallback;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.helpers.AmplitudeManager;
import com.habitrpg.android.habitica.prefs.scanner.IntentIntegrator;
import com.habitrpg.android.habitica.prefs.scanner.IntentResult;
import com.habitrpg.android.habitica.ui.views.login.LockableScrollView;
import com.habitrpg.android.habitica.ui.views.login.LoginBackgroundView;
import com.magicmicky.habitrpgwrapper.lib.api.ApiClient;
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -117,6 +116,8 @@ public class LoginActivity extends BaseActivity
LinearLayout formWrapper;
@BindView(R.id.back_button)
Button backButton;
@BindView(R.id.logo_view)
ImageView logoView;
@BindView(R.id.login_btn)
Button mLoginNormalBtn;
@ -173,6 +174,12 @@ public class LoginActivity extends BaseActivity
backgroundContainer.post(() -> backgroundContainer.scrollTo(0, backgroundContainer.getBottom()));
backgroundContainer.setScrollingEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
private void setupFacebookLogin() {
@ -517,9 +524,14 @@ public class LoginActivity extends BaseActivity
isShowingForm = true;
ValueAnimator panAnimation = ObjectAnimator.ofInt(backgroundContainer, "scrollY", 0).setDuration(1000);
ValueAnimator newGameAlphaAnimation = ObjectAnimator.ofFloat(newGameButton, View.ALPHA, 0);
ValueAnimator showLoginAlphaAnimation = ObjectAnimator.ofFloat(showLoginButton, View.ALPHA, 0);
ValueAnimator scaleLogoAnimation = ValueAnimator.ofInt(logoView.getMeasuredHeight(), (int)(logoView.getMeasuredHeight()*0.75));
scaleLogoAnimation.addUpdateListener(valueAnimator -> {
int val = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = logoView.getLayoutParams();
layoutParams.height = val;
logoView.setLayoutParams(layoutParams);
});
if (isRegistering) {
newGameAlphaAnimation.setStartDelay(600);
newGameAlphaAnimation.setDuration(400);
@ -547,7 +559,7 @@ public class LoginActivity extends BaseActivity
}
ValueAnimator backAlphaAnimation = ObjectAnimator.ofFloat(backButton, View.ALPHA, 1).setDuration(800);
AnimatorSet showAnimation = new AnimatorSet();
showAnimation.playTogether(panAnimation, newGameAlphaAnimation, showLoginAlphaAnimation);
showAnimation.playTogether(panAnimation, newGameAlphaAnimation, showLoginAlphaAnimation, scaleLogoAnimation);
showAnimation.play(backAlphaAnimation).after(panAnimation);
for (int i = 0; i < formWrapper.getChildCount(); i++) {
View view = formWrapper.getChildAt(i);
@ -565,6 +577,13 @@ public class LoginActivity extends BaseActivity
ValueAnimator panAnimation = ObjectAnimator.ofInt(backgroundContainer, "scrollY", backgroundContainer.getBottom()).setDuration(1000);
ValueAnimator newGameAlphaAnimation = ObjectAnimator.ofFloat(newGameButton, View.ALPHA, 1).setDuration(700);
ValueAnimator showLoginAlphaAnimation = ObjectAnimator.ofFloat(showLoginButton, View.ALPHA, 1).setDuration(700);
ValueAnimator scaleLogoAnimation = ValueAnimator.ofInt(logoView.getMeasuredHeight(), (int)(logoView.getMeasuredHeight()*1.333333));
scaleLogoAnimation.addUpdateListener(valueAnimator -> {
int val = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = logoView.getLayoutParams();
layoutParams.height = val;
logoView.setLayoutParams(layoutParams);
});
showLoginAlphaAnimation.setStartDelay(300);
ValueAnimator scrollViewAlphaAnimation = ObjectAnimator.ofFloat(scrollView, View.ALPHA, 0).setDuration(800);
scrollViewAlphaAnimation.addListener(new AnimatorListenerAdapter() {
@ -576,7 +595,7 @@ public class LoginActivity extends BaseActivity
});
ValueAnimator backAlphaAnimation = ObjectAnimator.ofFloat(backButton, View.ALPHA, 0).setDuration(800);
AnimatorSet showAnimation = new AnimatorSet();
showAnimation.playTogether(panAnimation, scrollViewAlphaAnimation, backAlphaAnimation);
showAnimation.playTogether(panAnimation, scrollViewAlphaAnimation, backAlphaAnimation, scaleLogoAnimation);
showAnimation.play(newGameAlphaAnimation).after(scrollViewAlphaAnimation);
showAnimation.play(showLoginAlphaAnimation).after(scrollViewAlphaAnimation);
showAnimation.start();

View file

@ -1,5 +1,13 @@
package com.habitrpg.android.habitica.ui.fragments.setup;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.ui.AvatarView;
@ -10,15 +18,6 @@ import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Days;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -88,6 +87,7 @@ public class TaskSetupFragment extends BaseFragment {
{getString(R.string.setup_group_teams), "teams"},
{getString(R.string.setup_group_chores), "chores"},
{getString(R.string.setup_group_creativity), "creativity"},
{getString(R.string.setuP_group_other), "other"}
};
this.tasks = new Object[][]{
@ -132,7 +132,8 @@ public class TaskSetupFragment extends BaseFragment {
}
List<Task> tasks = new ArrayList<>();
for (Object[] task : this.tasks) {
if (groups.contains((String) task[0])) {
String taskGroup = (String) task[0];
if (groups.contains(taskGroup)) {
Task taskObject;
if (task.length == 5) {
taskObject = this.makeTaskObject((String) task[1], (String) task[2], (Boolean) task[3], (Boolean) task[4]);
@ -145,7 +146,7 @@ public class TaskSetupFragment extends BaseFragment {
return tasks;
}
private Task makeTaskObject(String type, String text, Boolean up, Boolean down) {
private Task makeTaskObject(String type, String text, @Nullable Boolean up, @Nullable Boolean down) {
Task task = new Task();
task.text = text;
task.priority = 1.0f;