package com.sogouchat.ui; import com.sogouchat.R; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.RelativeLayout; public class msgpopnotice extends Activity { public Button mButton_back; public RelativeLayout mLayoutPop,mLayoutInfoBar; public CheckBox mCheckBoxckPopnotice,mCheckBoxcInfoBarnotice; public SharedPreferences mSetingPreferences; public SharedPreferences.Editor mSetingEditor; public boolean mStatusPop,mStatusInfobar; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.msgpopalart); mButton_back=(Button)findViewById(R.id.msgpopalart_back); mCheckBoxckPopnotice=(CheckBox)findViewById(R.id.ck_pop_notice); mCheckBoxcInfoBarnotice=(CheckBox)findViewById(R.id.ck_infobar_notice); mSetingPreferences = getSharedPreferences("setting", Activity.MODE_WORLD_READABLE); mSetingEditor =mSetingPreferences.edit(); mStatusPop=mSetingPreferences.getBoolean("PopNotice", false); mStatusInfobar=mSetingPreferences.getBoolean("InfoBarNotice",false); mCheckBoxckPopnotice.setChecked(mStatusPop); mCheckBoxcInfoBarnotice.setChecked(mStatusInfobar); mButton_back.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); intent.setClass(msgpopnotice.this, settingActivity.class); startActivity(intent); finish(); } }); mLayoutPop=(RelativeLayout)findViewById(R.id.rl_msgnotice_layout1); mLayoutPop.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mStatusPop=!mStatusPop; mCheckBoxckPopnotice.setChecked(mStatusPop); mSetingEditor.putBoolean("PopNotice", mStatusPop); mSetingEditor.commit(); } }); mLayoutInfoBar=(RelativeLayout)findViewById(R.id.rl_msgnotice_layout2); mLayoutInfoBar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mStatusInfobar=!mStatusInfobar; mCheckBoxcInfoBarnotice.setChecked(mStatusInfobar); mSetingEditor.putBoolean("InfobarNotice", mStatusInfobar); mSetingEditor.commit(); } }); } }