Search in sources :

Example 1 with URLEntity

use of twitter4j.URLEntity in project Talon-for-Twitter by klinker24.

the class DMDataSource method createSentDirectMessage.

public synchronized void createSentDirectMessage(DirectMessageEvent status, User recipient, AppSettings settings, int account) {
    ContentValues values = new ContentValues();
    long time = status.getCreatedTimestamp().getTime();
    String[] html = TweetLinkUtils.getLinksInStatus(status);
    String text = html[0];
    String media = html[1];
    String url = html[2];
    String hashtags = html[3];
    String users = html[4];
    values.put(DMSQLiteHelper.COLUMN_ACCOUNT, account);
    values.put(DMSQLiteHelper.COLUMN_TEXT, text);
    values.put(DMSQLiteHelper.COLUMN_TWEET_ID, status.getId());
    values.put(DMSQLiteHelper.COLUMN_NAME, settings.myName);
    values.put(DMSQLiteHelper.COLUMN_PRO_PIC, settings.myProfilePicUrl);
    values.put(DMSQLiteHelper.COLUMN_SCREEN_NAME, settings.myScreenName);
    values.put(DMSQLiteHelper.COLUMN_TIME, time);
    values.put(DMSQLiteHelper.COLUMN_RETWEETER, recipient.getScreenName());
    values.put(DMSQLiteHelper.COLUMN_EXTRA_ONE, recipient.getOriginalProfileImageURL());
    values.put(DMSQLiteHelper.COLUMN_EXTRA_TWO, recipient.getName());
    values.put(HomeSQLiteHelper.COLUMN_PIC_URL, media);
    values.put(DMSQLiteHelper.COLUMN_EXTRA_THREE, TweetLinkUtils.getGIFUrl(status.getMediaEntities(), url));
    MediaEntity[] entities = status.getMediaEntities();
    if (entities.length > 0) {
        values.put(DMSQLiteHelper.COLUMN_PIC_URL, entities[0].getMediaURL());
    }
    URLEntity[] urls = status.getUrlEntities();
    for (URLEntity u : urls) {
        Log.v("inserting_dm", "url here: " + u.getExpandedURL());
        values.put(DMSQLiteHelper.COLUMN_URL, u.getExpandedURL());
    }
    try {
        database.insert(DMSQLiteHelper.TABLE_DM, null, values);
    } catch (Exception e) {
        open();
        database.insert(DMSQLiteHelper.TABLE_DM, null, values);
    }
}
Also used : ContentValues(android.content.ContentValues) URLEntity(twitter4j.URLEntity) MediaEntity(twitter4j.MediaEntity) SQLException(android.database.SQLException)

Example 2 with URLEntity

use of twitter4j.URLEntity in project Talon-for-Twitter by klinker24.

the class DMDataSource method createDirectMessage.

public synchronized void createDirectMessage(DirectMessage status, int account) {
    ContentValues values = new ContentValues();
    long time = status.getCreatedAt().getTime();
    values.put(DMSQLiteHelper.COLUMN_ACCOUNT, account);
    values.put(DMSQLiteHelper.COLUMN_TEXT, TweetLinkUtils.getLinksInStatus(status)[0]);
    values.put(DMSQLiteHelper.COLUMN_TWEET_ID, status.getId());
    values.put(DMSQLiteHelper.COLUMN_NAME, status.getSender().getName());
    values.put(DMSQLiteHelper.COLUMN_PRO_PIC, status.getSender().getOriginalProfileImageURL());
    values.put(DMSQLiteHelper.COLUMN_SCREEN_NAME, status.getSender().getScreenName());
    values.put(DMSQLiteHelper.COLUMN_TIME, time);
    values.put(DMSQLiteHelper.COLUMN_RETWEETER, status.getRecipientScreenName());
    values.put(DMSQLiteHelper.COLUMN_EXTRA_ONE, status.getRecipient().getOriginalProfileImageURL());
    values.put(DMSQLiteHelper.COLUMN_EXTRA_TWO, status.getRecipient().getName());
    values.put(HomeSQLiteHelper.COLUMN_PIC_URL, TweetLinkUtils.getLinksInStatus(status)[1]);
    MediaEntity[] entities = status.getMediaEntities();
    if (entities.length > 0) {
        values.put(DMSQLiteHelper.COLUMN_PIC_URL, entities[0].getMediaURL());
    }
    URLEntity[] urls = status.getURLEntities();
    for (URLEntity url : urls) {
        Log.v("inserting_dm", "url here: " + url.getExpandedURL());
        values.put(DMSQLiteHelper.COLUMN_URL, url.getExpandedURL());
    }
    try {
        database.insert(DMSQLiteHelper.TABLE_DM, null, values);
    } catch (Exception e) {
        open();
        database.insert(DMSQLiteHelper.TABLE_DM, null, values);
    }
}
Also used : ContentValues(android.content.ContentValues) URLEntity(twitter4j.URLEntity) MediaEntity(twitter4j.MediaEntity) SQLException(android.database.SQLException)

