Ejemplo n.º 1
0
 private void getAccountInfo() {
   SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
   String id = sharedPref.getString("id", "");
   if (!TextUtils.isEmpty(id)) {
     accountBean = DatabaseManager.getInstance().getAccount(id);
     if (accountBean != null) {
       token = accountBean.getAccess_token();
       getActionBar().setSubtitle(accountBean.getUsernick());
     } else {
       List<AccountBean> accountList = DatabaseManager.getInstance().getAccountList();
       if (accountList != null && accountList.size() > 0) {
         AccountBean account = accountList.get(0);
         accountBean = account;
         token = account.getAccess_token();
         getActionBar().setSubtitle(account.getUsernick());
       }
     }
   }
 }
Ejemplo n.º 2
0
 private String getLastContent() {
   SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
   String draft = sharedPref.getString(TYPE_DRAFT, "");
   return draft;
 }
Ejemplo n.º 3
0
 private void savaDraft() {
   if (!TextUtils.isEmpty(content.getText().toString())) {
     SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
     sharedPref.edit().putString(TYPE_DRAFT, content.getText().toString()).commit();
   }
 }