Search in sources :

Example 6 with PreferenceManager

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();
}
Also used : PreferenceManager(org.havenapp.main.PreferenceManager) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with PreferenceManager

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);
}
Also used : Intent(android.content.Intent) View(android.view.View) PreferenceManager(org.havenapp.main.PreferenceManager)

Aggregations

PreferenceManager (org.havenapp.main.PreferenceManager)7 Toolbar (android.support.v7.widget.Toolbar)3 View (android.view.View)3 NotificationChannel (android.app.NotificationChannel)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 PowerManager (android.os.PowerManager)1 Nullable (android.support.annotation.Nullable)1 Button (android.widget.Button)1 FrameLayout (android.widget.FrameLayout)1 OnValueChangeListener (me.angrybyte.numberpicker.listener.OnValueChangeListener)1 MotionAsyncTask (org.havenapp.main.sensors.media.MotionAsyncTask)1 Preview (org.havenapp.main.sensors.motion.Preview)1