Java Code Examples for android.widget.SeekBar#setEnabled()

The following examples show how to use android.widget.SeekBar#setEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReadActivity.java    From FriendBook with GNU General Public License v3.0 6 votes vote down vote up
private void findView() {
    readDrawer = (DrawerLayout) findViewById(R.id.read_drawer);
    readSide = (LinearLayout) findViewById(R.id.read_side);
    readRvSection = (RecyclerView) findViewById(R.id.read_rv_section);
    readView = (PageView) findViewById(R.id.pv_read);
    appBar = (AppBarLayout) findViewById(R.id.appbar);
    readBottom = findViewById(R.id.read_bottom);
    readTvPreChapter = (TextView) findViewById(R.id.read_tv_pre_chapter);
    readSbChapterProgress = (SeekBar) findViewById(R.id.read_sb_chapter_progress);
    readTvNextChapter = (TextView) findViewById(R.id.read_tv_next_chapter);
    readTvCategory = (TextView) findViewById(R.id.read_tv_category);
    readTvNightMode = (TextView) findViewById(R.id.read_tv_night_mode);
    readTvSetting = (TextView) findViewById(R.id.read_tv_setting);
    tvSectionName=findViewById(R.id.tv_section_name);
    readSectionProgress=findViewById(R.id.ll_section_progress);
    readTvSectionProgress=findViewById(R.id.tv_section_progress);
    readSbChapterProgress.setEnabled(false);
}
 
Example 2
Source File: SeekBarPreference.java    From ploggy with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindView(View view) {
    super.onBindView(view);
    if (view != null) {
        mSeekBar = (SeekBar)view.findViewById(R.id.seekBarPrefSeekBar);
        mSeekBar.setMax(mMaxValue - mMinValue);
        mSeekBar.setOnSeekBarChangeListener(this);
        mSeekBar.setEnabled(view.isEnabled());
    }
    updateView(view);
}
 
Example 3
Source File: RealtimeCameraPreviewActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.activity_realtime_camera_preview);

    mSurfaceView = (GLSurfaceView) findViewById(R.id.gl_surface_view);
    mGPUImage = new GPUImage(this);
    mGPUImage.setGLSurfaceView(mSurfaceView);

    mSeekBar = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBar.setMax(100);
    mSeekBar.setEnabled(false);
    mSeekBar.setOnSeekBarChangeListener(this);

    // セピア
    mSepia = new GPUImageSepiaFilter();
    // 白黒
    mGray = new GPUImageGrayscaleFilter();
    // シャープ
    // -4.0 to 4.0
    mSharp = new GPUImageSharpenFilter();
    // エッジ
    // 0.0 to 5.0
    mEdge = new GPUImageSobelEdgeDetection();

    findViewById(R.id.sepia).setOnClickListener(this);
    findViewById(R.id.gray).setOnClickListener(this);
    findViewById(R.id.sharp).setOnClickListener(this);
    findViewById(R.id.edge).setOnClickListener(this);
}
 
Example 4
Source File: ImageProccessingActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_proccessing);

    mImageView = (GPUImageView) findViewById(R.id.gpuimage);
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
            R.drawable.image);
    mImageView.setImage(bitmap);

    mSeekBar = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBar.setMax(100);
    mSeekBar.setEnabled(false);
    mSeekBar.setOnSeekBarChangeListener(this);

    // セピア
    mSepia = new GPUImageSepiaFilter();
    // 白黒
    mGray = new GPUImageGrayscaleFilter();
    // シャープ
    // -4.0 to 4.0
    mSharp = new GPUImageSharpenFilter();
    // エッジ
    // 0.0 to 5.0
    mEdge = new GPUImageSobelEdgeDetection();

    findViewById(R.id.sepia).setOnClickListener(this);
    findViewById(R.id.gray).setOnClickListener(this);
    findViewById(R.id.sharp).setOnClickListener(this);
    findViewById(R.id.edge).setOnClickListener(this);

}
 
Example 5
Source File: SeekBarPreference.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mMax);
    seekBar.setProgress(mProgress);
    seekBar.setEnabled(isEnabled());
}
 
