private void clearKeys() {
   SharedPreferences prefs =
       parentActivity.getSharedPreferences(ACCOUNT_PREFS_NAME, Context.MODE_PRIVATE);
   Editor edit = prefs.edit();
   edit.clear();
   edit.commit();
 }
 private void setLoggedin(boolean loggedIn) {
   SharedPreferences prefs =
       parentActivity.getSharedPreferences(ACCOUNT_PREFS_NAME, Context.MODE_PRIVATE);
   Editor edit = prefs.edit();
   edit.putBoolean(LOGIN_FLAG, loggedIn);
   edit.commit();
 }
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    Log.i(TAG, "---onActivityCreated");

    mActivity = getActivity();
    mParent = getView();

    init_RL();

    nickname = (TextView) mParent.findViewById(R.id.id_me_info_ll_ll1_nickname);
    vid = (TextView) mParent.findViewById(R.id.id_me_info_ll_ll1_id);

    // 获取对象
    SharedPreferences share = mActivity.getSharedPreferences("jonny", Activity.MODE_WORLD_READABLE);
    //		isregister_test = share.getBoolean("isregister", false);
    requestString = share.getString("request", null);
    nicknameString = share.getString("nickname", null);

    //		Log.v(TAG, isregister + "");
    //		Log.v(TAG, isregister_test + "");

    String request_vid = requestString.split("@@")[0];
    String request_imageurl = requestString.split("@@")[1];

    Log.v(TAG, request_imageurl);

    Toast.makeText(mActivity, request_vid + "*" + request_imageurl, Toast.LENGTH_SHORT).show();

    // 此处设置nickname和user_id(vid)
    nickname.setText(nicknameString);
    vid.setText(request_vid);

    // 此处设置我的里面的头像
    CircularImageView cover_user_photo =
        (CircularImageView) mParent.findViewById(R.id.id_me_info_ll_photo);
    asynImageLoader.showImageAsyn(cover_user_photo, request_imageurl, R.drawable.ic_launcher);
    // cover_user_photo.setImageResource(R.drawable.sssss);

    mTitle = (TitleView) mParent.findViewById(R.id.id_me_title);
    me_help_setting = (RelativeLayout) mParent.findViewById(R.id.id_me_help_ll_ll3);

    me_help_setting.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Toast.makeText(mActivity, "点击了我的设置", Toast.LENGTH_SHORT).show();
            Intent intent = new Intent();
          }
        });

    mTitle.setLayoutParams(LayoutParams.MATCH_PARENT, tabheight);
    mTitle.setTitle("个人中心");
  }
 /**
  * Shows keeping the access keys returned from Trusted Authenticator in a local store, rather than
  * storing user name & password, and re-authenticating each time (which is not to be done, ever).
  */
 private void storeKeys(String key, String secret) {
   // Save the access key for later
   SharedPreferences prefs =
       parentActivity.getSharedPreferences(ACCOUNT_PREFS_NAME, Context.MODE_PRIVATE);
   Editor edit = prefs.edit();
   edit.putString(ACCESS_KEY_NAME, key);
   edit.putString(ACCESS_SECRET_NAME, secret);
   edit.commit();
 }
 public PostListAdapter(Context c, List<PostVO> postVOs, FragmentActivity fragmentActivity) {
   super(c, R.layout.post_list_adapter_row, postVOs);
   this.context = c;
   this.postVOs = postVOs;
   this.activity = fragmentActivity;
   prefs = context.getSharedPreferences("MisPreferencias", Context.MODE_PRIVATE);
   dataBaseLikeHandler = new DataBaseLikeHandler(c);
   dataBaseCommentHandle = new DataBaseCommentsHandler(c);
   dataBaseCommentHandle.open();
   reloadListComments();
   preferences = fragmentActivity.getSharedPreferences("MyShared", Context.MODE_PRIVATE);
 }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    fa = super.getActivity();
    ll = (LinearLayout) inflater.inflate(R.layout.saturate_frag, container, false);
    prefs = fa.getSharedPreferences(C.PREF, Context.MODE_PRIVATE);
    mUtils = new Utils(fa);
    wm = WallpaperManager.getInstance(fa);
    image = (ImageView) ll.findViewById(R.id.main_image);
    try {
      WallpaperInfo info = wm.getWallpaperInfo();
      info.toString();
      mUtils.sendToast(getResources().getString(R.string.live_wallpaper));
    } catch (NullPointerException ignore) {
    }
    time_text = (TextView) ll.findViewById(R.id.time_text);
    seek = (SeekBar) ll.findViewById(R.id.seeker);
    seek.setMax(23);
    Calendar cal = Calendar.getInstance();
    hour = cal.get(Calendar.HOUR_OF_DAY);
    time_text.setText(mUtils.getHour(hour));
    seek.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {

          @Override
          public void onProgressChanged(SeekBar v, int num, boolean isU) {
            if (!isRunning) {
              time_text.setText(mUtils.getHour(num));
              seekerFl = mUtils.getFloat(num);
              Drawable d = mUtils.convertToGrayscale(wm.getDrawable(), seekerFl);
              image.setImageDrawable(d);
            }
          }

          @Override
          public void onStartTrackingTouch(SeekBar arg0) {
            // TODO Auto-generated method stub
          }

          @Override
          public void onStopTrackingTouch(SeekBar arg0) {
            // TODO Auto-generated method stub
          }
        });

    if (!prefs.getBoolean(C.PREF_SATURATE_FIRST_RUN_MAIN, false)) {
      prefs.edit().putBoolean(C.PREF_SATURATE_FIRST_RUN_MAIN, true).commit();
      String title = getResources().getString(R.string.main_title_saturate);
      String message = getResources().getString(R.string.saturate_description);
      new CustomDialogs().openFirstDialog(fa, title, message);
    }
    setHasOptionsMenu(true);
    return ll;
  }
  @Override
  public SharedPreferences getSharedPreferences(String name, int mode) {
    if (mProxyActivity == this) {

      return super.getSharedPreferences(name, mode);
    } else {
      if (mProxyActivity != null) {
        return mProxyActivity.getSharedPreferences(name, mode);
      } else {
        return super.getSharedPreferences(name, mode);
      }
    }
  }
 /**
  * Shows keeping the access keys returned from Trusted Authenticator in a local store, rather than
  * storing user name & password, and re-authenticating each time (which is not to be done, ever).
  *
  * @return Array of [access_key, access_secret], or null if none stored
  */
 private String[] getKeys() {
   SharedPreferences prefs =
       parentActivity.getSharedPreferences(ACCOUNT_PREFS_NAME, Context.MODE_PRIVATE);
   String key = prefs.getString(ACCESS_KEY_NAME, null);
   String secret = prefs.getString(ACCESS_SECRET_NAME, null);
   if (key != null && secret != null) {
     String[] ret = new String[2];
     ret[0] = key;
     ret[1] = secret;
     return ret;
   } else {
     return null;
   }
 }
 private void clearLoginPreference() {
   SharedPreferences loginPreferences =
       parentActivity.getSharedPreferences("loginPreference", Context.MODE_PRIVATE);
   if (loginPreferences != null) {
     SharedPreferences.Editor loginPrefsEditor = loginPreferences.edit();
     boolean usernameSaved = loginPreferences.getBoolean("usernameSaved", false);
     if (usernameSaved) {
       loginPrefsEditor = loginPreferences.edit();
       loginPrefsEditor.putBoolean("usernameSaved", false);
       loginPrefsEditor.putString("username", "");
       boolean passwordSaved = loginPreferences.getBoolean("passwordSaved", false);
       if (passwordSaved) {
         loginPrefsEditor.putBoolean("passwordSaved", false);
         loginPrefsEditor.putString("password", "");
       }
       loginPrefsEditor.commit();
     }
   }
 }
 private boolean dropboxLoggedIn() {
   SharedPreferences prefs =
       parentActivity.getSharedPreferences(ACCOUNT_PREFS_NAME, Context.MODE_PRIVATE);
   boolean loggedIn = prefs.getBoolean(LOGIN_FLAG, false);
   return loggedIn;
 }