Search in sources :

Example 1 with PopupWindowUtil

use of cn.eoe.app.utils.PopupWindowUtil in project android-app by eoecn.

the class MainActivity method onClick.

// [end]
// [start]继承方法
@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch(v.getId()) {
        case R.id.Linear_above_toHome:
            showMenu();
            break;
        case R.id.login_login:
            SharedPreferences share = this.getSharedPreferences(UserLoginUidActivity.SharedName, Context.MODE_PRIVATE);
            // [start] 修复上一个bug
            String Key = share.getString(UserLoginUidActivity.KEY, "");
            if (Key != "" && !Key.contains(":")) {
                Editor edit = share.edit();
                edit.putString(UserLoginUidActivity.KEY, "");
                edit.commit();
            }
            // [end] 下一版本删除掉
            if (share.contains(UserLoginUidActivity.KEY) && !share.getString(UserLoginUidActivity.KEY, "").equals("")) {
                IntentUtil.start_activity(this, UserCenterActivity.class);
            } else {
                IntentUtil.start_activity(this, UserLoginActivity.class);
            }
            break;
        case R.id.imageview_above_more:
            if (isShowPopupWindows) {
                new PopupWindowUtil(mViewPager).showActionWindow(v, this, mBasePageAdapter.tabs);
            }
            break;
        case R.id.imageview_above_query:
            if (NetWorkHelper.isNetworkAvailable(MainActivity.this)) {
                IntentUtil.start_activity(this, SearchActivity.class, new BasicNameValuePair("tag", current_page));
            } else {
                Toast.makeText(getApplicationContext(), "网络连接失败,请检查网络", Toast.LENGTH_LONG).show();
            }
            break;
        case R.id.cbFeedback:
            FeedbackAgent agent = new FeedbackAgent(this);
            agent.startFeedbackActivity();
            break;
        case R.id.cbAbove:
            IntentUtil.start_activity(this, AboutActivity.class);
            break;
        case R.id.bn_refresh:
            switch(mTag) {
                case 0:
                    imgQuery.setVisibility(View.GONE);
                    new MyTask().execute(topDao);
                    break;
                case 1:
                    new MyTask().execute(newsDao);
                    break;
                case 2:
                    new MyTask().execute(wikiDao);
                    break;
                case 3:
                    new MyTask().execute(blogsDao);
                    break;
                default:
                    break;
            }
            break;
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) Editor(android.content.SharedPreferences.Editor) PopupWindowUtil(cn.eoe.app.utils.PopupWindowUtil) FeedbackAgent(com.umeng.fb.FeedbackAgent)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 Editor (android.content.SharedPreferences.Editor)1 PopupWindowUtil (cn.eoe.app.utils.PopupWindowUtil)1 FeedbackAgent (com.umeng.fb.FeedbackAgent)1 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)1