Example 3 with URLEntity

use of twitter4j.URLEntity in project Talon-for-Twitter by klinker24.

the class TweetLinkUtils method getAllExternalPictures.

public static ArrayList<String> getAllExternalPictures(Status status) {
    URLEntity[] urls = status.getURLEntities();
    String expandedUrls = "";
    String compressedUrls = "";
    for (URLEntity entity : urls) {
        String url = entity.getExpandedURL();
        if (url.length() > 1) {
            expandedUrls += url + "  ";
            compressedUrls += entity.getURL() + "  ";
        }
    }
    MediaEntity[] medias = status.getMediaEntities();
    String mediaExp = "";
    String mediaComp = "";
    for (MediaEntity e : medias) {
        String url = e.getURL();
        if (url.length() > 1) {
            mediaComp += url + "  ";
            mediaExp += e.getExpandedURL() + "  ";
        }
    }
    String[] sExpandedUrls;
    String[] sCompressedUrls;
    String[] sMediaExp;
    String[] sMediaComp;
    try {
        sCompressedUrls = compressedUrls.split("  ");
    } catch (Exception e) {
        sCompressedUrls = new String[0];
    }
    try {
        sExpandedUrls = expandedUrls.split("  ");
    } catch (Exception e) {
        sExpandedUrls = new String[0];
    }
    try {
        sMediaComp = mediaComp.split("  ");
    } catch (Exception e) {
        sMediaComp = new String[0];
    }
    try {
        sMediaExp = mediaExp.split("  ");
    } catch (Exception e) {
        sMediaExp = new String[0];
    }
    ArrayList<String> images = new ArrayList<String>();
    for (int i = 0; i < sCompressedUrls.length; i++) {
        String comp = sCompressedUrls[i];
        String exp = sExpandedUrls[i];
        if (comp.length() > 1 && exp.length() > 1) {
            String str = exp.toLowerCase();
            if (str.contains("instag") && !str.contains("blog.insta")) {
                images.add(exp + "media/?size=m");
            } else if (exp.toLowerCase().contains("youtub") && !(str.contains("channel") || str.contains("user") || str.contains("playlist"))) {
                // first get the youtube surfaceView code
                int start = exp.indexOf("v=") + 2;
                int end = exp.length();
                if (exp.substring(start).contains("&")) {
                    end = exp.indexOf("&");
                } else if (exp.substring(start).contains("?")) {
                    end = exp.indexOf("?");
                }
                try {
                    images.add("http://img.youtube.com/vi/" + exp.substring(start, end) + "/hqdefault.jpg");
                } catch (Exception e) {
                    images.add("http://img.youtube.com/vi/" + exp.substring(start, exp.length() - 1) + "/hqdefault.jpg");
                }
            } else if (str.contains("youtu.be")) {
                // first get the youtube surfaceView code
                int start = exp.indexOf(".be/") + 4;
                int end = exp.length();
                if (exp.substring(start).contains("&")) {
                    end = exp.indexOf("&");
                } else if (exp.substring(start).contains("?")) {
                    end = exp.indexOf("?");
                }
                try {
                    images.add("http://img.youtube.com/vi/" + exp.substring(start, end) + "/hqdefault.jpg");
                } catch (Exception e) {
                    images.add("http://img.youtube.com/vi/" + exp.substring(start, exp.length() - 1) + "/mqefault.jpg");
                }
            } else if (str.contains("twitpic")) {
                int start = exp.indexOf(".com/") + 5;
                images.add("http://twitpic.com/show/full/" + exp.substring(start).replace("/", ""));
            } else if (str.contains("i.imgur") && !str.contains("/a/")) {
                images.add(("http://i.imgur.com/" + exp.replace("http://i.imgur.com/", "").replace(".jpg", "") + "m.jpg").replace("gallery/", ""));
            } else if (str.contains("imgur") && !str.contains("/a/")) {
                images.add(("http://i.imgur.com/" + exp.replace("http://imgur.com/", "").replace(".jpg", "") + "m.jpg").replace("gallery/", "").replace("a/", ""));
            } else if (str.contains("pbs.twimg.com")) {
                images.add(exp);
            } else if (str.contains("ow.ly/i/")) {
                images.add("http://static.ow.ly/photos/original/" + exp.substring(exp.lastIndexOf("/")).replaceAll("/", "") + ".jpg");
            } else if (str.contains("p.twipple.jp")) {
                images.add("http://p.twipple.jp/show/large/" + exp.replace("p.twipple.jp/", "").replace("http://", "").replace("https://", "").replace("www.", ""));
            } else if (str.contains(".jpg") || str.contains(".png")) {
                images.add(exp);
            } else if (str.contains("img.ly")) {
                images.add(exp.replace("https", "http").replace("http://img.ly/", "http://img.ly/show/large/"));
            }
        }
    }
    for (int i = 0; i < sMediaComp.length; i++) {
        String comp = sMediaComp[i];
        String exp = sMediaExp[i];
        if (comp.length() > 1 && exp.length() > 1) {
            images.add(status.getMediaEntities()[0].getMediaURL());
        }
    }
    return images;
}
Also used : URLEntity(twitter4j.URLEntity) ArrayList(java.util.ArrayList) MediaEntity(twitter4j.MediaEntity)

