Compare commits
7 commits
dev
...
revert-710
Author | SHA1 | Date | |
---|---|---|---|
|
5de5fc1c3a | ||
|
f2be4720ad | ||
|
459b1bd668 | ||
|
6065c994ad | ||
|
23c882bdb7 | ||
|
5d34055fd0 | ||
|
967c6fb5ac |
24 changed files with 939 additions and 52 deletions
|
@ -99,6 +99,11 @@ android {
|
|||
kapt {
|
||||
generateStubs = true
|
||||
}
|
||||
kotlin {
|
||||
experimental {
|
||||
coroutines "enable"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,6 +173,9 @@ dependencies {
|
|||
def kotlin_coroutines_version = "1.3.3"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
|
||||
def arch_version = '2.2.0'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$arch_version"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$arch_version"
|
||||
|
||||
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.4.0.201406110918-r'
|
||||
|
||||
|
@ -184,4 +192,6 @@ dependencies {
|
|||
def dagger_version = "2.23.1"
|
||||
implementation "com.google.dagger:dagger:$dagger_version"
|
||||
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
}
|
||||
|
||||
implementation 'com.github.ologe:scroll-helper:1.1.5'
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
|
@ -30,6 +29,7 @@
|
|||
android:usesCleartextTraffic="false"
|
||||
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
|
||||
tools:targetApi="m">
|
||||
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
|
@ -122,20 +122,18 @@
|
|||
<activity android:name=".activities.bugreport.BugReportActivity" />
|
||||
<activity android:name=".activities.ShareInstagramStory" />
|
||||
<activity android:name=".activities.DriveModeActivity" />
|
||||
<activity android:name=".activities.EqualizerActivity" />
|
||||
<activity
|
||||
android:name=".activities.SearchActivity"
|
||||
android:windowSoftInputMode="stateVisible" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.LockScreenActivity"
|
||||
android:noHistory="true"
|
||||
android:showOnLockScreen="true" />
|
||||
|
||||
<activity
|
||||
android:name=".appshortcuts.AppShortcutLauncherActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.saf.SAFGuideActivity"
|
||||
android:theme="@style/Theme.Intro" />
|
||||
|
@ -149,8 +147,6 @@
|
|||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}"
|
||||
|
@ -166,14 +162,12 @@
|
|||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".appwidgets.BootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetBig"
|
||||
android:exported="false"
|
||||
|
@ -186,7 +180,6 @@
|
|||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_big_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetClassic"
|
||||
android:exported="false"
|
||||
|
@ -235,6 +228,15 @@
|
|||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_card_info" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".AudioEffectsReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="org.oucho.musicplayer.OPEN_AUDIO_EFFECT_SESSION"/>
|
||||
<action android:name="org.oucho.musicplayer.CLOSE_AUDIO_EFFECT_SESSION"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".service.MusicService"
|
||||
|
@ -250,15 +252,12 @@
|
|||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.lge.support.SPLIT_WINDOW"
|
||||
android:value="true" />
|
||||
|
||||
<meta-data
|
||||
android:name="code.name.monkey.retromusic.glide.RetroMusicGlideModule"
|
||||
android:value="GlideModule" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule"
|
||||
android:value="GlideModule" />
|
||||
|
@ -266,4 +265,5 @@
|
|||
android:name="com.android.vending.splits.required"
|
||||
android:value="true" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,123 @@
|
|||
package code.name.monkey.retromusic.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.AdapterView
|
||||
import android.widget.AdapterView.OnItemSelectedListener
|
||||
import android.widget.ArrayAdapter
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||
import code.name.monkey.retromusic.equalizer.FreqLevelItem
|
||||
import code.name.monkey.retromusic.equalizer.MainContract
|
||||
import code.name.monkey.retromusic.equalizer.MainPresenter
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.model.Band
|
||||
import kotlinx.android.synthetic.main.activity_equalizer.*
|
||||
|
||||
|
||||
class EqualizerActivity : AbsMusicServiceActivity(), MainContract.View {
|
||||
|
||||
private lateinit var mainPresenter: MainPresenter
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_equalizer)
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
equalizerToggle.setOnCheckedChangeListener { _, isChecked ->
|
||||
mainPresenter.effectOnOff(isChecked)
|
||||
}
|
||||
|
||||
mainPresenter = MainPresenter(this)
|
||||
mainPresenter.initEqualizer()
|
||||
|
||||
val accentColor = ThemeStore.accentColor(this)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(
|
||||
this,
|
||||
ColorUtil.isColorLight(accentColor)
|
||||
)
|
||||
equalizerToggle.setBackgroundColor(accentColor)
|
||||
equalizerToggle.setTextColor(textColor)
|
||||
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
mainPresenter.detachView()
|
||||
}
|
||||
|
||||
override fun showEmptyView() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun showBandInfo(bands: Array<Band?>) {
|
||||
bandList.removeAllViews()
|
||||
for (i in bands.indices) {
|
||||
val band = bands[i]
|
||||
val freqLevelItem = FreqLevelItem(this, null, 0)
|
||||
freqLevelItem.setLevelInfo(band)
|
||||
freqLevelItem.id = i
|
||||
bandList.addView(freqLevelItem, i)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showPresetList(presetNames: Array<String?>?) {
|
||||
val spinnerAdapter: ArrayAdapter<*> = ArrayAdapter<Any?>(
|
||||
this,
|
||||
R.layout.dropdown_item,
|
||||
presetNames!!
|
||||
)
|
||||
spinnerAdapter.setDropDownViewResource(R.layout.dropdown_item)
|
||||
preset.adapter = spinnerAdapter
|
||||
preset.onItemSelectedListener = object : OnItemSelectedListener {
|
||||
override fun onItemSelected(
|
||||
parent: AdapterView<*>?,
|
||||
view: View?,
|
||||
position: Int,
|
||||
id: Long
|
||||
) {
|
||||
Log.d("eq", "onItemSelected position $position, id $id")
|
||||
mainPresenter.changePreset(position.toShort())
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||
Log.d("eq", "onNothingSelected")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showBandLevel(levels: ShortArray) {
|
||||
val count = bandList.childCount
|
||||
for (i in 0 until count) {
|
||||
val item: View = bandList.getChildAt(i)
|
||||
if (item is FreqLevelItem) {
|
||||
val freqLevelItem = item as FreqLevelItem
|
||||
freqLevelItem.setBandLevel(levels[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
super.onServiceConnected()
|
||||
mainPresenter.changeAudioSession(MusicPlayerRemote.audioSessionId)
|
||||
}
|
||||
|
||||
override fun onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged()
|
||||
mainPresenter.changeAudioSession(MusicPlayerRemote.audioSessionId)
|
||||
}
|
||||
}
|
|
@ -4,8 +4,10 @@ import android.app.Activity
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.GenreAdapter.ViewHolder
|
||||
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
|
@ -19,7 +21,7 @@ class GenreAdapter(
|
|||
private val activity: Activity,
|
||||
var dataSet: List<Genre>,
|
||||
private val mItemLayoutRes: Int
|
||||
) : RecyclerView.Adapter<GenreAdapter.ViewHolder>() {
|
||||
) : ListAdapter<Genre, ViewHolder>(GenreDiffCallback()) {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
|
@ -54,3 +56,19 @@ class GenreAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for calculating the diff between two non-null items in a list.
|
||||
*
|
||||
* Used by ListAdapter to calculate the minimum number of changes between and old list and a new
|
||||
* list that's been passed to `submitList`.
|
||||
*/
|
||||
class GenreDiffCallback : DiffUtil.ItemCallback<Genre>() {
|
||||
override fun areItemsTheSame(oldItem: Genre, newItem: Genre): Boolean {
|
||||
return oldItem.id == newItem.id
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: Genre, newItem: Genre): Boolean {
|
||||
return oldItem == newItem
|
||||
}
|
||||
}
|
|
@ -0,0 +1,272 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.audiofx.BassBoost;
|
||||
import android.media.audiofx.Equalizer;
|
||||
import android.util.Log;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
|
||||
public class AudioEffects {
|
||||
|
||||
public static final short BASSBOOST_MAX_STRENGTH = 1000;
|
||||
private static final String PREF_EQ_ENABLED = "enabled";
|
||||
private static final String PREF_BAND_LEVEL = "level";
|
||||
private static final String PREF_PRESET = "preset";
|
||||
private static final String PREF_BASSBOOST = "bassboost";
|
||||
private static final String AUDIO_EFFECTS_PREFS = "audioeffects";
|
||||
|
||||
private static final BassBoostValues sBassBoostValues = new BassBoostValues();
|
||||
private static final EqualizerValues sEqualizerValues = new EqualizerValues();
|
||||
private static BassBoost sBassBoost;
|
||||
private static Equalizer sEqualizer;
|
||||
private static boolean sCustomPreset;
|
||||
|
||||
public static void init(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(AUDIO_EFFECTS_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
initBassBoostValues(prefs);
|
||||
initEqualizerValues(prefs);
|
||||
}
|
||||
|
||||
|
||||
public static void openAudioEffectSession(Context context, int audioSessionId) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(AUDIO_EFFECTS_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
initBassBoost(audioSessionId);
|
||||
initEqualizer(prefs, audioSessionId);
|
||||
}
|
||||
|
||||
public static void closeAudioEffectSession() {
|
||||
if (sBassBoost != null) {
|
||||
sBassBoost.release();
|
||||
sBassBoost = null;
|
||||
}
|
||||
|
||||
if (sEqualizer != null) {
|
||||
sEqualizer.release();
|
||||
sEqualizer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void initBassBoostValues(SharedPreferences prefs) {
|
||||
sBassBoostValues.enabled = prefs.getBoolean(PREF_EQ_ENABLED, false);
|
||||
sBassBoostValues.strength = (short) prefs.getInt(PREF_BASSBOOST, 0);
|
||||
}
|
||||
|
||||
private static void initBassBoost(int audioSessionId) {
|
||||
if (sBassBoost != null) {
|
||||
sBassBoost.release();
|
||||
sBassBoost = null;
|
||||
}
|
||||
sBassBoost = new BassBoost(0, audioSessionId);
|
||||
sBassBoost.setEnabled(sBassBoostValues.enabled);
|
||||
|
||||
short strength = sBassBoostValues.strength;
|
||||
|
||||
if (strength >= 0 && strength <= BASSBOOST_MAX_STRENGTH) {
|
||||
sBassBoost.setStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initEqualizerValues(SharedPreferences prefs) {
|
||||
|
||||
|
||||
sEqualizerValues.enabled = prefs.getBoolean(PREF_EQ_ENABLED, false);
|
||||
|
||||
sEqualizerValues.preset = (short) prefs.getInt(PREF_PRESET, -1);
|
||||
|
||||
if (sEqualizerValues.preset == -1) {
|
||||
sCustomPreset = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void initEqualizer(SharedPreferences prefs, int audioSessionId) {
|
||||
|
||||
if (sEqualizer != null) {
|
||||
sEqualizer.release();
|
||||
sEqualizer = null;
|
||||
}
|
||||
sEqualizer = new Equalizer(0, audioSessionId);
|
||||
sEqualizer.setEnabled(sEqualizerValues.enabled);
|
||||
|
||||
if (!sCustomPreset) {
|
||||
usePreset(sEqualizerValues.preset);
|
||||
|
||||
}
|
||||
|
||||
sEqualizerValues.numberOfBands = sEqualizer.getNumberOfBands();
|
||||
|
||||
|
||||
if (!sEqualizerValues.levelsSet) {
|
||||
sEqualizerValues.bandLevels = new short[sEqualizerValues.numberOfBands];
|
||||
}
|
||||
for (short b = 0; b < sEqualizerValues.numberOfBands; b++) {
|
||||
if (!sEqualizerValues.levelsSet) {
|
||||
short level = (short) prefs.getInt(PREF_BAND_LEVEL + b, sEqualizer.getBandLevel(b));
|
||||
sEqualizerValues.bandLevels[b] = level;
|
||||
if (sCustomPreset) {
|
||||
|
||||
sEqualizer.setBandLevel(b, level);
|
||||
}
|
||||
} else {
|
||||
sEqualizer.setBandLevel(b, sEqualizerValues.bandLevels[b]);
|
||||
}
|
||||
}
|
||||
|
||||
sEqualizerValues.levelsSet = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static short getBassBoostStrength() {
|
||||
return sBassBoostValues.strength;
|
||||
}
|
||||
|
||||
public static void setBassBoostStrength(short strength) {
|
||||
sBassBoostValues.strength = strength;
|
||||
if (sBassBoost != null) {
|
||||
sBassBoost.setStrength(strength);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static short[] getBandLevelRange() {
|
||||
if (sEqualizer == null) {
|
||||
return null;
|
||||
}
|
||||
return sEqualizer.getBandLevelRange();
|
||||
}
|
||||
|
||||
public static short getBandLevel(short band) {
|
||||
if (sEqualizer == null) {
|
||||
if (sEqualizerValues.levelsSet && sEqualizerValues.bandLevels.length > band) {
|
||||
return sEqualizerValues.bandLevels[band];
|
||||
}
|
||||
}
|
||||
Log.d("audiofx", "eeeD");
|
||||
return sEqualizer.getBandLevel(band);
|
||||
}
|
||||
|
||||
public static boolean areAudioEffectsEnabled() {
|
||||
if (sEqualizer == null) {
|
||||
return sEqualizerValues.enabled;
|
||||
}
|
||||
return sEqualizer.getEnabled();
|
||||
}
|
||||
|
||||
public static void setAudioEffectsEnabled(boolean enabled) {
|
||||
if (sEqualizer == null || sBassBoost == null) {
|
||||
return;
|
||||
}
|
||||
sBassBoost.setEnabled(true);
|
||||
sEqualizer.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public static void setBandLevel(short band, short level) {
|
||||
sCustomPreset = true;
|
||||
|
||||
if (sEqualizerValues.bandLevels.length > band) {
|
||||
sEqualizerValues.preset = -1;
|
||||
sEqualizerValues.bandLevels[band] = level;
|
||||
}
|
||||
|
||||
if (sEqualizer != null) {
|
||||
sEqualizer.setBandLevel(band, level);
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getEqualizerPresets(Context context) {
|
||||
if (sEqualizer == null) {
|
||||
return new String[]{};
|
||||
}
|
||||
short numberOfPresets = sEqualizer.getNumberOfPresets();
|
||||
|
||||
String[] presets = new String[numberOfPresets + 1];
|
||||
|
||||
presets[0] = context.getResources().getString(R.string.custom);
|
||||
|
||||
for (short n = 0; n < numberOfPresets; n++) {
|
||||
presets[n + 1] = sEqualizer.getPresetName(n);
|
||||
}
|
||||
|
||||
return presets;
|
||||
}
|
||||
|
||||
public static int getCurrentPreset() {
|
||||
if (sEqualizer == null || sCustomPreset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sEqualizer.getCurrentPreset() + 1;
|
||||
}
|
||||
|
||||
public static void usePreset(short preset) {
|
||||
if (sEqualizer == null) {
|
||||
return;
|
||||
}
|
||||
sCustomPreset = false;
|
||||
sEqualizer.usePreset(preset);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static short getNumberOfBands() {
|
||||
if (sEqualizer == null) {
|
||||
return 0;
|
||||
}
|
||||
return sEqualizer.getNumberOfBands();
|
||||
}
|
||||
|
||||
public static int getCenterFreq(short band) {
|
||||
if (sEqualizer == null) {
|
||||
return 0;
|
||||
}
|
||||
return sEqualizer.getCenterFreq(band);
|
||||
}
|
||||
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
public static void savePrefs(Context context) {
|
||||
if (sEqualizer == null || sBassBoost == null) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = context.getSharedPreferences(AUDIO_EFFECTS_PREFS,
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
editor.putInt(PREF_BASSBOOST, sBassBoostValues.strength);
|
||||
|
||||
short preset = sCustomPreset ? -1 : sEqualizer.getCurrentPreset();
|
||||
editor.putInt(PREF_PRESET, preset);
|
||||
|
||||
|
||||
short bands = sEqualizer.getNumberOfBands();
|
||||
|
||||
for (short b = 0; b < bands; b++) {
|
||||
short level = sEqualizer.getBandLevel(b);
|
||||
|
||||
editor.putInt(PREF_BAND_LEVEL + b, level);
|
||||
}
|
||||
editor.putBoolean(PREF_EQ_ENABLED,
|
||||
sEqualizer.getEnabled());
|
||||
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
private static class BassBoostValues {
|
||||
public boolean enabled;
|
||||
public short strength;
|
||||
}
|
||||
|
||||
private static class EqualizerValues {
|
||||
public boolean enabled;
|
||||
public short preset;
|
||||
public short numberOfBands;
|
||||
public short[] bandLevels;
|
||||
|
||||
public boolean levelsSet = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class AudioEffectsReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String EXTRA_AUDIO_SESSION_ID = "org.oucho.musicplayer.EXTRA_AUDIO_SESSION_ID";
|
||||
|
||||
public static final String ACTION_OPEN_AUDIO_EFFECT_SESSION = "org.oucho.musicplayer.OPEN_AUDIO_EFFECT_SESSION";
|
||||
public static final String ACTION_CLOSE_AUDIO_EFFECT_SESSION = "org.oucho.musicplayer.CLOSE_AUDIO_EFFECT_SESSION";
|
||||
|
||||
public AudioEffectsReceiver() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
int audioSessionId = intent.getIntExtra(EXTRA_AUDIO_SESSION_ID, 0);
|
||||
if (ACTION_OPEN_AUDIO_EFFECT_SESSION.equals(action)) {
|
||||
AudioEffects.openAudioEffectSession(context, audioSessionId);
|
||||
} else if (ACTION_CLOSE_AUDIO_EFFECT_SESSION.equals(action)) {
|
||||
AudioEffects.closeAudioEffectSession();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import code.name.monkey.retromusic.mvp.BaseView;
|
||||
|
||||
public class BasePresenter<T extends BaseView> {
|
||||
protected T mView;
|
||||
|
||||
final public void attachView(T view){
|
||||
mView = view;
|
||||
}
|
||||
|
||||
final public void detachView(){
|
||||
mView = null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package code.name.monkey.retromusic.equalizer
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import android.widget.TextView
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.model.Band
|
||||
|
||||
/**
|
||||
* Created by 1100416 on 2018. 1. 11..
|
||||
*/
|
||||
class FreqLevelItem @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||
private var band: Band? = null
|
||||
private var mSeekBar: SeekBar? = null
|
||||
private var mCenterFreq: TextView? = null
|
||||
private var mLevel: TextView? = null
|
||||
|
||||
interface OnBandLevelChangeListener {
|
||||
fun onBandLevelChange(band: View?, level: Short)
|
||||
fun onBandLevelChangeStop()
|
||||
}
|
||||
|
||||
var mBandLevelChangeListener: OnBandLevelChangeListener? = null
|
||||
private fun initView() {
|
||||
val rootView =
|
||||
LayoutInflater.from(context).inflate(R.layout.freq_level_item, this, false)
|
||||
mCenterFreq = rootView.findViewById(R.id.centerFreq)
|
||||
|
||||
mLevel = rootView.findViewById(R.id.currentLevel)
|
||||
mSeekBar = rootView.findViewById(R.id.seekBar)
|
||||
mSeekBar?.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar,
|
||||
i: Int,
|
||||
b: Boolean
|
||||
) {
|
||||
if (band != null) {
|
||||
mLevel?.text = "${i + band!!.rangeMin}"
|
||||
} else {
|
||||
mLevel?.text = "$i"
|
||||
}
|
||||
if (mBandLevelChangeListener != null) {
|
||||
mBandLevelChangeListener!!.onBandLevelChange(
|
||||
this@FreqLevelItem,
|
||||
(i + band!!.rangeMin).toShort()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
if (mBandLevelChangeListener != null) {
|
||||
mBandLevelChangeListener!!.onBandLevelChangeStop()
|
||||
}
|
||||
}
|
||||
})
|
||||
addView(rootView)
|
||||
}
|
||||
|
||||
fun setLevelInfo(band: Band?) {
|
||||
this.band = band
|
||||
mCenterFreq!!.text = displayNameOfHz(band!!.centerFreq)
|
||||
|
||||
mSeekBar!!.max = band.rangeMax - band.rangeMin
|
||||
mSeekBar!!.progress = band.level - band.rangeMin
|
||||
}
|
||||
|
||||
private fun displayNameOfHz(freq: Int): String {
|
||||
var display = freq.toString() + "mHz"
|
||||
when {
|
||||
1000 * 1000 * 1000 < freq -> {
|
||||
display = String.format("%.1f", freq / 1000 / 1000f) + "MHz"
|
||||
}
|
||||
1000 * 1000 < freq -> {
|
||||
display = String.format("%.1f", freq / 1000 / 1000f) + "KHz"
|
||||
}
|
||||
1000 < freq -> {
|
||||
display = String.format("%d", freq / 1000) + "Hz"
|
||||
}
|
||||
}
|
||||
return display
|
||||
}
|
||||
|
||||
fun setBandLevel(level: Short) {
|
||||
band!!.level = level
|
||||
setLevelInfo(band)
|
||||
}
|
||||
|
||||
fun setBandLevelChangeListener(listener: OnBandLevelChangeListener?) {
|
||||
mBandLevelChangeListener = listener
|
||||
}
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import code.name.monkey.retromusic.model.Band;
|
||||
import code.name.monkey.retromusic.mvp.BaseView;
|
||||
|
||||
public interface MainContract {
|
||||
interface View extends BaseView {
|
||||
void showBandInfo(Band[] bands);
|
||||
|
||||
void showPresetList(String[] presetNames);
|
||||
|
||||
void showBandLevel(short[] levels);
|
||||
}
|
||||
|
||||
abstract class Presenter extends BasePresenter<View> {
|
||||
abstract void initEqualizer();
|
||||
|
||||
abstract void changePreset(short presetId);
|
||||
|
||||
abstract void changeAudioSession(int audioSession);
|
||||
|
||||
abstract public void effectOnOff(boolean effectOn);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package code.name.monkey.retromusic.equalizer;
|
||||
|
||||
import android.media.audiofx.Equalizer;
|
||||
import android.util.Log;
|
||||
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.model.Band;
|
||||
|
||||
|
||||
/**
|
||||
* Created by 1100416 on 2018. 1. 15..
|
||||
*/
|
||||
|
||||
public class MainPresenter extends MainContract.Presenter {
|
||||
private Equalizer mEqualizer;
|
||||
private int mAudioSession = -1;
|
||||
private boolean mEffectEnabled = false;
|
||||
|
||||
private short mPreset = 0;
|
||||
|
||||
|
||||
public MainPresenter(MainContract.View view) {
|
||||
attachView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEqualizer() {
|
||||
initEqualizer(MusicPlayerRemote.INSTANCE.getAudioSessionId());
|
||||
mAudioSession = 0;
|
||||
displayEQStatus(mEqualizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePreset(short presetId) {
|
||||
mEqualizer.usePreset(presetId);
|
||||
updateBandLevel(mEqualizer);
|
||||
mPreset = presetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeAudioSession(int audioSession) {
|
||||
initEqualizer(audioSession);
|
||||
mAudioSession = audioSession;
|
||||
enableEqualisingEffect(mEffectEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void effectOnOff(boolean effectOn) {
|
||||
mEffectEnabled = effectOn;
|
||||
enableEqualisingEffect(mEffectEnabled);
|
||||
}
|
||||
|
||||
|
||||
private void initEqualizer(int audioSession) {
|
||||
if (mAudioSession != audioSession) {
|
||||
try {
|
||||
mEqualizer = new Equalizer(0, audioSession);
|
||||
mEqualizer.usePreset(mPreset);
|
||||
mEqualizer.setParameterListener(mEqualizerParameterChangeListener);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void enableEqualisingEffect(boolean enable) {
|
||||
if (mEqualizer != null) {
|
||||
mEqualizer.setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayEQStatus(Equalizer equalizer) {
|
||||
if (mView != null && equalizer != null) {
|
||||
int numOfPresets = equalizer.getNumberOfPresets();
|
||||
String[] presetNames = new String[numOfPresets];
|
||||
|
||||
for (short p = 0; p < numOfPresets; p++) {
|
||||
presetNames[p] = equalizer.getPresetName(p);
|
||||
}
|
||||
((MainContract.View) mView).showPresetList(presetNames);
|
||||
|
||||
int numOfBands = mEqualizer.getNumberOfBands();
|
||||
Band[] bands = new Band[numOfBands];
|
||||
for (short i = 0; i < numOfBands; i++) {
|
||||
int centerFreq = mEqualizer.getCenterFreq(i);
|
||||
short bandLevel = mEqualizer.getBandLevel(i);
|
||||
int freqRange[] = mEqualizer.getBandFreqRange(i);
|
||||
short[] bandLevelRange = mEqualizer.getBandLevelRange();
|
||||
|
||||
Band band = new Band(centerFreq, bandLevel, freqRange, bandLevelRange[0], bandLevelRange[bandLevelRange.length - 1]);
|
||||
bands[i] = band;
|
||||
}
|
||||
((MainContract.View) mView).showBandInfo(bands);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBandLevel(Equalizer equalizer) {
|
||||
if (equalizer != null) {
|
||||
int numOfBands = equalizer.getNumberOfBands();
|
||||
short[] bandLevels = new short[numOfBands];
|
||||
for (short i = 0; i < numOfBands; i++) {
|
||||
bandLevels[i] = equalizer.getBandLevel(i);
|
||||
}
|
||||
|
||||
if (mView != null) {
|
||||
((MainContract.View) mView).showBandLevel(bandLevels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Equalizer.OnParameterChangeListener mEqualizerParameterChangeListener = (equalizer, i, i1, i2, i3) -> {
|
||||
Log.d("eq", "onParameterChange : i " + i + ", i1 " + i1 + ", i2 " + i2 + ", i3 " + i3);
|
||||
updateBandLevel(equalizer);
|
||||
};
|
||||
}
|
|
@ -20,6 +20,7 @@ import android.util.DisplayMetrics
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.Constants
|
||||
|
@ -44,6 +45,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|||
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||
import kotlinx.android.synthetic.main.home_content.*
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
@ -119,7 +122,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
actionShuffle.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(requireActivity()), true)
|
||||
lifecycleScope.launch {
|
||||
val songs = async { SongLoader.getAllSongs(requireContext()) }
|
||||
MusicPlayerRemote.openAndShuffleQueue(songs.await(), true)
|
||||
}
|
||||
}
|
||||
|
||||
history.setOnClickListener {
|
||||
|
|
|
@ -16,7 +16,6 @@ package code.name.monkey.retromusic.fragments.settings
|
|||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.TwoStatePreference
|
||||
import code.name.monkey.appthemehelper.ACCENT_COLORS
|
||||
|
@ -54,9 +53,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue(theme))
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
}
|
||||
Handler().postDelayed({
|
||||
requireActivity().recreate()
|
||||
}, 400)
|
||||
requireActivity().recreate()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -78,9 +75,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
ThemeStore.editTheme(requireContext()).accentColor(color).commit()
|
||||
if (VersionUtils.hasNougatMR())
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
Handler().postDelayed({
|
||||
requireActivity().recreate()
|
||||
}, 400)
|
||||
requireActivity().recreate()
|
||||
}
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
|
@ -96,9 +91,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
requireActivity().setTheme(PreferenceUtil.getThemeResFromPrefValue("black"))
|
||||
DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
|
||||
}
|
||||
Handler().postDelayed({
|
||||
requireActivity().recreate()
|
||||
}, 400)
|
||||
requireActivity().recreate()
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -109,9 +102,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
|
|||
ThemeStore.prefs(requireContext()).edit().putBoolean("desaturated_color", desaturated)
|
||||
.apply()
|
||||
PreferenceUtil.getInstance(requireContext()).setDesaturatedColor(desaturated)
|
||||
Handler().postDelayed({
|
||||
requireActivity().recreate()
|
||||
}, 400)
|
||||
requireActivity().recreate()
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package code.name.monkey.retromusic.model;
|
||||
|
||||
public class Band {
|
||||
public final int centerFreq;
|
||||
public short level;
|
||||
|
||||
private final int[] freqRange;
|
||||
public final int freqLow;
|
||||
public final int freqHigh;
|
||||
public final short rangeMin;
|
||||
public final short rangeMax;
|
||||
|
||||
public Band(int centerFreq, short level, int[] freqRange, short rangeMin, short rangeMax) {
|
||||
this.centerFreq = centerFreq;
|
||||
this.level = level;
|
||||
this.freqRange = freqRange;
|
||||
|
||||
if (0 < freqRange.length) {
|
||||
freqLow = freqRange[0];
|
||||
freqHigh = freqRange[freqRange.length - 1];
|
||||
} else {
|
||||
freqLow = 0;
|
||||
freqHigh = 0;
|
||||
}
|
||||
|
||||
this.rangeMin = rangeMin;
|
||||
this.rangeMax = rangeMax;
|
||||
}
|
||||
}
|
|
@ -168,4 +168,4 @@ class PlaybackHandler extends Handler {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package code.name.monkey.retromusic.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
||||
const val THREAD_COUNT = 3
|
||||
|
||||
/**
|
||||
* Global executor pools for the whole application.
|
||||
*
|
||||
* Grouping tasks like this avoids the effects of task starvation (e.g. disk reads don't wait behind
|
||||
* webservice requests).
|
||||
*/
|
||||
open class AppExecutors constructor(
|
||||
val ioContext: CoroutineDispatcher = Dispatchers.IO
|
||||
)
|
|
@ -32,6 +32,7 @@ import code.name.monkey.retromusic.activities.AboutActivity;
|
|||
import code.name.monkey.retromusic.activities.AlbumDetailsActivity;
|
||||
import code.name.monkey.retromusic.activities.ArtistDetailActivity;
|
||||
import code.name.monkey.retromusic.activities.DriveModeActivity;
|
||||
import code.name.monkey.retromusic.activities.EqualizerActivity;
|
||||
import code.name.monkey.retromusic.activities.GenreDetailsActivity;
|
||||
import code.name.monkey.retromusic.activities.LicenseActivity;
|
||||
import code.name.monkey.retromusic.activities.LyricsActivity;
|
||||
|
@ -39,7 +40,6 @@ import code.name.monkey.retromusic.activities.PlayingQueueActivity;
|
|||
import code.name.monkey.retromusic.activities.PlaylistDetailActivity;
|
||||
import code.name.monkey.retromusic.activities.PurchaseActivity;
|
||||
import code.name.monkey.retromusic.activities.SearchActivity;
|
||||
import code.name.monkey.retromusic.activities.SettingsActivity;
|
||||
import code.name.monkey.retromusic.activities.SupportDevelopmentActivity;
|
||||
import code.name.monkey.retromusic.activities.UserInfoActivity;
|
||||
import code.name.monkey.retromusic.activities.WhatsNewActivity;
|
||||
|
@ -139,7 +139,7 @@ public class NavigationUtil {
|
|||
}
|
||||
|
||||
public static void goToSettings(@NonNull Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, SettingsActivity.class), null);
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, EqualizerActivity.class), null);
|
||||
}
|
||||
|
||||
public static void goToSupportDevelopment(@NonNull Activity activity) {
|
||||
|
|
66
app/src/main/res/layout/activity_equalizer.xml
Normal file
66
app/src/main/res/layout/activity_equalizer.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
|
||||
app:title="@string/action_about"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/equalizerToggle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="On"
|
||||
tools:checked="true"
|
||||
android:textAppearance="@style/TextViewSubtitle1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/preset"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:spinnerMode="dialog"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/equalizerToggle" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/bandListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/preset">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bandList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -97,7 +97,8 @@
|
|||
app:retroCornerSize="36dp"
|
||||
app:srcCompat="@drawable/ic_person_flat"
|
||||
app:strokeColor="?attr/colorSurface"
|
||||
app:strokeWidth="2dp" />
|
||||
app:strokeWidth="2dp"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
10
app/src/main/res/layout/dropdown_item.xml
Normal file
10
app/src/main/res/layout/dropdown_item.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.textview.MaterialTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textAppearance="@style/TextViewBody1"
|
||||
tools:text="@tools:sample/full_names" />
|
32
app/src/main/res/layout/equalizer_slider.xml
Normal file
32
app/src/main/res/layout/equalizer_slider.xml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?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="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/frequency"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:maxLines="1" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/level"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:maxLines="1" />
|
||||
|
||||
</LinearLayout>
|
27
app/src/main/res/layout/freq_level_item.xml
Normal file
27
app/src/main/res/layout/freq_level_item.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?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="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/centerFreq"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="12Khz" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSeekBar
|
||||
android:id="@+id/seekBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/currentLevel"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
|
@ -844,5 +844,6 @@
|
|||
<string name="start_payment">Start payment</string>
|
||||
<string name="pref_title_expand_now_playing_panel">Show now playing screen</string>
|
||||
<string name="pref_summary_expand_now_playing_panel">Clicking on the notification will show now playing screen instead of the home screen</string>
|
||||
<string name="custom">Custom</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
<style name="Theme.RetroMusic" parent="Theme.RetroMusic.Base" />
|
||||
|
||||
<style name="Theme.RetroMusic.Light" parent="Theme.RetroMusic.Base.Light" >
|
||||
<style name="Theme.RetroMusic.Light" parent="Theme.RetroMusic.Base.Light">
|
||||
<item name="android:windowBackground">@color/window_color_light</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black" >
|
||||
<style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black">
|
||||
<item name="android:windowBackground">@color/window_color_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive" >
|
||||
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive">
|
||||
<item name="android:windowBackground">@color/window_color</item>
|
||||
</style>
|
||||
|
||||
|
@ -211,4 +211,10 @@
|
|||
<item name="android:background">@color/md_white_1000</item>
|
||||
<item name="android:textColor">@color/md_red_400</item>
|
||||
</style>
|
||||
|
||||
<style name="AppRadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
|
||||
<item name="android:textSize">16dp</item>
|
||||
<item name="android:textColor">#b4b4ba</item>
|
||||
<item name="android:minHeight">40dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -10,22 +10,14 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
/**
|
||||
* @author Aidan Follestad (afollestad)
|
||||
*/
|
||||
class ATESwitch : SwitchCompat {
|
||||
class ATESwitch @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : SwitchCompat(context, attrs, defStyleAttr) {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context) {
|
||||
ATH.setTint(this, ThemeStore.accentColor(context))
|
||||
init {
|
||||
ATH.setTint(this, ThemeStore.accentColor(getContext()))
|
||||
}
|
||||
|
||||
override fun isShown(): Boolean {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue