Search in sources :

Example 16 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class WifiAutoDownloadPictureRunnable method startDownload.

private void startDownload(MessageBean msg) {
    if (!msg.isMultiPics()) {
        String url = msg.getOriginal_pic();
        if (!TextUtils.isEmpty(url)) {
            downloadPic(url);
        }
    } else {
        ArrayList<String> urls = msg.getHighPicUrls();
        for (String url : urls) {
            downloadPic(url);
        }
    }
    MessageBean reTweetedMsg = msg.getRetweeted_status();
    if (reTweetedMsg != null) {
        if (!reTweetedMsg.isMultiPics()) {
            String url = reTweetedMsg.getOriginal_pic();
            if (!TextUtils.isEmpty(url)) {
                downloadPic(url);
            }
        } else {
            ArrayList<String> urls = reTweetedMsg.getHighPicUrls();
            for (String url : urls) {
                downloadPic(url);
            }
        }
    }
    UserBean user = msg.getUser();
    if (user != null) {
        downloadAvatar(user.getAvatar_large());
    }
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UserBean(org.qii.weiciyuan.bean.UserBean)

Example 17 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class BigTextNotificationService method getPendingIntent.

private PendingIntent getPendingIntent(Intent clickToOpenAppPendingIntentInner, Parcelable itemBean, AccountBean accountBean) {
    clickToOpenAppPendingIntentInner.setExtrasClassLoader(getClass().getClassLoader());
    UnreadTabIndex unreadTabIndex = UnreadTabIndex.NONE;
    if (itemBean instanceof MessageBean) {
        unreadTabIndex = UnreadTabIndex.MENTION_WEIBO;
    } else if (itemBean instanceof CommentBean) {
        CommentBean commentBean = (CommentBean) itemBean;
        MessageBean messageBean = commentBean.getStatus();
        if (messageBean != null) {
            UserBean userBean = messageBean.getUser();
            if (accountBean.getInfo().equals(userBean)) {
                unreadTabIndex = UnreadTabIndex.COMMENT_TO_ME;
            } else {
                unreadTabIndex = UnreadTabIndex.MENTION_COMMENT;
            }
        } else {
            unreadTabIndex = UnreadTabIndex.MENTION_COMMENT;
        }
    }
    clickToOpenAppPendingIntentInner.putExtra(BundleArgsConstants.OPEN_NAVIGATION_INDEX_EXTRA, unreadTabIndex);
    PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(), getMentionsWeiboNotificationId(accountBean), clickToOpenAppPendingIntentInner, PendingIntent.FLAG_UPDATE_CURRENT);
    return pendingIntent;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) UnreadTabIndex(org.qii.weiciyuan.bean.android.UnreadTabIndex) UserBean(org.qii.weiciyuan.bean.UserBean) PendingIntent(android.app.PendingIntent) CommentBean(org.qii.weiciyuan.bean.CommentBean)

Example 18 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class AccountDBTask method getAccountList.

public static List<AccountBean> getAccountList() {
    List<AccountBean> accountList = new ArrayList<AccountBean>();
    String sql = "select * from " + AccountTable.TABLE_NAME;
    Cursor c = getWsd().rawQuery(sql, null);
    while (c.moveToNext()) {
        AccountBean account = new AccountBean();
        int colid = c.getColumnIndex(AccountTable.OAUTH_TOKEN);
        account.setAccess_token(c.getString(colid));
        colid = c.getColumnIndex(AccountTable.OAUTH_TOKEN_EXPIRES_TIME);
        account.setExpires_time(Long.valueOf(c.getString(colid)));
        colid = c.getColumnIndex(AccountTable.BLACK_MAGIC);
        account.setBlack_magic(c.getInt(colid) == 1);
        colid = c.getColumnIndex(AccountTable.NAVIGATION_POSITION);
        account.setNavigationPosition(c.getInt(colid));
        Gson gson = new Gson();
        String json = c.getString(c.getColumnIndex(AccountTable.INFOJSON));
        try {
            UserBean value = gson.fromJson(json, UserBean.class);
            account.setInfo(value);
        } catch (JsonSyntaxException e) {
            AppLogger.e(e.getMessage());
        }
        accountList.add(account);
    }
    c.close();
    return accountList;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) AccountBean(org.qii.weiciyuan.bean.AccountBean) Cursor(android.database.Cursor)

Example 19 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class AccountDBTask method getAccount.