Example 6
Source File: GalleryActivity.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
@SuppressLint("InflateParams")
public GalleryMenuHelper(Context context) {
    mView = LayoutInflater.from(context).inflate(R.layout.dialog_gallery_menu, null);
    mScreenRotation = (Spinner) mView.findViewById(R.id.screen_rotation);
    mReadingDirection = (Spinner) mView.findViewById(R.id.reading_direction);
    mScaleMode = (Spinner) mView.findViewById(R.id.page_scaling);
    mStartPosition = (Spinner) mView.findViewById(R.id.start_position);
    mKeepScreenOn = (SwitchCompat) mView.findViewById(R.id.keep_screen_on);
    mShowClock = (SwitchCompat) mView.findViewById(R.id.show_clock);
    mShowProgress = (SwitchCompat) mView.findViewById(R.id.show_progress);
    mShowBattery = (SwitchCompat) mView.findViewById(R.id.show_battery);
    mShowPageInterval = (SwitchCompat) mView.findViewById(R.id.show_page_interval);
    mVolumePage = (SwitchCompat) mView.findViewById(R.id.volume_page);
    mReadingFullscreen = (SwitchCompat) mView.findViewById(R.id.reading_fullscreen);
    mCustomScreenLightness = (SwitchCompat) mView.findViewById(R.id.custom_screen_lightness);
    mScreenLightness = (SeekBar) mView.findViewById(R.id.screen_lightness);

    mScreenRotation.setSelection(Settings.getScreenRotation());
    mReadingDirection.setSelection(Settings.getReadingDirection());
    mScaleMode.setSelection(Settings.getPageScaling());
    mStartPosition.setSelection(Settings.getStartPosition());
    mKeepScreenOn.setChecked(Settings.getKeepScreenOn());
    mShowClock.setChecked(Settings.getShowClock());
    mShowProgress.setChecked(Settings.getShowProgress());
    mShowBattery.setChecked(Settings.getShowBattery());
    mShowPageInterval.setChecked(Settings.getShowPageInterval());
    mVolumePage.setChecked(Settings.getVolumePage());
    mReadingFullscreen.setChecked(Settings.getReadingFullscreen());
    mCustomScreenLightness.setChecked(Settings.getCustomScreenLightness());
    mScreenLightness.setProgress(Settings.getScreenLightness());
    mScreenLightness.setEnabled(Settings.getCustomScreenLightness());

    mCustomScreenLightness.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mScreenLightness.setEnabled(isChecked);
        }
    });
}
 
Example 7
Source File: MySeekBarPreference.java    From Float-Bar with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
	super.onBindView(view);

	SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
	seekBar.setMax(mMax);
	seekBar.setProgress(mProgress);
	seekBar.setEnabled(isEnabled());
	seekBar.setOnSeekBarChangeListener(this);
	value = (TextView) view.findViewById(R.id.value);
	value.setText(String.valueOf(mProgress));
}
 
Example 8
Source File: SeekBarPreference.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(prefValueToSeekBarProgress(mMax));
    seekBar.setProgress(prefValueToSeekBarProgress(mValue));
    seekBar.setEnabled(isEnabled());
    mSummaryView = (TextView) view.findViewById(R.id.seekbar_amount);
    mSummaryView.setText(mSummary);
}
 
Example 9
Source File: SeekBarPreference.java    From MaterialPreference with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
    super.onBindViewHolder(view);
    view.itemView.setOnKeyListener(mSeekBarKeyListener);
    mSeekBar = (SeekBar) view.findViewById(R.id.seekbar);
    mSeekBarValueTextView = (TextView) view.findViewById(R.id.seekbar_value);
    if (mShowSeekBarValue) {
        mSeekBarValueTextView.setVisibility(View.VISIBLE);
    } else {
        mSeekBarValueTextView.setVisibility(View.GONE);
        mSeekBarValueTextView = null;
    }

    if (mSeekBar == null) {
        Log.e(TAG, "SeekBar view is null in onBindViewHolder.");
        return;
    }
    mSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
    mSeekBar.setMax(mMax - mMin);
    // If the increment is not zero, use that. Otherwise, use the default mKeyProgressIncrement
    // in AbsSeekBar when it's zero. This default increment value is set by AbsSeekBar
    // after calling setMax. That's why it's important to call setKeyProgressIncrement after
    // calling setMax() since setMax() can change the increment value.
    if (mSeekBarIncrement != 0) {
        mSeekBar.setKeyProgressIncrement(mSeekBarIncrement);
    } else {
        mSeekBarIncrement = mSeekBar.getKeyProgressIncrement();
    }

    mSeekBar.setProgress(mSeekBarValue - mMin);
    if (mSeekBarValueTextView != null) {
        mSeekBarValueTextView.setText(String.valueOf(mSeekBarValue));
    }
    mSeekBar.setEnabled(isEnabled());
}
 
