universal7885: Add FMRadio app
* Created from scratch by me (Royna) with help of LineageOS repo [1], Sony Xperia Dev repo [2] * Basic input/output, channel selection is working [1]: https://github.com/LineageOS/android_hardware_samsung_slsi_fm [2]: https://github.com/sonyxperiadev/vendor-qcom-opensource-fm Change-Id: I922bbeb9f86e6a4c7bc993d27d2f9eeb2a712186 Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
BIN
universal7885-common/apps/FMRadio/res/drawable/left.png
Normal file
|
After Width: | Height: | Size: 452 B |
12
universal7885-common/apps/FMRadio/res/drawable/power.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24.0dp"
|
||||
android:height="24.0dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11,2h2v10h-2z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M18.37,5.64l-1.41,1.41c2.73,2.73 2.72,7.16 -0.01,9.89c-2.73,2.73 -7.17,2.73 -9.89,0.01c-2.73,-2.73 -2.74,-7.18 -0.01,-9.91L5.64,5.64c-3.51,3.51 -3.51,9.21 0.01,12.73c3.51,3.51 9.21,3.51 12.72,-0.01C21.88,14.85 21.88,9.16 18.37,5.64z"/>
|
||||
</vector>
|
||||
BIN
universal7885-common/apps/FMRadio/res/drawable/radio.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
universal7885-common/apps/FMRadio/res/drawable/radio_text.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
universal7885-common/apps/FMRadio/res/drawable/right.png
Normal file
|
After Width: | Height: | Size: 434 B |
BIN
universal7885-common/apps/FMRadio/res/drawable/start.png
Normal file
|
After Width: | Height: | Size: 457 B |
BIN
universal7885-common/apps/FMRadio/res/drawable/stop.png
Normal file
|
After Width: | Height: | Size: 305 B |
BIN
universal7885-common/apps/FMRadio/res/drawable/warning.jpg
Normal file
|
After Width: | Height: | Size: 144 KiB |
310
universal7885-common/apps/FMRadio/res/layout/activity_main.xml
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="top|center"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/debug_info"
|
||||
android:layout_width="190dp"
|
||||
android:layout_height="30dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp" />
|
||||
|
||||
<de.dlyt.yanndroid.oneui.layout.RoundLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primary_color"
|
||||
android:gravity="center">
|
||||
|
||||
<Space
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/radio"/>
|
||||
<TextView
|
||||
android:id="@+id/fm_radio_title"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="120dp"
|
||||
|
||||
android:gravity="center"
|
||||
android:text="@string/fm_radio"
|
||||
android:textColor="#263238"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Space
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</de.dlyt.yanndroid.oneui.layout.RoundLinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<de.dlyt.yanndroid.oneui.layout.RoundLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="140dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/primary_color"
|
||||
android:gravity="center|top">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/output_modes"
|
||||
android:layout_width="185dp"
|
||||
android:layout_height="70dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/output_modes"
|
||||
android:textColor="#263238"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/fm_output"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/wired_earphones"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</de.dlyt.yanndroid.oneui.layout.RoundLinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<de.dlyt.yanndroid.oneui.layout.RoundLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="140dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/primary_color"
|
||||
android:gravity="center|top">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enable_fm"
|
||||
android:layout_width="185dp"
|
||||
android:layout_height="70dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/turn_on_fm"
|
||||
android:textColor="#263238"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/fmswitch"
|
||||
android:layout_width="175dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/disabled"
|
||||
android:textColor="#263238"
|
||||
android:textSize="18sp"
|
||||
android:theme="@style/ButtonStyle.Colored" />
|
||||
|
||||
</de.dlyt.yanndroid.oneui.layout.RoundLinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<de.dlyt.yanndroid.oneui.layout.RoundLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="230dp"
|
||||
android:background="@color/primary_color"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center|top">
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/freq_title"
|
||||
android:layout_width="375dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/fm_radio_frequency"
|
||||
android:textColor="#263238"
|
||||
android:textSize="35sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/band_select"
|
||||
android:layout_width="375dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/select_channel"
|
||||
android:textColor="#263238"
|
||||
android:textSize="25sp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/secondary_color">
|
||||
|
||||
<de.dlyt.yanndroid.oneui.view.SeekBar
|
||||
android:id="@+id/fm_freq_seekbar"
|
||||
android:layout_width="325dp"
|
||||
android:layout_height="50dp"
|
||||
android:progressBackgroundTint="@color/white"
|
||||
android:thumbTint="#263238"
|
||||
android:progressTint="#263238"/>
|
||||
</FrameLayout>
|
||||
|
||||
</de.dlyt.yanndroid.oneui.layout.RoundLinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<de.dlyt.yanndroid.oneui.layout.RoundLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|center"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/primary_color">
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/radio_ctrl"
|
||||
android:layout_width="375dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/radio_controls"
|
||||
android:textColor="#263238"
|
||||
android:textSize="35sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/scan_through"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/scan"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/stop_scan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/stop"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored" />
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|center">
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/seek_down"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/seek_down"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/quit_fm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/quit"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/seek_up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/seek_up"
|
||||
android:textColor="#263238"
|
||||
android:theme="@style/ButtonStyle.Colored" />
|
||||
|
||||
<Space
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp" />
|
||||
|
||||
</de.dlyt.yanndroid.oneui.layout.RoundLinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/warning">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/error_img"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="@drawable/ic_samsung_error"
|
||||
android:translationZ="0dp" />
|
||||
|
||||
<Space
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_simple"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="75dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#00838F"
|
||||
android:textSize="18sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_detailed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="202dp"
|
||||
android:textColor="#00838F"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:background="@android:color/white"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_rewind"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:background="@null"
|
||||
android:contentDescription="@string/previous_radio_channel"
|
||||
android:src="@drawable/left"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_play_pause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:background="@null"
|
||||
android:contentDescription="@string/play_pause"
|
||||
android:src="@drawable/stop" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_forward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:background="@null"
|
||||
android:contentDescription="@string/next_radio_channel"
|
||||
android:src="@drawable/right"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
android:contentDescription="@string/close_radio"
|
||||
android:minWidth="32dp"
|
||||
android:minHeight="48dp"
|
||||
android:src="@drawable/power" />
|
||||
</LinearLayout>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
34
universal7885-common/apps/FMRadio/res/values/strings.xml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<resources>
|
||||
<string name="app_name">FM Radio</string>
|
||||
<string name="fm_radio">FM Radio</string>
|
||||
<string name="output_modes">Output Modes</string>
|
||||
<string name="turn_on_fm">FM Power</string>
|
||||
<string name="disabled">Disabled</string>
|
||||
<string name="enabled">Enabled</string>
|
||||
<string name="phone_speaker">Speaker</string>
|
||||
<string name="wired_earphones">Wired Earphones</string>
|
||||
<string name="select_channel">Radio Channel</string>
|
||||
<string name="refresh">Refresh</string>
|
||||
<string name="seek_down">Seek Down</string>
|
||||
<string name="seek_up">Seek Up</string>
|
||||
<string name="scan">Scan</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="mhz">%s Mhz</string>
|
||||
<string name="quit">Quit</string>
|
||||
<string name="album_art">Album Art</string>
|
||||
<string name="previous_radio_channel">Previous Radio Channel</string>
|
||||
<string name="next_radio_channel">Next Radio Channel</string>
|
||||
<string name="play_pause">Play Pause</string>
|
||||
<string name="close_radio">Close Radio</string>
|
||||
<string name="radio_io_error">Failed to open radio chr device!!</string>
|
||||
<string name="radio_io_error_desc">The FM radio app needs to call ioctl()
|
||||
to radio chr device (/dev/radio0). If SELinux is enforcing, try making
|
||||
it permissive</string>
|
||||
<string name="tracks_empty_error">Failed to check if array != null!!</string>
|
||||
<string name="tracks_empty_error_desc">Most likely because FM device couldn\'t
|
||||
find radio channels, if you are sure it should find channels, contact the devs</string>
|
||||
<string name="no_headphones_error">Failed to find wired headset</string>
|
||||
<string name="no_headphones_error_desc">Insert Headphones and try again</string>
|
||||
<string name="radio_controls">Radio Controls</string>
|
||||
<string name="fm_radio_frequency">FM Radio Station</string>
|
||||
</resources>
|
||||