Git Product home page Git Product logo

social-app-android's Introduction

SocialComponents

Summary

This application is a pattern of social components comprising posts, likes, comments, views, and others that can be used for Android application development. It is Firebase-based and uses such Firebase features as the database, storage, and authentication. Our app has Firebase queries implemented in it, i.e. data pagination, filtering data by an author. As well, it is the example of working with Firebase transaction for counting likes, views, and comments. Our application is the great example of material design. The user-friendly animation guides a person by opening screens of details and a user profile.

Current build

The latest app version is available on Google Play

Setup steps

  1. First of all you need google-services.json. Create a Firebase project in the Firebase console, if you don't already have one. Go to your project and click ‘Add Firebase to your Android app’. Follow the setup steps. At the end, you'll download a google-services.json file which you should add to your project.

google_service_json

  1. Setup realtime database. In firebase console go to DEVELOP->Database-> Get Started -> choose tab ‘RULES’ and past this:
{
  "rules": {
    ".read": "true",
    ".write": "true"
  }
}
  1. If you haven't yet specified your app's SHA-1 fingerprint, do so from the Settings page Settings page of the Firebase console. See Authenticating Your Client for details on how to get your app's SHA-1 fingerprint.

  2. Enable the sign in method with google. Go to DEVELOP -> Authentication -> SIGN-IN METHODS. You will see Sign-in providers. Find Google and enable it. Here you will see Web SDK configuration. Open it and copy Web client ID and put it in the project: /app/src/main/res/values/constants.xml to “google_web_client_id” property.

google_web_client_id

  1. Enable facebook sign in method.
  • On the Facebook for Developers site, add new application.

  • Get the App ID and an App Secret for your app.

  • Go to DEVELOP -> Authentication -> SIGN-IN METHODS. On the Sign in method tab, enable the Facebook sign-in method and specify the App ID and App Secret you got from Facebook. There you can fined OAuth redirect URL (e.g. my-app-12345.firebaseapp.com/__/auth/handler). You should use it on the next step.

  • Configure the Facebook Login on the Facebook for Developers site. You don't need add extra lines to the project from the instruction! All necessary data is already there. Define OAuth redirect URL you got from the firebase console on the previous step.

  • Finally, Put App ID from facebook to the project: /app/src/main/res/values/constants.xml to the “facebook_app_id” property.

  1. Init storage. Go to Firebase console, DEVELOP->Storage. Follow instructions on this page. At the end you should see the link. It is like “gs://test-9eff4.appspot.com”. Put this link to the project /app/src/main/res/values/constants.xml to “storage_link” property.

storage_link_exp

  1. Deploy cloud functions
  • Set up and initialize Firebase SDK for Cloud Functions following the Firebase instruction. Important! During initialization CLI firebase ask you to override package.json and index.js files. Do not override index.js file! All cloud functions code from this repository are already there. Subsequently you can add new functions to this file.
  • Deploy the function by running the command:
    $ firebase deploy --only functions
    

Now you can install app, login and create a post.

Blog posts

Getting Started — Opening the App

Implemented elements and features:

  • Hiding Toolbar when the post list is scrolling down and showing it again when it’s scrolling up.
  • RecyclerView with CardViews
  • Float Action Button
  • Snack Bar for messages
  • Refresh a screen
  • Loading posts by parts (Progress bar in the bottom of the screen for loading the next portion of posts)

main_screen


Registration screen

Implemented elements and effects:

  • Facebook Sign-In
  • Google Sign-In

login_screen


Create profile

Implemented elements and features:

  • Feeling in fields with data from social network
  • Text Input Layout
  • Pick image or take photo
  • Manage App Permissions on Android 6.0

create_profile


Create post

Implemented elements and features:

  • Text Input Layout
  • Pick image or take photo
  • Manage App Permissions on Android 6.0

create_post


Post Details

Implemented elements and features:

  • Clickable link in description
  • Like button animation
  • Add comments
  • Scroll to the first comment by press on Comments Counter
  • Collapse/expand text in the long comments
  • Add complain for the post
  • Page is updated in real time

post_detail


Image Details

Implemented elements and features:

  • Zooming image

image_detail


Post Details. Comments

Implemented elements and features:

  • Comments counter
  • Collapse / expand text of large comment
  • Date of a comment

comments


Profile

Implemented elements and features:

  • Posts and likes counters
  • Refresh list of posts
  • Update profile information (photo and name) in real time
  • RecyclerView with CardViews
  • My profile options:
    • sign in
    • edit profile
    • create a post

profile


Panel of Counters

Implemented elements and features:

  • Counters of watches, likes and comments
  • Created date
  • Possibility to add like by click on “like” button
  • Animation of like button

counters_panel


Edit profile

Implemented elements and features:

  • Feeling in fields with personal info of current user
  • Text Input Layout
  • Pick image or take photo
  • Manage App Permissions on Android 6.0

edit_profile