Example 10
Source File: BrightnessSkillViewFragment.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public ViewGroup onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    LinearLayout view = new LinearLayout(getContext());
    view.setOrientation(LinearLayout.VERTICAL);

    LinearLayout auto_layout = new LinearLayout(getContext());
    auto_layout.setOrientation(LinearLayout.HORIZONTAL);
    TextView tv_auto = new TextView(getContext());
    tv_auto.setText(getResources().getString(R.string.operation_brightness_desc_autobrightness));
    mIsAuto = new Switch(getContext());
    mIsAuto.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mBrightnessLevel = new SeekBar(getContext());
    mBrightnessLevel.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mBrightnessLevel.setMax(255);
    mBrightnessLevel.setEnabled(false);
    mIsAuto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                mBrightnessLevel.setEnabled(false);
            else
                mBrightnessLevel.setEnabled(true);
        }
    });
    auto_layout.addView(mIsAuto);
    auto_layout.addView(tv_auto);

    view.addView(auto_layout);
    view.addView(mBrightnessLevel);

    return view;
}
 
Example 11
Source File: SeekBarPreference.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(prefValueToSeekBarProgress(mMax));
    seekBar.setProgress(prefValueToSeekBarProgress(mValue));
    seekBar.setEnabled(isEnabled());
    mSummaryView = (TextView) view.findViewById(R.id.seekbar_amount);
    mSummaryView.setText(mSummary);
}
 
Example 12
Source File: SeekBarPreference.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(prefValueToSeekBarProgress(mMax));
    seekBar.setProgress(prefValueToSeekBarProgress(mValue));
    seekBar.setEnabled(isEnabled());
    mSummaryView = (TextView) view.findViewById(R.id.seekbar_amount);
    mSummaryView.setText(mSummary);
}
 
Example 13
Source File: SeekBarPreference.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mMax);
    seekBar.setProgress(mProgress);
    seekBar.setEnabled(isEnabled());
}
 
Example 14
Source File: SeekBarPreference.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    SeekBar seekBar = (SeekBar) view.findViewById(
            com.android.internal.R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mMax);
    seekBar.setProgress(mProgress);
    seekBar.setEnabled(isEnabled());
}
 
Example 15
Source File: FloatingVideoActivity.java    From KSYMediaPlayer_Android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this.getApplicationContext();
    mHandler = new Handler(getMainLooper(), this);

    KSYFloatingPlayer.getInstance().init(mContext);

    mDataSource = getIntent().getStringExtra("path");

    setContentView(R.layout.activity_floating);

    mQosLayout = (RelativeLayout) findViewById(R.id.player_qos);
    mPlayerPanel = (RelativeLayout) findViewById(R.id.player_panel);
    mTextureView = (TextureView) findViewById(R.id.player_view);
    mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
    mPlayerStartBtn = (ImageView) findViewById(R.id.player_start);
    mFloatingPlaying = (ImageView) findViewById(R.id.floating_playing);
    mPlayerSeekBar = (SeekBar) findViewById(R.id.player_seekbar);
    mPlayerPosition = (TextView) findViewById(R.id.player_time);
    mLoadText = (TextView) findViewById(R.id.loading_text);
    mCpu = (TextView) findViewById(R.id.player_cpu);
    mMemInfo = (TextView) findViewById(R.id.player_mem);
    mVideoResolution = (TextView) findViewById(R.id.player_re);
    mVideoBitrate = (TextView) findViewById(R.id.player_br);
    mVideoBufferTime = (TextView) findViewById(R.id.player_video_time);
    mAudioBufferTime = (TextView) findViewById(R.id.player_audio_time);
    mServerIp = (TextView) findViewById(R.id.player_ip);
    mSdkVersion = (TextView) findViewById(R.id.player_sdk_version);
    mDNSTime = (TextView) findViewById(R.id.player_dns_time);
    mHttpConnectionTime = (TextView) findViewById(R.id.player_http_connection_time);
    mBufferEmptyCnt = (TextView) findViewById(R.id.player_buffer_empty_count);
    mBufferEmptyDuration = (TextView) findViewById(R.id.player_buffer_empty_duration);
    mDecodeFps = (TextView) findViewById(R.id.player_decode_fps);
    mOutputFps = (TextView) findViewById(R.id.player_output_fps);

    mTextureView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            dealTouchEvent(view, motionEvent);
            return false;
        }
    });

    mPlayerStartBtn.setOnClickListener(mPlayerListener);
    mFloatingPlaying.setOnClickListener(mFloatingPlayingListener);

    mPlayerSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
    mPlayerSeekBar.setEnabled(true);
    mPlayerSeekBar.bringToFront();

    startToPlay();
}
 
Example 16
Source File: Gpu.java    From Kernel-Tuner with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState)
{
	c = this;
   	board = android.os.Build.DEVICE;
   	preferences = PreferenceManager.getDefaultSharedPreferences(c);

	super.onCreate(savedInstanceState);
	   
	setContentView(R.layout.gpu);
	gpu2dmax = readFile(Constants.GPU_2D);
	gpu3dmax = readFile(Constants.GPU_3D);
	gpu2dcurent = readFile(Constants.GPU_2D_CURRENT);
	gpu3dcurent = readFile(Constants.GPU_3D_CURRENT);
	seek2d = (SeekBar)findViewById(R.id.seek_2d);
	seek3d = (SeekBar)findViewById(R.id.seek_3d);
	List<String> adreno220 = Arrays.asList("shooter", "shooteru", "pyramid", "tenderloin", "vigor", "rider", "nozomi", "LT26i", "hikari", "doubleshot", "su640","SHV-E160S","SHV-E160L", "SHV-E120L", "holiday");
	List<String> adreno225 = Arrays.asList("evita", "ville", "jewel", "d2spr", "d2tmo");
	List<String> adreno320 = Arrays.asList("mako","dlx");
	if (adreno220.contains(board))
	{
		gpu2d = Arrays.asList(160000000, 200000000, 228571000, 266667000);
		gpu3d = Arrays.asList(200000000, 228571000, 266667000, 300000000, 320000000);
	    seekBar(gpu2d.size()-1, gpu3d.size()-1, gpu2d.indexOf(gpu2dmax), gpu3d.indexOf(gpu3dmax));
	}
	else if (adreno225.contains(board))
	{
		gpu2d = Arrays.asList(320000000, 266667000, 228571000, 200000000, 160000000, 96000000, 27000000);
		gpu3d = Arrays.asList(512000000, 400000000, 320000000, 300000000, 266667000, 228571000, 200000000, 177778000, 27000000);
		seekBar(gpu2d.size()-1, gpu3d.size()-1, gpu2d.indexOf(gpu2dmax), gpu3d.indexOf(gpu3dmax));
	}
	else if (adreno320.contains(board))
	{
		
		gpu2d = Arrays.asList(27000000, 48000000, 54857000, 64000000,
                   76800000,
                   96000000,
                   128000000,
                   145455000,
                   160000000,
                   177778000,
                   200000000,
                   266667000,
                   300000000);
		gpu3d = Arrays.asList(27000000,
                   48000000,
                   54857000,
                   64000000,
                   76800000,
                   96000000,
                   128000000,
                   145455000,
                   160000000,
                   177778000,
                   200000000,
                   228571000,
                   266667000,
                   300000000,
                   320000000,
                   400000000,
                   450000000,
                   500000000);
		seekBar(gpu2d.size()-1, gpu3d.size()-1, gpu2d.indexOf(gpu2dmax), gpu3d.indexOf(gpu3dmax));
	}
	else{
	seek2d.setEnabled(false);
	seek3d.setEnabled(false);
	TextView ns = (TextView)findViewById(R.id.not_supported);
	ns.setVisibility(View.VISIBLE);
	}
	preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
	
	cur2dTxt = (TextView)findViewById(R.id.current_2d);
	cur3dTxt = (TextView)findViewById(R.id.current_3d);
	max2dTxt = (TextView)findViewById(R.id.max_2d);
	max3dTxt = (TextView)findViewById(R.id.max_3d);
	mhz = getResources().getString(R.string.mhz);
	current = getResources().getString(R.string.current);
	max = getResources().getString(R.string._max);
	cur3dTxt.setText(current+": "+(gpu3dcurent/1000000) + mhz);
	cur2dTxt.setText(current+": "+(gpu2dcurent/1000000) + mhz);
	
	max3dTxt.setText(max+": "+(gpu3dmax/1000000) + mhz);
	max2dTxt.setText(max+": "+(gpu2dmax/1000000) + mhz);
	Button cancel = (Button)findViewById(R.id.cancel);
	cancel.setOnClickListener(new OnClickListener(){

		@Override
		public void onClick(View arg0) {
		finish();
		}
		
	});

}
 
