Permalink
Browse files

Creating the Feed Activity

  • Loading branch information...
dragosholban committed May 13, 2018
1 parent aecb312 commit e5a103734993ef418bcc0a3f953c6c039ade4181
Binary file not shown.
@@ -29,4 +29,4 @@ dependencies {
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
@@ -9,14 +9,16 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FeedActivity"></activity>
</application>

</manifest>
@@ -0,0 +1,18 @@
package com.dragosholban.myinstagramapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class FeedActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed);
}

public void uploadImage(View view) {

}
}
@@ -19,6 +19,14 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

FirebaseUser fbUser = FirebaseAuth.getInstance().getCurrentUser();
if(fbUser != null) {
// User already signed in
// go to feed activity
Intent intent = new Intent(this, FeedActivity.class);
startActivity(intent);
}
}

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

if (resultCode == RESULT_OK) {
// Successfully signed in
FirebaseUser fbUser = FirebaseAuth.getInstance().getCurrentUser();
Toast.makeText(this, "Authenticated as " + fbUser.getDisplayName(), Toast.LENGTH_SHORT).show();
// go to feed activity
Intent intent = new Intent(this, FeedActivity.class);
startActivity(intent);
} else {
// Sign in failed, check response for error code
if (response != null) {
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FeedActivity">

<Button
android:id="@+id/uploadButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:onClick="uploadImage"
android:text="+"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>

0 comments on commit e5a1037

Please sign in to comment.