-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,346 additions
and
477 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 110 additions & 7 deletions
117
app/src/main/java/com/theknight/quizeo/FrontActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,128 @@ | ||
package com.theknight.quizeo; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.ProgressBar; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.FirebaseUser; | ||
import com.google.firebase.firestore.FirebaseFirestore; | ||
import com.theknight.quizeo.controller.Connection; | ||
|
||
public class FrontActivity extends AppCompatActivity { | ||
private Button startButton; | ||
private ProgressBar progressBar; | ||
private TextView textView; | ||
private FirebaseAuth firebaseAuth; | ||
private FirebaseUser currentUser; | ||
|
||
|
||
|
||
|
||
//Firestore connection | ||
|
||
|
||
/* access modifiers changed from: protected */ | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView((int) R.layout.activity_front); | ||
Button button = (Button) findViewById(R.id.start_button); | ||
this.startButton = button; | ||
button.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
FrontActivity.this.startActivity(new Intent(FrontActivity.this, Login.class)); | ||
setContentView(R.layout.activity_front); | ||
firebaseAuth = FirebaseAuth.getInstance(); | ||
|
||
|
||
|
||
final ProgressBar progress = (ProgressBar) findViewById(R.id.check); | ||
final Button button = (Button) findViewById(R.id.start_button); | ||
|
||
|
||
|
||
|
||
|
||
|
||
if(progress != null){ | ||
|
||
TextView text = (TextView) findViewById(R.id.set); | ||
if(button !=null){ | ||
button.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
text.setText(""); | ||
text.setTextColor(0); | ||
|
||
progress.setVisibility(View.VISIBLE); | ||
Handler h = new Handler(); | ||
h.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
if(Connection.checkConnection(FrontActivity.this)){ | ||
|
||
progress.setVisibility(View.INVISIBLE); | ||
text.setText(R.string.connected); | ||
currentUser = firebaseAuth.getCurrentUser(); | ||
Toast.makeText(FrontActivity.this, "Connected", Toast.LENGTH_SHORT).show(); | ||
if(currentUser != null){ | ||
startActivity(new Intent(FrontActivity.this,OptionActivity.class)); | ||
|
||
|
||
} | ||
else{ | ||
FrontActivity.this.startActivity(new Intent(FrontActivity.this, Login.class)); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
// | ||
|
||
|
||
|
||
|
||
}else{ | ||
if(text != null){ | ||
progress.setVisibility(View.INVISIBLE); | ||
|
||
text.setText(R.string.notConnected); | ||
text.setTextColor(Color.RED); | ||
Toast.makeText(FrontActivity.this, "Please check your internet connection", Toast.LENGTH_SHORT).show(); | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
} | ||
},2000); | ||
|
||
|
||
|
||
|
||
|
||
} | ||
}); | ||
|
||
} | ||
}); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
Oops, something went wrong.