-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuccessfullyIn.java
48 lines (40 loc) · 1.72 KB
/
SuccessfullyIn.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.example.elvina.quickshop;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class SuccessfullyIn extends AppCompatActivity implements View.OnClickListener{
private Button logOutButton;
private FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_successfully_in);
ActionBar actionBar = getSupportActionBar();
if (!(null == actionBar)) actionBar.hide();
firebaseAuth = FirebaseAuth.getInstance();
TextView proofStatementTextView = findViewById(R.id.proofStatementTextView);
logOutButton = findViewById(R.id.logOutButton);
if (firebaseAuth.getCurrentUser() == null) {
Toast.makeText(this, "Access failed", Toast.LENGTH_SHORT).show();
startActivity(new Intent(this, Authenticate.class));
}
FirebaseUser user = firebaseAuth.getCurrentUser();
proofStatementTextView.append(String.format("\n%s", user != null ? user.getEmail() : null));
proofStatementTextView.setOnClickListener(this);
logOutButton.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view == logOutButton) {
firebaseAuth.signOut();
startActivity(new Intent(this, Authenticate.class));
}
}
}