Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invite and search users feature #144

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Houseclub/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices.-->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.appkit.api.SimpleCallback;
import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.Contact;
import me.grishka.houseclub.api.model.FullUser;

public class GetSuggestedInvites extends ClubhouseAPIRequest<GetSuggestedInvites.Response> {

public GetSuggestedInvites(List<Contact> contacts){
super("POST", "get_suggested_invites", Response.class);
requestBody=new GetSuggestedInvites.Body(contacts);
}

private static class Body{
public boolean upload_contacts;
public List<Contact> contacts;

public Body(List<Contact> contacts){
this.upload_contacts=true;
this.contacts=contacts;
}
}

public static class Response{
public List<Contact> suggested_invites;
public int num_invites;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.FullUser;

public class InviteToApp extends ClubhouseAPIRequest<BaseResponse> {

public InviteToApp(String name, String phone_number, String message){
super("POST", "invite_to_app", BaseResponse.class);
requestBody=new InviteToApp.Body(name, phone_number, message);
}

private static class Body{
public String name;
public String phone_number;
public String message;

public Body(String name, String phone_number, String message){
this.name=name;
this.phone_number=phone_number;
this.message=message;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.FullUser;

public class SearchPeople extends ClubhouseAPIRequest<SearchPeople.Resp> {

public SearchPeople(String query) {
super("POST", "search_users", Resp.class);
requestBody = new Body(query);
}

private static class Body {
public boolean cofollowsOnly;
public boolean followingOnly;
public boolean followersOnly;
public String query;

public Body(String query) {
this.query = query;
}
}

public static class Resp {
public List<FullUser> users;
public int count;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package me.grishka.houseclub.api.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Date;

public class Contact {
public String name, phone_number;
public boolean in_app, is_invited;
public int num_friends;

public Contact(){
}

public Contact(String name, String phone_number){
this.name=name;
this.phone_number=phone_number;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,34 @@ public boolean wantsLightStatusBar(){

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
menu.add(0,0,0,"").setIcon(R.drawable.ic_notifications).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(0,1,0,"").setIcon(R.drawable.ic_baseline_person_24).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
inflater.inflate(R.menu.menu_home, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item){
Bundle args=new Bundle();
args.putInt("id", Integer.parseInt(ClubhouseSession.userID));
if(item.getItemId()==0) {
Nav.go(getActivity(), NotificationListFragment.class, args);
} else if(item.getItemId()==1){
if (item.getItemId() == R.id.homeMenuProfile) {
Bundle args=new Bundle();
args.putInt("id", Integer.parseInt(ClubhouseSession.userID));
Nav.go(getActivity(), ProfileFragment.class, args);
return true;
} else if (item.getItemId() == R.id.homeMenuSearchPeople) {
Bundle args = new Bundle();
//args.putInt(BaseSearchFragment.KEY_SEARCH_TYPE, BaseSearchFragment.SearchType.PEOPLE.ordinal());
//Nav.go(getActivity(), SearchPeopleFragment.class, args);
Nav.go(getActivity(), SearchListFragment.class, args);
return true;
} else if (item.getItemId() == R.id.homeMenuNotifications) {
Bundle args = new Bundle();
args.putInt("id", Integer.parseInt(ClubhouseSession.userID));
Nav.go(getActivity(), NotificationListFragment.class, args);
return true;
} else if(item.getItemId() == R.id.homeMenuInvite) {

Bundle args = new Bundle();
Nav.go(getActivity(), InviteListFragment.class, args);

}
return true;
return false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm changed this return to false independently too. Dunno why, but got some exceptions in navigation when more than 2 items in a menu...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bit-world: with true here I had the same problem as @josefjebavy described, couldnt navigate twice to the same page.

}

private class ChannelAdapter extends RecyclerView.Adapter<ChannelViewHolder> implements ImageLoaderRecyclerAdapter{
Expand Down
Loading