fixed behaviour, layout and style fix, renamed method, added comment

This commit is contained in:
nuclearfog 2021-02-16 14:00:43 +01:00
parent 14c78bd5bc
commit 149edf5000
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
10 changed files with 139 additions and 85 deletions

View File

@ -62,12 +62,12 @@
<activity <activity
android:name=".activity.TweetEditor" android:name=".activity.TweetEditor"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Transparency" /> android:theme="@style/TransparencyDim" />
<activity <activity
android:name=".activity.MessageEditor" android:name=".activity.MessageEditor"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Transparency" /> android:theme="@style/TransparencyDim" />
<activity <activity
android:name=".activity.AppSettings" android:name=".activity.AppSettings"
@ -118,7 +118,7 @@
<activity <activity
android:name=".activity.ListEditor" android:name=".activity.ListEditor"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Transparency" /> android:theme="@style/TransparencyDim" />
</application> </application>

View File

@ -36,15 +36,14 @@ import org.nuclearfog.twidda.backend.engine.EngineException;
import org.nuclearfog.twidda.backend.holder.ImageHolder; import org.nuclearfog.twidda.backend.holder.ImageHolder;
import org.nuclearfog.twidda.backend.utils.AppStyles; import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.backend.utils.ErrorHandler; import org.nuclearfog.twidda.backend.utils.ErrorHandler;
import org.nuclearfog.twidda.backend.utils.StringTools;
import org.nuclearfog.twidda.database.GlobalSettings; import org.nuclearfog.twidda.database.GlobalSettings;
import org.nuclearfog.zoomview.ZoomView; import org.nuclearfog.zoomview.ZoomView;
import java.text.NumberFormat;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static android.graphics.PorterDuff.Mode.SRC_IN;
import static android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN; import static android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END; import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START; import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START;
@ -97,10 +96,15 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
*/ */
public static final int MEDIAVIEWER_ANGIF = 4; public static final int MEDIAVIEWER_ANGIF = 4;
private static final int PROGRESS_DELAY = 500; /**
private static final int SPEED_FACTOR = 6; * refresh time for video progress update
*/
private static final int PROGRESS_UPDATE = 1000;
private static final NumberFormat formatter = NumberFormat.getIntegerInstance(); /**
* speed factor for fast forward or backward
*/
private static final int SPEED_FACTOR = 6;
private enum PlayStat { private enum PlayStat {
PLAY, PLAY,
@ -115,7 +119,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
private TextView duration, position; private TextView duration, position;
private ProgressBar loadingCircle; private ProgressBar loadingCircle;
private SeekBar video_progress; private SeekBar video_progress;
private ImageButton playPause; private ImageButton play, pause;
private ImageAdapter adapter; private ImageAdapter adapter;
private VideoView videoView; private VideoView videoView;
private ZoomView zoomImage; private ZoomView zoomImage;
@ -138,29 +142,24 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
zoomImage = findViewById(R.id.image_full); zoomImage = findViewById(R.id.image_full);
videoView = findViewById(R.id.video_view); videoView = findViewById(R.id.video_view);
video_progress = controlPanel.findViewById(R.id.controller_progress); video_progress = controlPanel.findViewById(R.id.controller_progress);
playPause = controlPanel.findViewById(R.id.controller_playpause); play = controlPanel.findViewById(R.id.controller_play);
pause = controlPanel.findViewById(R.id.controller_pause);
duration = controlPanel.findViewById(R.id.controller_duration); duration = controlPanel.findViewById(R.id.controller_duration);
position = controlPanel.findViewById(R.id.controller_position); position = controlPanel.findViewById(R.id.controller_position);
ImageButton forward = controlPanel.findViewById(R.id.controller_forward); ImageButton forward = controlPanel.findViewById(R.id.controller_forward);
ImageButton backward = controlPanel.findViewById(R.id.controller_backward); ImageButton backward = controlPanel.findViewById(R.id.controller_backward);
ImageButton share = controlPanel.findViewById(R.id.controller_share); ImageButton share = controlPanel.findViewById(R.id.controller_share);
videoView.setZOrderOnTop(true);
GlobalSettings settings = GlobalSettings.getInstance(this); GlobalSettings settings = GlobalSettings.getInstance(this);
adapter = new ImageAdapter(settings, this); adapter = new ImageAdapter(settings, this);
share.setImageResource(R.drawable.share); share.setImageResource(R.drawable.share);
forward.setImageResource(R.drawable.forward); forward.setImageResource(R.drawable.forward);
backward.setImageResource(R.drawable.backward); backward.setImageResource(R.drawable.backward);
playPause.setImageResource(R.drawable.pause); play.setImageResource(R.drawable.play);
pause.setImageResource(R.drawable.pause);
AppStyles.setProgressColor(loadingCircle, settings.getHighlightColor()); AppStyles.setProgressColor(loadingCircle, settings.getHighlightColor());
controlPanel.setBackgroundColor(settings.getCardColor()); controlPanel.setBackgroundColor(settings.getCardColor());
AppStyles.setSeekBarColor(settings, video_progress); AppStyles.setTheme(settings, controlPanel);
share.setColorFilter(settings.getIconColor(), SRC_IN);
forward.setColorFilter(settings.getIconColor(), SRC_IN);
backward.setColorFilter(settings.getIconColor(), SRC_IN);
playPause.setColorFilter(settings.getIconColor(), SRC_IN);
duration.setTextColor(settings.getFontColor());
position.setTextColor(settings.getFontColor());
// get intent data and type // get intent data and type
mediaLinks = getIntent().getStringArrayExtra(KEY_MEDIA_LINK); mediaLinks = getIntent().getStringArrayExtra(KEY_MEDIA_LINK);
@ -193,7 +192,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
} }
}); });
} }
}, PROGRESS_DELAY, PROGRESS_DELAY, TimeUnit.MILLISECONDS); }, PROGRESS_UPDATE, PROGRESS_UPDATE, TimeUnit.MILLISECONDS);
case MEDIAVIEWER_ANGIF: case MEDIAVIEWER_ANGIF:
zoomImage.setVisibility(GONE); zoomImage.setVisibility(GONE);
Uri video = Uri.parse(mediaLinks[0]); Uri video = Uri.parse(mediaLinks[0]);
@ -202,7 +201,8 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
} }
} }
share.setOnClickListener(this); share.setOnClickListener(this);
playPause.setOnClickListener(this); play.setOnClickListener(this);
pause.setOnClickListener(this);
videoView.setOnTouchListener(this); videoView.setOnTouchListener(this);
backward.setOnTouchListener(this); backward.setOnTouchListener(this);
forward.setOnTouchListener(this); forward.setOnTouchListener(this);
@ -234,18 +234,24 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// play/pause video // play video
if (v.getId() == R.id.controller_playpause) { if (v.getId() == R.id.controller_play) {
if (videoView.isPlaying()) { if (!videoView.isPlaying()) {
videoView.pause(); play.setVisibility(INVISIBLE);
playPause.setImageResource(R.drawable.play); pause.setVisibility(VISIBLE);
playStat = PlayStat.PAUSE;
} else {
videoView.resume(); videoView.resume();
playPause.setImageResource(R.drawable.pause);
playStat = PlayStat.PLAY; playStat = PlayStat.PLAY;
} }
} }
// pause video
if (v.getId() == R.id.controller_pause) {
if (videoView.isPlaying()) {
pause.setVisibility(INVISIBLE);
play.setVisibility(VISIBLE);
videoView.pause();
playStat = PlayStat.PAUSE;
}
}
// open link with another app // open link with another app
else if (v.getId() == R.id.controller_share) { else if (v.getId() == R.id.controller_share) {
if (mediaLinks != null && mediaLinks.length > 0) { if (mediaLinks != null && mediaLinks.length > 0) {
@ -259,6 +265,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
} }
} }
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.controller_backward) { if (v.getId() == R.id.controller_backward) {
@ -322,11 +329,11 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
} else { } else {
playStat = PlayStat.PLAY; playStat = PlayStat.PLAY;
video_progress.setMax(mp.getDuration()); video_progress.setMax(mp.getDuration());
duration.setText(formatter.format(mp.getDuration())); duration.setText(StringTools.formatMediaTime(mp.getDuration()));
if (videoPos > 0) { if (videoPos > 0) {
mp.seekTo(videoPos); mp.seekTo(videoPos);
} }
position.setText(formatter.format(mp.getCurrentPosition())); position.setText(StringTools.formatMediaTime(mp.getCurrentPosition()));
mp.setOnSeekCompleteListener(this); mp.setOnSeekCompleteListener(this);
} }
mp.setOnInfoListener(this); mp.setOnInfoListener(this);
@ -365,9 +372,8 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
@Override @Override
public void onSeekComplete(MediaPlayer mp) { public void onSeekComplete(MediaPlayer mp) {
position.setText(formatter.format(mp.getCurrentPosition())); position.setText(StringTools.formatMediaTime(mp.getCurrentPosition()));
if (playStat == PlayStat.PLAY) { if (playStat == PlayStat.PLAY) {
playPause.setImageResource(R.drawable.pause);
mp.start(); mp.start();
} }
} }
@ -375,7 +381,8 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
@Override @Override
public void onCompletion(MediaPlayer mp) { public void onCompletion(MediaPlayer mp) {
playPause.setImageResource(R.drawable.play); pause.setVisibility(INVISIBLE);
play.setVisibility(VISIBLE);
playStat = PlayStat.PAUSE; playStat = PlayStat.PAUSE;
videoPos = 0; videoPos = 0;
} }
@ -383,6 +390,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
position.setText(StringTools.formatMediaTime(progress));
} }
@ -437,11 +445,10 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
case PLAY: case PLAY:
video_progress.setProgress(videoPos); video_progress.setProgress(videoPos);
videoPos = videoView.getCurrentPosition(); videoPos = videoView.getCurrentPosition();
position.setText(formatter.format(videoPos));
break; break;
case FORWARD: case FORWARD:
videoPos += 2 * PROGRESS_DELAY * SPEED_FACTOR; videoPos += 2 * PROGRESS_UPDATE * SPEED_FACTOR;
if (videoPos > videoView.getDuration()) if (videoPos > videoView.getDuration())
videoPos = videoView.getDuration(); videoPos = videoView.getDuration();
videoView.pause(); videoView.pause();
@ -449,7 +456,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
break; break;
case BACKWARD: case BACKWARD:
videoPos -= 2 * PROGRESS_DELAY * SPEED_FACTOR; videoPos -= 2 * PROGRESS_UPDATE * SPEED_FACTOR;
if (videoPos < 0) if (videoPos < 0)
videoPos = 0; videoPos = 0;
videoView.pause(); videoView.pause();

