diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c885945..0843f0f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -19,20 +19,22 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> + android:name=".SplashActivity" + android:theme="@style/AppTheme.NoActionBar" + android:noHistory="true"> - + - - - - + \ No newline at end of file diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java index 8b71b22..564eb34 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java @@ -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); diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/SplashActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/SplashActivity.java index 3b134df..8794643 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/SplashActivity.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/SplashActivity.java @@ -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; + + } + } } diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png index d5a01b8..9a23568 100644 Binary files a/app/src/main/res/drawable/logo.png and b/app/src/main/res/drawable/logo.png differ diff --git a/app/src/main/res/drawable/splash_2.jpg b/app/src/main/res/drawable/splash_2.jpg new file mode 100644 index 0000000..c43aae8 Binary files /dev/null and b/app/src/main/res/drawable/splash_2.jpg differ diff --git a/app/src/main/res/drawable/splash_3.jpg b/app/src/main/res/drawable/splash_3.jpg new file mode 100644 index 0000000..e490731 Binary files /dev/null and b/app/src/main/res/drawable/splash_3.jpg differ diff --git a/app/src/main/res/drawable/splash_4.jpg b/app/src/main/res/drawable/splash_4.jpg new file mode 100644 index 0000000..4d125de Binary files /dev/null and b/app/src/main/res/drawable/splash_4.jpg differ diff --git a/app/src/main/res/drawable/splash_screen.JPG b/app/src/main/res/drawable/splash_screen.JPG deleted file mode 100644 index fb959b8..0000000 Binary files a/app/src/main/res/drawable/splash_screen.JPG and /dev/null differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 03073f0..8d100f9 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -26,12 +26,13 @@ android:layout_marginBottom="8dp" android:visibility="gone" /> - + android:src="@drawable/logo" + android:cropToPadding="false" + android:scaleType="fitXY" /> + android:text="Login" + android:background="@color/colorPrimary" + android:textColor="#ffffff" /> diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index 792f6c9..beb3bff 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -1,9 +1,12 @@ - - + android:layout_height="fill_parent"> + + \ No newline at end of file