Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package com.nitsilchar.hp.passwordStorage.activity;

/**
* Created by admin on 12/22/2017.
*/


import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.VideoView;
import android.content.Intent;

import android.content.SharedPreferences;
Expand All @@ -18,25 +34,30 @@

import io.fabric.sdk.android.Fabric;


public class SplashActivity extends AppCompatActivity {

VideoView video;

public static String str_login_test;

public static SharedPreferences sh;
public static SharedPreferences.Editor editor;

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(@Nullable Bundle savedInstanceState) {


super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_splash);

//ADDED BY ThisIsNSH

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow(); // in Activity's onCreate() for instance
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}

// getSupportActionBar().hide();

sh = getSharedPreferences("myprefe", 0);
editor = sh.edit();
str_login_test = sh.getString("loginTest", null);
Expand All @@ -46,15 +67,46 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

new Handler().postDelayed(new Runnable() {

video=(VideoView)findViewById(R.id.videoView);
Uri videouri=Uri.parse("android.resource://" +getPackageName()+"/"+R.raw.splash_final);//location of the splash video
video.setVideoURI(videouri);
video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void run() {
public void onCompletion(MediaPlayer mediaPlayer) {
// action which happens after completion of the video
//*****************************************//

if (str_login_test != null
&& !str_login_test.toString().trim().equals("")) {
Intent send = new Intent(getApplicationContext(),
LoginActivity.class);
startActivity(send);
}
/*
* if user login test is true on oncreate then redirect the user
* to result page
* if user login test is false on oncreate then redirect the
* user to login & registration page
*/
else {

Intent send = new Intent(getApplicationContext(),
LoginRegistrationActivity.class);
startActivity(send);

}

//*****************************************************************//

}
});

video.start();

//if the user touches the screen while splash screen video is playing, it moves to the next activity as deignated

video.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
////////////////////////////////////////////////////////////
if (str_login_test != null
&& !str_login_test.toString().trim().equals("")) {
Intent send = new Intent(getApplicationContext(),
Expand All @@ -72,15 +124,19 @@ public void run() {
startActivity(send);

}
////////////////////////////////////////////////////////////////
// finish();
return false;
}
});


}, 3000);

}

public boolean containsPass(String str){

return sh.contains(str)?true:false;
return sh.contains(str)?true:false;


}
Expand Down
45 changes: 9 additions & 36 deletions app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,14 @@
<?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"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"

android:background="@drawable/splash"
android:layout_height="match_parent"
tools:context="com.nitsilchar.hp.passwordStorage.activity.SplashActivity">
android:orientation="vertical"
android:gravity="center"
>

<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:id="@+id/layout"
android:layout_centerVertical="true"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="275dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_height="275dp"
android:padding="10dp"
android:src="@mipmap/icon"/>

<TextView
android:layout_below="@id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password\nStorage"
android:textAllCaps="true"
android:textAlignment="center"
android:textStyle="bold"
android:textColor="#ffffff"
android:textSize="25sp"
android:id="@+id/password"
android:layout_centerHorizontal="true"
android:fontFamily="sans-serif-condensed"/>
</LinearLayout>
</RelativeLayout>
<VideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Binary file added app/src/main/res/raw/splash_final.mp4
Binary file not shown.