Example 17
Source File: EqualizerFragment.java    From Audinaut with GNU General Public License v3.0 4 votes vote down vote up
private void updateBars(boolean changedEnabled) {
    try {
        boolean isEnabled = equalizer.getEnabled();
        short minEQLevel = equalizer.getBandLevelRange()[0];
        short maxEQLevel = equalizer.getBandLevelRange()[1];
        for (Map.Entry<Short, SeekBar> entry : bars.entrySet()) {
            short band = entry.getKey();
            SeekBar bar = entry.getValue();
            bar.setEnabled(isEnabled);
            if (band >= (short) 0) {
                short setLevel;
                if (changedEnabled) {
                    setLevel = (short) (equalizer.getBandLevel(band) - masterLevel);
                    if (isEnabled) {
                        bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
                    } else {
                        bar.setProgress(-minEQLevel);
                    }
                } else {
                    bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
                    setLevel = (short) (equalizer.getBandLevel(band) + masterLevel);
                }
                if (setLevel < minEQLevel) {
                    setLevel = minEQLevel;
                } else if (setLevel > maxEQLevel) {
                    setLevel = maxEQLevel;
                }
                equalizer.setBandLevel(band, setLevel);
            } else if (!isEnabled) {
                bar.setProgress(-minEQLevel);
            }
        }

        bassBar.setEnabled(isEnabled);
        if (loudnessBar != null) {
            loudnessBar.setEnabled(isEnabled);
        }
        if (changedEnabled && !isEnabled) {
            bass.setStrength((short) 0);
            bassBar.setProgress(0);
            if (loudnessBar != null) {
                loudnessEnhancer.setGain(0);
                loudnessBar.setProgress(0);
            }
        }

        if (!isEnabled) {
            masterLevel = 0;
            SharedPreferences prefs = Util.getPreferences(context);
            SharedPreferences.Editor editor = prefs.edit();
            editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel);
            editor.apply();
        }
    } catch (Exception e) {
        Log.e(TAG, "Failed to update bars");
    }
}
 
Example 18
Source File: EqualizerFragment.java    From Popeens-DSub with GNU General Public License v3.0 4 votes vote down vote up
private void updateBars(boolean changedEnabled) {
	try {
		boolean isEnabled = equalizer.getEnabled();
		short minEQLevel = equalizer.getBandLevelRange()[0];
		short maxEQLevel = equalizer.getBandLevelRange()[1];
		for (Map.Entry<Short, SeekBar> entry : bars.entrySet()) {
			short band = entry.getKey();
			SeekBar bar = entry.getValue();
			bar.setEnabled(isEnabled);
			if (band >= (short) 0) {
				short setLevel;
				if (changedEnabled) {
					setLevel = (short) (equalizer.getBandLevel(band) - masterLevel);
					if (isEnabled) {
						bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
					} else {
						bar.setProgress(-minEQLevel);
					}
				} else {
					bar.setProgress(equalizer.getBandLevel(band) - minEQLevel);
					setLevel = (short) (equalizer.getBandLevel(band) + masterLevel);
				}
				if (setLevel < minEQLevel) {
					setLevel = minEQLevel;
				} else if (setLevel > maxEQLevel) {
					setLevel = maxEQLevel;
				}
				equalizer.setBandLevel(band, setLevel);
			} else if (!isEnabled) {
				bar.setProgress(-minEQLevel);
			}
		}

		bassBar.setEnabled(isEnabled);
		if (loudnessBar != null) {
			loudnessBar.setEnabled(isEnabled);
		}
		if (changedEnabled && !isEnabled) {
			bass.setStrength((short) 0);
			bassBar.setProgress(0);
			if (loudnessBar != null) {
				loudnessEnhancer.setGain(0);
				loudnessBar.setProgress(0);
			}
		}

		if (!isEnabled) {
			masterLevel = 0;
			SharedPreferences prefs = Util.getPreferences(context);
			SharedPreferences.Editor editor = prefs.edit();
			editor.putInt(Constants.PREFERENCES_EQUALIZER_SETTINGS, masterLevel);
			editor.commit();
		}
	} catch(Exception e) {
		Log.e(TAG, "Failed to update bars");
	}
}
 