Example 4 with URLEntity

use of twitter4j.URLEntity in project Talon-for-Twitter by klinker24.

the class TweetLinkUtils method getLinksInStatus.

private static String[] getLinksInStatus(String tweetTexts, UserMentionEntity[] users, HashtagEntity[] hashtags, URLEntity[] urls, MediaEntity[] medias) {
    String mUsers = "";
    for (UserMentionEntity name : users) {
        String n = name.getScreenName();
        if (n.length() > 1) {
            mUsers += n + "  ";
        }
    }
    String mHashtags = "";
    for (HashtagEntity hashtagEntity : hashtags) {
        String text = hashtagEntity.getText();
        if (text.length() > 1) {
            mHashtags += text + "  ";
        }
    }
    String expandedUrls = "";
    String compressedUrls = "";
    for (URLEntity entity : urls) {
        String url = entity.getExpandedURL();
        if (url.length() > 1) {
            expandedUrls += url + "  ";
            compressedUrls += entity.getURL() + "  ";
        }
    }
    String mediaExp = "";
    String mediaComp = "";
    String mediaDisplay = "";
    for (MediaEntity e : medias) {
        String url = e.getURL();
        if (url.length() > 1) {
            mediaComp += url + "  ";
            mediaExp += e.getExpandedURL() + "  ";
            mediaDisplay += e.getDisplayURL() + "  ";
        }
    }
    String[] sExpandedUrls;
    String[] sCompressedUrls;
    String[] sMediaExp;
    String[] sMediaComp;
    String[] sMediaDisplay;
    try {
        sCompressedUrls = compressedUrls.split("  ");
    } catch (Exception e) {
        sCompressedUrls = new String[0];
    }
    try {
        sExpandedUrls = expandedUrls.split("  ");
    } catch (Exception e) {
        sExpandedUrls = new String[0];
    }
    try {
        sMediaComp = mediaComp.split("  ");
    } catch (Exception e) {
        sMediaComp = new String[0];
    }
    try {
        sMediaExp = mediaExp.split("  ");
    } catch (Exception e) {
        sMediaExp = new String[0];
    }
    try {
        sMediaDisplay = mediaDisplay.split("  ");
    } catch (Exception e) {
        sMediaDisplay = new String[0];
    }
    String imageUrl = "";
    String otherUrl = "";
    for (int i = 0; i < sCompressedUrls.length; i++) {
        String comp = sCompressedUrls[i];
        String exp = sExpandedUrls[i];
        if (comp.length() > 1 && exp.length() > 1) {
            String str = exp.toLowerCase();
            try {
                String replacement = exp.replace("http://", "").replace("https://", "").replace("www.", "");
                boolean hasCom = replacement.contains(".com");
                replacement = replacement.substring(0, 30) + "...";
                if (hasCom && !replacement.contains(".com")) {
                    // the link was too long...
                    replacement = exp.replace("http://", "").replace("https://", "").replace("www.", "");
                    replacement = replacement.substring(0, replacement.indexOf(".com") + 6) + "...";
                }
                tweetTexts = tweetTexts.replace(comp, replacement);
            } catch (Exception e) {
                tweetTexts = tweetTexts.replace(comp, exp.replace("http://", "").replace("https://", "").replace("www.", ""));
            }
            if (str.contains("instag") && !str.contains("blog.insta")) {
                imageUrl = exp + "media/?size=l";
                otherUrl += exp + "  ";
            } else if (exp.toLowerCase().contains("youtub") && !(str.contains("channel") || str.contains("user") || str.contains("playlist"))) {
                // first get the youtube surfaceView code
                int start = exp.indexOf("v=") + 2;
                int end = exp.length();
                if (exp.substring(start).contains("&")) {
                    end = exp.indexOf("&");
                } else if (exp.substring(start).contains("?")) {
                    end = exp.indexOf("?");
                }
                try {
                    imageUrl = "http://img.youtube.com/vi/" + exp.substring(start, end) + "/hqdefault.jpg";
                } catch (Exception e) {
                    imageUrl = "http://img.youtube.com/vi/" + exp.substring(start, exp.length() - 1) + "/hqdefault.jpg";
                }
                otherUrl += exp + "  ";
            } else if (str.contains("youtu.be")) {
                // first get the youtube surfaceView code
                int start = exp.indexOf(".be/") + 4;
                int end = exp.length();
                if (exp.substring(start).contains("&")) {
                    end = exp.indexOf("&");
                } else if (exp.substring(start).contains("?")) {
                    end = exp.indexOf("?");
                }
                try {
                    imageUrl = "http://img.youtube.com/vi/" + exp.substring(start, end) + "/hqdefault.jpg";
                } catch (Exception e) {
                    imageUrl = "http://img.youtube.com/vi/" + exp.substring(start, exp.length() - 1) + "/hqdefault.jpg";
                }
                otherUrl += exp + "  ";
            } else if (str.contains("twitpic")) {
                int start = exp.indexOf(".com/") + 5;
                imageUrl = "http://twitpic.com/show/full/" + exp.substring(start).replace("/", "");
                otherUrl += exp + "  ";
            } else if (str.contains("i.imgur") && !str.contains("/a/") && !str.contains(".gifv")) {
                int start = exp.indexOf(".com/") + 5;
                imageUrl = "http://i.imgur.com/" + exp.replace("http://i.imgur.com/", "").replace(".jpg", "") + "l.jpg";
                imageUrl = imageUrl.replace("gallery/", "");
                otherUrl += exp + "  ";
            } else if (str.contains("imgur") && !str.contains("/a/") && !str.contains(".gifv")) {
                int start = exp.indexOf(".com/") + 6;
                imageUrl = "http://i.imgur.com/" + exp.replace("http://imgur.com/", "").replace(".jpg", "") + "l.jpg";
                imageUrl = imageUrl.replace("gallery/", "").replace("a/", "");
                otherUrl += exp + "  ";
            } else if (str.contains("pbs.twimg.com")) {
                imageUrl = exp;
                otherUrl += exp + "  ";
            } else if (str.contains("ow.ly/i/")) {
                imageUrl = "http://static.ow.ly/photos/original/" + exp.substring(exp.lastIndexOf("/")).replaceAll("/", "") + ".jpg";
                otherUrl += exp + "  ";
            } else if (str.contains("p.twipple.jp")) {
                imageUrl = "http://p.twipple.jp/show/large/" + exp.replace("p.twipple.jp/", "").replace("http://", "").replace("https://", "").replace("www.", "");
                otherUrl += exp + "  ";
            } else if (str.contains(".jpg") || str.contains(".png")) {
                imageUrl = exp;
                otherUrl += exp + "  ";
            } else if (str.contains("img.ly")) {
                imageUrl = exp.replace("https", "http").replace("http://img.ly/", "http://img.ly/show/large/");
                otherUrl += exp + "  ";
            } else {
                otherUrl += exp + "  ";
            }
        }
    }
    for (int i = 0; i < sMediaComp.length; i++) {
        String comp = sMediaComp[i];
        String exp = sMediaExp[i];
        if (comp.length() > 1 && exp.length() > 1) {
            try {
                String replacement = sMediaDisplay[i].replace("http://", "").replace("https://", "").replace("www.", "");
                boolean hasCom = replacement.contains(".com");
                replacement = replacement.substring(0, 22) + "...";
                if (hasCom && !replacement.contains(".com")) {
                    // the link was too long...
                    replacement = sMediaDisplay[i].replace("http://", "").replace("https://", "").replace("www.", "");
                    replacement = replacement.substring(0, replacement.indexOf(".com") + 6) + "...";
                }
                tweetTexts = tweetTexts.replace(comp, replacement);
            } catch (Exception e) {
                e.printStackTrace();
                tweetTexts = tweetTexts.replace(comp, sMediaDisplay[i].replace("http://", "").replace("https://", "").replace("www.", ""));
            }
            imageUrl = medias[0].getMediaURL();
            for (MediaEntity m : medias) {
                if (m.getType().equals("photo")) {
                    if (!imageUrl.contains(m.getMediaURL())) {
                        imageUrl += " " + m.getMediaURL();
                    }
                }
            }
            otherUrl += sMediaDisplay[i];
        }
    }
    return new String[] { tweetTexts, imageUrl, otherUrl, mHashtags, mUsers };
}
Also used : UserMentionEntity(twitter4j.UserMentionEntity) URLEntity(twitter4j.URLEntity) HashtagEntity(twitter4j.HashtagEntity) MediaEntity(twitter4j.MediaEntity)

