Skip to content

Commit e5a1037

Browse files
committed
Creating the Feed Activity
1 parent aecb312 commit e5a1037

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed
0 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ dependencies {
2929
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
3030
}
3131

32-
apply plugin: 'com.google.gms.google-services'
32+
apply plugin: 'com.google.gms.google-services'

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
12-
<activity android:name=".MainActivity"
12+
<activity
13+
android:name=".MainActivity"
1314
android:screenOrientation="portrait">
1415
<intent-filter>
1516
<action android:name="android.intent.action.MAIN" />
1617

1718
<category android:name="android.intent.category.LAUNCHER" />
1819
</intent-filter>
1920
</activity>
21+
<activity android:name=".FeedActivity"></activity>
2022
</application>
2123

2224
</manifest>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.dragosholban.myinstagramapp;
2+
3+
import android.support.v7.app.AppCompatActivity;
4+
import android.os.Bundle;
5+
import android.view.View;
6+
7+
public class FeedActivity extends AppCompatActivity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
setContentView(R.layout.activity_feed);
13+
}
14+
15+
public void uploadImage(View view) {
16+
17+
}
18+
}

app/src/main/java/com/dragosholban/myinstagramapp/MainActivity.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public class MainActivity extends AppCompatActivity {
1919
protected void onCreate(Bundle savedInstanceState) {
2020
super.onCreate(savedInstanceState);
2121
setContentView(R.layout.activity_main);
22+
23+
FirebaseUser fbUser = FirebaseAuth.getInstance().getCurrentUser();
24+
if(fbUser != null) {
25+
// User already signed in
26+
// go to feed activity
27+
Intent intent = new Intent(this, FeedActivity.class);
28+
startActivity(intent);
29+
}
2230
}
2331

2432
public void signIn(View view) {
@@ -37,8 +45,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
3745

3846
if (resultCode == RESULT_OK) {
3947
// Successfully signed in
40-
FirebaseUser fbUser = FirebaseAuth.getInstance().getCurrentUser();
41-
Toast.makeText(this, "Authenticated as " + fbUser.getDisplayName(), Toast.LENGTH_SHORT).show();
48+
// go to feed activity
49+
Intent intent = new Intent(this, FeedActivity.class);
50+
startActivity(intent);
4251
} else {
4352
// Sign in failed, check response for error code
4453
if (response != null) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context=".FeedActivity">
8+
9+
<Button
10+
android:id="@+id/uploadButton"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:layout_marginBottom="8dp"
14+
android:layout_marginEnd="8dp"
15+
android:layout_marginLeft="8dp"
16+
android:layout_marginRight="8dp"
17+
android:layout_marginStart="8dp"
18+
android:onClick="uploadImage"
19+
android:text="+"
20+
app:layout_constraintBottom_toBottomOf="parent"
21+
app:layout_constraintEnd_toEndOf="parent"
22+
app:layout_constraintStart_toStartOf="parent" />
23+
24+
</android.support.constraint.ConstraintLayout>

0 commit comments

Comments
 (0)