Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
3 changes: 0 additions & 3 deletions HappyPanda/.idea/markdown-navigator/profiles_settings.xml

This file was deleted.

69 changes: 0 additions & 69 deletions HappyPanda/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion HappyPanda/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity android:name=".SplashActivity"
android:theme="@style/AppTheme.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity"
android:theme="@style/AppTheme.NoActionBar"
></activity>
</application>

</manifest>
Binary file added HappyPanda/app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HappyPanda/app/src/main/ic_launcher_round-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions HappyPanda/app/src/main/java/com/happypanda/LoginActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.happypanda;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class LoginActivity extends AppCompatActivity {

private String MyPREFERENCES = "MyPrefs";
private TextView mEmail;
private TextView mPassword;
private Button mSignIn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

mEmail = (TextView)findViewById(R.id.login_email);
mPassword = (TextView)findViewById(R.id.login_password);
mSignIn = (Button)findViewById(R.id.login_sign_in);

mSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkDetails();
}
});

}

/*
Function to verify textedit details
*/
void checkDetails(){

String email = mEmail.getText().toString();
String password = mPassword.getText().toString();

if(email!= null){
doSignIn(email,password);
}

}

/*
Function to connect to internet and check for login details valid or not
*/
private void doSignIn(String email,String password) {
Toast.makeText(getApplicationContext(),"signing in" + email,Toast.LENGTH_SHORT).show();
if(email.equals("[email protected]")){
SharedPreferences.Editor editor = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE).edit();
editor.putString("Login", "yes");
editor.apply();

Intent intent = new Intent(LoginActivity.this,MainActivity.class);
startActivity(intent);
finish();
}
}

}
39 changes: 39 additions & 0 deletions HappyPanda/app/src/main/java/com/happypanda/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.happypanda;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Expand All @@ -16,10 +19,18 @@
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

private String MyPREFERENCES = "MyPrefs";
private String login;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

SharedPreferences sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
login = sharedpreferences.getString("Login", "");
checkLogin();

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

Expand Down Expand Up @@ -79,10 +90,38 @@ public boolean onNavigationItemSelected(MenuItem item) {

} else if (id == R.id.nav_send) {

}else if (id == R.id.logout) {
logout();
}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}

void checkLogin() {
// TODO make login activity and store token in shared prefs.
if (login == "") {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}

@Override
protected void onStop() {
super.onStop();
}

void logout(){

SharedPreferences.Editor editor = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE).edit();
editor.putString("Login", "");
editor.apply();

Intent intent = new Intent(MainActivity.this,LoginActivity.class);
startActivity(intent);
finish();

}
}
39 changes: 39 additions & 0 deletions HappyPanda/app/src/main/java/com/happypanda/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.happypanda;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class SplashActivity extends AppCompatActivity {

private String MyPREFERENCES = "MyPrefs";
private int DELAYTIME = 3000;
private String login = "";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);


new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startNext();
}
}, DELAYTIME);

}

void startNext() {
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
finish();

}
}


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions HappyPanda/app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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"
android:background="@color/logo_blue"
tools:context="com.happypanda.LoginActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="32dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginTop="32dp"
android:orientation="vertical">


<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:text="[email protected]" />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password" />
</android.support.design.widget.TextInputLayout>

<Button
android:id="@+id/login_sign_in"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login" />

<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register" />


</LinearLayout>

<ImageView
android:id="@+id/imageView3"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
app:srcCompat="@drawable/panda_bear" />
</RelativeLayout>
26 changes: 26 additions & 0 deletions HappyPanda/app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
android:background="@color/logo_blue"
tools:context="com.happypanda.SplashActivity">


<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="64dp"
android:layout_marginRight="64dp"
android:src="@drawable/panda_bear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>
3 changes: 3 additions & 0 deletions HappyPanda/app/src/main/res/menu/activity_main_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="About Us" />
<item
android:id="@+id/logout"
android:title="Logout" />
</menu>
</item>

Expand Down
Binary file modified HappyPanda/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HappyPanda/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions HappyPanda/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="logo_blue">#079ED9</color>
</resources>
Loading