The Social App is a Minimum Viable Product intended for building social features for an Android application. It is free to use for other developers. Though, our team is ready to create a mobile application for you implementing any social features you need, along with GPS-navigation functions, and an offline mode. Contact us to know more.

social-app-android's People

Contributors

batishev-rozdoum avatar kristinassb avatar tymaks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

social-app-android's Issues

Firebase outdated Cloud Functions

I think Social App has outdated cloud functions. I am not much familiar with JavaScript but I tried to figure it out, now two functions are working for me , but PushNotification for new Post function is not working.

Updated (Working):

var functions = require('firebase-functions');

const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

const actionTypeNewLike = "new_like"
const actionTypeNewComment = "new_comment"
const actionTypeNewPost = "new_post"
const notificationTitle = "Social App"

const postsTopic = "postsTopic"


exports.pushNotificationLikes = functions.database.ref('/post-likes/{postId}/{authorId}/{likeId}').onCreate((data, context) => {
    console.log('New like was added');

    const likeAuthorId = context.params.authorId;
    const postId = context.params.postId;
    const posType = "Post";

    // Get liked post.
    const getPostTask = admin.database().ref(`/posts/${postId}`).once('value');

    return getPostTask.then(post => {

        if (likeAuthorId === post.val().authorId) {
            return console.log('User liked own post');
        }

        // Get the list of device notification tokens.
        const getDeviceTokensTask = admin.database().ref(`/profiles/${post.val().authorId}/notificationTokens`).once('value');
        console.log('getDeviceTokensTask path: ', `/profiles/${post.val().authorId}/notificationTokens`)

        // Get like author.
        const getLikeAuthorProfileTask = admin.database().ref(`/profiles/${likeAuthorId}`).once('value');

        return Promise.all([getDeviceTokensTask, getLikeAuthorProfileTask]).then(results => {
            const tokensSnapshot = results[0];
            const likeAuthorProfile = results[1].val();

            // Check if there are any device tokens.
            if (!tokensSnapshot.hasChildren()) {
                return console.log('There are no notification tokens to send to.');
            }

            console.log('There are', tokensSnapshot.numChildren(), 'tokens to send notifications to.');
            console.log('Fetched like Author profile', likeAuthorProfile);

            // Create a notification
            const payload = {
                data: {
                    actionType: actionTypeNewLike,
                    title: notificationTitle,
                    body: `${likeAuthorProfile.username} liked your post`,
                    icon: post.val().imagePath,
                    postId: postId,

                },
            };

            // Listing all tokens.
            const tokens = Object.keys(tokensSnapshot.val());
            console.log('tokens:', tokens[0]);

            // Send notifications to all tokens.
            return admin.messaging().sendToDevice(tokens, payload).then(response => {
                // For each message check if there was an error.
                const tokensToRemove = [];
                response.results.forEach((result, index) => {
                    const error = result.error;
                    if (error) {
                        console.error('Failure sending notification to', tokens[index], error);
                        // Cleanup the tokens who are not registered anymore.
                        if (error.code === 'messaging/invalid-registration-token' ||
                            error.code === 'messaging/registration-token-not-registered') {
                            tokensToRemove.push(tokensSnapshot.ref.child(tokens[index]).remove());
                        }
                    }
                });
                return Promise.all(tokensToRemove);
            });
        });
    })
});



exports.pushNotificationComments = functions.database.ref('/post-comments/{postId}/{commentId}').onCreate((snap, context) => {

    const commentId = context.params.commentId;
    const postId = context.params.postId;
    const comment = snap.val();


    console.log('New comment was added, id: ', postId);

    // Get the commented post .
    const getPostTask = admin.database().ref(`/posts/${postId}`).once('value');

    return getPostTask.then(post => {



        // Get the list of device notification tokens.
        const getDeviceTokensTask = admin.database().ref(`/profiles/${post.val().authorId}/notificationTokens`).once('value');
        console.log('getDeviceTokensTask path: ', `/profiles/${post.val().authorId}/notificationTokens`)

        // Get post author.
        const getCommentAuthorProfileTask = admin.database().ref(`/profiles/${comment.authorId}`).once('value');
        console.log('getCommentAuthorProfileTask path: ', `/profiles/${comment.authorId}`)

        return Promise.all([getDeviceTokensTask, getCommentAuthorProfileTask]).then(results => {
            const tokensSnapshot = results[0];
            const commentAuthorProfile = results[1].val();

            if (commentAuthorProfile.id === post.val().authorId) {
                return console.log('User commented own post');
            }

            // Check if there are any device tokens.
            if (!tokensSnapshot.hasChildren()) {
                return console.log('There are no notification tokens to send to.');
            }

            console.log('There are', tokensSnapshot.numChildren(), 'tokens to send notifications to.');

            // Create a notification
            const payload = {
                data: {
                    actionType: actionTypeNewComment,
                    title: notificationTitle,
                    body: `${commentAuthorProfile.username} commented your post`,
                    icon: post.val().imagePath,
                    postId: postId,
                },
            };

            // Listing all tokens.
            const tokens = Object.keys(tokensSnapshot.val());
            console.log('tokens:', tokens[0]);

            // Send notifications to all tokens.
            return admin.messaging().sendToDevice(tokens, payload).then(response => {
                // For each message check if there was an error.
                const tokensToRemove = [];
                response.results.forEach((result, index) => {
                    const error = result.error;
                    if (error) {
                        console.error('Failure sending notification to', tokens[index], error);
                        // Cleanup the tokens who are not registered anymore.
                        if (error.code === 'messaging/invalid-registration-token' ||
                            error.code === 'messaging/registration-token-not-registered') {
                            tokensToRemove.push(tokensSnapshot.ref.child(tokens[index]).remove());
                        }
                    }
                });
                return Promise.all(tokensToRemove);
            });
        });
    })
});

