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());
}
}
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;
}
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;
}
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;
}
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();
}
}
Aggregations