Commit 43f09992 authored by Vladimír Pokorný's avatar Vladimír Pokorný Committed by Geoffrey Métais

Vertical volume/brightness bar

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent dae4f853
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#00000000" />
<stroke android:width="1dp"
android:color="#77ffffff" />
</shape>
\ No newline at end of file
......@@ -77,6 +77,33 @@
android:textColor="#ffffff"
android:textSize="36sp"
android:visibility="invisible" />
<FrameLayout android:id="@+id/verticalbar"
android:layout_width="28dp"
android:layout_height="100dp"
android:layout_above="@+id/progress_overlay"
android:layout_toLeftOf="@+id/player_overlay_info"
android:layout_marginRight="8dp"
android:layout_marginBottom="-16dp"
android:background="@drawable/video_list_length_bg"
android:visibility="invisible">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="7dp"
android:background="@drawable/verticalbar_border"
android:orientation="vertical"
android:weightSum="15"
android:gravity="bottom">
<View android:id="@+id/verticalbar_progress"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:background="@color/orange500transparent" />
</LinearLayout>
</FrameLayout>
<ImageView
android:id="@+id/player_delay_minus"
android:layout_width="wrap_content"
......
......@@ -89,6 +89,7 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
......@@ -200,6 +201,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
private TextView mTime;
private TextView mLength;
private TextView mInfo;
private View mVerticalBar;
private View mVerticalBarProgress;
private ImageView mLoading;
private TextView mLoadingText;
private ImageView mTipsBackground;
......@@ -401,6 +404,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
// the info textView is not on the overlay
mInfo = (TextView) findViewById(R.id.player_overlay_info);
mVerticalBar = findViewById(R.id.verticalbar);
mVerticalBarProgress = findViewById(R.id.verticalbar_progress);
mEnableBrightnessGesture = mSettings.getBoolean("enable_brightness_gesture", true);
mScreenOrientation = Integer.valueOf(
......@@ -1198,12 +1203,27 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
mLockBackButton = false;
}
/**
* Show text in the info view and vertical progress bar for "duration" milliseconds
* @param text
* @param duration
* @param barNewValue new volume/brightness value (range: 0 - 15)
*/
private void showInfoWithVerticalBar(String text, int duration, int barNewValue) {
showInfo(text, duration);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mVerticalBarProgress.getLayoutParams();
layoutParams.weight = barNewValue;
mVerticalBarProgress.setLayoutParams(layoutParams);
mVerticalBar.setVisibility(View.VISIBLE);
}
/**
* Show text in the info view for "duration" milliseconds
* @param text
* @param duration
*/
private void showInfo(String text, int duration) {
mVerticalBar.setVisibility(View.INVISIBLE);
mInfo.setVisibility(View.VISIBLE);
mInfo.setText(text);
mHandler.removeMessages(FADE_OUT_INFO);
......@@ -1211,6 +1231,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
}
private void showInfo(int textid, int duration) {
mVerticalBar.setVisibility(View.INVISIBLE);
mInfo.setVisibility(View.VISIBLE);
mInfo.setText(textid);
mHandler.removeMessages(FADE_OUT_INFO);
......@@ -1222,6 +1243,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
* @param text
*/
private void showInfo(String text) {
mVerticalBar.setVisibility(View.INVISIBLE);
mHandler.removeMessages(FADE_OUT_INFO);
mInfo.setVisibility(View.VISIBLE);
mInfo.setText(text);
......@@ -1248,6 +1270,11 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
mInfo.startAnimation(AnimationUtils.loadAnimation(
VideoPlayerActivity.this, android.R.anim.fade_out));
mInfo.setVisibility(View.INVISIBLE);
if (mVerticalBar.getVisibility() == View.VISIBLE)
mVerticalBar.startAnimation(AnimationUtils.loadAnimation(
VideoPlayerActivity.this, android.R.anim.fade_out));
mVerticalBar.setVisibility(View.INVISIBLE);
}
private OnAudioFocusChangeListener mAudioFocusListener = !LibVlcUtil.isFroyoOrLater() ? null :
......@@ -1840,7 +1867,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, vol, AudioManager.FLAG_SHOW_UI);
mTouchAction = TOUCH_VOLUME;
showInfo(getString(R.string.volume) + '\u00A0' + Integer.toString(vol),1000);
showInfoWithVerticalBar(getString(R.string.volume) + '\u00A0' + Integer.toString(vol), 1000, vol);
}
private void mute(boolean mute) {
......@@ -1898,7 +1925,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
lp.screenBrightness = Math.min(Math.max(lp.screenBrightness + delta, 0.01f), 1);
// Set Brightness
getWindow().setAttributes(lp);
showInfo(getString(R.string.brightness) + '\u00A0' + Math.round(lp.screenBrightness * 15),1000);
int brightness = Math.round(lp.screenBrightness * 15);
showInfoWithVerticalBar(getString(R.string.brightness) + '\u00A0' + brightness, 1000, brightness);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment