Ejemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MobclickAgent.onError(this);
    UMFeedbackService.enableNewReplyNotification(this, NotificationType.AlertDialog);

    setContentView(R.layout.activity_main);

    mGoodsAdapter =
        new GoodsItemAdapter(this, R.id.imageView1, GoodsItemManager.instance().getGoodsItems());

    // mAdapter = new SGVAdapter(this);
    mSGV = (StaggeredGridView) findViewById(R.id.grid);
    // mSGV.setColumnCount(-1);
    // mSGV.setAdapter(mAdapter);
    mSGV.setAdapter(mGoodsAdapter);
    // mSGV.setAdapter(new EndlessGoodsItemAdapter(this, mGoodsAdapter, R.id.textView1));
    mSGV.setItemMargin(10);
    mGoodsAdapter.notifyDataSetChanged();

    mProgress = (ProgressBar) findViewById(R.id.progress);

    mGaInstance = GoogleAnalytics.getInstance(this);
    mGaTracker = mGaInstance.getTracker("UA-39513550-1");
  }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_try_again:
       // umeng event
       MobclickAgent.onEvent(this, "home", "btn_try_again");
       showProgressLayout();
       getCategory(mCategoryUrl);
       break;
     case R.id.btn_search:
       search();
       break;
     case R.id.layout_about:
       // umeng event
       MobclickAgent.onEvent(this, "home", "btn_about");
       MobclickAgent.onEvent(this, "about", "enter");
       aboutDialog.show();
       break;
     case R.id.layout_recommand:
       // umeng event
       MobclickAgent.onEvent(this, "home", "btn_recommand");
       recommandToFriend();
       break;
     case R.id.layout_feedback:
       // umeng event
       MobclickAgent.onEvent(this, "home", "btn_feedback");
       UMFeedbackService.openUmengFeedbackSDK(this);
       break;
     case R.id.btn_recent:
       try {
         Intent intent = new Intent(this, RecentlyUpdatedActivity.class);
         this.getmMainActivity().showView(1, intent);
       } catch (Exception e) {
         Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
       }
       break;
     case R.id.iv_favorite:
       // umeng event
       MobclickAgent.onEvent(this, "home", "btn_favorite");
       Intent intent = new Intent(mContext, FavoriteActivity.class);
       getmMainActivity().showView(1, intent);
       break;
     default:
       break;
   }
 }
Ejemplo n.º 3
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.refresh:
       mRefreshItem = item;
       refresh();
       return true;
     case R.id.action_feedback:
       UMFeedbackService.openUmengFeedbackSDK(this);
       return true;
     case R.id.action_about:
       Intent intent = new Intent();
       intent.setClass(MainActivity.this, AboutActivity.class);
       MainActivity.this.startActivity(intent);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }