public void initializeSetting() { textView10 = (TextView) findViewById(R.id.textView10); textView11 = (TextView) findViewById(R.id.textView11); textView12 = (TextView) findViewById(R.id.textView12); textView13 = (TextView) findViewById(R.id.textView13); textView14 = (TextView) findViewById(R.id.textView14); imageView3 = (ImageView) findViewById(R.id.imageView3); imageView4 = (ImageView) findViewById(R.id.imageView4); imageView5 = (ImageView) findViewById(R.id.imageView5); imageView6 = (ImageView) findViewById(R.id.imageView6); imageView7 = (ImageView) findViewById(R.id.imageView7); imageView8 = (ImageView) findViewById(R.id.imageView8); imageView3.setOnClickListener(this); imageView4.setOnClickListener(this); imageView5.setOnClickListener(this); imageView6.setOnClickListener(this); imageView7.setOnClickListener(this); imageView8.setOnClickListener(this); textView10.setOnClickListener(this); textView11.setOnClickListener(this); textView12.setOnClickListener(this); textView13.setOnClickListener(this); textView14.setOnClickListener(this); editText1 = (EditText) findViewById(R.id.editText1); editText2 = (EditText) findViewById(R.id.editText2); editText3 = (EditText) findViewById(R.id.editText3); editText4 = (EditText) findViewById(R.id.editText4); editText5 = (EditText) findViewById(R.id.editText5); editText3.setText(SIP); editText4.setText(String.valueOf(DATA_SPORT)); editText5.setText(String.valueOf(VIDEO_SPORT)); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button6 = (Button) findViewById(R.id.button6); tButton1 = (ToggleButton) findViewById(R.id.toggleButton1); tButton2 = (ToggleButton) findViewById(R.id.toggleButton2); tButton3 = (ToggleButton) findViewById(R.id.toggleButton3); button1.setOnClickListener(this); button2.setOnClickListener(this); button6.setOnClickListener(this); tButton1.setOnClickListener(this); tButton2.setOnClickListener(this); tButton3.setOnClickListener(this); tButton1.setChecked(true); tButton1.setText("1단계"); tButton2.setText("2단계"); tButton3.setText("3단계"); lockLevel = 1; }
@Override protected final void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainActivityMenu menuView = new MainActivityMenu(this); layout_ = menuView.getLayout(); name_ = (EditText) layout_.findViewById(R.id.name); name_.addTextChangedListener(new NameListener(this)); text_ = (TextView) layout_.findViewById(R.id.text); text_.setText(""); menuButton_ = (ToggleButton) layout_.findViewById(R.id.menuButton); menuButton_.setChecked(true); menuButton_.setOnClickListener(new MenuButtonListener(layout_, menuButton_)); validButton_ = (Button) layout_.findViewById(R.id.nameButton); // Add an animation on start up Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.view_animation); validButton_.startAnimation(animation); // Add touch listener validButton_.setOnTouchListener(new ValidButtonListener(text_, name_, validButton_)); // Set keyboard hidden by default getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); // Set theme according to preferences setTheme(); setContentView(layout_); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.channelsitem, parent, false); } Channel channel = getItem(position); TextView channelName = (TextView) row.findViewById(R.id.txtName); TextView channelCreated = (TextView) row.findViewById(R.id.txtCreated); ToggleButton tg = (ToggleButton) row.findViewById(R.id.toggleButton1); tg.setOnClickListener(myCheckChangList); tg.setTag(position); if (channel.name != null) { channelName.setText(channel.name); } if (channel.created != null) { channelCreated.setText(channel.created); } if (channel.send != null) { tg.setChecked(channel.send); channelName.setTextColor(Color.BLACK); } return row; }
void populateFrom(final int position) { final Profile account = getItem(position); Protocol p = RosterHelper.getInstance().getProtocol(account); if (null != p) { ImageView icProtocol = getImageProtocol(); Icon ic = p.getStatusInfo().getIcon((byte) 0); if (ic != null) { icProtocol.setVisibility(ImageView.VISIBLE); icProtocol.setImageDrawable(ic.getImage()); } else { icProtocol.setVisibility(ImageView.GONE); } } getTextLogin().setText(account.userId); ToggleButton tb = getToggleButton(); tb.setChecked(account.isActive); tb.setFocusableInTouchMode(false); tb.setFocusable(false); tb.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ToggleButton t = (ToggleButton) v.findViewById(R.id.toggle_button); account.isActive = t.isChecked(); RosterHelper.getInstance().setCurrentProtocol(); Options.saveAccount(account); notifyDataSetChanged(); } }); }
public GroupInfoViewHolder(View itemView) { super(itemView); group_name = (TextView) itemView.findViewById(R.id.group_name); members_count = (TextView) itemView.findViewById(R.id.tv_members_count); followers_count = (TextView) itemView.findViewById(R.id.tv_followers_count); group_icon = (CircularImageView) itemView.findViewById(R.id.group_image); tbtn_follow = (ToggleButton) itemView.findViewById(R.id.tb_followers); iv_member = (ImageView) itemView.findViewById(R.id.iv_members); Bundle bundle = ((Activity) itemView.getContext()).getIntent().getExtras(); g_name = bundle.getString("G_NAME"); g_icon = bundle.getInt("G_ICON"); m_count = bundle.getInt("M_COUNT"); f_count = bundle.getInt("F_COUNT"); tbtn_follow.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); iv_member.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { MemberConfirmationDialog confirmDialog = new MemberConfirmationDialog((Activity) v.getContext()); Window window = confirmDialog.getWindow(); window.setLayout(450, ViewGroup.LayoutParams.WRAP_CONTENT); confirmDialog.show(); } }); }
@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(); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LEDState = (TextView) this.findViewById(R.id.LED_State); ledBrightness = (SeekBar) this.findViewById(R.id.ledBrightness1); ledBrightness.setMax(255); myToggle1 = (ToggleButton) this.findViewById(R.id.toggleButton1); myToggle1.setOnClickListener( new OnClickListener() { public void onClick(View v) { checkToggle(); } }); ledBrightness.setOnSeekBarChangeListener( new OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { seekChange(); } public void onStartTrackingTouch(SeekBar seekBar) {} public void onStopTrackingTouch(SeekBar seekBar) {} }); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (DEBUG) Log.v(TAG, "onCreate:"); setContentView(R.layout.activity_main); mCameraButton = (ToggleButton) findViewById(R.id.camera_button); mCameraButton.setOnClickListener(mOnClickListener); mCaptureButton = (ImageButton) findViewById(R.id.capture_button); mCaptureButton.setOnClickListener(mOnClickListener); mCaptureButton.setVisibility(View.INVISIBLE); mUVCCameraViewL = (UVCCameraTextureView) findViewById(R.id.camera_view_L); mUVCCameraViewL.setAspectRatio( UVCCamera.DEFAULT_PREVIEW_WIDTH / (float) UVCCamera.DEFAULT_PREVIEW_HEIGHT); mUVCCameraViewL.setSurfaceTextureListener(mSurfaceTextureListener); mUVCCameraViewL.setOnLongClickListener(mOnLongClickListener); mUVCCameraViewR = (UVCCameraTextureView) findViewById(R.id.camera_view_R); mUVCCameraViewR.setAspectRatio( UVCCamera.DEFAULT_PREVIEW_WIDTH / (float) UVCCamera.DEFAULT_PREVIEW_HEIGHT); mUVCCameraViewR.setSurfaceTextureListener(mSurfaceTextureListener); mUVCCameraViewR.setOnLongClickListener(mOnLongClickListener); mUSBMonitor = new USBMonitor(this, mOnDeviceConnectListener); mHandler = UVCCameraHandler.createHandler(this); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_details, container, false); toolbar = (Toolbar) rootView.findViewById(R.id.toolbar); posterText = (TextView) rootView.findViewById(R.id.posterTitle); posterBar = (ImageView) rootView.findViewById(R.id.posterImage); dateText = (TextView) rootView.findViewById(R.id.release_date); durationText = (TextView) rootView.findViewById(R.id.duration); voteText = (TextView) rootView.findViewById(R.id.average_vote); overviewText = (TextView) rootView.findViewById(R.id.overview); trailerListView = (ListView) rootView.findViewById(R.id.trailerListView); trailerListView.setOnItemClickListener(this); reviewListView = (ListView) rootView.findViewById(R.id.reviewListView); trailerLinear = (LinearLayout) rootView.findViewById(R.id.trailer_linear); reviewLinear = (LinearLayout) rootView.findViewById(R.id.review_linear); toggleBtn = (ToggleButton) rootView.findViewById(R.id.toggle); toggleBtn.setOnClickListener(this); Log.i("isNull", getArguments() == null ? "ok" : "no"); if (toolbar != null) { // onePane Mode ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); try { ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); } catch (NullPointerException e) { e.printStackTrace(); } } curd = new CURD(getActivity(), movie); return rootView; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sniff); ; // HIDE STATUS BAR View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); // ScrollView scrollView = (ScrollView) findViewById(R.id.scrollSniff); scrollView.post( new Runnable() { @Override public void run() { scrollView.fullScroll(View.FOCUS_DOWN); } }); // SETUP NFC nfc = new Nfc(this); NfcAdapter adapter = nfc.getNfcAdapter(); // UPDATE OUTPUT Intent intent = getIntent(); if (intent.hasExtra(Stealth.EXTRA_MESSAGE)) { protocols = intent.getStringExtra(Stealth.EXTRA_MESSAGE); } if (protocols == null) { protocols = ""; } // Create the output text output = (TextView) findViewById(R.id.scrollText); // Deal with the toggle button presses final ToggleButton mode_toggle = (ToggleButton) findViewById(R.id.swap_mode); mode_toggle.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!mode_toggle.isChecked()) { Intent intent = new Intent(v.getContext(), Stealth.class); intent.putExtra(Stealth.EXTRA_MESSAGE, protocols); startActivity(intent); } } }); // RESTOFCODE androidFile = new AndroidFile(logLocation); output.setText(protocols); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ToggleButton bt_oneFragment = (ToggleButton) findViewById(R.id.bt_oneFragment); bt_oneFragment.setOnClickListener(this); ToggleButton bt_twoFragment = (ToggleButton) findViewById(R.id.bt_twoFragment); bt_twoFragment.setOnClickListener(this); ToggleButton bt_threeFragment = (ToggleButton) findViewById(R.id.bt_threeFragment); bt_threeFragment.setOnClickListener(this); mCurrentFragmentIndex = FRAGMENT_FOUR; fragmentReplace(mCurrentFragmentIndex); new HttpTask().execute(); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_search, container, false); conf = PreferenceManager.getDefaultSharedPreferences(getActivity()); resultList = (ListView) rootView.findViewById(R.id.listView1); resultList.setOnItemClickListener(this); adapter = new SimpleCursorAdapter( getActivity(), android.R.layout.simple_list_item_1, null, new String[] {Katalog.TERM}, new int[] {android.R.id.text1}, 0); resultList.setAdapter(adapter); ((EditText) rootView.findViewById(R.id.autoCompleteTextView1)) .setOnEditorActionListener( new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { startSearch(); return true; } return false; } }); vollSucheButton = (ToggleButton) rootView.findViewById(R.id.voll_suche); irdiSucheButton = (ToggleButton) rootView.findViewById(R.id.irdi_suche); vollSucheButton.setOnClickListener(this); irdiSucheButton.setOnClickListener(this); vollSucheButton.setChecked(vollSuche); irdiSucheButton.setChecked(!vollSuche); // AutoCompleteTextView searchTerm = (AutoCompleteTextView) // rootView.findViewById(R.id.autoCompleteTextView1); // searchTerm.setText("0001-EXPROB#02-1#1"); return rootView; }
public void setUnderlineToggleButton(ToggleButton button) { underlineToggle = button; underlineToggle.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { toggleStyle(STYLE_UNDERLINED); } }); }
// Style toggle button setters public void setBoldToggleButton(ToggleButton button) { boldToggle = button; boldToggle.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { toggleStyle(STYLE_BOLD); } }); }
public void setItalicsToggleButton(ToggleButton button) { italicsToggle = button; italicsToggle.setOnClickListener( new Button.OnClickListener() { public void onClick(View v) { toggleStyle(STYLE_ITALIC); } }); }
private void setupChat() { Log.d(TAG, "setupChat()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message); mConversationView = (ListView) findViewById(R.id.in); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key // mOutEditText = (EditText) findViewById(R.id.edit_text_out); // mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events /*mSendButton = (Button) findViewById(R.id.button_send); mSendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget TextView view = (TextView) findViewById(R.id.edit_text_out); String message = view.getText().toString(); sendMessage(message + '\r'); } });*/ // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothChatService(this, mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); // ---Get Vehicle Data Button--- final ToggleButton getDataButton = (ToggleButton) findViewById(R.id.toggleButton1); getDataButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { if (getDataButton.isChecked()) { startTransmission(); } else { message_number = 0; } } }); // ---Clear Trouble Codes Button--- Button getCodesButton = (Button) findViewById(R.id.button2); getCodesButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { clearCodes(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.password); AkshayVariables(); tb1.setOnClickListener(this); b1.setOnClickListener(this); }
private void setupFormatBarButtonMap(View view) { ToggleButton boldButton = (ToggleButton) view.findViewById(R.id.format_bar_button_bold); mTagToggleButtonMap.put(getString(R.string.format_bar_tag_bold), boldButton); ToggleButton italicButton = (ToggleButton) view.findViewById(R.id.format_bar_button_italic); mTagToggleButtonMap.put(getString(R.string.format_bar_tag_italic), italicButton); ToggleButton quoteButton = (ToggleButton) view.findViewById(R.id.format_bar_button_quote); mTagToggleButtonMap.put(getString(R.string.format_bar_tag_blockquote), quoteButton); ToggleButton ulButton = (ToggleButton) view.findViewById(R.id.format_bar_button_ul); mTagToggleButtonMap.put(getString(R.string.format_bar_tag_unorderedList), ulButton); ToggleButton olButton = (ToggleButton) view.findViewById(R.id.format_bar_button_ol); mTagToggleButtonMap.put(getString(R.string.format_bar_tag_orderedList), olButton); // Tablet-only ToggleButton strikethroughButton = (ToggleButton) view.findViewById(R.id.format_bar_button_strikethrough); if (strikethroughButton != null) { mTagToggleButtonMap.put( getString(R.string.format_bar_tag_strikethrough), strikethroughButton); } ToggleButton mediaButton = (ToggleButton) view.findViewById(R.id.format_bar_button_media); mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_MEDIA, mediaButton); registerForContextMenu(mediaButton); ToggleButton linkButton = (ToggleButton) view.findViewById(R.id.format_bar_button_link); mTagToggleButtonMap.put(TAG_FORMAT_BAR_BUTTON_LINK, linkButton); ToggleButton htmlButton = (ToggleButton) view.findViewById(R.id.format_bar_button_html); htmlButton.setOnClickListener(this); for (ToggleButton button : mTagToggleButtonMap.values()) { button.setOnClickListener(this); } }
@Override protected void initViews(View view) { super.initViews(view); localVideoView = (QBGLVideoView) view.findViewById(R.id.localVideoVidew); localVideoView.setVisibility(View.VISIBLE); remoteVideoView = (QBGLVideoView) view.findViewById(R.id.remoteVideoView); remoteVideoView.setVisibility(View.VISIBLE); cameraToggle = (ToggleButton) view.findViewById(R.id.cameraToggle); cameraToggle.setVisibility(View.VISIBLE); cameraToggle.setOnClickListener(this); switchCameraToggle = (ToggleButton) view.findViewById(R.id.switchCameraToggle); switchCameraToggle.setVisibility(View.VISIBLE); switchCameraToggle.setOnClickListener(this); imgMyCameraOff = (ImageView) view.findViewById(R.id.imgMyCameraOff); actionButtonsEnabled(false); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); ///// Easy way to create Method and Maintained ./////ONLY THESE THREE METHOD AFTER // CLEANING.///// baconandeggs(); toggleButton.setOnClickListener(this); clickmeButton.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); baconAndEggs(); /* * Could use passTog.setChecked() instead * But onClickListener is needed for later tutorials */ passTog.setOnClickListener(this); chkCmd.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate begin"); super.onCreate(savedInstanceState); setContentView(R.layout.download_activity_main); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // AppInitSupport.initApp(this.getApplicationContext(), this.getAssets()); // 设备ID String androidId = AndroidIdSupport.getAndroidID(); TextView tvAndroidId = (TextView) this.findViewById(R.id.textViewDeviceId); tvAndroidId.setText(androidId); // UI handler DownloadUIHandler.init(this); // 会议列表 ListView lvMeetingInfo = (ListView) this.findViewById(R.id.lvMeetingList); BaseAdapter meetingListItemAdapter = new MeetingInfoLVButtonAdapter(this); lvMeetingInfo.setAdapter(meetingListItemAdapter); // toggleBtnDownload = (ToggleButton) findViewById(R.id.toggleBtnDownload); toggleBtnDownload.setOnClickListener( new OnClickListener() { public void onClick(View v) { if (toggleBtnDownload.isChecked()) { WsDownloadServiceSupport.getInstance().connect(); // Toast.makeText(DownloadActivity.this, "进入", // Toast.LENGTH_LONG).show(); } else { WsDownloadServiceSupport.getInstance().disconnect(); // Toast.makeText(DownloadActivity.this, "退出", // Toast.LENGTH_LONG).show(); } } // end of onClick }); Button btnEntryActivateMeeting = (Button) findViewById(R.id.btnEntryActivateMeeting); btnEntryActivateMeeting.setOnClickListener( new OnClickListener() { public void onClick(View v) { // TODO:fixme Intent intent = new Intent(); // intent.setClass(DownloadActivity.this, LoginActivity.class); intent.setData(Uri.parse("one")); startActivityForResult(intent, REQUEST_CODE); // 以传递参数的方式跳转到下一个Activity } }); Log.d(TAG, "onCreate end"); } // end of onCreate
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.pace, container, false); listview = (ListView) view.findViewById(R.id.pacelistview); populateListViewFromDB(); nextColor = 0; final SharedPreferences settings = getActivity().getSharedPreferences(getString(R.string.settingsFile), Context.MODE_PRIVATE); Button addBtn = (Button) view.findViewById(R.id.Add_Btn); addBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { ((MainActivity) getActivity()) .myDb. // float speed, int direction, int color, float location, int // queue insertRow(defaultSpeed, colorIDs[nextColor]); nextColor = (nextColor + 1) % 7; populateListViewFromDB(); // refresh } }); final ToggleButton startStop = (ToggleButton) view.findViewById(R.id.startStop); startStop.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor editor = settings.edit(); if (startStop.isChecked()) { // start service Log.w("test", "starting service"); editor.putInt(getString(R.string.mode), 1); editor.commit(); Intent intent = new Intent(getActivity(), ContinuousService.class); getActivity().startService(intent); } else { // stop service Log.w("test", "stopping service"); editor.putInt(getString(R.string.mode), 0); editor.commit(); } } }); return view; }
public void addListenerTglTipArtBtn() { tglTipArtBtn.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { if (tglTipArtBtn.isChecked()) { if (!tglButton.isChecked()) { txtNumeArticol.setHint("Introduceti nume sintetic"); } else txtNumeArticol.setHint("Introduceti cod sintetic"); } else { if (!tglButton.isChecked()) { txtNumeArticol.setHint("Introduceti nume articol"); } else txtNumeArticol.setHint("Introduceti cod articol"); } } }); }
/** 初始化相关View */ protected void initViews() { // 发送和回退按钮 findViewById(ResFinder.getId("umeng_comm_post_ok_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_post_back_btn")).setOnClickListener(this); mLocProgressBar = (ProgressBar) findViewById(ResFinder.getId("umeng_comm_post_loc_progressbar")); mLocIcon = (ImageView) findViewById(ResFinder.getId("umeng_comm_post_loc_icon")); mLocIcon.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { initLocationLayout(); } }); mLocationTv = (TextView) findViewById(ResFinder.getId("umeng_comm_location_text")); mLocationLayout = findViewById(ResFinder.getId("umeng_community_loc_layout")); initEditView(); // 以下四个按钮分别是选择话题、添加图片、选择位置、@好友 findViewById(ResFinder.getId("umeng_comm_take_photo_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_select_location_btn")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_at_friend_btn")).setOnClickListener(this); mPhotoButton = (ImageButton) findViewById(ResFinder.getId("umeng_comm_add_image_btn")); mPhotoButton.setOnClickListener(this); mTopicButton = (ToggleButton) findViewById(ResFinder.getId("umeng_comm_pick_topic_btn")); mTopicButton.setOnClickListener(this); mFragmentLatout = (FrameLayout) findViewById(ResFinder.getId("umeng_comm_select_layout")); mGridView = (GridView) findViewById(ResFinder.getId("umeng_comm_prev_images_gv")); initSelectedImageAdapter(); mTopicTipView = (TopicTipView) findViewById(ResFinder.getId("umeng_comm_topic_tip")); if (CommConfig.getConfig().loginedUser.gender == Gender.FEMALE) { // 根据性别做不同的提示 mTopicTipView.setText(ResFinder.getString("umeng_comm_topic_tip_female")); } if (!isForwardFeed) { startAnimationForTopicTipView(); } }
// 给每一个控件设置监听器 private void setViewOnclickListener() { ViewOnClickListener viewOnClickListener = new ViewOnClickListener(); return_bt.setOnClickListener(viewOnClickListener); music_play_bt.setOnClickListener(viewOnClickListener); music_album_iv.setOnClickListener(viewOnClickListener); btn_love.setOnClickListener(viewOnClickListener); songlist_lv.setOnItemClickListener(new MusicListItemClickListener()); // 列表监听 songlist_lv.setOnItemLongClickListener(new ListItemLongClickListener()); // 长按删除 bottombar_layout.setOnClickListener(viewOnClickListener); bottombar_layout.setOnTouchListener( new OnTouchListener() { // 捕获bottombar_layout的触摸事件,并传递给GestureDetector @Override public boolean onTouch(View v, MotionEvent event) { myGestureDetector.onTouchEvent(event); return false; } }); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences themePrefs = getSharedPreferences("THEME", 0); Boolean isDark = themePrefs.getBoolean("isDark", false); if (isDark) setTheme(R.style.DarkTheme); else setTheme(R.style.AppTheme); setTitle(System.getCurrentTarget() + " > MITM > DNS spoofing"); setContentView(R.layout.plugin_mitm_dns_spoofing); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mTextDnsList = (TextView) findViewById(R.id.textViewDNSList); mCmdSave = (Button) findViewById(R.id.cmd_save); mSniffToggleButton = (ToggleButton) findViewById(R.id.sniffToggleButton); mSniffProgress = (ProgressBar) findViewById(R.id.sniffActivity); mTextDnsList.setHorizontallyScrolling(true); mSpoofSession = new SpoofSession(false, false, null, null); readDNSlist(); mSniffToggleButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mRunning) { setStoppedState(); } else { setStartedState(); } } }); mCmdSave.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { saveDNSlist(); } }); }
public LocationHandler(MapView tileMap, int button_id) { mTileMap = tileMap; this.button_id = button_id; mLocationManager = (LocationManager) tileMap.mapActivity.getSystemService(Context.LOCATION_SERVICE); mLocationListener = new MyLocationListener(); mSnapToLocationView = (ToggleButton) tileMap.mapActivity.findViewById(button_id); mSnapToLocationView.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { if (isSnapToLocationEnabled()) { disableSnapToLocation(true); } else { enableSnapToLocation(true); } } }); }
/** 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); }
public ImportanceControlSet(int containerId) { LinearLayout layout = (LinearLayout) findViewById(containerId); int min = Task.IMPORTANCE_MOST; int max = Task.IMPORTANCE_LEAST; int importanceOffset = max; if (ProducteevUtilities.INSTANCE.isLoggedIn()) { max = 5; importanceOffset = max - 1; } for (int i = min; i <= max; i++) { final ToggleButton button = new ToggleButton(TaskEditActivity.this); button.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1)); StringBuilder label = new StringBuilder(); if (ProducteevUtilities.INSTANCE.isLoggedIn()) label.append(5 - i).append("\n\u2605"); // $NON-NLS-1$ else { for (int j = importanceOffset; j >= i; j--) label.append('!'); } button.setTextColor(colors[i]); button.setTextOff(label); button.setTextOn(label); button.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { setImportance((Integer) button.getTag()); } }); button.setTag(i); buttons.add(button); layout.addView(button); } }