예제 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_page);
    Intent intent = getIntent();

    initLayout();
    TextView tvTitle = (TextView) findViewById(R.id.title_text);
    if (intent.hasExtra("isZone")) {
      tvTitle.setText(R.string.zone_page_title);
    } else {
      tvTitle.setText(R.string.home_page_title);
    }

    // 返回
    ImageButton btnLeft = (ImageButton) findViewById(R.id.title_button_left);
    btnLeft.setImageResource(R.drawable.back_btn_selector);
    btnLeft.setOnClickListener(btnListClickListener);
    // 修改
    btnRight = (ImageButton) findViewById(R.id.title_button_right);
    btnRight.setImageResource(R.drawable.edit_btn_selector);
    btnRight.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (isUpdate) {
              final MyRemDialog dialog = new MyRemDialog(HomePageActivity.this, R.style.dialog);
              dialog.setTitle(R.string.user_basic_dialog_save_title);
              dialog.setMessage(R.string.user_basic_dialog_to_save_message);
              dialog.setPosBtnText(R.string.user_basic_dialog_save_rem_btn_save);
              dialog.setNegBtnText(R.string.user_basic_dialog_save_rem_btn_cancel);
              dialog.setPosBtnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      isUpdate = false;
                      btnRight.setImageResource(R.drawable.edit_btn_selector);
                      // 修改
                      afterToUpdateUserInfo();
                    }
                  });
              dialog.setNegBtnClickListener(
                  new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                      dialog.dismiss();
                    }
                  });
              dialog.show();
            } else {
              // 编辑
              isUpdate = true;
              btnRight.setImageResource(R.drawable.titlebar_btn_share_selector);
              reayToUpdateUserInfo();
            }
          }
        });
    init();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_category_review_list);
   Init();
   InitTopBar();
   InitData();
 }