use of org.qii.weiciyuan.bean.AccountBean 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.AccountBean in project weiciyuan by qii.
the class WriteWeiboActivity method getAccountInfo.
private void getAccountInfo() {
AccountBean account = GlobalContext.getInstance().getAccountBean();
if (account != null) {
accountBean = account;
token = account.getAccess_token();
getActionBar().setSubtitle(account.getUsernick());
}
}
use of org.qii.weiciyuan.bean.AccountBean in project weiciyuan by qii.
the class MainTimeLineActivity method onNewIntent.
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
AccountBean intentAccountBean = intent.getParcelableExtra(BundleArgsConstants.ACCOUNT_EXTRA);
if (intentAccountBean == null) {
return;
}
if (accountBean.equals(intentAccountBean)) {
accountBean = intentAccountBean;
GlobalContext.getInstance().setAccountBean(accountBean);
setIntent(intent);
} else {
finish();
overridePendingTransition(0, 0);
startActivity(intent);
overridePendingTransition(0, 0);
}
}
use of org.qii.weiciyuan.bean.AccountBean in project weiciyuan by qii.
the class AccountActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
String action = getIntent() != null ? getIntent().getAction() : null;
if (ACTION_OPEN_FROM_APP_INNER.equals(action)) {
//empty
} else if (ACTION_OPEN_FROM_APP_INNER_REFRESH_TOKEN.equals(action)) {
//empty
} else {
//finish current Activity
jumpToMainTimeLineActivity();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.accountactivity_layout);
getActionBar().setTitle(getString(R.string.app_name));
listAdapter = new AccountAdapter();
listView = (ListView) findViewById(R.id.listView);
listView.setOnItemClickListener(new AccountListItemClickListener());
listView.setAdapter(listAdapter);
listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
listView.setMultiChoiceModeListener(new AccountMultiChoiceModeListener());
getLoaderManager().initLoader(LOADER_ID, null, this);
if (SettingUtility.firstStart()) {
showChangeLogDialog();
}
if (ACTION_OPEN_FROM_APP_INNER_REFRESH_TOKEN.equals(action)) {
showAddAccountDialog();
AccountBean accountBean = getIntent().getParcelableExtra(REFRESH_ACTION_EXTRA);
Toast.makeText(this, String.format(getString(R.string.account_token_has_expired), accountBean.getUsernick()), Toast.LENGTH_SHORT).show();
}
}
Aggregations