Not Working

exports.pushNotificationNewPost = functions.database.ref('/posts/{postId}').onWrite(event => {
    const postId = event.params.postId;

    // Only edit data when it is first created.
    if (event.data.previous.exists()) {
        console.log('Post was changed');
        return;
    }
    // Exit when the data is deleted.
    if (!event.data.exists()) {
        console.log('Post was removed');
        return;
    }

    console.log('New post was created');

    // Get post authorID.
    const getAuthorIdTask = admin.database().ref(`/posts/${postId}/authorId`).once('value');

     return getAuthorIdTask.then(authorId => {

        console.log('post author id', authorId.val());

          // Create a notification
        const payload = {
            data : {
                actionType: actionTypeNewPost,
                postId: postId,
                authorId: authorId.val(),
            },
        };

        // Send a message to devices subscribed to the provided topic.
        return admin.messaging().sendToTopic(postsTopic, payload)
                 .then(function(response) {
                   // See the MessagingTopicResponse reference documentation for the
                   // contents of response.
                   console.log("Successfully sent info about new post :", response);
                 })
                 .catch(function(error) {
                   console.log("Error sending info about new post:", error);
                 });
         });

});

Any body tried this?

Problem search bar

after searching users from firebase all the user are displayed correectly with picture name and email but My problem is when i try to pass to the user profile after clicking on the user
it's always an error
please any one can try the code

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

import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;

import android.widget.EditText;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.rozdoum.socialcomponents.R;

import java.util.ArrayList;

public class SearchBarActivity extends AppCompatActivity {
EditText search_edit_text;
RecyclerView recyclerView;
DatabaseReference databaseReference;
FirebaseUser firebaseUser;
ArrayList usernameA;
ArrayList emailA;
ArrayList photoUrlA;
SearchAdapter searchAdapter;

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

    search_edit_text =  findViewById(R.id.search_edit_text);
    recyclerView =  findViewById(R.id.recyclerView);

    databaseReference = FirebaseDatabase.getInstance().getReference();
    firebaseUser = FirebaseAuth.getInstance().getCurrentUser();

    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));

    /*
    * Create a array list for each node you want to use
    * */
    usernameA = new ArrayList<>();
    emailA = new ArrayList<>();
    photoUrlA = new ArrayList<>();

    search_edit_text.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (!s.toString().isEmpty()) {
                setAdapter(s.toString());
            } else {
                /*
                * Clear the list when editText is empty
                * */
                usernameA.clear();
                emailA.clear();
                photoUrlA.clear();
                recyclerView.removeAllViews();
            }
        }
    });
}

private void setAdapter(final String searchedString) {
    databaseReference.child("profiles").addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            /*
            * Clear the list for every new search
            * */
            usernameA.clear();
            emailA.clear();
            photoUrlA.clear();
            recyclerView.removeAllViews();

            int counter = 0;

            /*
            * Search all users for matching searched string
            * */
            for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                String uid = snapshot.getKey();
                String username = snapshot.child("username").getValue(String.class);
                String email = snapshot.child("email").getValue(String.class);
                String photoUrl = snapshot.child("photoUrl").getValue(String.class);

                if (username != null) {
                    if (username.toLowerCase().contains(searchedString.toLowerCase())) {
                        usernameA.add(username);
                        emailA.add(email);
                        photoUrlA.add(photoUrl);
                        counter++;
                    } else if (username != null && username.toLowerCase().contains( searchedString.toLowerCase() )) {
                        usernameA.add( username );
                        emailA.add( email );
                        photoUrlA.add( photoUrl );
                        counter++;
                    }
                }

                /*
                * Get maximum of 15 searched results only
                * */
                if (counter == 15)
                    break;
            }

            searchAdapter = new SearchAdapter(SearchBarActivity.this, usernameA, emailA, photoUrlA);
            recyclerView.setAdapter(searchAdapter);
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });
}

/////////////////////////////

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.rozdoum.socialcomponents.R;
import com.rozdoum.socialcomponents.model.Profile;