Example 19
Source File: SetupIntro.java    From android-picturepassword with MIT License 4 votes vote down vote up
private void confirmNumber()
{
	final TextView title = ( TextView ) findViewById( R.id.headerText );
	title.setText( R.string.confirm_title );
	
	final Button nextButton = ( Button ) findViewById( R.id.next_button );
	nextButton.setEnabled( false );
	
	final SeekBar gridSize = ( SeekBar ) findViewById( R.id.grid_size );
	gridSize.setEnabled( false );
	
	final CheckBox randomize = ( CheckBox ) findViewById( R.id.randomize );
	randomize.setEnabled( false );
	
	PicturePasswordView passwordView = ( PicturePasswordView ) findViewById( R.id.chosenImage );
	mGridSize = passwordView.getGridSize();
	mRandomize = randomize.isChecked();
			
	int unlockNumber = mChosenNumber;
	PointF unlockPosition = passwordView.getHighlightPosition();
	mUnlockPosition = unlockPosition;
	
	passwordView.setFocusNumber( -1 );
	passwordView.reset();
	passwordView.setUnlockNumber( unlockNumber, unlockPosition.x, unlockPosition.y );
	passwordView.setOnFingerUpListener( new OnFingerUpListener()
	{
		@Override
		public void onFingerUp( PicturePasswordView picturePassword, boolean shouldUnlock )
		{
			if ( shouldUnlock )
			{
				nextButton.setEnabled( true );
				picturePassword.setEnabled( false );
				picturePassword.setHighlightUnlockNumber( true );
				title.setText( R.string.done_title );
			}
			else
			{
				title.setText( R.string.try_again );
				picturePassword.reset();
			}
		}
	} );
	
	mStep = STEP_CONFIRM_NUMBER;
}
 
Example 20
Source File: PlayRtspVideoView.java    From Viewer with Apache License 2.0 4 votes vote down vote up
private void initView()
	{
		cid = getIntent().getExtras().getString("avsCid");
		isCloudVideo = getIntent().getBooleanExtra("isCloudVideo", false);
		videodata = getIntent().getStringExtra("videodate");
		TextView title = (TextView) findViewById(R.id.video_title);
		title.setText(videodata);
		camera_title = (LinearLayout) findViewById(R.id.camera_title);
		wait_relayout = (RelativeLayout) findViewById(R.id.wait_relayout);
		progressBar_relayout = (RelativeLayout) findViewById(R.id.progressBar_relayout);
		progressBar_relayout_params = (MarginLayoutParams) progressBar_relayout.getLayoutParams();
		progressBar_relayout_params.height = CommUtil.getPixelsWidth(this) * 3 / 4;
		progressBar_relayout.setLayoutParams(progressBar_relayout_params);
		relayout_play_control = (RelativeLayout) findViewById(R.id.relayout_play_control);
		relayout_play_control_params = (MarginLayoutParams) relayout_play_control.getLayoutParams();

		relayout_play_control.setOnClickListener(this);
		pause = (ImageButton) findViewById(R.id.pause);
		pause.setOnClickListener(this);
		full_screen = (ImageButton) findViewById(R.id.full_screen);
		pause_image = (ImageButton) findViewById(R.id.pause_image);
		pause_image.setOnClickListener(this);
		play_time = (TextView) findViewById(R.id.play_time);
		total_time = (TextView) findViewById(R.id.total_time);
		video_seek = (SeekBar) findViewById(R.id.video_seek);
		relayout_camera_bg = (RelativeLayout) findViewById(R.id.relayout_camera_bg);
		camera_bg_params = (MarginLayoutParams) relayout_camera_bg.getLayoutParams();
		int totaltime = getIntent().getIntExtra("filetime", 0);
		video_seek.setMax(totaltime);
		showTime(totaltime, total_time);
		video_seek.setEnabled(false);
		pause.setEnabled(false);
		full_screen.setEnabled(false);
		full_screen.setOnClickListener(this);
		findViewById(R.id.back_linlayout).setOnClickListener(this);
		findViewById(R.id.ipc_warn_img).setOnClickListener(this);
		video_seek.setOnSeekBarChangeListener(this);
		surfaceViewLayout = (RelativeLayout) findViewById(R.id.glsurfaceviewlayout);
		connectUrl = "rtsp://127.0.01:554/record?recordtype=" + getIntent().getIntExtra("filetype", 0) + "&filename=" + videodata;
		animation_alpha_in = AnimationUtils.loadAnimation(this, R.anim.alpha_in);
//		adViewContent = (AdViewContent) findViewById(R.id.adView_layout);
		load_relayout = (RelativeLayout) findViewById(R.id.load_relayout);
	}