Search in sources :

Example 6 with User

use of garbagecollectors.com.unipool.models.User in project UniPool by divya21raj.

the class LoginActivity method dummyInitFinalCurrentUser.

private void dummyInitFinalCurrentUser(FirebaseUser user) {
    GenLocation dummyGenLocation = new GenLocation("dummy", "dummy", 0d, 0d);
    TripEntry dummyTripEntry = new TripEntry("dummy", "dummyId", "DummyUser", "12:00", "1/11/12", dummyGenLocation, dummyGenLocation, "dummyMessage", "", "", true);
    HashMap<String, TripEntry> dummyUserEntries = new HashMap<>();
    dummyUserEntries.put("dummy", dummyTripEntry);
    HashMap<String, TripEntry> dummyRequestSent = new HashMap<>();
    dummyRequestSent.put(dummyTripEntry.getEntry_id(), dummyTripEntry);
    ArrayList<String> dummyUserIdList = new ArrayList<>();
    dummyUserIdList.add("dummy");
    HashMap<String, ArrayList<String>> dummyRequestReceived = new HashMap<>();
    dummyRequestReceived.put("dummy", dummyUserIdList);
    PairUp dummyPairUp = new PairUp("dummydummy", "dummy", "dummy", "dummy", dummyUserIdList);
    HashMap<String, PairUp> dummyPairUps = new HashMap<>();
    dummyPairUps.put("dummy", dummyPairUp);
    FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(instanceIdResult -> {
        String deviceToken = instanceIdResult.getToken();
        String url = "";
        Uri photoUrl = user.getPhotoUrl();
        if (photoUrl != null)
            url = photoUrl.toString();
        finalCurrentUser = new User(user.getUid(), user.getDisplayName(), url, user.getEmail(), dummyUserEntries, dummyRequestSent, dummyRequestReceived, deviceToken, true, dummyPairUps);
    });
}
Also used : User(garbagecollectors.com.unipool.models.User) FirebaseUser(com.google.firebase.auth.FirebaseUser) BaseActivity.finalCurrentUser(garbagecollectors.com.unipool.activities.BaseActivity.finalCurrentUser) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PairUp(garbagecollectors.com.unipool.models.PairUp) TripEntry(garbagecollectors.com.unipool.models.TripEntry) GenLocation(garbagecollectors.com.unipool.models.GenLocation) Uri(android.net.Uri)

Example 7 with User

use of garbagecollectors.com.unipool.models.User in project UniPool by divya21raj.

the class ChatFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_chat, container, false);
    recycle = view.findViewById(R.id.recycle_users);
    ArrayList<User> chatList = new ArrayList<>();
    for (Map.Entry<String, User> entry : BaseActivity.getChatMap().entrySet()) chatList.add(entry.getValue());
    recycleAdapter = new UserAdapter(chatList, getContext());
    RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 1);
    recycle.setLayoutManager(layoutManager);
    recycle.setItemAnimator(new DefaultItemAnimator());
    recycle.setAdapter(recycleAdapter);
    return view;
}
Also used : User(garbagecollectors.com.unipool.models.User) GridLayoutManager(android.support.v7.widget.GridLayoutManager) ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) UserAdapter(garbagecollectors.com.unipool.adapters.UserAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Map(java.util.Map) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

User (garbagecollectors.com.unipool.models.User)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 Task (com.google.android.gms.tasks.Task)4 DataSnapshot (com.google.firebase.database.DataSnapshot)4 TripEntry (garbagecollectors.com.unipool.models.TripEntry)4 FirebaseUser (com.google.firebase.auth.FirebaseUser)3 PairUp (garbagecollectors.com.unipool.models.PairUp)3 ProgressDialog (android.app.ProgressDialog)2 Intent (android.content.Intent)2 AlertDialog (android.support.v7.app.AlertDialog)2 DatabaseReference (com.google.firebase.database.DatabaseReference)2 Map (java.util.Map)2 Activity (android.app.Activity)1 Uri (android.net.Uri)1 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 BaseActivity (garbagecollectors.com.unipool.activities.BaseActivity)1