View File

@ -29,7 +29,7 @@ import static android.view.View.GONE;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION; import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import static org.nuclearfog.twidda.backend.utils.StringTools.getTimeString; import static org.nuclearfog.twidda.backend.utils.StringTools.formatCreationTime;
/** /**
* Adapter class for user lists * Adapter class for user lists
@ -204,7 +204,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
vh.textViews[1].setText(item.getDescription()); vh.textViews[1].setText(item.getDescription());
vh.textViews[2].setText(owner.getUsername()); vh.textViews[2].setText(owner.getUsername());
vh.textViews[3].setText(owner.getScreenname()); vh.textViews[3].setText(owner.getScreenname());
vh.textViews[4].setText(getTimeString(item.getCreatedAt())); vh.textViews[4].setText(formatCreationTime(item.getCreatedAt()));
vh.textViews[5].setText(formatter.format(item.getMemberCount())); vh.textViews[5].setText(formatter.format(item.getMemberCount()));
vh.textViews[6].setText(formatter.format(item.getSubscriberCount())); vh.textViews[6].setText(formatter.format(item.getSubscriberCount()));
if (settings.getImageLoad() && owner.hasProfileImage()) { if (settings.getImageLoad() && owner.hasProfileImage()) {

View File

@ -28,7 +28,7 @@ import static android.view.View.GONE;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION; import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import static org.nuclearfog.twidda.backend.utils.StringTools.getTimeString; import static org.nuclearfog.twidda.backend.utils.StringTools.formatCreationTime;
/** /**
* Adapter class for direct messages list * Adapter class for direct messages list
@ -195,7 +195,7 @@ public class MessageAdapter extends Adapter<ViewHolder> {
holder.textViews[0].setText(sender.getUsername()); holder.textViews[0].setText(sender.getUsername());
holder.textViews[1].setText(sender.getScreenname()); holder.textViews[1].setText(sender.getScreenname());
holder.textViews[2].setText(message.getReceiver().getScreenname()); holder.textViews[2].setText(message.getReceiver().getScreenname());
holder.textViews[3].setText(getTimeString(message.getTime())); holder.textViews[3].setText(formatCreationTime(message.getTime()));
holder.textViews[4].setText(text); holder.textViews[4].setText(text);
if (sender.isVerified()) { if (sender.isVerified()) {
holder.verifiedIcon.setVisibility(VISIBLE); holder.verifiedIcon.setVisibility(VISIBLE);

View File

@ -34,7 +34,7 @@ import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static androidx.recyclerview.widget.RecyclerView.NO_ID; import static androidx.recyclerview.widget.RecyclerView.NO_ID;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION; import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import static org.nuclearfog.twidda.backend.utils.StringTools.getTimeString; import static org.nuclearfog.twidda.backend.utils.StringTools.formatCreationTime;
/** /**
* Adapter class for tweet list * Adapter class for tweet list
@ -275,7 +275,7 @@ public class TweetAdapter extends Adapter<ViewHolder> {
tweetItem.textViews[1].setText(user.getScreenname()); tweetItem.textViews[1].setText(user.getScreenname());
tweetItem.textViews[3].setText(formatter.format(tweet.getRetweetCount())); tweetItem.textViews[3].setText(formatter.format(tweet.getRetweetCount()));
tweetItem.textViews[4].setText(formatter.format(tweet.getFavoriteCount())); tweetItem.textViews[4].setText(formatter.format(tweet.getFavoriteCount()));
tweetItem.textViews[6].setText(getTimeString(tweet.getTime())); tweetItem.textViews[6].setText(formatCreationTime(tweet.getTime()));
if (tweet.retweeted()) { if (tweet.retweeted()) {
tweetItem.rtIcon.setColorFilter(Color.GREEN, SRC_IN); tweetItem.rtIcon.setColorFilter(Color.GREEN, SRC_IN);

View File

@ -19,7 +19,7 @@ public final class StringTools {
* @param time time value from which to create a difference * @param time time value from which to create a difference
* @return time string showing the time difference * @return time string showing the time difference
*/ */
public static String getTimeString(long time) { public static String formatCreationTime(long time) {
long diff = new Date().getTime() - time; long diff = new Date().getTime() - time;
long seconds = diff / 1000; long seconds = diff / 1000;
long minutes = seconds / 60; long minutes = seconds / 60;
@ -49,7 +49,29 @@ public final class StringTools {
} }
/** /**
* count @usernames in a string * format media time to string
*
* @param time duration/current position in ms
* @return time string
*/
public static String formatMediaTime(int time) {
String result = "";
int seconds = (time / 1000) % 60;
int minutes = (time / 60000) % 60;
if (minutes < 10)
result += "0";
result += minutes + ":";
if (seconds < 10)
result += "0";
result += seconds;
return result;
}
/**
* count @username mentions in a string
* *
* @param text text * @param text text
* @return username count * @return username count
@ -59,7 +81,7 @@ public final class StringTools {
for (int i = 0; i < text.length() - 1; i++) { for (int i = 0; i < text.length() - 1; i++) {
if (text.charAt(i) == '@') { if (text.charAt(i) == '@') {
char next = text.charAt(i + 1); char next = text.charAt(i + 1);
if ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z') || (next >= '0' && next <= '9')) { if ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z') || (next >= '0' && next <= '9') || next == '_') {
result++; result++;
} }
} }

View File

@ -2,18 +2,19 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/half_transparent">
<org.nuclearfog.zoomview.ZoomView <org.nuclearfog.zoomview.ZoomView
android:id="@+id/image_full" android:id="@+id/image_full"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:visibility="invisible" android:visibility="invisible"
app:enable_move="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:enable_move="true"
app:max_zoom_in="10.0" app:max_zoom_in="10.0"
app:max_zoom_out="0.7" /> app:max_zoom_out="0.7" />
@ -26,19 +27,19 @@
android:layout_marginBottom="@dimen/mediapage_preview_margin" android:layout_marginBottom="@dimen/mediapage_preview_margin"
android:scrollbars="horizontal" android:scrollbars="horizontal"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_percent="0.2" app:layout_constraintHeight_percent="0.2" />
app:layout_constraintStart_toStartOf="parent" />
<VideoView <VideoView
android:id="@+id/video_view" android:id="@+id/video_view"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ProgressBar <ProgressBar
android:id="@+id/media_progress" android:id="@+id/media_progress"
@ -46,9 +47,9 @@
android:layout_height="@dimen/mediapage_circle_size" android:layout_height="@dimen/mediapage_circle_size"
android:layout_marginTop="@dimen/mediapage_preview_margin" android:layout_marginTop="@dimen/mediapage_preview_margin"
app:layout_constraintBottom_toTopOf="@+id/image_list" app:layout_constraintBottom_toTopOf="@+id/image_list"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<include <include
android:id="@+id/media_controlpanel" android:id="@+id/media_controlpanel"
@ -57,8 +58,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/mediapage_controller_bottom_margin" android:layout_marginBottom="@dimen/mediapage_controller_bottom_margin"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,63 +6,81 @@
<ImageButton <ImageButton
android:id="@+id/controller_backward" android:id="@+id/controller_backward"
android:layout_width="@dimen/controller_button_size" android:layout_width="@dimen/controller_button_width"
android:layout_height="@dimen/controller_button_size" android:layout_height="@dimen/controller_button_height"
android:layout_marginTop="@dimen/controller_seekbar_margin" android:layout_marginTop="@dimen/controller_seekbar_margin"
android:contentDescription="@string/button_backward" android:contentDescription="@string/button_backward"
app:layout_constraintEnd_toStartOf="@id/controller_playpause"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/controller_play"
style="@style/RoundButton" />
<ImageButton <ImageButton
android:id="@+id/controller_playpause" android:id="@+id/controller_play"
android:layout_width="@dimen/controller_button_size" style="@style/RoundButton"
android:layout_height="@dimen/controller_button_size" android:layout_width="@dimen/controller_button_width"
android:layout_height="@dimen/controller_button_height"
android:layout_marginTop="@dimen/controller_seekbar_margin" android:layout_marginTop="@dimen/controller_seekbar_margin"
android:contentDescription="@string/button_play_pause" android:contentDescription="@string/button_play_pause"
android:visibility="invisible"
app:layout_constraintEnd_toStartOf="@id/controller_forward" app:layout_constraintEnd_toStartOf="@id/controller_forward"
app:layout_constraintStart_toEndOf="@id/controller_backward" app:layout_constraintStart_toEndOf="@id/controller_backward"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/controller_pause"
style="@style/RoundButton"
android:layout_width="@dimen/controller_button_width"
android:layout_height="@dimen/controller_button_height"
android:contentDescription="@string/button_play_pause"
android:visibility="visible"
app:layout_constraintStart_toStartOf="@+id/controller_play"
app:layout_constraintTop_toTopOf="@+id/controller_play"
app:layout_constraintBottom_toBottomOf="@+id/controller_play"
app:layout_constraintEnd_toEndOf="@+id/controller_play" />
<ImageButton <ImageButton
android:id="@+id/controller_forward" android:id="@+id/controller_forward"
android:layout_width="@dimen/controller_button_size" android:layout_width="@dimen/controller_button_width"
android:layout_height="@dimen/controller_button_size" android:layout_height="@dimen/controller_button_height"
android:layout_marginTop="@dimen/controller_seekbar_margin" android:layout_marginTop="@dimen/controller_seekbar_margin"
android:contentDescription="@string/button_forward" android:contentDescription="@string/button_forward"
app:layout_constraintStart_toEndOf="@id/controller_play"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/controller_share" app:layout_constraintEnd_toStartOf="@id/controller_share"
app:layout_constraintStart_toEndOf="@id/controller_playpause" style="@style/RoundButton" />
app:layout_constraintTop_toTopOf="parent" />
<ImageButton <ImageButton
android:id="@+id/controller_share" android:id="@+id/controller_share"
android:layout_width="@dimen/controller_button_size" android:layout_width="@dimen/controller_button_width"
android:layout_height="@dimen/controller_button_size" android:layout_height="@dimen/controller_button_height"
android:layout_marginTop="@dimen/controller_seekbar_margin" android:layout_marginTop="@dimen/controller_seekbar_margin"
android:contentDescription="@string/button_share" android:contentDescription="@string/button_share"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/controller_forward" app:layout_constraintStart_toEndOf="@id/controller_forward"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
style="@style/RoundButton" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/controller_barrier" android:id="@+id/controller_barrier"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:barrierDirection="bottom" app:barrierDirection="bottom"
app:constraint_referenced_ids="controller_backward,controller_forward,controller_playpause" /> app:constraint_referenced_ids="controller_backward,controller_forward,controller_play" />
<TextView <TextView
android:id="@+id/controller_position" android:id="@+id/controller_position"
android:layout_width="@dimen/controller_text_width" android:layout_width="@dimen/controller_text_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:layout_marginStart="@dimen/controller_text_margin" android:layout_marginStart="@dimen/controller_text_margin"
android:layout_marginLeft="@dimen/controller_text_margin" android:layout_marginLeft="@dimen/controller_text_margin"
app:layout_constraintStart_toStartOf="parent" android:singleLine="true"
app:layout_constraintTop_toBottomOf="@id/controller_barrier" android:textSize="@dimen/controller_text_size"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/controller_progress" /> app:layout_constraintEnd_toStartOf="@id/controller_progress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/controller_barrier" />
<SeekBar <SeekBar
android:id="@+id/controller_progress" android:id="@+id/controller_progress"
@ -79,12 +97,13 @@
android:id="@+id/controller_duration" android:id="@+id/controller_duration"
android:layout_width="@dimen/controller_text_width" android:layout_width="@dimen/controller_text_width"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:layout_marginRight="@dimen/controller_text_margin"
android:layout_marginEnd="@dimen/controller_text_margin" android:layout_marginEnd="@dimen/controller_text_margin"
app:layout_constraintStart_toEndOf="@id/controller_progress" android:layout_marginRight="@dimen/controller_text_margin"
app:layout_constraintTop_toBottomOf="@id/controller_barrier" android:singleLine="true"
android:textSize="@dimen/controller_text_size"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/controller_progress"
app:layout_constraintTop_toBottomOf="@id/controller_barrier" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -195,7 +195,9 @@
<!--dimens of controlpanel--> <!--dimens of controlpanel-->
<dimen name="controller_seekbar_margin">10dp</dimen> <dimen name="controller_seekbar_margin">10dp</dimen>
<dimen name="controller_text_margin">5dp</dimen> <dimen name="controller_text_margin">5dp</dimen>
<dimen name="controller_button_size">48dp</dimen> <dimen name="controller_text_size">12sp</dimen>
<dimen name="controller_button_width">64dp</dimen>
<dimen name="controller_button_height">32dp</dimen>
<dimen name="controller_text_width">60sp</dimen> <dimen name="controller_text_width">60sp</dimen>
</resources> </resources>

View File

@ -12,6 +12,9 @@
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackground">@android:color/transparent</item> <item name="android:colorBackground">@android:color/transparent</item>
</style>
<style name="TransparencyDim" parent="Transparency">
<item name="android:backgroundDimEnabled">true</item> <item name="android:backgroundDimEnabled">true</item>
</style> </style>