import java.util.ArrayList;

public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.SearchViewHolder> {
public static final String USER_ID_EXTRA_KEY = "ProfileActivity.USER_ID_EXTRA_KEY";

Context context;
ArrayList<String> usernameA;
ArrayList<String> emailA;
ArrayList<String> photoUrlA;
private Profile userId;

class SearchViewHolder extends RecyclerView.ViewHolder {
    ImageView profileImage;
    TextView full_name, user_name;

    public SearchViewHolder(View itemView) {
        super(itemView);
        profileImage = (ImageView) itemView.findViewById(R.id.profile_image);
        full_name = (TextView) itemView.findViewById( R.id.full_name);
        user_name = (TextView) itemView.findViewById(R.id.user_name);
    }
}

public SearchAdapter(Context context, ArrayList<String> fullNameList, ArrayList<String> userNameList, ArrayList<String> profilePicList) {
    this.context = context;
    this.usernameA = fullNameList;
    this.emailA = userNameList;
    this.photoUrlA = profilePicList;
}

@Override
public SearchAdapter.SearchViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(context).inflate(R.layout.search_list_items, parent, false);
    return new SearchAdapter.SearchViewHolder(view);
}

@Override
public void onBindViewHolder(SearchViewHolder holder, int position) {
    holder.full_name.setText(usernameA.get(position));
    holder.user_name.setText(emailA.get(position));
    Glide.with(context).load(photoUrlA.get(position)).asBitmap().placeholder(R.mipmap.ic_launcher).into(holder.profileImage);

    holder.full_name.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            Toast.makeText(context, "Full Name Clicked", Toast.LENGTH_SHORT).show();
            Intent i = new Intent (context, ProfileActivity.class);
            i.putExtra("profile", userId);
            context.startActivity(i);
        }
    });
}

@Override
public int getItemCount() {
    return usernameA.size();
}

}

and on the ProfileActivity.class

i added this
String value = getIntent().getStringExtra("profile");

When i start to use program i keep getting dependencies errors

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.firebase:firebase-database-connection:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.firebase:firebase-storage-common:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.firebase:firebase-iid:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-api-phone:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any matches for com.google.android.gms:play-services-measurement-base:[15.0.4] as no versions of com.google.android.gms:play-services-measurement-base are available.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics-impl:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-database-connection:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-storage-common:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-iid:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-api-phone:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any matches for com.google.android.gms:play-services-measurement-base:[15.0.4] as no versions of com.google.android.gms:play-services-measurement-base are available.
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics-impl:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-database-connection:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-storage-common:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-iid:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-api-phone:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any matches for com.google.android.gms:play-services-measurement-base:[15.0.4] as no versions of com.google.android.gms:play-services-measurement-base are available.
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics-impl:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.firebase:firebase-database-connection:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.firebase:firebase-storage-common:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.firebase:firebase-iid:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-api-phone:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any matches for com.google.android.gms:play-services-measurement-base:[15.0.4] as no versions of com.google.android.gms:play-services-measurement-base are available.
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics-impl:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-database-connection:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-storage-common:[16.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-iid:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-api-phone:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-auth-base:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any matches for com.google.android.gms:play-services-measurement-base:[15.0.4] as no versions of com.google.android.gms:play-services-measurement-base are available.
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics-impl:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.firebase:firebase-analytics:[16.0.0].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-basement:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-tasks:[15.0.1].
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1].
Open File
Show Details

Why not create Library Project Instead of App Project?

Hi,

Thank you so much for creating such a nice project to demonstrate how to create Social Network using Firebase.

Why not create a Library Project instead of App Project and do further development etc because that way it can be included in other apps easily.

Locally we already converted it into Library Project by downloading it.

What do you recommend?

Google Login dont work

Hi,
I cannot login with google account, if i click google login, i can choose a account its loading, but nothing do. Facebook login works fine. Have u a idea?

Unable to create profile after login through google sign in

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.conrado.annapode, PID: 22765
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.conrado.annapode/com.example.conrado.annapode.activities.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.DatabaseReference com.example.conrado.annapode.managers.DatabaseHelper.getDatabaseReference()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6342)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.DatabaseReference com.example.conrado.annapode.managers.DatabaseHelper.getDatabaseReference()' on a null object reference
at com.example.conrado.annapode.managers.DatabaseHelper.removeRegistrationToken(DatabaseHelper.java:151)
at com.example.conrado.annapode.utils.LogoutHelper.signOut(LogoutHelper.java:35)
at com.example.conrado.annapode.activities.LoginActivity.onCreate(LoginActivity.java:76)
at android.app.Activity.performCreate(Activity.java:6847)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6342) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770) 

Error when update firebase from 9.8.0 to 16.0.2

