@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settingstab); // All Activity buttons mailButton = (Button) findViewById(mailButtonId); smsButton = (Button) findViewById(smsButtonId); blockOtherCalls = (Button) findViewById(blockOtherCallsId); muteRButton = (RadioButton) findViewById(muteRButtonId); hangUpRButton = (RadioButton) findViewById(hangUpRButtonId); serviceToggleButton = (ToggleButton) findViewById(serviceToggleButtonId); // Define all button listeners mailButton.setOnClickListener(this); smsButton.setOnClickListener(this); blockOtherCalls.setOnClickListener(this); muteRButton.setOnClickListener(this); hangUpRButton.setOnClickListener(this); serviceToggleButton.setOnClickListener(this); // Get the notification manager service // notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); /* Set the previous saved state in the ddbb in the widgets that need * the saved state, such as toggle button. */ initActivity(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); searchEditText = (EditText) findViewById(R.id.etSearch); moviesSearchRadioButton = (RadioButton) findViewById(R.id.rMovie); peopleSearchRadioButton = (RadioButton) findViewById(R.id.rPeople); searchRadioGroup = (RadioGroup) findViewById(R.id.rgSelector); searchButton = (Button) findViewById(R.id.bSearch); searchTypeTextView = (TextView) findViewById(R.id.search_type_text_view); moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { longToast(moviesSearchRadioButton.getText() + " " + query); } else if (peopleSearchRadioButton.isChecked()) { longToast(peopleSearchRadioButton.getText() + " " + query); } } }); searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener("Search")); int id = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(id); searchTypeTextView.setText(radioButton.getText()); }
public Options(Activity myActivity) { this.splashMenu = (SplashMenu) myActivity; mDialog = new Dialog(myActivity); mDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(R.layout.options); mSelectionMessage = myActivity.getString(R.string.model_type_selected); final RadioButton robot_type_1 = (RadioButton) mDialog.findViewById(R.id.robot_type_1); final RadioButton robot_type_2 = (RadioButton) mDialog.findViewById(R.id.robot_type_2); final RadioButton robot_type_3 = (RadioButton) mDialog.findViewById(R.id.robot_type_3); switch (splashMenu.getRobotType()) { case R.id.robot_type_2: robot_type_2.setChecked(true); break; case R.id.robot_type_3: robot_type_3.setChecked(true); break; default: robot_type_1.setChecked(true); break; } robot_type_1.setOnClickListener(radio_listener); robot_type_2.setOnClickListener(radio_listener); robot_type_3.setOnClickListener(radio_listener); robot_type_3.setEnabled(false); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dsdrawerbackground); drawbg_back = (LinearLayout) findViewById(R.id.drawerbg_backll); drawbg_back.setOnClickListener(this); drawer_bgdefault = (LinearLayout) findViewById(R.id.drawer_bgdefault); drawer_bgdefault.setOnClickListener(this); drawer_bgradiodefault = (RadioButton) findViewById(R.id.drawer_bgradiodefault); drawer_bgradiodefault.setOnClickListener(this); dsdrawer_bgcustom = (LinearLayout) findViewById(R.id.dsdrawer_bgcustom); dsdrawer_bgcustom.setOnClickListener(this); dsdrawer_bgradiocustom = (RadioButton) findViewById(R.id.dsdrawer_bgradiocustom); dsdrawer_bgradiocustom.setOnClickListener(this); drawer_bgshowtxt = (LinearLayout) findViewById(R.id.drawer_bgshowtxt); drawer_txt = (RelativeLayout) findViewById(R.id.drawer_txt); drawer_bgrlsb = (RelativeLayout) findViewById(R.id.drawer_bgrlsb); drawer_seekbarbg = (SeekBar) findViewById(R.id.drawer_seekbarbg); drawer_seekbarbg.setOnSeekBarChangeListener(this); drawer_bgopacitytxt = (TextView) findViewById(R.id.drawer_bgopacitytxt); drawer_bgradiodefault.setChecked(true); drawer_seekbarbg.setProgress(AppHost3D.mainmenuBgAlpha); drawer_bgopacitytxt.setText(AppHost3D.mainmenuBgAlpha + "%"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.repeat_dialog); setTitle(REPEAT); repeatRepEdit = (EditText) findViewById(R.id.repeatRepEdit); repeatUntilDate = (TextView) findViewById(R.id.repeatUntilDate); repeatRepEdit.setOnClickListener(this); repeatUntilDate.setOnClickListener(this); repeatRepRow = (TableRow) findViewById(R.id.repeatRepRow); repeatUntilRow = (TableRow) findViewById(R.id.repeatUntilRow); repeatRepRow.setOnClickListener(this); repeatUntilRow.setOnClickListener(this); repeatRepRadio = (RadioButton) findViewById(R.id.repeatRepRadio); repeatUntilRadio = (RadioButton) findViewById(R.id.repeatUntilRadio); repeatRepRadio.setOnClickListener(this); repeatUntilRadio.setOnClickListener(this); yes = (Button) findViewById(R.id.btn_yes); no = (Button) findViewById(R.id.btn_no); yes.setOnClickListener(this); no.setOnClickListener(this); if (null != rule && rule.getUntil() == null && rule.getCount() == null) { repeatRepEdit.performClick(); repeatRepEdit.setText("1"); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.findAllViewsById(); moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { longToast(moviesSearchRadioButton.getText() + " " + query); } else if (peopleSearchRadioButton.isChecked()) { longToast(peopleSearchRadioButton.getText() + " " + query); } } }); searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener(getString(R.string.search))); int id = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(id); searchTypeTextView.setText(radioButton.getText()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.measurement_creation_main); assert (this.getParent().getClass().getName().compareTo("SpeedometerApp") == 0); this.parent = (SpeedometerApp) this.getParent(); /* Initialize the measurement type spinner */ Spinner spinner = (Spinner) findViewById(R.id.measurementTypeSpinner); spinnerValues = new ArrayAdapter<String>(this.getApplicationContext(), R.layout.spinner_layout); for (String name : MeasurementTask.getMeasurementNames()) { spinnerValues.add(name); } spinnerValues.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(spinnerValues); spinner.setOnItemSelectedListener(new MeasurementTypeOnItemSelectedListener()); spinner.requestFocus(); /* Setup the 'run' button */ Button runButton = (Button) this.findViewById(R.id.runTaskButton); runButton.setOnClickListener(new ButtonOnClickListener()); this.measurementTypeUnderEdit = PingTask.TYPE; setupEditTextFocusChangeListener(); this.udpDir = "Up"; final RadioButton radioUp = (RadioButton) findViewById(R.id.UDPBurstUpButton); final RadioButton radioDown = (RadioButton) findViewById(R.id.UDPBurstDownButton); radioUp.setChecked(true); radioUp.setOnClickListener(new RadioOnClickListener()); radioDown.setOnClickListener(new RadioOnClickListener()); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.setting, container, false); levelNum = (RadioGroup) root.findViewById(R.id.levelGroup); level3 = (RadioButton) root.findViewById(R.id.radioButton); level5 = (RadioButton) root.findViewById(R.id.radioButton2); level7 = (RadioButton) root.findViewById(R.id.radioButton3); nameButton = (Button) root.findViewById(R.id.btnNameSetting); levelButton = (Button) root.findViewById(R.id.btnLevelSetting); p1Edit = (EditText) root.findViewById(R.id.p1edit); p2Edit = (EditText) root.findViewById(R.id.p2edit); insDisplay = (TextView) root.findViewById(R.id.instruction); nameButton.setOnClickListener(new Onclick()); levelButton.setOnClickListener(new Onclick()); level3.setOnClickListener(new Onclick()); level5.setOnClickListener(new Onclick()); level7.setOnClickListener(new Onclick()); preData(); getInstruction(); // level3.setOnClickListener(even1); // level5.setOnClickListener(even1); // level7.setOnClickListener(even1); return root; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); OnRadio = (RadioButton) findViewById(R.id.onRadio); OffRadio = (RadioButton) findViewById(R.id.offRadio); readAllFromFile(); if (TTS == 1) { OnRadio.setChecked(true); OffRadio.setChecked(false); } OffRadio.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { OnRadio.setChecked(false); } }); OnRadio.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { OffRadio.setChecked(false); } }); }
private void initOutgoing() { smtps.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on SMTPS"); port.setText(SendMailProtocol.SMTPS.standardPort() + ""); } }); smtp.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on SMTP"); port.setText(SendMailProtocol.SMTP.standardPort() + ""); } }); SendMailConnection conn = userAccount.getConfiguration().getSendMailConncetions().get(0); String value = ""; value = conn.getSenderAddress().getValue(); if (value != "") { adress.setText(value); value = ""; } value = conn.getHost().getValue(); if (value != "") { host.setText(value); value = ""; } value = conn.getPassword().getValue(); if (value != "") { password.setText(value); value = ""; } value = conn.getUsername().getValue(); if (value != "") { username.setText(value); value = ""; } value = conn.getPort().getValue(); if (value != "") { port.setText(value); } value = conn.getProtocol().lowerCaseName(); if (value != "") { String name = conn.getProtocol().lowerCaseName(); if (name == "smtp") { smtp.setChecked(true); name = ""; } name = conn.getProtocol().lowerCaseName(); if (name == "smtps") { smtps.setChecked(true); } } }
private void initIncoming() { pop3s.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on POP3S"); port.setText(FetchMailProtocol.POP3S.standardPort() + ""); } }); pop3.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on POP3"); port.setText(FetchMailProtocol.POP3.standardPort() + ""); } }); FetchMailConnection conn = userAccount.getConfiguration().getFetchMailConncetions().get(0); String value = conn.getSenderAddress().getValue(); if (value != "") { adress.setText(value); value = ""; } value = conn.getHost().getValue(); if (value != "") { host.setText(value); value = ""; } value = conn.getPassword().getValue(); if (value != "") { password.setText(value); value = ""; } value = conn.getUsername().getValue(); if (value != "") { username.setText(value); value = ""; } value = conn.getPort().getValue(); if (value != "") { port.setText(value); } value = conn.getProtocol().lowerCaseName(); if (value != "") { String name = conn.getProtocol().lowerCaseName(); if (name == "pop3") { pop3.setChecked(true); name = ""; } name = conn.getProtocol().lowerCaseName(); if (name == "pop3s") { pop3s.setChecked(true); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GezitechService.getInstance().appendActivity(this); setContentView(R.layout.activity_zhuye); // user = GezitechService.getInstance().getCurrentLoginUser(this); home = (RadioButton) findViewById(R.id.home); session = (RadioButton) findViewById(R.id.session); person = (RadioButton) findViewById(R.id.person); group = (RadioGroup) findViewById(R.id.zhuye_group); nearby = (RadioButton) findViewById(R.id.nearby); // 初始化个推推送 PushManager.getInstance().initialize(this.getApplicationContext()); // 提示消息 ll_unreadcount = (LinearLayout) findViewById(R.id.ll_unreadcount); tv_unreadcount = (TextView) findViewById(R.id.tv_unreadcount); // 附近人有新消息提示 只显示红点 ll_nearbycount = (LinearLayout) findViewById(R.id.ll_nearbycount); // 喜欢 和 评论的提示条数 ll_like_comment_count = (LinearLayout) findViewById(R.id.ll_like_comment_count); tv_like_comment_count = (TextView) findViewById(R.id.tv_like_comment_count); // 计算未读的消息 unreadcount(); // 计算 喜欢和 评论的未读消息 like_comment_count(tv_like_comment_count, ll_like_comment_count); home.setOnClickListener(this); session.setOnClickListener(this); person.setOnClickListener(this); nearby.setOnClickListener(this); fragmentManager = getSupportFragmentManager(); mFragments = new Fragment[4]; fghome = HomeFramgent.newInstance(); fsession = SessionFramgent.newInstance(); fperson = PersonFramgent.newInstance(); fNearby = NearbyFramgent.newInstance(); mFragments[0] = fghome; mFragments[1] = null; mFragments[2] = null; mFragments[3] = null; fragmentManager.beginTransaction().add(R.id.zhuye_content, fghome).show(fghome).commit(); IntentFilter filter = new IntentFilter(); filter.addAction(Constant.NEW_MESSAGE_ACTION); filter.addAction(Constant.LIKE_COMMENT_ACTION); registerReceiver(receiver, filter); _jumpActivity(this.getIntent()); setSelectFragment(); }
/** 选择头像时弹出的对话框 */ private void showDialog() { final AlertDialog potraidDlg = new AlertDialog.Builder(super.getActivity()).create(); potraidDlg.show(); Window win = potraidDlg.getWindow(); win.setContentView(R.layout.dialog_show_photo); View viewTop = win.findViewById(R.id.view_top_dialog_sethead); View viewBottom = win.findViewById(R.id.view_bottom_dialog_sethead); RadioButton photo = (RadioButton) win.findViewById(R.id.rb_photo_dialog_sethead); RadioButton pic = (RadioButton) win.findViewById(R.id.rb_pic_dialog_sethead); RadioButton bind = (RadioButton) win.findViewById(R.id.rb_bind_dialog_sethead); // 点击dialog外部,关闭dialog viewTop.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub potraidDlg.dismiss(); } }); viewBottom.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub potraidDlg.dismiss(); } }); // 调用相机 photo.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intentPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intentPhoto.putExtra( MediaStore.EXTRA_OUTPUT, Uri.fromFile( new File(Environment.getExternalStorageDirectory(), "/user_head.png"))); startActivityForResult(intentPhoto, 22); potraidDlg.dismiss(); } }); // 调用相片 pic.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intentPic = new Intent(Intent.ACTION_PICK, null); intentPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intentPic, 11); potraidDlg.dismiss(); } }); }
private void initPager() { mViewPager.setOffscreenPageLimit(2); NewsFragmentPagerAdapter mAdapetr = new NewsFragmentPagerAdapter(getSupportFragmentManager(), fragments); mViewPager.setAdapter(mAdapetr); mViewPager.setCurrentItem(0); mViewPager.setOnPageChangeListener(new MyOnPageChangeListener()); mJingXuan.setOnClickListener(new MyOnClickListener(0, mViewPager)); mQuTu.setOnClickListener(new MyOnClickListener(1, mViewPager)); mMeiTu.setOnClickListener(new MyOnClickListener(2, mViewPager)); mGuShi.setOnClickListener(new MyOnClickListener(3, mViewPager)); }
private void initView() { llEthernet = (LinearLayout) findViewById(R.id.llEthernet); tvPortInfo = (TextView) findViewById(R.id.tvPortInfo); btConnect = (Button) findViewById(R.id.btOk); rbUSB = (RadioButton) findViewById(R.id.rbUsb); rbBluetooth = (RadioButton) findViewById(R.id.rbBluetooth); rbEhternet = (RadioButton) findViewById(R.id.rbEthernet); etIpAddress = (EditText) findViewById(R.id.etIpAddress); etPortNum = (EditText) findViewById(R.id.etPortNumber); rbUSB.setOnClickListener(new USBRaidoOnClickListener()); rbBluetooth.setOnClickListener(new BluetoothRaidoOnClickListener()); rbEhternet.setOnClickListener(new EthernetRaidoOnClickListener()); }
public YLShareLiveView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setBackgroundResource(R.drawable.bg_yl_share_live_view); setOrientation(LinearLayout.HORIZONTAL); setGravity(Gravity.CENTER_VERTICAL); LayoutInflater.from(context).inflate(R.layout.ui_yl_share_live_view, this, true); mSelectedPlatform = (RadioButton) findViewById(R.id.mSelectedPlatform); mPlatforms = (RadioGroup) findViewById(R.id.mPlatforms); RadioButton platformWeChat = (RadioButton) findViewById(R.id.mPlatformWeChat); RadioButton platformWeChatMoments = (RadioButton) findViewById(R.id.mPlatformWeChatMoments); RadioButton platformWeibo = (RadioButton) findViewById(R.id.mPlatformWeibo); RadioButton platformQQ = (RadioButton) findViewById(R.id.mPlatformQQ); RadioButton platformQzone = (RadioButton) findViewById(R.id.mPlatformQzone); platformWeChat.setOnClickListener(this); platformWeChatMoments.setOnClickListener(this); platformWeibo.setOnClickListener(this); platformQQ.setOnClickListener(this); platformQzone.setOnClickListener(this); mIndicator = (ImageButton) findViewById(R.id.mIndicator); mIndicatorClick = RxView.clicks(mIndicator) .throttleFirst(500, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe( new Action1<Void>() { @Override public void call(Void aVoid) { if (mExpanded) { mExpanded = false; hidePlatforms(); } else { mExpanded = true; showPlatforms(); } } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { throwable.printStackTrace(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get the button id celsiusRadio = (RadioButton) findViewById(R.id.celRadio); fahrenheitRadio = (RadioButton) findViewById(R.id.fahRadio); tempListener = new TempListener(this); celsiusRadio.setOnClickListener(tempListener); fahrenheitRadio.setOnClickListener(tempListener); Log.d(TAG, "onCreate before commit"); }
private RadioButton initRadioButton(View v, int viewId, final byte fileType) { final RadioButton button = findView(v, viewId); final Resources r = button.getResources(); final FileTypeRadioButtonSelectorFactory fileTypeRadioButtonSelectorFactory = new FileTypeRadioButtonSelectorFactory( fileType, r, FileTypeRadioButtonSelectorFactory.RadioButtonContainerType.BROWSE); fileTypeRadioButtonSelectorFactory.updateButtonBackground(button); button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (button.isChecked()) { browseFilesButtonClick(fileType); } fileTypeRadioButtonSelectorFactory.updateButtonBackground(button); } }); button.setOnCheckedChangeListener( new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { browseFilesButtonClick(fileType); } fileTypeRadioButtonSelectorFactory.updateButtonBackground(button); } }); button.setChecked(fileType == Constants.FILE_TYPE_AUDIO); return button; }
private void loadUserRelation(int relation) { switch (relation) { case User.RELATION_TYPE_BOTH: mRelation.setCompoundDrawablesWithIntrinsicBounds( R.drawable.widget_bar_relation_del, 0, 0, 0); mRelation.setText("取消互粉"); break; case User.RELATION_TYPE_FANS_HIM: mRelation.setCompoundDrawablesWithIntrinsicBounds( R.drawable.widget_bar_relation_del, 0, 0, 0); mRelation.setText("取消关注"); break; case User.RELATION_TYPE_FANS_ME: mRelation.setCompoundDrawablesWithIntrinsicBounds( R.drawable.widget_bar_relation_add, 0, 0, 0); mRelation.setText("加关注"); break; case User.RELATION_TYPE_NULL: mRelation.setCompoundDrawablesWithIntrinsicBounds( R.drawable.widget_bar_relation_add, 0, 0, 0); mRelation.setText("加关注"); break; } if (relation > 0) mRelation.setOnClickListener(relationClickListener); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.share_audio_tabwidget); final RadioButton byUploadRadio = (RadioButton) findViewById(R.id.postOrShare_audio_byUpload); final RadioButton byUrlRadio = (RadioButton) findViewById(R.id.postOrShare_audio_byUrl); final FrameLayout uploadFrame = (FrameLayout) findViewById(R.id.postOrShare_audio_uploadFrame); final EditText urlEditText = (EditText) findViewById(R.id.postOrShare_audio_url); final Button chooseAudioButton = (Button) findViewById(R.id.postOrShare_audio_chooseButton); byUrlRadio.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { uploadFrame.setVisibility(View.GONE); urlEditText.setVisibility(View.VISIBLE); } }); byUploadRadio.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { uploadFrame.setVisibility(View.VISIBLE); urlEditText.setVisibility(View.GONE); } }); chooseAudioButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent getImageIntent = new Intent(Intent.ACTION_GET_CONTENT); getImageIntent.setType("audio/mp3"); startActivityForResult(getImageIntent, 1543); } }); }
@Override protected void onBindView(View view) { super.onBindView(view); mPreferenceTitle = (TextView) view.findViewById(R.id.preference_title); mPreferenceTitle.setText(mTitleValue); mPreferenceButton = (RadioButton) view.findViewById(R.id.preference_radiobutton); mPreferenceButton.setOnClickListener(this); mPreferenceButton.setChecked(mChecked); }
private void setListeners() { setDefaultTag(); sunBtn.setOnClickListener(this); monBtn.setOnClickListener(this); tueBtn.setOnClickListener(this); wedBtn.setOnClickListener(this); thuBtn.setOnClickListener(this); friBtn.setOnClickListener(this); satBtn.setOnClickListener(this); weekDayRB.setOnClickListener(this); weekEndRB.setOnClickListener(this); alwaysOnRB.setOnClickListener(this); enteredCB.setOnClickListener(this); exitCB.setOnClickListener(this); mBtnUpdate.setOnClickListener(this); mBtnDelete.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dials); schemesLL = (LinearLayout) findViewById(R.id.colors); prefs = getSharedPreferences(getString(R.string.prefs_name), MODE_PRIVATE); colorSchemes = getResources().getStringArray(R.array.color_schemes); // load the color schemes OnClickListener ocl = new OnClickListener() { public void onClick(View v) { String sc = (String) v.getTag(); SharedPreferences.Editor editor = prefs.edit(); editor.putString("color_scheme", sc); editor.commit(); } }; // color oscillator colorOscillator = new Runnable() { public void run() { nyxView.setDuration(OSC_PERIOD); nyxView.setTimingFunction(OSC_TIMING); nyxView.setBaseColor(colors[(++curColor) % 2]); nyxView.postDelayed(this, OSC_PERIOD); } }; // construct the list of color schemes for (String cs : colorSchemes) { View v = getLayoutInflater().inflate(R.layout.color_scheme_item, null); RadioButton rb = (RadioButton) v.findViewById(R.id.color_scheme_name); rb.setTag(cs); rb.setText( getString( getResources().getIdentifier("color_scheme_" + cs, "string", getPackageName()))); rb.setOnClickListener(ocl); schemesLL.addView(v); } nyxView = (NyxView) findViewById(R.id.nyxview); nyxView.setDuration(0); nyxView.setComposition(Util.loadCompositionRes(this, R.string.default_composition)); nyxView.setText(getString(R.string.configure_me)); nyxView.setTextSize( getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? 1.0 : 1.5); nyxView.rerender(); }
public void init() { main_tab_home = (RadioButton) findViewById(R.id.main_tab_home); main_tab_catagory = (RadioButton) findViewById(R.id.main_tab_catagory); // main_tab_car = (RadioButton) findViewById(R.id.main_tab_car); main_tab_buy = (RadioButton) findViewById(R.id.main_tab_buy); main_tab_more = (RadioButton) findViewById(R.id.main_tab_more); main_tab_home.setOnClickListener( new OnClickListener() { public void onClick(View view) { tabHost.setCurrentTabByTag("home"); } }); main_tab_catagory.setOnClickListener( new OnClickListener() { public void onClick(View view) { tabHost.setCurrentTabByTag("catagory"); } }); /* main_tab_car.setOnClickListener(new OnClickListener() { public void onClick(View view) { tabHost.setCurrentTabByTag("car"); } });*/ main_tab_buy.setOnClickListener( new OnClickListener() { public void onClick(View view) { tabHost.setCurrentTabByTag("buy"); } }); main_tab_more.setOnClickListener( new OnClickListener() { public void onClick(View view) { tabHost.setCurrentTabByTag("more"); } }); }
private void init() { homePageRadioButton = (RadioButton) findViewById(R.id.homePageRadioButton); homePageRadioButton.setOnClickListener(this); homeCommodityRadioButton = (RadioButton) findViewById(R.id.homeCommodityRadioButton); homeCommodityRadioButton.setOnClickListener(this); homeShoppingCartRadioButton = (RadioButton) findViewById(R.id.homeShoppingCartRadioButton); homeShoppingCartRadioButton.setOnClickListener(this); homePersonalRadioButton = (RadioButton) findViewById(R.id.homePersonalRadioButton); homePersonalRadioButton.setOnClickListener(this); homePageFragment = new HomepageFragment(); commodityFragment = new CommodityFragment(); shoppingCartFragment = new ShoppingCartFragment(); personalFragment = new PersonalFragment(); // 初始化第一个页面 changeFrament(homePageFragment, null, "homePageFragment"); homePageRadioButton.setCompoundDrawablesWithIntrinsicBounds( 0, R.drawable.home_homepage_tab_pressed2, 0, 0); homePageRadioButton.setTextColor(getResources().getColor(R.color.common_title_bg)); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Tell AQUtility about context: it can use this globally...which is really handy! AQUtility.setContext(getApplication()); // Load default preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, false); findAllViewsById(); View.OnClickListener radioButtonListener = new View.OnClickListener() { public void onClick(View v) { RadioButton radioButton = (RadioButton) v; searchTypeTextView.setText("Searching for " + radioButton.getText()); } }; moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { PerformFilmSearchTask task = new PerformFilmSearchTask(FilmSearchAppActivity.this); task.execute(query); } else if (peopleSearchRadioButton.isChecked()) { PerformPersonSearchTask task = new PerformPersonSearchTask(FilmSearchAppActivity.this); task.execute(query); } } }); int radioId = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(radioId); searchTypeTextView.setText(radioButton.getText()); }
@NonNull @SuppressLint("InflateParams") @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.settings, null); builder.setView(view); builder.setNeutralButton("Done", new DoneClickListener()); sp_sellto_system = (Spinner) view.findViewById(R.id.sp_sellto_system); rg_sellto_source = (RadioGroup) view.findViewById(R.id.rg_sellto_source); RadioButton rb_sellto_sell = (RadioButton) view.findViewById(R.id.rb_sellto_sell); RadioButton rb_sellto_buy = (RadioButton) view.findViewById(R.id.rb_sellto_buy); sp_buyfrom_system = (Spinner) view.findViewById(R.id.sp_buyfrom_system); rg_buyfrom_source = (RadioGroup) view.findViewById(R.id.rg_buyfrom_source); RadioButton rb_buyfrom_sell = (RadioButton) view.findViewById(R.id.rb_buyfrom_sell); RadioButton rb_buyfrom_buy = (RadioButton) view.findViewById(R.id.rb_buyfrom_buy); ed_default_me = new IntegerEditText( (EditText) view.findViewById(R.id.ed_settings_melevel), 0, 10, 0, new MeResearchChangeWatcher()); ed_default_te = new IntegerEditText( (EditText) view.findViewById(R.id.ed_settings_pelevel), 0, 20, 0, new TeResearchChangeWatcher()); updateSettings(); rb_sellto_sell.setOnClickListener(new SellClickListener(false)); rb_sellto_buy.setOnClickListener(new BuyClickListener(false)); rb_buyfrom_sell.setOnClickListener(new SellClickListener(true)); rb_buyfrom_buy.setOnClickListener(new BuyClickListener(true)); return builder.create(); }
// 初始化视图控件 private void initView() { _hisuid = getIntent().getIntExtra("his_id", 0); _hisname = getIntent().getStringExtra("his_name"); _username = getIntent().getStringExtra("his_name"); _uid = ((AppContext) getApplication()).getLoginUid(); mBack = (ImageView) findViewById(R.id.user_center_back); mRefresh = (ImageView) findViewById(R.id.user_center_refresh); mHeadTitle = (TextView) findViewById(R.id.user_center_head_title); mProgressbar = (ProgressBar) findViewById(R.id.user_center_head_progress); mRelation = (RadioButton) findViewById(R.id.user_center_footbar_relation); mMessage = (RadioButton) findViewById(R.id.user_center_footbar_message); mAtme = (RadioButton) findViewById(R.id.user_center_footbar_atme); mTabActive = (Button) findViewById(R.id.user_center_btn_active); mTabBlog = (Button) findViewById(R.id.user_center_btn_blog); mUserinfoDialog = new UserInfoDialog(UserCenter.this); mUserface = (ImageView) mUserinfoDialog.findViewById(R.id.user_center_userface); mUsername = (TextView) mUserinfoDialog.findViewById(R.id.user_center_username); mFrom = (TextView) mUserinfoDialog.findViewById(R.id.user_center_from); mGender = (TextView) mUserinfoDialog.findViewById(R.id.user_center_gender); mJointime = (TextView) mUserinfoDialog.findViewById(R.id.user_center_jointime); mDevplatform = (TextView) mUserinfoDialog.findViewById(R.id.user_center_devplatform); mExpertise = (TextView) mUserinfoDialog.findViewById(R.id.user_center_expertise); mLatestonline = (TextView) mUserinfoDialog.findViewById(R.id.user_center_latestonline); mHeadTitle.setText(_username + " ▼"); // 设置第一选中项 mTabActive.setEnabled(false); mTabActive.setOnClickListener(tabBtnClick(mTabActive)); mTabBlog.setOnClickListener(tabBtnClick(mTabBlog)); mBack.setOnClickListener(UIHelper.finish(this)); mRefresh.setOnClickListener(refreshClickListener); mHeadTitle.setOnClickListener(headTitleClickListener); mMessage.setOnClickListener(messageClickListener); mAtme.setOnClickListener(atmeClickListener); mUserinfoDialog.setOnCancelListener(dialogCancelListener); this.initLvActive(); this.initLvBlog(); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button = (Button) findViewById(R.id.button); final EditText edittext = (EditText) findViewById(R.id.edittext); final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox); final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red); final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue); final ToggleButton togglebutton = (ToggleButton) findViewById(R.id.togglebutton); final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar); button.setOnClickListener(button_listener); edittext.setOnKeyListener(edittext_listener); checkbox.setOnClickListener(checkbox_listener); radio_red.setOnClickListener(radio_listener); radio_blue.setOnClickListener(radio_listener); togglebutton.setOnClickListener(togglebutton_listener); ratingbar.setOnRatingBarChangeListener(ratingbar_listener); }
@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.afford_fragment, container, false); mMonthly = (EditText) v.findViewById(R.id.edit_monthly); mInterest = (EditText) v.findViewById(R.id.edit_interest); mTerm = (EditText) v.findViewById(R.id.edit_term); mAfford = (TextView) v.findViewById(R.id.affordText); yearsCheck = (RadioButton) v.findViewById(R.id.years); monthsCheck = (RadioButton) v.findViewById(R.id.months); calculate_button = (Button) v.findViewById(R.id.afford_button); // OnClickListeners yearsCheck.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { monthsCheck.setChecked(false); } }); monthsCheck.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { yearsCheck.setChecked(false); } }); calculate_button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int months = terms(); numbers(); calculate = new AffordabilityLogic(interest, monthly, months); mAfford.setText(formatString(calculate.total())); } }); v.setBackgroundColor(Color.WHITE); return v; }