use of org.havenapp.main.PreferenceManager in project haven by guardianproject.
the class MicrophoneConfigureActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_microphone_configure);
mPrefManager = new PreferenceManager(this.getApplicationContext());
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mTextLevel = findViewById(R.id.text_display_level);
mNumberTrigger = findViewById(R.id.number_trigger_level);
mWaveform = findViewById(R.id.simplewaveform);
mWaveform.setMaxVal(100);
mNumberTrigger.setMinValue(0);
mNumberTrigger.setMaxValue(MAX_SLIDER_VALUE);
if (!mPrefManager.getMicrophoneSensitivity().equals(PreferenceManager.MEDIUM))
mNumberTrigger.setValue(Integer.parseInt(mPrefManager.getMicrophoneSensitivity()));
else
mNumberTrigger.setValue(60);
mNumberTrigger.setListener((oldValue, newValue) -> {
mWaveform.setThreshold(newValue);
mPrefManager.setMicrophoneSensitivity(newValue + "");
});
initWave();
startMic();
}
use of org.havenapp.main.PreferenceManager in project haven by guardianproject.
the class PPAppIntro method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setFadeAnimation();
setWizardMode(true);
setBackButtonVisibilityWithDone(true);
// Instead of fragments, you can also use our default slide
// Just set a title, description, background and image. AppIntro will do the rest.
addSlide(AppIntroFragment.newInstance(getString(R.string.intro1_title), getString(R.string.intro1_desc), R.drawable.web_hi_res_512, getResources().getColor(R.color.colorPrimaryDark)));
/**
* SliderPage sliderPage = new SliderPage();
* sliderPage.setTitle(getString(R.string.intro2_title));
* // sliderPage.setDescription("This is a demo of the AppIntro library.");
* sliderPage.setBgColor(getResources().getColor(R.color.colorPrimaryDark));
* addSlide(AppIntroFragment.newInstance(sliderPage));*
*/
CustomSlideBigText cs1 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs1.setTitle(getString(R.string.intro2_title));
addSlide(cs1);
CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs2.setTitle(getString(R.string.intro3_desc));
cs2.showButton(getString(R.string.action_configure), new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(PPAppIntro.this, AccelConfigureActivity.class));
startActivity(new Intent(PPAppIntro.this, MicrophoneConfigureActivity.class));
startActivity(new Intent(PPAppIntro.this, CameraConfigureActivity.class));
}
});
addSlide(cs2);
CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs3.setTitle(getString(R.string.intro4_desc));
addSlide(cs3);
final CustomSlideNotify cs4 = CustomSlideNotify.newInstance(R.layout.custom_slide_notify);
cs4.setSaveListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PreferenceManager pm = new PreferenceManager(PPAppIntro.this);
pm.activateSms(true);
pm.setSmsNumber(cs4.getPhoneNumber());
Toast.makeText(PPAppIntro.this, R.string.phone_saved, Toast.LENGTH_SHORT).show();
getPager().setCurrentItem(getPager().getCurrentItem() + 1);
}
});
addSlide(cs4);
addSlide(AppIntroFragment.newInstance(getString(R.string.intro5_title), getString(R.string.intro5_desc), R.drawable.web_hi_res_512, getResources().getColor(R.color.colorPrimaryDark)));
setDoneText(getString(R.string.onboarding_action_end));
// Hide Skip/Done button.
showSkipButton(false);
// setProgressButtonEnabled(false);
}
Aggregations