Search in sources :

Example 1 with SinaWeibo

use of cn.sharesdk.sina.weibo.SinaWeibo in project AnimeTaste by daimajia.

the class SettingActivity method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.only_for_wifi:
            break;
        case R.id.use_hd:
            break;
        case R.id.suggestion:
            Intent intent = new Intent(mContext, FeedbackActivity.class);
            startActivity(intent);
            break;
        case R.id.recommend:
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getText(R.string.share_title));
            shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, getText(R.string.share_app_body));
            startActivity(Intent.createChooser(shareIntent, getText(R.string.share_via)));
            break;
        case R.id.focus_us:
            mWeibo = new SinaWeibo(mContext);
            mWeibo.setPlatformActionListener(this);
            mWeibo.authorize();
            break;
        case R.id.cancel_auth:
            ShareSDK.getPlatform(mContext, SinaWeibo.NAME).removeAccount();
            ShareSDK.getPlatform(mContext, QZone.NAME).removeAccount();
            mSharedPreferences.edit().remove("login").commit();
            MobclickAgent.onEvent(mContext, "logout");
            Toast.makeText(mContext, R.string.logout_success, Toast.LENGTH_SHORT).show();
            break;
        case R.id.rate_for_us:
            Uri uri = Uri.parse("market://details?id=" + mContext.getPackageName());
            Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
            try {
                startActivity(goToMarket);
                MobclickAgent.onEvent(mContext, "rate");
            } catch (ActivityNotFoundException e) {
                Toast.makeText(mContext, R.string.can_not_open_market, Toast.LENGTH_SHORT).show();
            }
            break;
        case R.id.clear_cache:
            new Thread() {

                @Override
                public void run() {
                    super.run();
                    CacheUtils.deleteCache(mContext);
                }
            }.start();
            Toast.makeText(mContext, R.string.clear_ok, Toast.LENGTH_SHORT).show();
            break;
        default:
            break;
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) SinaWeibo(cn.sharesdk.sina.weibo.SinaWeibo) Intent(android.content.Intent) Uri(android.net.Uri)

Aggregations

ActivityNotFoundException (android.content.ActivityNotFoundException)1 Intent (android.content.Intent)1 Uri (android.net.Uri)1 SinaWeibo (cn.sharesdk.sina.weibo.SinaWeibo)1