When i update firebase from 9.8.0 to 16.0.2 error error: cannot find symbol method getDownloadUrl().
Please help me!
@OverRide
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL.
Uri downloadUrl = taskSnapshot.getDownloadUrl();
LogUtil.logDebug(TAG, "successful upload image, image url: " + String.valueOf(downloadUrl));

                post.setImagePath(String.valueOf(downloadUrl));
                post.setImageTitle(imageTitle);
                createOrUpdatePost(post);

                onPostCreatedListener.onPostSaved(true);
            }
        });

Notifications

Hi, I really liked the code. Well tidy and structured. But where does the active part of notifications received from the other user who post information?

Google Log In error

I am getting this error..

04-13 22:01:43.754 18588-18958/com.google.android.gms E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE

Like comment button

I need to block like & comment button after one hour after posting the picture any solution ?????

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.2.

what could i be doing wrong

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-database:15.0.1'
compile 'com.google.firebase:firebase-auth:15.1.0'
compile 'com.google.firebase:firebase-storage:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.google.firebase:firebase-auth:15.1.0'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile 'com.google.gms:google-services:3.3.0'

}

Sign in Method Error

If one email address for example [email protected] that is used in facebook account creation. And i login with facebook and i signout. And then i login with that gmail and logout. Finally i sign in facebook again then an alert happen(An account already exists with the same email address but diferent sign-in credentials...)

java.lang.RuntimeException: Unable to start activity

At the very first time the project will successfully debugged to my smartphone! After creating a post from phone when i debug the project for the second time its gives the below errors! why it says i have not created any post or why it says null ?

E/AndroidRuntime: FATAL EXCEPTION: main
Process: bd.ac.pstu.rezwan12cse.bounduley12, PID: 10078
java.lang.RuntimeException: Unable to start activity ComponentInfo{bd.ac.pstu.rezwan12cse.bounduley12/bd.ac.pstu.rezwan12cse.bounduley12.activities.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void bd.ac.pstu.rezwan12cse.bounduley12.managers.DatabaseHelper.getPostList(bd.ac.pstu.rezwan12cse.bounduley12.managers.listeners.OnPostListChangedListener, long)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2516)
at android.app.ActivityThread.access$800(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5528)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void bd.ac.pstu.rezwan12cse.bounduley12.managers.DatabaseHelper.getPostList(bd.ac.pstu.rezwan12cse.bounduley12.managers.listeners.OnPostListChangedListener, long)' on a null object reference
at bd.ac.pstu.rezwan12cse.bounduley12.managers.PostManager.getPostsList(PostManager.java:59)
at bd.ac.pstu.rezwan12cse.bounduley12.adapters.PostsAdapter.loadNext(PostsAdapter.java:202)
at bd.ac.pstu.rezwan12cse.bounduley12.adapters.PostsAdapter.loadFirstPage(PostsAdapter.java:155)
at bd.ac.pstu.rezwan12cse.bounduley12.activities.MainActivity.initContentView(MainActivity.java:277)
at bd.ac.pstu.rezwan12cse.bounduley12.activities.MainActivity.onCreate(MainActivity.java:120)
at android.app.Activity.performCreate(Activity.java:5966)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2516) 
at android.app.ActivityThread.access$800(ActivityThread.java:162) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:189) 
at android.app.ActivityThread.main(ActivityThread.java:5528) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) 

Cannot read property 'authorId' of undefined

i got this from logs

TypeError: Cannot read property 'authorId' of undefined at exports.pushNotificationLikes.functions.database.ref.onWrite.event (/user_code/index.js:24:38) at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27) at next (native) at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71 at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12) at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36) at /var/tmp/worker/worker.js:710:26 at process._tickDomainCallback (internal/process/next_tick.js:135:7)

the deploy was successful

Dislike or vote down option..

I am trying to add dislike or vote down feature but not getting successful in postdeatails activity due to button states.. Anybody tried this???

Firebase Rules amendment.

Currently firebase rules for this apps are public e.g.

{
  "rules": {
    ".read": "true",
    ".write": "true"
  }
}

everyone can easily access the data base,,, if i try to change any rule , it shows error notification on startup, how to change the rules to make it private for specific user. I have read the firebase rules documentation , but I am new to firebase and don't have much expertise for this..

Slow to load images

Actually its a little bit slow to load images...does anybody have any idea to fix it

No adapter attached; skipping layout, Only displays 1st time each Fragment (Tablayout)

Hi I tried this project in Tab layout using view-pager with more than 1 fragment. I categorize the posts in different sections it works fine when I use it in different activities but here is a problem with fragments in main activity, if I use only one tab it works all fine. But if i exceed from 1 tabs , on first time it loads the layout but if i start switching between tabs the content is gone with a message in log-cat "No adapter attached; skipping layout",
Here posType is variable which categorize the posts. rest code is same for all fragments.
I have been searching for it for a long time, there are so many questions about this but i think my case is different, if there there is problem in my code then it should not load for the first time.

public class TabFragment extends android.support.v4.app.Fragment {


    @Nullable
    @Override
    public View onCreateView( @NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab4_fragment, container, false);

