use of android.widget.ToggleButton in project android_frameworks_base by ParanoidAndroid.
the class EnvReverbTest method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.d(TAG, "onCreate");
SeekBar seekBar;
TextView textView;
ToggleButton button;
setContentView(R.layout.envreverbtest);
ImageView playPause = (ImageView) findViewById(R.id.playPause1);
ImageView stop = (ImageView) findViewById(R.id.stop1);
textView = (TextView) findViewById(R.id.sessionText);
if (sPlayerController == null) {
sPlayerController = new SimplePlayer(this, R.id.playPause1, playPause, R.id.stop1, stop, textView, R.raw.mp3_sample, AudioManager.STREAM_MUSIC, 0);
} else {
sPlayerController.set(this, R.id.playPause1, playPause, R.id.stop1, stop, textView, AudioManager.STREAM_MUSIC, 0);
}
// send level
mSendLevelSeekBar = (SeekBar) findViewById(R.id.sendLevelSeekBar);
mSendLevelDisplay = (TextView) findViewById(R.id.sendLevelValue);
mSendLevelSeekBar.setMax(100);
mSendLevelSeekBar.setOnSeekBarChangeListener(this);
mSendLevelSeekBar.setProgress(expToLin(sSendLevel, 100));
sPlayerController.setAuxEffectSendLevel(sSendLevel);
mOnOffButton = (ToggleButton) findViewById(R.id.rvbOnOff);
mReleaseButton = (ToggleButton) findViewById(R.id.rvbReleaseButton);
mAttachButton = (ToggleButton) findViewById(R.id.attachButton);
getEffect(0);
if (mReverb != null) {
mOnOffButton.setOnCheckedChangeListener(this);
mReleaseButton.setOnCheckedChangeListener(this);
mAttachButton.setOnCheckedChangeListener(this);
// button = (ToggleButton)findViewById(R.id.rvbBypass);
// button.setChecked(false);
// button.setOnCheckedChangeListener(this);
// Room level
seekBar = (SeekBar) findViewById(R.id.rvbParam1SeekBar);
textView = (TextView) findViewById(R.id.rvbParam1Value);
mParameters[0] = new RoomLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[0]);
// Room HF level
seekBar = (SeekBar) findViewById(R.id.rvbParam2SeekBar);
textView = (TextView) findViewById(R.id.rvbParam2Value);
mParameters[1] = new RoomHFLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[1]);
// Decay time
seekBar = (SeekBar) findViewById(R.id.rvbParam3SeekBar);
textView = (TextView) findViewById(R.id.rvbParam3Value);
mParameters[2] = new DecayTimeParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[2]);
// Decay HF ratio
seekBar = (SeekBar) findViewById(R.id.rvbParam4SeekBar);
textView = (TextView) findViewById(R.id.rvbParam4Value);
mParameters[3] = new DecayHFRatioParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[3]);
// Reflections level
seekBar = (SeekBar) findViewById(R.id.rvbParam5SeekBar);
textView = (TextView) findViewById(R.id.rvbParam5Value);
mParameters[4] = new ReflectionsLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[4]);
// Reflections delay
seekBar = (SeekBar) findViewById(R.id.rvbParam6SeekBar);
textView = (TextView) findViewById(R.id.rvbParam6Value);
mParameters[5] = new ReflectionsDelayParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[5]);
// Reverb level
seekBar = (SeekBar) findViewById(R.id.rvbParam7SeekBar);
textView = (TextView) findViewById(R.id.rvbParam7Value);
mParameters[6] = new ReverbLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[6]);
// Reverb delay
seekBar = (SeekBar) findViewById(R.id.rvbParam8SeekBar);
textView = (TextView) findViewById(R.id.rvbParam8Value);
mParameters[7] = new ReverbDelayParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[7]);
// Diffusion
seekBar = (SeekBar) findViewById(R.id.rvbParam9SeekBar);
textView = (TextView) findViewById(R.id.rvbParam9Value);
mParameters[8] = new DiffusionParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[8]);
// Density
seekBar = (SeekBar) findViewById(R.id.rvbParam10SeekBar);
textView = (TextView) findViewById(R.id.rvbParam10Value);
mParameters[9] = new DensityParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[9]);
}
}
use of android.widget.ToggleButton in project platform_frameworks_base by android.
the class EnvReverbTest method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.d(TAG, "onCreate");
SeekBar seekBar;
TextView textView;
ToggleButton button;
setContentView(R.layout.envreverbtest);
ImageView playPause = (ImageView) findViewById(R.id.playPause1);
ImageView stop = (ImageView) findViewById(R.id.stop1);
textView = (TextView) findViewById(R.id.sessionText);
if (sPlayerController == null) {
sPlayerController = new SimplePlayer(this, R.id.playPause1, playPause, R.id.stop1, stop, textView, R.raw.mp3_sample, AudioManager.STREAM_MUSIC, 0);
} else {
sPlayerController.set(this, R.id.playPause1, playPause, R.id.stop1, stop, textView, AudioManager.STREAM_MUSIC, 0);
}
// send level
mSendLevelSeekBar = (SeekBar) findViewById(R.id.sendLevelSeekBar);
mSendLevelDisplay = (TextView) findViewById(R.id.sendLevelValue);
mSendLevelSeekBar.setMax(100);
mSendLevelSeekBar.setOnSeekBarChangeListener(this);
mSendLevelSeekBar.setProgress(expToLin(sSendLevel, 100));
sPlayerController.setAuxEffectSendLevel(sSendLevel);
mOnOffButton = (ToggleButton) findViewById(R.id.rvbOnOff);
mReleaseButton = (ToggleButton) findViewById(R.id.rvbReleaseButton);
mAttachButton = (ToggleButton) findViewById(R.id.attachButton);
getEffect(0);
if (mReverb != null) {
mOnOffButton.setOnCheckedChangeListener(this);
mReleaseButton.setOnCheckedChangeListener(this);
mAttachButton.setOnCheckedChangeListener(this);
// button = (ToggleButton)findViewById(R.id.rvbBypass);
// button.setChecked(false);
// button.setOnCheckedChangeListener(this);
// Room level
seekBar = (SeekBar) findViewById(R.id.rvbParam1SeekBar);
textView = (TextView) findViewById(R.id.rvbParam1Value);
mParameters[0] = new RoomLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[0]);
// Room HF level
seekBar = (SeekBar) findViewById(R.id.rvbParam2SeekBar);
textView = (TextView) findViewById(R.id.rvbParam2Value);
mParameters[1] = new RoomHFLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[1]);
// Decay time
seekBar = (SeekBar) findViewById(R.id.rvbParam3SeekBar);
textView = (TextView) findViewById(R.id.rvbParam3Value);
mParameters[2] = new DecayTimeParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[2]);
// Decay HF ratio
seekBar = (SeekBar) findViewById(R.id.rvbParam4SeekBar);
textView = (TextView) findViewById(R.id.rvbParam4Value);
mParameters[3] = new DecayHFRatioParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[3]);
// Reflections level
seekBar = (SeekBar) findViewById(R.id.rvbParam5SeekBar);
textView = (TextView) findViewById(R.id.rvbParam5Value);
mParameters[4] = new ReflectionsLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[4]);
// Reflections delay
seekBar = (SeekBar) findViewById(R.id.rvbParam6SeekBar);
textView = (TextView) findViewById(R.id.rvbParam6Value);
mParameters[5] = new ReflectionsDelayParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[5]);
// Reverb level
seekBar = (SeekBar) findViewById(R.id.rvbParam7SeekBar);
textView = (TextView) findViewById(R.id.rvbParam7Value);
mParameters[6] = new ReverbLevelParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[6]);
// Reverb delay
seekBar = (SeekBar) findViewById(R.id.rvbParam8SeekBar);
textView = (TextView) findViewById(R.id.rvbParam8Value);
mParameters[7] = new ReverbDelayParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[7]);
// Diffusion
seekBar = (SeekBar) findViewById(R.id.rvbParam9SeekBar);
textView = (TextView) findViewById(R.id.rvbParam9Value);
mParameters[8] = new DiffusionParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[8]);
// Density
seekBar = (SeekBar) findViewById(R.id.rvbParam10SeekBar);
textView = (TextView) findViewById(R.id.rvbParam10Value);
mParameters[9] = new DensityParam(mReverb, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[9]);
}
}
use of android.widget.ToggleButton in project Rajawali by Rajawali.
the class VuforiaExampleFragment method initialize.
@Override
public void initialize() {
// Add button for Cloud Reco:
mStartScanButton = new Button(getContext());
mStartScanButton.setText("Start Scanning CloudReco");
mStartScanButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mVuforiaManager.enterScanningModeNative();
mStartScanButton.setVisibility(View.GONE);
}
});
ToggleButton extendedTrackingButton = new ToggleButton(getContext());
extendedTrackingButton.setTextOn("Extended Tracking On");
extendedTrackingButton.setTextOff("Extended Tracking Off");
extendedTrackingButton.setChecked(false);
extendedTrackingButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (((ToggleButton) v).isChecked()) {
if (!mVuforiaManager.startExtendedTracking()) {
RajLog.e("Could not start extended tracking");
}
} else {
if (!mVuforiaManager.stopExtendedTracking()) {
RajLog.e("Could not stop extended tracking");
}
}
}
});
LinearLayout ll = new LinearLayout(getContext());
ll.addView(mStartScanButton);
ll.addView(extendedTrackingButton);
((ViewGroup) getView()).addView(ll, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
use of android.widget.ToggleButton in project Fairphone by Kwamecorp.
the class KWFontsManager method setFontInTag.
public static void setFontInTag(ViewGroup root, String tag, Typeface font) {
ArrayList<View> regularViews = getViewsByTag(root, tag);
for (View view : regularViews) {
if (view.getClass() == TextView.class) {
TextView text = (TextView) view;
text.setTypeface(font);
} else if (view.getClass() == Button.class) {
Button text = (Button) view;
text.setTypeface(font);
} else if (view.getClass() == ToggleButton.class) {
ToggleButton text = (ToggleButton) view;
text.setTypeface(font);
} else if (view.getClass() == EditText.class) {
EditText text = (EditText) view;
text.setTypeface(font);
}
}
}
use of android.widget.ToggleButton in project android_frameworks_base by DirtyUnicorns.
the class ElementLayoutActivity method createToggleButton.
private void createToggleButton() {
ToggleButton button = new ToggleButton(this);
button.setChecked(mRandom.nextBoolean());
mLayout.addView(button);
}
Aggregations