Пример #1
0
 private void setupRatingViewSection() {
   boolean showDebug = debugShow.get();
   showRatingView.setChecked(showDebug);
   showRatingView.setOnCheckedChangeListener(
       new CompoundButton.OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
           debugShow.set(isChecked);
           showRatingView.setEnabled(isChecked);
         }
       });
 }
Пример #2
0
  private void setupPicassoSection() {
    boolean picassoDebuggingValue = picassoDebugging.get();
    picasso.setIndicatorsEnabled(picassoDebuggingValue);
    picassoIndicatorView.setChecked(picassoDebuggingValue);
    picassoIndicatorView.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton button, boolean isChecked) {
            Timber.d("Setting Picasso debugging to " + isChecked);
            picasso.setIndicatorsEnabled(isChecked);
            picassoDebugging.set(isChecked);
          }
        });

    refreshPicassoStats();
  }
Пример #3
0
  private void setupUserInterfaceSection() {
    final AnimationSpeedAdapter speedAdapter = new AnimationSpeedAdapter(getContext());
    uiAnimationSpeedView.setAdapter(speedAdapter);
    final int animationSpeedValue = animationSpeed.get();
    uiAnimationSpeedView.setSelection(
        AnimationSpeedAdapter.getPositionForValue(animationSpeedValue));
    uiAnimationSpeedView.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
            int selected = speedAdapter.getItem(position);
            if (selected != animationSpeed.get()) {
              Timber.d("Setting animation speed to %sx", selected);
              animationSpeed.set(selected);
              applyAnimationSpeed(selected);
            } else {
              Timber.d("Ignoring re-selection of animation speed %sx", selected);
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });
    // Ensure the animation speed value is always applied across app restarts.
    post(
        new Runnable() {
          @Override
          public void run() {
            applyAnimationSpeed(animationSpeedValue);
          }
        });

    boolean gridEnabled = pixelGridEnabled.get();
    uiPixelGridView.setChecked(gridEnabled);
    uiPixelRatioView.setEnabled(gridEnabled);
    uiPixelGridView.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Timber.d("Setting pixel grid overlay enabled to " + isChecked);
            pixelGridEnabled.set(isChecked);
            uiPixelRatioView.setEnabled(isChecked);
          }
        });

    uiPixelRatioView.setChecked(pixelRatioEnabled.get());
    uiPixelRatioView.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Timber.d("Setting pixel scale overlay enabled to " + isChecked);
            pixelRatioEnabled.set(isChecked);
          }
        });

    uiScalpelView.setChecked(scalpelEnabled.get());
    uiScalpelWireframeView.setEnabled(scalpelEnabled.get());
    uiScalpelView.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Timber.d("Setting scalpel interaction enabled to " + isChecked);
            scalpelEnabled.set(isChecked);
            uiScalpelWireframeView.setEnabled(isChecked);
          }
        });

    uiScalpelWireframeView.setChecked(scalpelWireframeEnabled.get());
    uiScalpelWireframeView.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Timber.d("Setting scalpel wireframe enabled to " + isChecked);
            scalpelWireframeEnabled.set(isChecked);
          }
        });
  }