        posType = "post";

        profileManager = ProfileManager.getInstance(getActivity());

        postManager = PostManager.getInstance(getActivity());


        floatingActionButton = (FloatingActionButton) view.findViewById(R.id.addNewPostFab);
        if (recyclerView == null) {

            if (floatingActionButton != null) {
                floatingActionButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick( View v ) {
                        if (hasInternetConnection()) {
                            addPostClickAction();
                        } else {
                            showFloatButtonRelatedSnackBar(R.string.internet_connection_failed);
                        }
                    }
                });
            }

            newPostsCounterTextView = (TextView) view.findViewById(R.id.newPostsCounterTextView);
            newPostsCounterTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick( View v ) {
                    refreshPostList((posType));
                }
            });

            final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
            SwipeRefreshLayout swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
            recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
            postsAdapter = new PostsAdapter((MainActivity) getActivity(), swipeContainer, "Quiz");
            postsAdapter.setCallback(new PostsAdapter.Callback() {
                @Override
                public void onItemClick( final Post post, final View view ) {
                    PostManager.getInstance(getActivity()).isPostExistSingleValue(post.getId(), new OnObjectExistListener<Post>() {
                        @Override
                        public void onDataChanged( boolean exist ) {
                            if (exist) {
                                openPostDetailsActivity(post, view);
                            } else {
                                showFloatButtonRelatedSnackBar(R.string.error_post_was_removed);
                            }
                        }
                    },posType);
                }

                @Override
                public void onListLoadingFinished() {
                    progressBar.setVisibility(View.GONE);
                }

                @Override
                public void onAuthorClick( String authorId, View view ) {
                    openProfileActivity(authorId, view);
                }

                @Override
                public void onCanceled( String message ) {
                    progressBar.setVisibility(View.GONE);
                    Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
                }
            });

            recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
            ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
            recyclerView.setAdapter(postsAdapter);
            postsAdapter.loadFirstPage((posType));
            updateNewPostCounter();


            recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                @Override
                public void onScrolled( RecyclerView recyclerView, int dx, int dy ) {
                    hideCounterView();
                    super.onScrolled(recyclerView, dx, dy);
                }
            });
        }



        postCounterWatcher = new PostManager.PostCounterWatcher() {
            @Override
            public void onPostCounterChanged( int newValue ) {
                updateNewPostCounter();
            }
        };

        postManager.setPostCounterWatcher(postCounterWatcher);  

        return view;

    }



    @Override
    public void onActivityResult( int requestCode, int resultCode, Intent data ) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK) {
            switch (requestCode) {
                case ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST:
                    refreshPostList((posType));
                    break;
                case CreatePostActivity.CREATE_NEW_POST_REQUEST:
                    refreshPostList((posType));
                    showFloatButtonRelatedSnackBar(R.string.message_post_was_created);
                    break;

                case PostDetailsActivity.UPDATE_POST_REQUEST:
                    if (data != null) {
                        PostStatus postStatus = (PostStatus) data.getSerializableExtra(PostDetailsActivity.POST_STATUS_EXTRA_KEY);
                        if (postStatus.equals(PostStatus.REMOVED)) {
                            postsAdapter.removeSelectedPost();
                            showFloatButtonRelatedSnackBar(R.string.message_post_was_removed);
                        } else if (postStatus.equals(PostStatus.UPDATED)) {
                            postsAdapter.updateSelectedPost((posType));
                        }
                    }
                    break;
            }
        }
    }



    @Override
    public void onResume() {
        super.onResume();
        updateNewPostCounter();

    }




    private void updateNewPostCounter() {
        Handler mainHandler = new Handler(getActivity().getMainLooper());
        mainHandler.post(new Runnable() {
            @Override
            public void run() {
                int newPostsQuantity = postManager.getNewPostsCounter();

                if (newPostsCounterTextView != null) {
                    if (newPostsQuantity > 0) {
                        showCounterView();

                        String counterFormat = getResources().getQuantityString(R.plurals.new_posts_counter_format, newPostsQuantity, newPostsQuantity);
                        newPostsCounterTextView.setText(String.format(counterFormat, newPostsQuantity));
                    } else {
                        hideCounterView();
                    }
                }
            }
        });
    }



    public void doAuthorization(ProfileStatus status) {
        if (status.equals(ProfileStatus.NOT_AUTHORIZED) || status.equals(ProfileStatus.NO_PROFILE)) {
            startLoginActivity();
        }
    }


    private void startLoginActivity() {
        Intent intent = new Intent(getActivity(), LoginActivity.class);
        startActivity(intent);
    }

    private void openCreatePostActivity() {
        Intent intent = new Intent(getActivity(), CreatePostActivity.class);
        intent.putExtra("posType", posType);
        startActivityForResult(intent, CreatePostActivity.CREATE_NEW_POST_REQUEST);
    }

    private void addPostClickAction() {
        ProfileStatus profileStatus = profileManager.checkProfile();

        if (profileStatus.equals(ProfileStatus.PROFILE_CREATED)) {
            openCreatePostActivity();
        } else {
            doAuthorization(profileStatus);
        }
    }

    public void showSnackBar(View view, int messageId) {
        Snackbar.make(getView().findViewById(R.id.main_content),
                messageId, Snackbar.LENGTH_LONG).show();

    }


    public void showSnackBar(String message) {

        Snackbar.make(getView().findViewById(R.id.main_content),
                message, Snackbar.LENGTH_LONG).show();

    }

    public void showSnackBar(int messageId) {

        Snackbar.make(getView().findViewById(R.id.main_content),
                messageId, Snackbar.LENGTH_LONG).show();
    }



    public void showFloatButtonRelatedSnackBar( int messageId ) {
        showSnackBar(floatingActionButton, messageId);

    }

    private void hideCounterView() {
        if (!counterAnimationInProgress && newPostsCounterTextView.getVisibility() == View.VISIBLE) {
            counterAnimationInProgress = true;
            AlphaAnimation alphaAnimation = AnimationUtils.hideViewByAlpha(newPostsCounterTextView);
            alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart( Animation animation ) {

                }

                @Override
                public void onAnimationEnd( Animation animation ) {
                    counterAnimationInProgress = false;
                    newPostsCounterTextView.setVisibility(View.GONE);
                }

                @Override
                public void onAnimationRepeat( Animation animation ) {

                }
            });

            alphaAnimation.start();
        }
    }
    private void openPostDetailsActivity( Post post, View v ) {
        Intent intent = new Intent(getActivity(), PostDetailsActivity.class);
        intent.putExtra("posType", posType);
        intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());

        if ((new String(posType).equals("Question")) || (new String(posType).equals("Quiz"))){
            startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
        } else {

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

                View imageView = v.findViewById(R.id.postImageView);
                View authorImageView = v.findViewById(R.id.authorImageView);

                ActivityOptions options = ActivityOptions.
                        makeSceneTransitionAnimation(getActivity(),
                                new android.util.Pair<>(imageView, getString(R.string.post_image_transition_name)),
                                new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name))
                        );
                startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
            } else {
                startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
            }
        }
    }


    public boolean hasInternetConnection() {
        ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
        return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
    }



    @SuppressLint("RestrictedApi")
    private void openProfileActivity( String userId, View view ) {
        Intent intent = new Intent(getActivity(), ProfileActivity.class);
        intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && view != null) {

            View authorImageView = view.findViewById(R.id.authorImageView);

            ActivityOptions options = ActivityOptions.
                    makeSceneTransitionAnimation(getActivity(),
                            new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name)));
            startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST, options.toBundle());
        } else {
            startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST);
        }
    }


    private void showCounterView() {
        AnimationUtils.showViewByScaleAndVisibility(newPostsCounterTextView);
    }





    private void refreshPostList(String posType) {
        postsAdapter.loadFirstPage((posType));
        if (postsAdapter.getItemCount() > 0) {
            recyclerView.scrollToPosition(0);
        }
    }





}