Example 5 with URLEntity

use of twitter4j.URLEntity in project twicalico by moko256.

the class CachedUsersSQLiteOpenHelper method getCachedUser.

public synchronized User getCachedUser(long id) {
    User user = null;
    SQLiteDatabase database = getReadableDatabase();
    Cursor c = database.query(TABLE_NAME, TABLE_COLUMNS, "id=" + String.valueOf(id), null, null, null, null, "1");
    if (c.moveToLast()) {
        user = new User() {

            long id = c.getLong(0);

            String name = c.getString(1);

            String email = c.getString(2);

            String screenName = c.getString(3);

            String location = c.getString(4);

            String description = c.getString(5);

            boolean isContributorsEnabled = c.getInt(6) != 0;

            String profileImageURL = c.getString(7);

            String profileImageURLHttps = c.getString(8);

            boolean isDefaultProfileImage = c.getInt(9) != 0;

            String url = c.getString(10);

            boolean isProtected = c.getInt(11) != 0;

            int followersCount = c.getInt(12);

            String profileBackgroundColor = c.getString(13);

            String profileTextColor = c.getString(14);

            String profileLinkColor = c.getString(15);

            String profileSidebarFillColor = c.getString(16);

            String profileSidebarBorderColor = c.getString(17);

            boolean isProfileUseBackgroundImage = c.getInt(18) != 0;

            boolean isDefaultProfile = c.getInt(19) != 0;

            boolean isShowAllInlineMedia = c.getInt(20) != 0;

            int friendsCount = c.getInt(21);

            Date createdAt = new Date(c.getLong(22));

            int favoritesCount = c.getInt(23);

            int utcOffset = c.getInt(24);

            String timeZone = c.getString(25);

            String profileBackgroundImageURL = c.getString(26);

            String profileBackgroundImageURLHttps = c.getString(27);

            String profileBannerImageUrl = c.getString(28);

            boolean isProfileBackgroundTiled = c.getInt(29) != 0;

            String lang = c.getString(30);

            int statusesCount = c.getInt(31);

            boolean isGeoEnabled = c.getInt(32) != 0;

            boolean isVerified = c.getInt(33) != 0;

            boolean isTranslator = c.getInt(34) != 0;

            boolean isFollowRequestSent = c.getInt(35) != 0;

            URLEntity[] descriptionURLEntities = restoreURLEntities(c.getString(36).split(","), c.getString(37).split(","), c.getString(38).split(","), c.getString(39).split(","), c.getString(40).split(","), c.getString(41).split(","));

            String[] withheldInCountries = c.getString(42).split(",");

            @Override
            public long getId() {
                return id;
            }

            @Override
            public String getName() {
                return name;
            }

            @Override
            public String getEmail() {
                return email;
            }

            @Override
            public String getScreenName() {
                return screenName;
            }

            @Override
            public String getLocation() {
                return location;
            }

            @Override
            public String getDescription() {
                return description;
            }

            @Override
            public boolean isContributorsEnabled() {
                return isContributorsEnabled;
            }

            private String toResizedURL(String originalURL, String sizeSuffix) {
                if (null != originalURL && originalURL.length() >= 1 && isTwitter) {
                    int index = originalURL.lastIndexOf("_");
                    int suffixIndex = originalURL.lastIndexOf(".");
                    int slashIndex = originalURL.lastIndexOf("/");
                    String url = originalURL.substring(0, index) + sizeSuffix;
                    if (suffixIndex > slashIndex) {
                        url += originalURL.substring(suffixIndex);
                    }
                    return url;
                }
                return originalURL;
            }

            @Override
            public String getProfileImageURL() {
                return profileImageURL;
            }

            @Override
            public String get400x400ProfileImageURL() {
                return toResizedURL(profileImageURL, "_400x400");
            }

            @Override
            public String getBiggerProfileImageURL() {
                return toResizedURL(profileImageURL, "_bigger");
            }

            @Override
            public String getMiniProfileImageURL() {
                return toResizedURL(profileImageURL, "_mini");
            }

            @Override
            public String getOriginalProfileImageURL() {
                return toResizedURL(profileImageURL, "");
            }

            @Override
            public String getProfileImageURLHttps() {
                return profileImageURLHttps;
            }

            @Override
            public String get400x400ProfileImageURLHttps() {
                return toResizedURL(profileImageURLHttps, "_400x400");
            }

            @Override
            public String getBiggerProfileImageURLHttps() {
                return toResizedURL(profileImageURLHttps, "_bigger");
            }

            @Override
            public String getMiniProfileImageURLHttps() {
                return toResizedURL(profileImageURLHttps, "_mini");
            }

            @Override
            public String getOriginalProfileImageURLHttps() {
                return toResizedURL(profileImageURLHttps, "");
            }

            @Override
            public boolean isDefaultProfileImage() {
                return isDefaultProfileImage;
            }

            @Override
            public String getURL() {
                return url;
            }

            @Override
            public boolean isProtected() {
                return isProtected;
            }

            @Override
            public int getFollowersCount() {
                return followersCount;
            }

            @Override
            public Status getStatus() {
                return null;
            }

            @Override
            public String getProfileBackgroundColor() {
                return profileBackgroundColor;
            }

            @Override
            public String getProfileTextColor() {
                return profileTextColor;
            }

            @Override
            public String getProfileLinkColor() {
                return profileLinkColor;
            }

            @Override
            public String getProfileSidebarFillColor() {
                return profileSidebarFillColor;
            }

            @Override
            public String getProfileSidebarBorderColor() {
                return profileSidebarBorderColor;
            }

            @Override
            public boolean isProfileUseBackgroundImage() {
                return isProfileUseBackgroundImage;
            }

            @Override
            public boolean isDefaultProfile() {
                return isDefaultProfile;
            }

            @Override
            public boolean isShowAllInlineMedia() {
                return isShowAllInlineMedia;
            }

            @Override
            public int getFriendsCount() {
                return friendsCount;
            }

            @Override
            public Date getCreatedAt() {
                return createdAt;
            }

            @Override
            public int getFavouritesCount() {
                return favoritesCount;
            }

            @Override
            public int getUtcOffset() {
                return utcOffset;
            }

            @Override
            public String getTimeZone() {
                return timeZone;
            }

            @Override
            public String getProfileBackgroundImageURL() {
                return profileBackgroundImageURL;
            }

            @Override
            public String getProfileBackgroundImageUrlHttps() {
                return profileBackgroundImageURLHttps;
            }

            @Override
            public String getProfileBannerURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/web" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBannerRetinaURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/web_retina" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBannerIPadURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/ipad" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBannerIPadRetinaURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/ipad_retina" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBannerMobileURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/mobile" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBannerMobileRetinaURL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/mobile_retina" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBanner300x100URL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/300x100" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBanner600x200URL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/600x200" : profileBannerImageUrl;
            }

            @Override
            public String getProfileBanner1500x500URL() {
                return profileBannerImageUrl != null && isTwitter ? profileBannerImageUrl + "/1500x500" : profileBannerImageUrl;
            }

            @Override
            public boolean isProfileBackgroundTiled() {
                return isProfileBackgroundTiled;
            }

            @Override
            public String getLang() {
                return lang;
            }

            @Override
            public int getStatusesCount() {
                return statusesCount;
            }

            @Override
            public boolean isGeoEnabled() {
                return isGeoEnabled;
            }

            @Override
            public boolean isVerified() {
                return isVerified;
            }

            @Override
            public boolean isTranslator() {
                return isTranslator;
            }

            @Override
            public int getListedCount() {
                return 0;
            }

            @Override
            public boolean isFollowRequestSent() {
                return isFollowRequestSent;
            }

            @Override
            public URLEntity[] getDescriptionURLEntities() {
                return descriptionURLEntities;
            }

            @Override
            public URLEntity getURLEntity() {
                return url == null ? null : new URLEntity() {

                    @Override
                    public String getText() {
                        return url;
                    }

                    @Override
                    public String getURL() {
                        return url;
                    }

                    @Override
                    public String getExpandedURL() {
                        return url;
                    }

                    @Override
                    public String getDisplayURL() {
                        return url;
                    }

                    @Override
                    public int getStart() {
                        return 0;
                    }

                    @Override
                    public int getEnd() {
                        return url.length();
                    }
                };
            }

            @Override
            public String[] getWithheldInCountries() {
                return withheldInCountries;
            }

            @Override
            public int compareTo(@NonNull User that) {
                return (int) (this.id - that.getId());
            }

            @Override
            public RateLimitStatus getRateLimitStatus() {
                return null;
            }

            @Override
            public int getAccessLevel() {
                return 0;
            }

            @Override
            public int hashCode() {
                return (int) id;
            }

            @Override
            public boolean equals(Object obj) {
                return obj != null && (this == obj || obj instanceof User && ((User) obj).getId() == this.id);
            }
        };
    }
    c.close();
    database.close();
    return user;
}
Also used : Status(twitter4j.Status) RateLimitStatus(twitter4j.RateLimitStatus) RateLimitStatus(twitter4j.RateLimitStatus) User(twitter4j.User) URLEntity(twitter4j.URLEntity) Cursor(android.database.Cursor) Date(java.util.Date) SQLiteDatabase(android.database.sqlite.SQLiteDatabase)

Aggregations

URLEntity (twitter4j.URLEntity)10 MediaEntity (twitter4j.MediaEntity)5 SuppressLint (android.annotation.SuppressLint)3 ContentValues (android.content.ContentValues)3 SpannableStringBuilder (android.text.SpannableStringBuilder)3 SQLException (android.database.SQLException)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)2 ClickableSpan (android.text.style.ClickableSpan)2 View (android.view.View)2 TextView (android.widget.TextView)2 ArrayList (java.util.ArrayList)2 HashtagEntity (twitter4j.HashtagEntity)2 UserMentionEntity (twitter4j.UserMentionEntity)2 Context (android.content.Context)1 Cursor (android.database.Cursor)1 Drawable (android.graphics.drawable.Drawable)1 ArrayMap (android.support.v4.util.ArrayMap)1 Spanned (android.text.Spanned)1 ImageSpan (android.text.style.ImageSpan)1 GlideRequests (com.github.moko256.twicalico.GlideRequests)1