public static AccountBean getAccount(String id) {
    String sql = "select * from " + AccountTable.TABLE_NAME + " where " + AccountTable.UID + " = " + id;
    Cursor c = getRsd().rawQuery(sql, null);
    if (c.moveToNext()) {
        AccountBean account = new AccountBean();
        int colid = c.getColumnIndex(AccountTable.OAUTH_TOKEN);
        account.setAccess_token(c.getString(colid));
        colid = c.getColumnIndex(AccountTable.OAUTH_TOKEN_EXPIRES_TIME);
        account.setExpires_time(Long.valueOf(c.getString(colid)));
        colid = c.getColumnIndex(AccountTable.BLACK_MAGIC);
        account.setBlack_magic(c.getInt(colid) == 1);
        colid = c.getColumnIndex(AccountTable.NAVIGATION_POSITION);
        account.setNavigationPosition(c.getInt(colid));
        Gson gson = new Gson();
        String json = c.getString(c.getColumnIndex(AccountTable.INFOJSON));
        try {
            UserBean value = gson.fromJson(json, UserBean.class);
            account.setInfo(value);
        } catch (JsonSyntaxException e) {
            AppLogger.e(e.getMessage());
        }
        return account;
    }
    return null;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) Gson(com.google.gson.Gson) Cursor(android.database.Cursor) AccountBean(org.qii.weiciyuan.bean.AccountBean)

Example 20 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class UserInfoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initLayout();
    token = getIntent().getStringExtra("token");
    bean = getIntent().getParcelableExtra("user");
    if (bean == null) {
        String id = getIntent().getStringExtra("id");
        if (!TextUtils.isEmpty(id)) {
            bean = new UserBean();
            bean.setId(id);
        } else {
            String domain = getIntent().getStringExtra("domain");
            if (!TextUtils.isEmpty(domain)) {
                bean = new UserBean();
                bean.setDomain(domain);
            } else {
                Uri data = getIntent().getData();
                if (data != null) {
                    String d = data.toString();
                    int index = d.lastIndexOf("@");
                    String newValue = d.substring(index + 1);
                    bean = new UserBean();
                    bean.setScreen_name(newValue);
                } else if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
                    processIntent(getIntent());
                }
            }
        }
        fetchUserInfoFromServer();
        findViewById(android.R.id.content).setBackgroundDrawable(ThemeUtility.getDrawable(android.R.attr.windowBackground));
    } else {
        findViewById(android.R.id.content).setBackgroundDrawable(ThemeUtility.getDrawable(android.R.attr.windowBackground));
        buildContent();
    }
    if (isMyselfProfile()) {
        if (getClass() == MyInfoActivity.class) {
            return;
        }
        Intent intent = new Intent(this, MyInfoActivity.class);
        intent.putExtra("token", getToken());
        UserBean userBean = new UserBean();
        userBean.setId(GlobalContext.getInstance().getCurrentAccountId());
        intent.putExtra("user", bean);
        intent.putExtra("account", GlobalContext.getInstance().getAccountBean());
        startActivity(intent);
        finish();
    }
}
Also used : UserBean(org.qii.weiciyuan.bean.UserBean) Intent(android.content.Intent) Uri(android.net.Uri)

Aggregations

UserBean (org.qii.weiciyuan.bean.UserBean)31 Gson (com.google.gson.Gson)9 JsonSyntaxException (com.google.gson.JsonSyntaxException)9 DMUserBean (org.qii.weiciyuan.bean.DMUserBean)8 HashMap (java.util.HashMap)7 MessageBean (org.qii.weiciyuan.bean.MessageBean)6 Drawable (android.graphics.drawable.Drawable)4 RelativeLayout (android.widget.RelativeLayout)4 AtUserBean (org.qii.weiciyuan.bean.AtUserBean)4 SearchUserBean (org.qii.weiciyuan.bean.SearchUserBean)4 Intent (android.content.Intent)3 SpannableString (android.text.SpannableString)3 CommentBean (org.qii.weiciyuan.bean.CommentBean)3 Cursor (android.database.Cursor)2 View (android.view.View)2 ListView (android.widget.ListView)2 ArrayList (java.util.ArrayList)2 AccountBean (org.qii.weiciyuan.bean.AccountBean)2 WriteReplyToCommentActivity (org.qii.weiciyuan.ui.send.WriteReplyToCommentActivity)2 PendingIntent (android.app.PendingIntent)1