DatabaseHelper databaseHelper = ApplicationHelper.getDatabaseHelper(); null object reference

I am facing null point reference issue

    DatabaseHelper databaseHelper = ApplicationHelper.getDatabaseHelper(); 

its always null plz how can i refer this databasehelper object
DatabaseHelper databaseHelper = ApplicationHelper.getDatabaseHelper(); null object reference
at com.mirza.baig.newsfeedsapps.managers.PostManager.createOrUpdatePostWithImage(PostManager.java:101)
at com.mirza.baig.newsfeedsapps.activities.CreatePostActivity.savePost(CreatePostActivity.java:147)
at com.mirza.baig.newsfeedsapps.activities.CreatePostActivity.attemptCreatePost(CreatePostActivity.java:135)
at com.mirza.baig.newsfeedsapps.activities.CreatePostActivity.onOptionsItemSelected(CreatePostActivity.java:179)
at android.app.Activity.onMenuItemSelected(Activity.java:3213)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:368)
at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:108)
at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:674)
at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:963)
at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624)
at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:150)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22393)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6459)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)

use php and mySql insted of firebase

Hi, I live in country that firebase disable our usage and we can not use it. I wanted to know if there is a way to run the program with php and mySql? i try to understand the way its work but its so hard can someone please give a clue?

compress image

how to compress image before upload to firebase for the speed of the upload
any one can help

Help Compilation is not supported

hello when i try to clone the project it get this error ("work on android studio")
Compilation is not supported for following modules: social-app-android. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
i don't know why cause i started by cloning the project and get me this error
Could not find com.crashlytics.sdk.android:crashlytics:2.6.7.

onBackPressed() Error

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState in PostDetailsActivity.java onBackPressed() line 288. It is happened when you have multiple post details.

Deleting Post fails while telling The supplied bucketname is not available to this project.

