Refine UI - Splash + Login
This commit is contained in:
parent
002199a076
commit
78dad1bd11
10 changed files with 69 additions and 25 deletions
|
@ -19,20 +19,22 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
android:name=".SplashActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:noHistory="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".LoginActivity" />
|
||||
<activity android:name=".LoginActivity"
|
||||
android:noHistory="true"/>
|
||||
<activity android:name=".PersonalSpaceActivity" />
|
||||
<!--<activity-->
|
||||
<!--android:name=".MainActivity"-->
|
||||
<!--android:label="@string/title_activity_main"-->
|
||||
<!--android:theme="@style/AppTheme.NoActionBar"></activity>-->
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -226,7 +226,7 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
|
|||
// if(response.get("user") != null) {
|
||||
if(!response.isNull("user")) {
|
||||
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();
|
||||
loginUserBundle.putString("user_id", response.getJSONObject("user").getString("id"));
|
||||
personalSpaceActivity.putExtras(loginUserBundle);
|
||||
|
|
|
@ -3,21 +3,34 @@ package com.android_app.matan.ara.sagi.thesocialnotework;
|
|||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.graphics.drawable.DrawableWrapper;
|
||||
import android.util.Log;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private ImageView appSplashScreen;
|
||||
private int timerDelay = 3000;
|
||||
private ImageView background;
|
||||
private int timerDelay = 3500;
|
||||
private final String TAG = "Splash Screen Activity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
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(){
|
||||
public void run(){
|
||||
try{
|
||||
|
@ -39,4 +52,27 @@ public class SplashActivity extends AppCompatActivity {
|
|||
super.onPause();
|
||||
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 |
BIN
app/src/main/res/drawable/splash_2.jpg
Normal file
BIN
app/src/main/res/drawable/splash_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 353 KiB |
BIN
app/src/main/res/drawable/splash_3.jpg
Normal file
BIN
app/src/main/res/drawable/splash_3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 234 KiB |
BIN
app/src/main/res/drawable/splash_4.jpg
Normal file
BIN
app/src/main/res/drawable/splash_4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
Binary file not shown.
Before Width: | Height: | Size: 138 KiB |
|
@ -26,12 +26,13 @@
|
|||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView android:src="@drawable/logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:contentDescription="@string/logo" />
|
||||
android:src="@drawable/logo"
|
||||
android:cropToPadding="false"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<!-- Email Label -->
|
||||
<android.support.design.widget.TextInputLayout
|
||||
|
@ -67,13 +68,15 @@
|
|||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:padding="12dp"
|
||||
android:text="Login"/>
|
||||
android:text="Login"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<TextView android:id="@+id/link_signup"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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:textSize="16dip"/>
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/splash_screen"
|
||||
tools:context="com.android_app.matan.ara.sagi.thesocialnotework.SplashActivity"
|
||||
android:visibility="visible">
|
||||
</LinearLayout>
|
||||
android:layout_height="fill_parent">
|
||||
<ImageView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:id="@+id/background" />
|
||||
</RelativeLayout>
|
Loading…
Reference in a new issue