当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC.TL_contact方法代码示例

本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_contact方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_contact方法的具体用法?Java TLRPC.TL_contact怎么用?Java TLRPC.TL_contact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.tgnet.TLRPC的用法示例。


在下文中一共展示了TLRPC.TL_contact方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performWriteContactsToPhoneBookInternal

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void performWriteContactsToPhoneBookInternal(ArrayList<TLRPC.TL_contact> contactsArray) {
    try {
        if (!hasContactsPermission()) {
            return;
        }
        Uri rawContactUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_NAME, currentAccount.name).appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_TYPE, currentAccount.type).build();
        Cursor c1 = ApplicationLoader.applicationContext.getContentResolver().query(rawContactUri, new String[]{BaseColumns._ID, ContactsContract.RawContacts.SYNC2}, null, null, null);
        HashMap<Integer, Long> bookContacts = new HashMap<>();
        if (c1 != null) {
            while (c1.moveToNext()) {
                bookContacts.put(c1.getInt(1), c1.getLong(0));
            }
            c1.close();

            for (int a = 0; a < contactsArray.size(); a++) {
                TLRPC.TL_contact u = contactsArray.get(a);
                if (!bookContacts.containsKey(u.user_id)) {
                    TLRPC.User user = MessagesController.getInstance().getUser(u.user_id);
                    addContactToPhoneBook(user, false);
                }
            }
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:27,代码来源:ContactsController.java

示例2: putContacts

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putContacts(ArrayList<TLRPC.TL_contact> contacts, final boolean deleteAll) {
    if (contacts.isEmpty()) {
        return;
    }
    final ArrayList<TLRPC.TL_contact> contactsCopy = new ArrayList<>(contacts);
    storageQueue.postRunnable(new Runnable() {
        @Override
        public void run() {
            try {
                if (deleteAll) {
                    database.executeFast("DELETE FROM contacts WHERE 1").stepThis().dispose();
                }
                database.beginTransaction();
                SQLitePreparedStatement state = database.executeFast("REPLACE INTO contacts VALUES(?, ?)");
                for (int a = 0; a < contactsCopy.size(); a++) {
                    TLRPC.TL_contact contact = contactsCopy.get(a);
                    state.requery();
                    state.bindInteger(1, contact.user_id);
                    state.bindInteger(2, contact.mutual ? 1 : 0);
                    state.step();
                }
                state.dispose();
                database.commitTransaction();
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:30,代码来源:MessagesStorage.java

示例3: performWriteContactsToPhoneBook

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void performWriteContactsToPhoneBook() {
    final ArrayList<TLRPC.TL_contact> contactsArray = new ArrayList<>();
    contactsArray.addAll(contacts);
    Utilities.phoneBookQueue.postRunnable(new Runnable() {
        @Override
        public void run() {
            performWriteContactsToPhoneBookInternal(contactsArray);
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:11,代码来源:ContactsController.java

示例4: initOnlineUsersSectionsDict

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void initOnlineUsersSectionsDict() {
    reloadContactsStatuses();
    onlineUsersSectionsDict = new HashMap();
    onlineSortedUsersSectionsArray = new ArrayList();
    for (String key : this.usersSectionsDict.keySet()) {
        ArrayList<TLRPC.TL_contact> onlineContacts = new ArrayList();
        Iterator i$ = ((ArrayList) this.usersSectionsDict.get(key)).iterator();
        while (i$.hasNext()) {
            TLRPC.TL_contact tl_contact = (TLRPC.TL_contact) i$.next();
            TLRPC.User user = MessagesController.getInstance().getUser(Integer.valueOf(tl_contact.user_id));
            if (user.id == UserConfig.getClientUserId() || (user.status != null && user.status.expires > ConnectionsManager.getInstance().getCurrentTime())) {
                onlineContacts.add(tl_contact);
            }
        }
        if (onlineContacts.size() > 0) {
            onlineUsersSectionsDict.put(key, onlineContacts);
            if (!onlineSortedUsersSectionsArray.contains(key)) {
                onlineSortedUsersSectionsArray.add(key);
            }
        }
    }
    Collections.sort(this.onlineSortedUsersSectionsArray, new Comparator<String>() {
        public int compare(String s, String s2) {
            char cv1 = s.charAt(0);
            char cv2 = s2.charAt(0);
            if (cv1 == '#') {
                return 1;
            }
            if (cv2 == '#') {
                return -1;
            }
            return s.compareTo(s2);
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:36,代码来源:ContactsController.java

示例5: onFragmentCreate

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public boolean onFragmentCreate() {
    super.onFragmentCreate();
    NotificationCenter.getInstance().addObserver(this, NotificationCenter.mediaDidLoaded);
    NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesDeleted);
    NotificationCenter.getInstance().addObserver(this, NotificationCenter.didReceivedNewMessages);
    NotificationCenter.getInstance().addObserver(this, NotificationCenter.messageReceivedByServer);
    dialog_id = getArguments().getLong("dialog_id", 0);
    selectedMode = getArguments().getInt("selected_mode", 0);
    /*SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
    int sm = preferences.getInt("mediaSelectedMode", 0);
    if(selectedMode == 0 && selectedMode != sm){
        selectedMode = sm;
    }*/

    for (int a = 0; a < sharedMediaData.length; a++) {
        sharedMediaData[a] = new SharedMediaData();
        sharedMediaData[a].max_id[0] = ((int) dialog_id) == 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE;
        if (mergeDialogId != 0 && info != null) {
            sharedMediaData[a].max_id[1] = info.migrated_from_max_id;
            sharedMediaData[a].endReached[1] = false;
        }
    }
    sharedMediaData[0].loading = true;

    for (String str : ContactsController.getInstance().usersSectionsDict.keySet()) {
        Iterator it = ((ArrayList) ContactsController.getInstance().usersSectionsDict.get(str)).iterator();
        while (it.hasNext()) {

            TLRPC.TL_contact tL_contact = (TLRPC.TL_contact) it.next();

            TLRPC.User user = MessagesController.getInstance().getUser(Integer.valueOf(tL_contact.user_id));
            AllSharedMediaQuery.loadMedia(user.id, 0, 50, 0, AllSharedMediaQuery.MEDIA_PHOTOVIDEO, true, classGuid);
        }

    }

    return true;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:40,代码来源:AllMediaActivity.java

示例6: buildContactsSectionsArrays

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void buildContactsSectionsArrays(boolean sort) {
    if (sort) {
        Collections.sort(contacts, new Comparator<TLRPC.TL_contact>() {
            @Override
            public int compare(TLRPC.TL_contact tl_contact, TLRPC.TL_contact tl_contact2) {
                TLRPC.User user1 = MessagesController.getInstance().getUser(tl_contact.user_id);
                TLRPC.User user2 = MessagesController.getInstance().getUser(tl_contact2.user_id);
                String name1 = UserObject.getFirstName(user1);
                String name2 = UserObject.getFirstName(user2);
                return name1.compareTo(name2);
            }
        });
    }

    StringBuilder ids = new StringBuilder();
    final HashMap<String, ArrayList<TLRPC.TL_contact>> sectionsDict = new HashMap<>();
    final ArrayList<String> sortedSectionsArray = new ArrayList<>();

    for (TLRPC.TL_contact value : contacts) {
        TLRPC.User user = MessagesController.getInstance().getUser(value.user_id);
        if (user == null) {
            continue;
        }

        String key = UserObject.getFirstName(user);
        if (key.length() > 1) {
            key = key.substring(0, 1);
        }
        if (key.length() == 0) {
            key = "#";
        } else {
            key = key.toUpperCase();
        }
        String replace = sectionsToReplace.get(key);
        if (replace != null) {
            key = replace;
        }
        ArrayList<TLRPC.TL_contact> arr = sectionsDict.get(key);
        if (arr == null) {
            arr = new ArrayList<>();
            sectionsDict.put(key, arr);
            sortedSectionsArray.add(key);
        }
        arr.add(value);
        if (ids.length() != 0) {
            ids.append(",");
        }
        ids.append(value.user_id);
    }
    UserConfig.contactsHash = Utilities.MD5(ids.toString());
    UserConfig.saveConfig(false);

    Collections.sort(sortedSectionsArray, new Comparator<String>() {
        @Override
        public int compare(String s, String s2) {
            char cv1 = s.charAt(0);
            char cv2 = s2.charAt(0);
            if (cv1 == '#') {
                return 1;
            } else if (cv2 == '#') {
                return -1;
            }
            return s.compareTo(s2);
        }
    });

    usersSectionsDict = sectionsDict;
    sortedUsersSectionsArray = sortedSectionsArray;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:70,代码来源:ContactsController.java


注:本文中的org.telegram.tgnet.TLRPC.TL_contact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。