Search in sources :

Example 1 with OnContactsGetList

use of net.iGap.observers.interfaces.OnContactsGetList in project iGap-Android by KianIranian-STDG.

the class FragmentSyncRegisteredContacts method onContactsGetList.

@Override
public void onContactsGetList() {
    if (getActivity() == null || getActivity().isFinishing()) {
        return;
    }
    if (results == null || results.size() == 0) {
        results = DbManager.getInstance().doRealmTask(realm -> {
            return realm.where(RealmContacts.class).limit(ContactManager.CONTACT_LIMIT).findAll().sort("display_name");
        });
        contactListAdapter2 = new ContactListAdapter2(results);
        realmRecyclerView.setAdapter(contactListAdapter2);
        if (results.size() == 0) {
            // No Contacts Exist Go to Main
            if (getActivity() == null || getActivity().isFinishing()) {
                return;
            }
            Intent intent = new Intent(getContext(), ActivityMain.class);
            intent.putExtra(ARG_USER_ID, userID);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            G.context.startActivity(intent);
            G.fragmentActivity.finish();
        }
    }
    hideProgress();
}
Also used : LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) AppUtils(net.iGap.module.AppUtils) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ProgressBar(android.widget.ProgressBar) LastSeenTimeUtil(net.iGap.module.LastSeenTimeUtil) G(net.iGap.G) FragmentSyncRegisteredContactsBinding(net.iGap.databinding.FragmentSyncRegisteredContactsBinding) HelperPublicMethod(net.iGap.helper.HelperPublicMethod) LoginActions(net.iGap.module.LoginActions) FastScrollerBarBaseAdapter(net.iGap.module.scrollbar.FastScrollerBarBaseAdapter) HelperPermission(net.iGap.helper.HelperPermission) View(android.view.View) Button(android.widget.Button) HelperError(net.iGap.helper.HelperError) RecyclerView(androidx.recyclerview.widget.RecyclerView) DataBindingUtil(androidx.databinding.DataBindingUtil) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) OnPhoneContact(net.iGap.observers.interfaces.OnPhoneContact) AsyncTask(android.os.AsyncTask) ContactManager(net.iGap.helper.ContactManager) ProtoSignalingOffer(net.iGap.proto.ProtoSignalingOffer) RequestUserContactsGetList(net.iGap.request.RequestUserContactsGetList) ViewGroup(android.view.ViewGroup) DefaultRoundDialog(net.iGap.module.dialog.DefaultRoundDialog) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) ConstraintLayout(androidx.constraintlayout.widget.ConstraintLayout) ScrollingLinearLayoutManager(net.iGap.module.ScrollingLinearLayoutManager) OnGetPermission(net.iGap.observers.interfaces.OnGetPermission) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Case(io.realm.Case) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) NotNull(org.jetbrains.annotations.NotNull) HelperToolbar(net.iGap.helper.HelperToolbar) EmojiManager(net.iGap.libs.emojiKeyboard.emoji.EmojiManager) RealmChangeListener(io.realm.RealmChangeListener) StructListOfContact(net.iGap.module.structs.StructListOfContact) ActivityMain(net.iGap.activities.ActivityMain) AccountManager(net.iGap.module.accountManager.AccountManager) Intent(android.content.Intent) RealmContacts(net.iGap.realm.RealmContacts) ArrayList(java.util.ArrayList) Contacts(net.iGap.module.Contacts) OnContactsGetList(net.iGap.observers.interfaces.OnContactsGetList) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) LayoutInflater(android.view.LayoutInflater) RealmResults(io.realm.RealmResults) CheckBox(net.iGap.module.customView.CheckBox) IOException(java.io.IOException) CircleImageView(net.iGap.module.CircleImageView) Gravity(android.view.Gravity) FastScroller(net.iGap.module.scrollbar.FastScroller) R(net.iGap.R) DbManager(net.iGap.module.accountManager.DbManager) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 AsyncTask (android.os.AsyncTask)1 Bundle (android.os.Bundle)1 Gravity (android.view.Gravity)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Button (android.widget.Button)1 LinearLayout (android.widget.LinearLayout)1 ProgressBar (android.widget.ProgressBar)1 TextView (android.widget.TextView)1 Nullable (androidx.annotation.Nullable)1 ConstraintLayout (androidx.constraintlayout.widget.ConstraintLayout)1 DataBindingUtil (androidx.databinding.DataBindingUtil)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 Case (io.realm.Case)1 RealmChangeListener (io.realm.RealmChangeListener)1 RealmResults (io.realm.RealmResults)1