Hi there,

I setup my firebase-storage like that with the google.json file:
{
"project_info": {
"project_number": "954969473822",
"firebase_url": "https://bangarang-c7d3b.firebaseio.com",
"project_id": "bangarang-c7d3b",
"storage_bucket": "bangarang-c7d3b.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:954969473822:android:91e94fd9291e9ac6",
"android_client_info": {
"package_name": "com.rozdoum.socialcomponents"
}
},
"oauth_client": [
{
"client_id": "954969473822-34us3bf800e3a2cuk4jm416qi6t92m9g.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.rozdoum.socialcomponents",
"certificate_hash": "7a5cdf28cde3cb63cde818023dae9a4ba67e7719"
}
},
{
"client_id": "954969473822-e9tejj02d0u6iqvfarh34h3gfuihhqgp.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "954969473822-e9tejj02d0u6iqvfarh34h3gfuihhqgp.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCK7502vluxTbZk1oDhAP_wdnMOOoETEFQ"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "954969473822-e9tejj02d0u6iqvfarh34h3gfuihhqgp.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

Creating Posts succeeds, but deleting them fails with the following exception. I can see the entrys in my database but deleting them fails. Please help me out!

5-27 21:07:09.338 5056-5056/com.rozdoum.socialcomponents E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rozdoum.socialcomponents, PID: 5056
java.lang.IllegalArgumentException: The supplied bucketname is not available to this project.
at com.google.android.gms.common.internal.zzaa.zzb(Unknown Source:8)
at com.google.firebase.storage.FirebaseStorage.zzz(Unknown Source:31)
at com.google.firebase.storage.FirebaseStorage.getReferenceFromUrl(Unknown Source:64)
at com.rozdoum.socialcomponents.managers.DatabaseHelper.removeImage(DatabaseHelper.java:237)
at com.rozdoum.socialcomponents.managers.PostManager.removeImage(PostManager.java:130)
at com.rozdoum.socialcomponents.managers.PostManager.removePost(PostManager.java:135)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity.removePost(PostDetailsActivity.java:757)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity.access$2500(PostDetailsActivity.java:89)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity$22.onClick(PostDetailsActivity.java:794)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
05-27 21:07:09.341 5056-5056/com.rozdoum.socialcomponents E/UncaughtException: java.lang.IllegalArgumentException: The supplied bucketname is not available to this project.
at com.google.android.gms.common.internal.zzaa.zzb(Unknown Source:8)
at com.google.firebase.storage.FirebaseStorage.zzz(Unknown Source:31)
at com.google.firebase.storage.FirebaseStorage.getReferenceFromUrl(Unknown Source:64)
at com.rozdoum.socialcomponents.managers.DatabaseHelper.removeImage(DatabaseHelper.java:237)
at com.rozdoum.socialcomponents.managers.PostManager.removeImage(PostManager.java:130)
at com.rozdoum.socialcomponents.managers.PostManager.removePost(PostManager.java:135)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity.removePost(PostDetailsActivity.java:757)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity.access$2500(PostDetailsActivity.java:89)
at com.rozdoum.socialcomponents.activities.PostDetailsActivity$22.onClick(PostDetailsActivity.java:794)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Not getting new data from Post Class.

I have added a new String location in Post class and added getter setters as well:
public Map<String, Object> toMap() {
HashMap<String, Object> result = new HashMap<>();

    result.put("title", title);
    result.put("description", description);
    result.put("location", location);
    result.put("createdDate", createdDate);
    result.put("imagePath", imagePath);
    result.put("imageTitle", imageTitle);
    result.put("authorId", authorId);
    result.put("commentsCount", commentsCount);
    result.put("likesCount", likesCount);
    result.put("watchersCount", watchersCount);
    result.put("hasComplain", hasComplain);
    result.put("createdDateText", FormatterUtil.getFirebaseDateFormat().format(new Date(createdDate)));

    return result;
}

When I create a post I have verified that new value location is added into firebase database in post table.

But When I try to get this value using post.getLocation in "PostViewHolder" class bindData(Post post) method, I am getting null value. I have check all code thoroughly, all other value like title descriptions are fetched and displayed correctly, but not newly added value. Can anyone please check and let me know?

delete post problem

hello. first of all, app is great! thank you very much.
I have just one problem, when i click delete post it asks "delete this post?" (cancel or ok)
i click ok and it crash

Slow upload and download of image

everything is perfect except for the upload and download speed... can u update the app and add a function to resize the image pls??

search query

I have tried this #5 (comment) but there is no click listeneer, please add search listeneer to this project.

deploy error

Error: There was an unknown problem while trying to parse function triggers. Please ensure you are using Node.js v6 or greater.

node -v 9.11.1
npm -v 6.4.0

Invalid Resource Type

invalid resource type expected integer value in android:imeActionId="@+id/createProfile". It is located in res>layout>activity_edit_profile.xml.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.