List of usage examples for android.widget ToggleButton isChecked
@ViewDebug.ExportedProperty @Override public boolean isChecked()
From source file:com.a3did.partner.recosample.MainActivity.java
public void onRangingToggleButtonClicked(View v) { ToggleButton toggle = (ToggleButton) v; if (toggle.isChecked()) { Log.i("MainActivity", "onRangingToggleButtonClicked off to on"); Intent intent = new Intent(this, RecoBackgroundRangingService.class); startService(intent);/*from w w w.j av a 2 s . co m*/ } else { Log.i("MainActivity", "onRangingToggleButtonClicked on to off"); stopService(new Intent(this, RecoBackgroundRangingService.class)); } }
From source file:org.rockettrack.MapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.map_view, null, false); ToggleButton chkFollowMe = (ToggleButton) v.findViewById(R.id.chkFollowMe); followMe = chkFollowMe.isChecked(); chkFollowMe.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override// ww w . ja va 2 s .c om public void onCheckedChanged(CompoundButton arg0, boolean arg1) { followMe = arg1; } }); return v; }
From source file:polytech.carcassonnetour.MapsActivity.java
public void toggleOnClickListener(View view) { ToggleButton toggleButton = (ToggleButton) view; if (toggleButton.isChecked()) { // Radar mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.getUiSettings().setAllGesturesEnabled(false); overlay.setVisibility(View.VISIBLE); autoCenter = true;/* w w w . j av a 2 s .c o m*/ Toast.makeText(this, R.string.waitALittle, WAIT).show(); } else { // Carte mMap.getUiSettings().setMyLocationButtonEnabled(true); mMap.getUiSettings().setAllGesturesEnabled(true); overlay.setVisibility(View.INVISIBLE); autoCenter = false; } }
From source file:pl.zajecia.cw3.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings_layout); mIntervalEditText = (EditText) findViewById(R.id.intervalEditText); mIntervalSpinner = (Spinner) findViewById(R.id.intervalSpinner); /** //from www .j av a2s . c o m * On focus change listener to hide keyboard when focus left editText */ ((LinearLayout) findViewById(R.id.mainLinearLayout)).setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean arg) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }); mRandomOrderCheckBox = (CheckBox) findViewById(R.id.randomOrderCheckBox); mChangeDuringSleepCheckBox = (CheckBox) findViewById(R.id.changeDuringSleepCheckBox); mChangeOnScreenOnCheckBox = (CheckBox) findViewById(R.id.changeOnScreenOnCheckBox); mDisableOnBatteryLowCheckBox = (CheckBox) findViewById(R.id.dontChangeOnBatteryLowCheckBox); mEditPhotosButton = (Button) findViewById(R.id.viewGalleryButton); mSaveSettingsButton = (Button) findViewById(R.id.saveSettingsButton); mActivatedButton = (ToggleButton) findViewById(R.id.activateButton); //Listeners: mSaveSettingsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { saveSettings(); Toast.makeText(getApplicationContext(), R.string.settings_saved, Toast.LENGTH_SHORT).show(); } }); mActivatedButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ToggleButton button = (ToggleButton) v; if (button.isChecked()) { button.setChecked(runService()); } else { cancelService(); } } }); mEditPhotosButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplication(), PhotosActivity.class); startActivity(intent); } }); }
From source file:org.bdigi.andy.MainActivity.java
public void onAgcClicked(View v) { ToggleButton btn = (ToggleButton) v; _app.setAgc(btn.isChecked()); }
From source file:org.bdigi.andy.MainActivity.java
public void onAfcClicked(View v) { ToggleButton btn = (ToggleButton) v; _app.setAfc(btn.isChecked()); }
From source file:org.bdigi.andy.MainActivity.java
public void onRxTxClicked(View v) { ToggleButton btn = (ToggleButton) v; _app.setRxtx(btn.isChecked()); }
From source file:com.urbantamil.projmadurai.TamilInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ArrayAdapter<String> adapter_tamil_strings; // Inflate the layout for this fragment final View tamilinfo = inflater.inflate(R.layout.fragment_tamil_info, container, false); final ListView lv_tamilinfo = (ListView) tamilinfo.findViewById(R.id.listview_tamil_info_sort); adapter_tamil_strings = new ArrayAdapter<String>(tamilinfo.getContext(), android.R.layout.simple_list_item_1, mAUTHOR); lv_tamilinfo.setAdapter(adapter_tamil_strings); // use toggle button to flip the genre/author info // then sort the data final Button btn_tamilinfo = (Button) tamilinfo.findViewById(R.id.button_tamil_info_sort); final ToggleButton toggle_btn = (ToggleButton) tamilinfo.findViewById(R.id.toggle_tamil_info_category); toggle_btn.setOnClickListener(new View.OnClickListener() { @Override/*ww w . j a va2s. c om*/ public void onClick(View v) { List<String> ref_array = toggle_btn.isChecked() ? mGENRE : mAUTHOR; lv_tamilinfo.setAdapter(new ArrayAdapter<String>(tamilinfo.getContext(), android.R.layout.simple_list_item_1, ref_array)); lv_tamilinfo.invalidate(); lv_tamilinfo.setTag(ref_array); } }); /// sorting activity btn_tamilinfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { List<String> ref_array = toggle_btn.isChecked() ? mGENRE : mAUTHOR; ArrayAdapter<String> adapter_str = new ArrayAdapter<String>(lv_tamilinfo.getContext(), android.R.layout.simple_list_item_1, ref_array); adapter_str.sort(utf8.comparator); lv_tamilinfo.setAdapter(adapter_str); lv_tamilinfo.invalidate(); } }); return tamilinfo; }
From source file:com.google.android.gms.samples.vision.face.sleepAlert.DAssistActivity.java
@Override public boolean onNavigationItemSelected(MenuItem item) { System.out.println("Srini in onNavigationItemSelected part"); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_slideshow) { // Handle the camera action } else if (id == R.id.nav_manage) { } else if (id == R.id.nav_manage_toggle) { System.out.println("Srini in toggle part"); ToggleButton tb = (ToggleButton) item; boolean checked = tb.isChecked(); if (checked) { layout.setBackgroundColor(Color.BLUE); } else {/*from www .jav a2s . c o m*/ layout.setBackgroundColor(Color.GREEN); } } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }