Skip to content

Commit 23f1f5e

Browse files
committed
fix: Update prefix of IntroActivity
1 parent 183535a commit 23f1f5e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

app/src/main/java/com/edricchan/studybuddy/MainActivity.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.Calendar;
5151
import java.util.Date;
5252
import java.util.List;
53+
import java.util.StringJoiner;
5354

5455
import static java.lang.System.out;
5556

@@ -65,12 +66,12 @@ public class MainActivity extends AppCompatActivity implements GoogleApiClient.O
6566
private int testInt, RC_SIGN_IN;
6667
private FirebaseAuth mAuth;
6768
private GoogleApiClient mGoogleApiClient;
68-
69+
private String userName;
6970
@Override
7071
protected void onCreate(Bundle savedInstanceState) {
7172
super.onCreate(savedInstanceState);
7273
setContentView(R.layout.activity_main);
73-
view = (View) findViewById(R.id.content);
74+
view = (View) findViewById(R.id.todo_content);
7475
// Declare a new thread to do a preference check
7576
Thread t = new Thread(new Runnable() {
7677
@Override
@@ -86,7 +87,7 @@ public void run() {
8687
if (isFirstStart) {
8788

8889
// Launch app intro
89-
final Intent i = new Intent(MainActivity.this, IntroActivity.class);
90+
final Intent i = new Intent(MainActivity.this, MyIntroActivity.class);
9091

9192
runOnUiThread(new Runnable() {
9293
@Override
@@ -197,8 +198,16 @@ public void onClick(View view) {
197198
signInDialog.show();
198199
} else {
199200
// Logged in
200-
// TODO: Add database
201+
// TODO: Add firestore
201202
Log.d("Tag", "Successfully logged in!");
203+
String emailAddr = currentUser.getEmail();
204+
String[] userNameDots = emailAddr.substring(0, emailAddr.lastIndexOf("@"))
205+
.split(".");
206+
StringJoiner joiner = new StringJoiner("");
207+
for (String string:userNameDots) joiner.add(string);
208+
userName = joiner.toString();
209+
out.println(userName);
210+
// userName = userNameDots.join("");
202211
}
203212
}
204213

@@ -226,7 +235,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
226235
if (task.isSuccessful()) {
227236
// Sign in success, update UI with the signed-in user's information
228237
Log.d("Tag", "signInWithCredential:success");
229-
FirebaseUser user = mAuth.getCurrentUser();
238+
// FirebaseUser user = mAuth.getCurrentUser();
230239
// AlertDialog.Builder builder = new AlertDialog.Builder(context);
231240
// builder.setMessage(user.toString())
232241
// .setPositiveButton("Close", new DialogInterface.OnClickListener() {

0 commit comments

Comments
 (0)