コード例 #1
0
  @Override
  protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    dialogEqualizer = (EqualizerSurface) view.findViewById(R.id.FrequencyResponse);
    dialogEqualizer.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            float x = event.getX();
            float y = event.getY();

            int band = dialogEqualizer.findClosest(x);

            int wy = v.getHeight();
            float level =
                (y / wy) * (EqualizerSurface.MIN_DB - EqualizerSurface.MAX_DB)
                    - EqualizerSurface.MIN_DB;
            if (level < EqualizerSurface.MIN_DB) {
              level = EqualizerSurface.MIN_DB;
            }
            if (level > EqualizerSurface.MAX_DB) {
              level = EqualizerSurface.MAX_DB;
            }

            dialogEqualizer.setBand(band, level);
            levels[band] = level;
            refreshPreference(levels);
            return true;
          }
        });

    for (int i = 0; i < levels.length; i++) {
      dialogEqualizer.setBand(i, levels[i]);
    }
  }
コード例 #2
0
 @Override
 protected void onBindView(View view) {
   super.onBindView(view);
   listEqualizer = (EqualizerSurface) view.findViewById(R.id.FrequencyResponse);
   for (int i = 0; i < levels.length; i++) {
     listEqualizer.setBand(i, levels[i]);
   }
 }
コード例 #3
0
 @Override
 protected void onDialogClosed(boolean positiveResult) {
   if (positiveResult) {
     initialLevels = Arrays.copyOf(levels, levels.length);
     if (listEqualizer != null) {
       for (int i = 0; i < levels.length; i++) {
         listEqualizer.setBand(i, levels[i]);
       }
     }
     refreshPreference(levels);
     notifyChanged();
   } else if (showedDialogCount == 1) {
     levels = Arrays.copyOf(initialLevels, levels.length);
     refreshPreference(levels);
     notifyChanged();
   }
   showedDialogCount--;
 }