use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
geoApiKey = Applozic.getInstance(getContext()).getGeoApiKey();
String jsonString = FileUtils.loadSettingsJsonFile(ApplozicService.getContext(getContext()));
if (!TextUtils.isEmpty(jsonString)) {
alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
} else {
alCustomizationSettings = new AlCustomizationSettings();
}
richMessageActionProcessor = new RichMessageActionProcessor(this);
restrictedWords = FileUtils.loadRestrictedWordsFile(getContext());
conversationUIService = new ConversationUIService(getActivity());
syncCallService = SyncCallService.getInstance(getActivity());
appContactService = new AppContactService(getActivity());
messageDatabaseService = new MessageDatabaseService(getActivity());
fileClientService = new FileClientService(getActivity());
setHasOptionsMenu(true);
imageThumbnailLoader = new ImageLoader(getContext(), ImageUtils.getLargestScreenDimension((Activity) getContext())) {
@Override
protected Bitmap processBitmap(Object data) {
return fileClientService.downloadAndSaveThumbnailImage(getContext(), (Message) data, getImageLayoutParam(false).width, getImageLayoutParam(false).height);
}
};
imageCache = ImageCache.getInstance((getActivity()).getSupportFragmentManager(), 0.1f);
imageThumbnailLoader.setImageFadeIn(false);
imageThumbnailLoader.addImageCache((getActivity()).getSupportFragmentManager(), 0.1f);
messageImageLoader = new ImageLoader(getContext(), ImageUtils.getLargestScreenDimension((Activity) getContext())) {
@Override
protected Bitmap processBitmap(Object data) {
return fileClientService.loadMessageImage(getContext(), (String) data);
}
};
messageImageLoader.setImageFadeIn(false);
messageImageLoader.addImageCache((getActivity()).getSupportFragmentManager(), 0.1f);
applozicAudioRecordManager = new ApplozicAudioRecordManager(getActivity());
mDetector = new GestureDetectorCompat(getContext(), this);
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class MessageInfoFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
contactService = new AppContactService(getContext());
fileClientService = new FileClientService(getContext());
geoApiKey = Applozic.getInstance(getContext()).getGeoApiKey();
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class AppContactFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
contactDatabase = new ContactDatabase(getContext());
contactService = new AppContactService(getActivity());
mAdapter = new ContactsAdapter(getActivity().getApplicationContext());
userPreference = MobiComUserPreference.getInstance(getContext());
inviteMessage = Utils.getMetaDataValue(getActivity().getApplicationContext(), SHARE_TEXT);
if (savedInstanceState != null) {
mSearchTerm = savedInstanceState.getString(SearchManager.QUERY);
mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0);
alCustomizationSettings = (AlCustomizationSettings) savedInstanceState.getSerializable(AL_CUSTOMIZATION_SETTINGS);
}
refreshContactsScreenBroadcast = new RefreshContactsScreenBroadcast();
final Context context = getActivity().getApplicationContext();
mImageLoader = new ImageLoader(context, getListPreferredItemHeight()) {
@Override
protected Bitmap processBitmap(Object data) {
return contactService.downloadContactImage(context, (Contact) data);
}
};
// Set a placeholder loading image for the image loader
mImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_holo_light);
// Add a cache to the image loader
mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f);
mImageLoader.setImageFadeIn(false);
if (!TextUtils.isEmpty(MobiComUserPreference.getInstance(context).getContactsGroupId())) {
ChannelDatabaseService channelDatabaseService = ChannelDatabaseService.getInstance(context);
userIdArray = channelDatabaseService.getChannelMemberByName(MobiComUserPreference.getInstance(context).getContactsGroupId(), String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()));
if (Utils.isInternetAvailable(getContext())) {
ApplozicGetMemberFromContactGroupTask.GroupMemberListener eventMemberListener = new ApplozicGetMemberFromContactGroupTask.GroupMemberListener() {
@Override
public void onSuccess(String[] userIdArrays, Context context) {
if (isAdded()) {
userIdArray = new String[userIdArrays.length];
userIdArray = userIdArrays;
getLoaderManager().initLoader(ContactSelectionFragment.ContactsQuery.QUERY_ID, null, AppContactFragment.this);
}
}
@Override
public void onFailure(String response, Context context) {
}
};
ApplozicGetMemberFromContactGroupTask applozicGetMemberFromContactGroupTask = new ApplozicGetMemberFromContactGroupTask(getActivity(), MobiComUserPreference.getInstance(context).getContactsGroupId(), String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()), eventMemberListener);
AlTask.execute(applozicGetMemberFromContactGroupTask);
} else if (userIdArray != null) {
getLoaderManager().initLoader(ContactSelectionFragment.ContactsQuery.QUERY_ID, null, AppContactFragment.this);
}
} else if (MobiComUserPreference.getInstance(getContext()).getContactGroupIdList() != null && !MobiComUserPreference.getInstance(getContext()).getContactGroupIdList().isEmpty()) {
List<String> groupList = new ArrayList<String>();
groupList.addAll(MobiComUserPreference.getInstance(getContext()).getContactGroupIdList());
final ProgressDialog progressBar = new ProgressDialog(getContext());
progressBar.setMessage(getContext().getResources().getString(R.string.processing_please_wait));
progressBar.show();
AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener listener = new AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener() {
@Override
public void onSuccess(Context context, String response, String[] contactList) {
progressBar.dismiss();
userIdArray = contactList;
getLoaderManager().initLoader(ContactSelectionFragment.ContactsQuery.QUERY_ID, null, AppContactFragment.this);
}
@Override
public void onFailure(Context context, String response, Exception e) {
progressBar.dismiss();
Toast.makeText(getContext(), R.string.failed_to_load_contact + response + "\nException : " + e, Toast.LENGTH_SHORT).show();
}
};
if (MobiComUserPreference.getInstance(getContext()).isContactGroupNameList()) {
AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, null, groupList, "9"));
} else {
AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, groupList, null, "9"));
}
}
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class LoginActivity method buildContactData.
/**
* Don't use this method...this is only for demo purpose..
*/
private void buildContactData() {
Context context = getApplicationContext();
AppContactService appContactService = new AppContactService(context);
// avoid each time update ....
if (!appContactService.isContactExists("adarshk")) {
List<Contact> contactList = new ArrayList<Contact>();
// Adarsh....
Contact contact = new Contact();
contact.setUserId("adarshk");
contact.setFullName("John");
contact.setImageURL("R.drawable.couple");
contactList.add(contact);
Contact contactRaj = new Contact();
contactRaj.setUserId("raj");
contactRaj.setFullName("rajni");
contactRaj.setImageURL("https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p200x200/12049601_556630871166455_1647160929759032778_n.jpg?oh=7ab819fc614f202e144cecaad0eb696b&oe=56EBA555&__gda__=1457202000_85552414c5142830db00c1571cc50641");
contactList.add(contactRaj);
// Adarsh
Contact contact2 = new Contact();
contact2.setUserId("rathan");
contact2.setFullName("Liz");
contact2.setImageURL("R.drawable.liz");
contactList.add(contact2);
Contact contact3 = new Contact();
contact3.setUserId("clem");
contact3.setFullName("Clement");
contact3.setImageURL("R.drawable.shivam");
contactList.add(contact3);
Contact contact4 = new Contact();
contact4.setUserId("shanki.gupta");
contact4.setFullName("Bill");
contact4.setImageURL("R.drawable.contact_shanki");
contactList.add(contact4);
Contact contact6 = new Contact();
contact6.setUserId("krishna");
contact6.setFullName("Krishi");
contact6.setImageURL("R.drawable.girl");
contactList.add(contact6);
Contact contact7 = new Contact();
contact7.setUserId("heather");
contact7.setFullName("Heather");
contact7.setImageURL("R.drawable.heather");
contactList.add(contact7);
appContactService.addAll(contactList);
}
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class ContactSelectionFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bundle = getArguments();
String jsonString = FileUtils.loadSettingsJsonFile(getActivity().getApplicationContext());
if (!TextUtils.isEmpty(jsonString)) {
alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
} else {
alCustomizationSettings = new AlCustomizationSettings();
}
userPreference = MobiComUserPreference.getInstance(getActivity());
if (bundle != null) {
channel = (Channel) bundle.getSerializable(CHANNEL_OBJECT);
disableCheckBox = bundle.getBoolean(CHECK_BOX, false);
channelName = bundle.getString(CHANNEL);
imageUrl = bundle.getString(IMAGE_LINK);
groupType = bundle.getInt(GROUP_TYPE);
contactsGroupId = userPreference.getContactsGroupId();
}
setHasOptionsMenu(true);
refreshContactsScreenBroadcast = new RefreshContactsScreenBroadcast();
if (savedInstanceState != null) {
mSearchTerm = savedInstanceState.getString(SearchManager.QUERY);
mPreviouslySelectedSearchItem = savedInstanceState.getInt(STATE_PREVIOUSLY_SELECTED_KEY, 0);
}
contactDatabase = new ContactDatabase(getContext());
appContactService = new AppContactService(getActivity());
mAdapter = new ContactsAdapter(getActivity());
final Context context = getActivity().getApplicationContext();
mImageLoader = new ImageLoader(context, getListPreferredItemHeight()) {
@Override
protected Bitmap processBitmap(Object data) {
return appContactService.downloadContactImage(context, (Contact) data);
}
};
// Set a placeholder loading image for the image loader
mImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_holo_light);
// Add a cache to the image loader
mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f);
mImageLoader.setImageFadeIn(false);
if (contactsGroupId != null) {
ChannelDatabaseService channelDatabaseService = ChannelDatabaseService.getInstance(context);
groupContacts = channelDatabaseService.getChannelMemberByName(contactsGroupId, String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()));
if (Utils.isInternetAvailable(getContext())) {
ApplozicGetMemberFromContactGroupTask.GroupMemberListener eventMemberListener = new ApplozicGetMemberFromContactGroupTask.GroupMemberListener() {
@Override
public void onSuccess(String[] userIdArray, Context context) {
if (isAdded()) {
groupContacts = new String[userIdArray.length];
groupContacts = userIdArray;
getLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
}
}
@Override
public void onFailure(String response, Context context) {
}
};
// pass GroupId whose contact Members you want to show, contactGroupType
ApplozicGetMemberFromContactGroupTask applozicGetMemberFromContactGroupTask = new ApplozicGetMemberFromContactGroupTask(getActivity(), contactsGroupId, String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()), eventMemberListener);
AlTask.execute(applozicGetMemberFromContactGroupTask);
} else if (groupContacts != null) {
getLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
}
} else if (MobiComUserPreference.getInstance(getContext()).getContactGroupIdList() != null && !MobiComUserPreference.getInstance(getContext()).getContactGroupIdList().isEmpty()) {
List<String> groupList = new ArrayList<String>();
groupList.addAll(MobiComUserPreference.getInstance(getContext()).getContactGroupIdList());
final ProgressDialog progressBar = new ProgressDialog(getContext());
progressBar.setMessage(getContext().getResources().getString(R.string.processing_please_wait));
progressBar.show();
AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener listener = new AlGetMembersFromContactGroupListTask.GetMembersFromGroupIdListListener() {
@Override
public void onSuccess(Context context, String response, String[] contactList) {
progressBar.dismiss();
groupContacts = contactList;
getLoaderManager().initLoader(ContactSelectionFragment.ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this);
}
@Override
public void onFailure(Context context, String response, Exception e) {
progressBar.dismiss();
Toast.makeText(getContext(), "Failed to load contacts : Response : " + response + "\nException : " + e, Toast.LENGTH_SHORT).show();
}
};
if (MobiComUserPreference.getInstance(getContext()).isContactGroupNameList()) {
AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, null, groupList, "9"));
} else {
AlTask.execute(new AlGetMembersFromContactGroupListTask(getContext(), listener, groupList, null, "9"));
}
}
}
Aggregations