Skip to content
Snippets Groups Projects
Commit 4eb2f30c authored by chan24's avatar chan24
Browse files

splash screen

parent 0cca2e86
Branches
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ dependencies {
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support.constraint:constraint-layout:+'
testCompile 'junit:junit:4.12'
}
......@@ -40,4 +41,5 @@ dependencies {
apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
......@@ -21,17 +21,19 @@
<application
android:name=".AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/login_icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".LoginActivity">
<activity android:name=".SplashActivity"
android:theme="@android:style/Theme.Light.NoTitleBar">
<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=".RegisterActivity" />
<activity android:name=".UserArea" />
<!--
......@@ -55,7 +57,7 @@
android:label="@string/title_activity_maps" />
<activity
android:name=".MapsActivityLocation"
android:label="@string/title_activity_maps_location"></activity>
android:label="@string/title_activity_maps_location" />
</application>
</manifest>
\ No newline at end of file
package com.example.chan24.smartplanner;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
......@@ -21,6 +22,7 @@ import com.google.firebase.auth.FirebaseAuth;
public class LoginActivity extends AppCompatActivity {
FirebaseAuth firebaseAuth;
ProgressDialog progressDialog;
@Override
......@@ -46,6 +48,9 @@ public class LoginActivity extends AppCompatActivity {
String n=name.getText().toString();
String p =password.getText().toString();
progressDialog = new ProgressDialog(LoginActivity.this);
if (n.isEmpty()){
Toast.makeText(getApplicationContext(),"Enter Name",Toast.LENGTH_SHORT).show();
return;
......@@ -55,9 +60,17 @@ public class LoginActivity extends AppCompatActivity {
return;
}
progressDialog.setMessage("Authenticating...");
progressDialog.setCancelable(false);
progressDialog.show();
firebaseAuth.getInstance().signInWithEmailAndPassword(n, p).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
progressDialog.dismiss();
if (task.isSuccessful()) {
finish();
startActivity(new Intent(getApplicationContext(), UserArea.class));
......
package com.example.chan24.smartplanner;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashActivity extends Activity {
private static int SPLASH_TIME_OUT = 4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(i);
finish();
}
},SPLASH_TIME_OUT);
}
}
app/src/main/res/drawable/login_icon.jpg

7.5 KiB

......@@ -24,40 +24,44 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/mainCoordinatorLayout">
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="11dp">
<Button
android:id="@+id/shopping"
android:layout_gravity="bottom"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Shopping"
android:layout_alignParentBottom="true"
android:layout_alignEnd="@+id/supermarket"
android:layout_weight="1"
/>
<Button
android:id="@+id/dining"
android:layout_gravity="bottom"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Dining"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/shopping"
android:layout_marginStart="46dp"
android:layout_weight="1"
/>
<Button
android:id="@+id/supermarket"
android:layout_gravity="bottom"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Supermarket"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_weight="1"
/>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.chan24.smartplanner.SplashActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/login_icon" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="101dp"
android:textSize="30dp"
android:textColor="#DC143C"
android:fontFamily="serif-monospace"
android:text="Smart Planner"
android:layout_alignBottom="@+id/imageView"
android:layout_centerHorizontal="true" />
</RelativeLayout>
......@@ -72,7 +72,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="135dp"
android:layout_marginTop="70dp"
android:text="Save" />
android:text="Find places!" />
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3f51b5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorPrimary">#DC143C</color>
<color name="colorPrimaryDark">#DC143C</color>
<color name="colorAccent">#FF4081</color>
</resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment