feat: add rotation viewable setting

This commit is contained in:
rebelonion 2024-02-04 04:07:56 -06:00
parent 7a67fbb980
commit ed19aac553
5 changed files with 46 additions and 16 deletions

View file

@ -54,7 +54,7 @@ jobs:
shell: bash shell: bash
run: | run: |
contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" ) contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" )
curl -F "payload_json={\"content\":\" Alpha-Build: <@719439449423085569> **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/alpha/app-alpha.apk" ${{ secrets.DISCORD_WEBHOOK }} curl -F "payload_json={\"content\":\" Alpha-Build: <@659107544597266465> **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/alpha/app-alpha.apk" ${{ secrets.DISCORD_WEBHOOK }}
- name: Delete Old Pre-Releases - name: Delete Old Pre-Releases
id: delete-pre-releases id: delete-pre-releases

View file

@ -385,6 +385,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
}, AUDIO_CONTENT_TYPE_MOVIE, AUDIOFOCUS_GAIN) }, AUDIO_CONTENT_TYPE_MOVIE, AUDIOFOCUS_GAIN)
if (System.getInt(contentResolver, System.ACCELEROMETER_ROTATION, 0) != 1) { if (System.getInt(contentResolver, System.ACCELEROMETER_ROTATION, 0) != 1) {
if (PrefManager.getVal(PrefName.RotationPlayer)) {
orientationListener = orientationListener =
object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) { object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) {
override fun onOrientationChanged(orientation: Int) { override fun onOrientationChanged(orientation: Int) {
@ -400,6 +401,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
} }
} }
orientationListener?.enable() orientationListener?.enable()
}
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
exoRotate.setOnClickListener { exoRotate.setOnClickListener {

View file

@ -221,6 +221,11 @@ class PlayerSettingsActivity : AppCompatActivity() {
PrefManager.setVal(PrefName.Cast, isChecked) PrefManager.setVal(PrefName.Cast, isChecked)
} }
binding.playerSettingsRotate.isChecked = PrefManager.getVal(PrefName.RotationPlayer)
binding.playerSettingsRotate.setOnCheckedChangeListener { _, isChecked ->
PrefManager.setVal(PrefName.RotationPlayer, isChecked)
}
val resizeModes = arrayOf("Original", "Zoom", "Stretch") val resizeModes = arrayOf("Original", "Zoom", "Stretch")
val resizeDialog = AlertDialog.Builder(this, R.style.MyPopup) val resizeDialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle(getString(R.string.default_resize_mode)) .setTitle(getString(R.string.default_resize_mode))

View file

@ -83,6 +83,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
SkipTime(Pref(Location.Player, Int::class, 85)), SkipTime(Pref(Location.Player, Int::class, 85)),
Cast(Pref(Location.Player, Boolean::class, true)), Cast(Pref(Location.Player, Boolean::class, true)),
Pip(Pref(Location.Player, Boolean::class, true)), Pip(Pref(Location.Player, Boolean::class, true)),
RotationPlayer(Pref(Location.Player, Boolean::class, true)),
ContinueAnime(Pref(Location.Player, Set::class, setOf<Int>())), ContinueAnime(Pref(Location.Player, Set::class, setOf<Int>())),
//Reader //Reader

View file

@ -1054,8 +1054,7 @@
android:id="@+id/playerSettingsCast" android:id="@+id/playerSettingsCast"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:checked="true"
android:checked="false"
android:drawableStart="@drawable/ic_round_cast_24" android:drawableStart="@drawable/ic_round_cast_24"
android:drawablePadding="16dp" android:drawablePadding="16dp"
app:drawableTint="?attr/colorPrimary" app:drawableTint="?attr/colorPrimary"
@ -1073,6 +1072,29 @@
</com.google.android.material.materialswitch.MaterialSwitch> </com.google.android.material.materialswitch.MaterialSwitch>
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/playerSettingsRotate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:checked="true"
android:drawableStart="@drawable/ic_round_screen_rotation_alt_24"
android:drawablePadding="16dp"
app:drawableTint="?attr/colorPrimary"
android:elegantTextHeight="true"
android:fontFamily="@font/poppins_bold"
android:minHeight="64dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="Show Rotate Button"
android:textAlignment="viewStart"
android:textColor="@color/bg_opp"
app:cornerRadius="0dp"
app:showText="false"
app:thumbTint="@color/button_switch_track">
</com.google.android.material.materialswitch.MaterialSwitch>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"