Refine UI - Splash + Login

This commit is contained in:
Sagi Dayan 2016-07-05 17:38:58 +03:00
parent 002199a076
commit 78dad1bd11
10 changed files with 69 additions and 25 deletions

View file

@ -19,20 +19,22 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".SplashActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar"
android:noHistory="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".LoginActivity" /> <activity android:name=".LoginActivity"
android:noHistory="true"/>
<activity android:name=".PersonalSpaceActivity" /> <activity android:name=".PersonalSpaceActivity" />
<!--<activity--> <activity
<!--android:name=".MainActivity"--> android:name=".MainActivity"
<!--android:label="@string/title_activity_main"--> android:label="@string/title_activity_main"
<!--android:theme="@style/AppTheme.NoActionBar"></activity>--> android:theme="@style/AppTheme.NoActionBar"></activity>
</application> </application>
</manifest> </manifest>

View file

@ -226,7 +226,7 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
// if(response.get("user") != null) { // if(response.get("user") != null) {
if(!response.isNull("user")) { if(!response.isNull("user")) {
Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console
Intent personalSpaceActivity = new Intent(LoginActivity.this, PersonalSpaceActivity.class); Intent personalSpaceActivity = new Intent(LoginActivity.this, MainActivity.class);
Bundle loginUserBundle = new Bundle(); Bundle loginUserBundle = new Bundle();
loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id")); loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id"));
personalSpaceActivity.putExtras(loginUserBundle); personalSpaceActivity.putExtras(loginUserBundle);

View file

@ -3,21 +3,34 @@ package com.android_app.matan.ara.sagi.thesocialnotework;
import android.content.Intent; import android.content.Intent;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.graphics.drawable.DrawableWrapper;
import android.util.Log; import android.util.Log;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import java.util.Random;
public class SplashActivity extends AppCompatActivity { public class SplashActivity extends AppCompatActivity {
private ImageView appSplashScreen; private ImageView background;
private int timerDelay = 3000; private int timerDelay = 3500;
private final String TAG = "Splash Screen Activity"; private final String TAG = "Splash Screen Activity";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash); setContentView(R.layout.activity_splash);
background = (ImageView) findViewById(R.id.background);
final int sdk = android.os.Build.VERSION.SDK_INT;
if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
background.setImageDrawable( getResources().getDrawable(rand_splash()) );
} else {
background.setImageDrawable( getResources().getDrawable(rand_splash()));
}
Thread timerThread = new Thread(){ Thread timerThread = new Thread(){
public void run(){ public void run(){
try{ try{
@ -39,4 +52,27 @@ public class SplashActivity extends AppCompatActivity {
super.onPause(); super.onPause();
finish(); finish();
} }
protected int rand_splash() {
int min = 2, max = 4;
// Usually this can be a field rather than a method variable
Random rand = new Random();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = rand.nextInt((max - min) + 1) + min;
switch (randomNum){
// case 0:
// return R.drawable.splash_0;
// case 1:
// return R.drawable.splash_1;
case 2:
return R.drawable.splash_2;
case 3:
return R.drawable.splash_3;
default:
return R.drawable.splash_4;
}
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

View file

@ -26,12 +26,13 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:visibility="gone" /> android:visibility="gone" />
<ImageView android:src="@drawable/logo" <ImageView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="80dp"
android:layout_marginBottom="24dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo" /> android:src="@drawable/logo"
android:cropToPadding="false"
android:scaleType="fitXY" />
<!-- Email Label --> <!-- Email Label -->
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
@ -67,13 +68,15 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:padding="12dp" android:padding="12dp"
android:text="Login"/> android:text="Login"
android:background="@color/colorPrimary"
android:textColor="#ffffff" />
<TextView android:id="@+id/link_signup" <TextView android:id="@+id/link_signup"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:text="No account yet? Create one for FREE" android:text="No account yet?\nClick Here To Create one for FREE"
android:gravity="center" android:gravity="center"
android:textSize="16dip"/> android:textSize="16dip"/>

View file

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
android:background="@drawable/splash_screen" <ImageView
tools:context="com.android_app.matan.ara.sagi.thesocialnotework.SplashActivity" android:layout_width="fill_parent"
android:visibility="visible"> android:layout_height="fill_parent"
</LinearLayout> android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:id="@+id/background" />
</RelativeLayout>