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
15 changes: 1 addition & 14 deletions kute-android-app/.idea/misc.xml

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

4 changes: 4 additions & 0 deletions kute-android-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
def htextview_version = "0.1.2"



Expand All @@ -47,6 +48,9 @@ dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.25.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:appcompat-v7:25.1.1'
compile "com.hanks:htextview-base:$htextview_version" // base library
compile "com.hanks:htextview-typer:$htextview_version" // optional
compile "com.hanks:htextview-line:$htextview_version" // optional
compile 'com.android.support:design:25.1.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

Expand Down Expand Up @@ -42,10 +45,17 @@
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
import com.hanks.htextview.line.LineTextView;
import com.hanks.htextview.typer.TyperTextView;
import com.scorelab.kute.kute.Library.TextureVideoView;
import com.scorelab.kute.kute.R;
import com.scorelab.kute.kute.SplashActivity;
import com.scorelab.kute.kute.Util.ImageHandler;

import java.io.IOException;

import static java.lang.Thread.sleep;

public class RegisterActivity extends AppCompatActivity implements
GoogleApiClient.OnConnectionFailedListener,
View.OnClickListener{
Expand All @@ -55,28 +65,36 @@ public class RegisterActivity extends AppCompatActivity implements
private static final int RC_SIGN_IN = 9001;

private SignInButton mSignInButton;
LoginButton loginButton;
TyperTextView lineTextView;
String animText = "Kute";
CountDownTimer timer;

private GoogleApiClient mGoogleApiClient;

// Firebase instance variables
private FirebaseAuth mFirebaseAuth;

TextureVideoView videoview;
// [START declare_auth]
private FirebaseAuth mAuth;
// [END declare_auth]
// [START declare_auth_listener] Facebook
private FirebaseAuth.AuthStateListener mAuthListener;

private CallbackManager mCallbackManager; //Facebook
Button inG, inFB;


@Override
public void onClick(View v) {

switch (v.getId()) {
case R.id.login_with_google:
case R.id.btn_inG:
signIn();
break;
case R.id.btn_inFB:
loginButton.performClick();
break;
}
}

Expand Down Expand Up @@ -150,7 +168,61 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

try {

setContentView(R.layout.testreg);
videoview = (TextureVideoView) findViewById(R.id.videoview);
Uri myUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.videoview_kute);
videoview.setDataSourceURI(this, myUri);

videoview.setScaleType(TextureVideoView.ScaleType.CENTER_CROP);
videoview.setLooping(true);
videoview.play();
lineTextView = (TyperTextView) findViewById(R.id.textView);
inG = (Button) findViewById(R.id.btn_inG);
inFB = (Button) findViewById(R.id.btn_inFB);
inG.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signIn();
}
});
inFB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loginButton.performClick();
}
});
lineTextView.setSoundEffectsEnabled(false);
lineTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((TyperTextView)v).animateText(animText);
if (animText.equals("A Commute App for Sri Lanka")){
animText = "Kute";
}
else if (animText.equals("Kute")){
animText = "A Commute App for Sri Lanka";
}
}
});


timer = new CountDownTimer(5000, 3000) {

@Override
public void onTick(long millisUntilFinished) {
lineTextView.performClick();
}

@Override
public void onFinish() {
try{
yourMethod();
}catch(Exception e){
Log.e("Error", "Error: " + e.toString());
}
}
}.start();

// Assign fields
mSignInButton = (SignInButton) findViewById(R.id.login_with_google);
Expand All @@ -171,7 +243,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
// Initialize FirebaseAuth
mFirebaseAuth = FirebaseAuth.getInstance();


//Facebook
mAuth = FirebaseAuth.getInstance();
// [START auth_state_listener]
Expand Down Expand Up @@ -205,7 +276,7 @@ public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
};

mCallbackManager = CallbackManager.Factory.create();
LoginButton loginButton = (LoginButton) findViewById(R.id.connectWithFbButton);
loginButton = (LoginButton) findViewById(R.id.connectWithFbButton);
loginButton.setReadPermissions("email", "public_profile","user_friends");

loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
Expand Down Expand Up @@ -285,19 +356,33 @@ public void onError(FacebookException error) {

rq= Volley.newRequestQueue(this);
}
void yourMethod(){
timer.start();
}

@Override
protected void onStop() {
super.onStop();
videoview.stop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}

}

@Override
protected void onDestroy() {
super.onDestroy();
videoview.stop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}
}

@Override
protected void onStart() {
super.onStart();

mAuth.addAuthStateListener(mAuthListener);
}

Expand Down
Loading