Merge pull request #3369 from ByteHamster/playback-speed-icon
Added playback speed icon
This commit is contained in:
commit
fa3437960b
|
@ -60,11 +60,13 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
|
|||
}
|
||||
if (controller == null) {
|
||||
butPlaybackSpeed.setVisibility(View.GONE);
|
||||
txtvPlaybackSpeed.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
updatePlaybackSpeedButtonText();
|
||||
ViewCompat.setAlpha(butPlaybackSpeed, controller.canSetPlaybackSpeed() ? 1.0f : 0.5f);
|
||||
butPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
txtvPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,14 +76,15 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
|
|||
}
|
||||
if (controller == null) {
|
||||
butPlaybackSpeed.setVisibility(View.GONE);
|
||||
txtvPlaybackSpeed.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
float speed = 1.0f;
|
||||
if(controller.canSetPlaybackSpeed()) {
|
||||
speed = UserPreferences.getPlaybackSpeed();
|
||||
}
|
||||
String speedStr = new DecimalFormat("0.00x").format(speed);
|
||||
butPlaybackSpeed.setText(speedStr);
|
||||
String speedStr = new DecimalFormat("0.00").format(speed);
|
||||
txtvPlaybackSpeed.setText(speedStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,6 +139,7 @@ public class AudioplayerActivity extends MediaplayerInfoActivity {
|
|||
return true;
|
||||
});
|
||||
butPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
txtvPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class CastplayerActivity extends MediaplayerInfoActivity {
|
|||
super.setupGUI();
|
||||
if (butPlaybackSpeed != null) {
|
||||
butPlaybackSpeed.setVisibility(View.GONE);
|
||||
txtvPlaybackSpeed.setVisibility(View.GONE);
|
||||
}
|
||||
// if (butCastDisconnect != null) {
|
||||
// butCastDisconnect.setOnClickListener(v -> castManager.disconnect());
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.widget.AdapterView;
|
|||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.viewpagerindicator.CirclePageIndicator;
|
||||
|
@ -92,7 +93,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
NavListAdapter.SUBSCRIPTION_LIST_TAG
|
||||
};
|
||||
|
||||
Button butPlaybackSpeed;
|
||||
ImageButton butPlaybackSpeed;
|
||||
TextView txtvPlaybackSpeed;
|
||||
ImageButton butCastDisconnect;
|
||||
private DrawerLayout drawerLayout;
|
||||
private NavListAdapter navAdapter;
|
||||
|
@ -258,6 +260,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
});
|
||||
|
||||
butPlaybackSpeed = findViewById(R.id.butPlaybackSpeed);
|
||||
txtvPlaybackSpeed = findViewById(R.id.txtvPlaybackSpeed);
|
||||
butCastDisconnect = findViewById(R.id.butCastDisconnect);
|
||||
|
||||
pager = findViewById(R.id.pager);
|
||||
|
|
|
@ -155,11 +155,11 @@
|
|||
android:layout_marginTop="-8dp"
|
||||
android:gravity="center"
|
||||
android:text="30"
|
||||
android:textSize="10sp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:clickable="false"/>
|
||||
|
||||
<Button
|
||||
<ImageButton
|
||||
android:id="@+id/butPlaybackSpeed"
|
||||
android:layout_width="@dimen/audioplayer_playercontrols_length"
|
||||
android:layout_height="@dimen/audioplayer_playercontrols_length"
|
||||
|
@ -167,13 +167,28 @@
|
|||
android:layout_toStartOf="@id/butRev"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/set_playback_speed_label"
|
||||
android:src="?attr/av_fast_forward"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
android:textAllCaps="false"
|
||||
android:maxLines="1"
|
||||
android:src="?attr/av_speed"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@drawable/ic_playback_speed_white"
|
||||
tools:visibility="gone"
|
||||
tools:background="@android:color/holo_green_dark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPlaybackSpeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/butPlaybackSpeed"
|
||||
android:layout_alignLeft="@id/butPlaybackSpeed"
|
||||
android:layout_alignStart="@id/butPlaybackSpeed"
|
||||
android:layout_alignRight="@id/butPlaybackSpeed"
|
||||
android:layout_alignEnd="@id/butPlaybackSpeed"
|
||||
android:layout_marginTop="-8dp"
|
||||
android:gravity="center"
|
||||
android:text="1.00"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:clickable="false"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butCastDisconnect"
|
||||
android:layout_width="@dimen/audioplayer_playercontrols_length"
|
||||
|
@ -216,7 +231,7 @@
|
|||
android:layout_marginTop="-8dp"
|
||||
android:gravity="center"
|
||||
android:text="30"
|
||||
android:textSize="10sp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:clickable="false"/>
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#FF757575" android:pathData="M 12,14.888154 A 2.2284437,2.2284437 0 0 1 9.7715563,12.659711 c 0,-0.831952 0.4531167,-1.559911 1.1142217,-1.938746 L 18.098507,6.5463469 13.990743,13.66251 C 13.619336,14.390469 12.869093,14.888154 12,14.888154 m 0,-9.6565888 c 1.344494,0 2.599851,0.3714073 3.691789,0.9805151 L 14.131878,7.110886 C 13.485629,6.858329 12.742815,6.7171943 12,6.7171943 A 5.9425165,5.9425165 0 0 0 6.0574835,12.659711 c 0,1.64162 0.661105,3.127249 1.7381861,4.196902 h 0.00743 c 0.2896977,0.289697 0.2896977,0.757671 0,1.047369 -0.2896977,0.289697 -0.7650991,0.289697 -1.0547967,0.0075 v 0 C 5.4038067,16.566915 4.5718544,14.709879 4.5718544,12.659711 A 7.4281456,7.4281456 0 0 1 12,5.2315652 m 7.428145,7.4281458 c 0,2.050168 -0.831952,3.907204 -2.176446,5.251699 v 0 c -0.289698,0.282269 -0.757671,0.282269 -1.047369,-0.0075 -0.289697,-0.289698 -0.289697,-0.757671 0,-1.047368 v 0 c 1.077082,-1.077082 1.738186,-2.555282 1.738186,-4.196902 0,-0.742815 -0.141134,-1.48563 -0.401119,-2.154163 l 0.898805,-1.5599106 c 0.616537,1.1142216 0.987943,2.3621496 0.987943,3.7140736 z" />
|
||||
</vector>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="48dp"
|
||||
android:width="48dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#ffffffff" android:pathData="M 12,14.888154 A 2.2284437,2.2284437 0 0 1 9.7715563,12.659711 c 0,-0.831952 0.4531167,-1.559911 1.1142217,-1.938746 L 18.098507,6.5463469 13.990743,13.66251 C 13.619336,14.390469 12.869093,14.888154 12,14.888154 m 0,-9.6565888 c 1.344494,0 2.599851,0.3714073 3.691789,0.9805151 L 14.131878,7.110886 C 13.485629,6.858329 12.742815,6.7171943 12,6.7171943 A 5.9425165,5.9425165 0 0 0 6.0574835,12.659711 c 0,1.64162 0.661105,3.127249 1.7381861,4.196902 h 0.00743 c 0.2896977,0.289697 0.2896977,0.757671 0,1.047369 -0.2896977,0.289697 -0.7650991,0.289697 -1.0547967,0.0075 v 0 C 5.4038067,16.566915 4.5718544,14.709879 4.5718544,12.659711 A 7.4281456,7.4281456 0 0 1 12,5.2315652 m 7.428145,7.4281458 c 0,2.050168 -0.831952,3.907204 -2.176446,5.251699 v 0 c -0.289698,0.282269 -0.757671,0.282269 -1.047369,-0.0075 -0.289697,-0.289698 -0.289697,-0.757671 0,-1.047368 v 0 c 1.077082,-1.077082 1.738186,-2.555282 1.738186,-4.196902 0,-0.742815 -0.141134,-1.48563 -0.401119,-2.154163 l 0.898805,-1.5599106 c 0.616537,1.1142216 0.987943,2.3621496 0.987943,3.7140736 z" />
|
||||
</vector>
|
|
@ -9,6 +9,7 @@
|
|||
<attr name="av_fast_forward" format="reference"/>
|
||||
<attr name="av_pause" format="reference"/>
|
||||
<attr name="av_play" format="reference"/>
|
||||
<attr name="av_speed" format="reference"/>
|
||||
<attr name="av_rewind" format="reference"/>
|
||||
<attr name="content_discard" format="reference"/>
|
||||
<attr name="content_new" format="reference"/>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<item name="av_fast_forward">@drawable/ic_fast_forward_grey600_24dp</item>
|
||||
<item name="av_pause">@drawable/ic_pause_grey600_24dp</item>
|
||||
<item name="av_play">@drawable/ic_play_arrow_grey600_24dp</item>
|
||||
<item name="av_speed">@drawable/ic_playback_speed_dark</item>
|
||||
<item name="av_rewind">@drawable/ic_fast_rewind_grey600_24dp</item>
|
||||
<item name="content_discard">@drawable/ic_delete_grey600_24dp</item>
|
||||
<item name="content_new">@drawable/ic_add_grey600_24dp</item>
|
||||
|
@ -108,6 +109,7 @@
|
|||
<item name="av_fast_forward">@drawable/ic_fast_forward_white_24dp</item>
|
||||
<item name="av_pause">@drawable/ic_pause_white_24dp</item>
|
||||
<item name="av_play">@drawable/ic_play_arrow_white_24dp</item>
|
||||
<item name="av_speed">@drawable/ic_playback_speed_white</item>
|
||||
<item name="av_rewind">@drawable/ic_fast_rewind_white_24dp</item>
|
||||
<item name="content_discard">@drawable/ic_delete_white_24dp</item>
|
||||
<item name="content_new">@drawable/ic_add_white_24dp</item>
|
||||
|
|
Loading…
Reference in New Issue