Example usage for android.widget ToggleButton isChecked

List of usage examples for android.widget ToggleButton isChecked

Introduction

In this page you can find the example usage for android.widget ToggleButton isChecked.

Prototype

@ViewDebug.ExportedProperty
    @Override
    public boolean isChecked() 

Source Link

Usage

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

/**
 * Automatically linked with android:onClick to the toggleSslStrict button.
 * @param view/*from  w  ww  .  j  a va2s.  co  m*/
 */
public void toggleSslStrict(View view) {
    ToggleButton s = (ToggleButton) view;
    currentConnection.setSslStrict(s.isChecked());
}

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

/**
 * Automatically linked with android:onClick to the toggleUsingCustomOvirtCa button.
 * @param view/*from  www. j  ava 2  s  . com*/
 */
public void toggleUsingCustomOvirtCa(View view) {
    ToggleButton s = (ToggleButton) view;
    boolean usingCustomOvirtCa = s.isChecked();
    currentConnection.setUsingCustomOvirtCa(usingCustomOvirtCa);
    buttonManageOvirtCa.setEnabled(usingCustomOvirtCa);
}

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

/**
 * Automatically linked with android:onClick to the toggleAutoRotation button.
 * @param view/* w  w  w .  j a v  a 2s  .  c om*/
 */
public void toggleAutoRotation(View view) {
    ToggleButton s = (ToggleButton) view;
    currentConnection.setRotationEnabled(s.isChecked());
}

From source file:com.timothy.android.api.fragment.RightFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    activity = (SlidingActivity) getActivity();
    mContext = activity.getApplicationContext();
    sp = activity.getSharedPreferences("AndroidAPISP", 0);

    View view = inflater.inflate(R.layout.right, null);

    boolean syncFlag = SPUtil.getBooleanFromSP(SPUtil.SP_KEY_SYNC_FLAG, sp);
    //syncFlag//from   w  ww.  j a  v a 2s . com
    ToggleButton syncFlagBtn = (ToggleButton) view.findViewById(R.id.syncFlagBtn);
    syncFlagBtn.setChecked(syncFlag);
    syncFlagBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ToggleButton tb = (ToggleButton) v;
            SPUtil.save2SP(SPUtil.SP_KEY_SYNC_FLAG, tb.isChecked(), sp);
        }
    });

    //lstReadTV
    TextView lstReadTV = (TextView) view.findViewById(R.id.lstReadTV);
    lstReadTV.setMovementMethod(ScrollingMovementMethod.getInstance());

    int branchIndex = SPUtil.getIntegerFromSP(SPUtil.CURRENT_BRANCH_INDEX, sp);
    String[] contentsArray = activity.filterBranch(branchIndex);

    String contents = ContentUtil.getContentsById(contentsArray,
            SPUtil.getIntegerFromSP(SPUtil.CURRENT_INDEX, sp));
    if (contents != null) {
        String[] contentArray = contents.split(",");
        if (contentArray != null && contentArray.length >= 4) {
            String contentName = contentArray[3];
            lstReadTV.setText(contentName);
        }
    }

    Button gotoBtn = (Button) view.findViewById(R.id.gotoBtn);
    gotoBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshActivity();
        }
    });

    return view;
}

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

/**
 * Automatically linked with android:onClick to the toggleAudio button.
 * @param view//w w w. ja  v  a2s.  c  o  m
 */
public void toggleAudioPlaybackSetting(View view) {
    ToggleButton s = (ToggleButton) view;
    currentConnection.setAudioPlaybackEnabled(s.isChecked());
}

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

/**
 * Automatically linked with android:onClick to the toggleRotation button.
 * @param view//from  w w  w  . jav  a  2 s.com
 */
public void toggleAutoRequestDisplayResolution(View view) {
    ToggleButton s = (ToggleButton) view;
    currentConnection.setRequestingNewDisplayResolution(s.isChecked());
}

From source file:com.example.michael.paradis2_habittracker.CreateNewHabit.java

public void confirmButtonPressed(View v) {
    EditText DateText = (EditText) findViewById(R.id.NewHabitDate);
    //Calendar habitDate = Calendar.getInstance(DateText.getText().toString());
    //habitdate.setTime(DateText.getText().toString());

    String[] date_Array = DateText.getText().toString().split("-");
    int year = Integer.valueOf(date_Array[0]);
    int month = Integer.valueOf(date_Array[1]) - 1;
    int day = Integer.valueOf(date_Array[2]);
    Calendar c = Calendar.getInstance();
    c.set(year, month, day);/*from   w  w w  .j av  a  2  s.  c o m*/
    Date habitdate = c.getTime();

    String habitname = ((EditText) findViewById(R.id.NewHabitName)).getText().toString();
    Habit newhabit = new Habit(habitname, habitdate);
    HabitListController hlc = new HabitListController();
    CurrentDayHabitListController cdhlc = new CurrentDayHabitListController();
    int dayIndex = 0;
    for (int dayOfWeek : WeekDayButtonsid) {

        ToggleButton weekDayToggleButton = (ToggleButton) findViewById(dayOfWeek);
        newhabit.setDayOfWeek(dayIndex, weekDayToggleButton.isChecked());
        ++dayIndex;
    }
    int day1 = new DayOfWeek().getDayOfWeek();
    if (newhabit.getDayOfWeek(day1)) {
        cdhlc.addHabit(newhabit);

    }
    hlc.addHabit(newhabit);
    saveHabits();
    this.finish();
}

From source file:com.example.seonoh2.smarttoliet01.beacon.BeaconMainActivity.java

public void onMonitoringToggleButtonClicked(View v) {
    ToggleButton toggle = (ToggleButton) v;
    if (toggle.isChecked()) {
        Log.i("BeaconMainActivity", "onMonitoringToggleButtonClicked off to on");
        Intent intent = new Intent(this, RecoBackgroundMonitoringService.class);
        startService(intent);//from   w  w  w .  ja  v  a  2 s.  co m
    } else {
        Log.i("BeaconMainActivity", "onMonitoringToggleButtonClicked on to off");
        stopService(new Intent(this, RecoBackgroundMonitoringService.class));
    }
}

From source file:com.example.seonoh2.smarttoliet01.beacon.BeaconMainActivity.java

public void onRangingToggleButtonClicked(View v) {
    ToggleButton toggle = (ToggleButton) v;
    if (toggle.isChecked()) {
        Log.i("BeaconMainActivity", "onRangingToggleButtonClicked off to on");
        Intent intent = new Intent(this, RecoBackgroundRangingService.class);
        startService(intent);/*from ww w . j ava 2s  . c o m*/
    } else {
        Log.i("BeaconMainActivity", "onRangingToggleButtonClicked on to off");
        stopService(new Intent(this, RecoBackgroundRangingService.class));
    }
}

From source file:com.a3did.partner.recosample.MainActivity.java

public void onMonitoringToggleButtonClicked(View v) {
    ToggleButton toggle = (ToggleButton) v;
    if (toggle.isChecked()) {
        Log.i("MainActivity", "onMonitoringToggleButtonClicked off to on");
        Intent intent = new Intent(this, RecoBackgroundMonitoringService.class);
        startService(intent);//  w  ww.  j a  v a  2s.co m
    } else {
        Log.i("MainActivity", "onMonitoringToggleButtonClicked on to off");
        stopService(new Intent(this, RecoBackgroundMonitoringService.class));
    }
}