From 1a752eb7573c7dcd82cf9f82c323e20cacaa7fe9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 30 Nov 2017 00:01:54 +0100 Subject: [PATCH] update Commons, kotlin, gradle etc --- app/build.gradle | 29 +++++-------------- app/src/main/AndroidManifest.xml | 3 +- .../musicplayer/activities/MainActivity.kt | 26 +---------------- .../activities/WidgetConfigureActivity.kt | 3 +- .../musicplayer/helpers/MyWidgetProvider.kt | 8 ++--- .../musicplayer/services/MusicService.kt | 4 +-- app/src/main/res/layout/activity_main.xml | 4 +-- build.gradle | 9 ++++-- gradle/wrapper/gradle-wrapper.properties | 4 +-- 9 files changed, 30 insertions(+), 60 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f348ef8c..f64cc445 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,15 +3,16 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 26 - buildToolsVersion "26.0.2" + compileSdkVersion 27 + buildToolsVersion "27.0.1" defaultConfig { applicationId "com.simplemobiletools.musicplayer" minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 32 versionName "2.3.0" + setProperty("archivesBaseName", "music-player") } signingConfigs { @@ -37,26 +38,12 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.35.4' - compile 'com.squareup:otto:1.3.8' - compile 'com.facebook.stetho:stetho:1.4.2' - compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'com.simplemobiletools:commons:3.0.3' + implementation 'com.squareup:otto:1.3.8' + implementation 'com.facebook.stetho:stetho:1.5.0' } -buildscript { - ext.kotlin_version = '1.1.51' - repositories { - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" - } -} - -def Properties props = new Properties() +Properties props = new Properties() def propFile = new File('signing.properties') if (propFile.canRead()) { props.load(new FileInputStream(propFile)) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 47e740ea..31649814 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,8 @@ + package="com.simplemobiletools.musicplayer" + android:installLocation="auto"> diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt index 35683c95..6fe75fa9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/MainActivity.kt @@ -17,7 +17,6 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.Release -import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.musicplayer.BuildConfig import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.adapters.SongAdapter @@ -283,9 +282,8 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener { setDrawable(context.resources.getDrawable(R.drawable.divider)) addItemDecoration(this) } - isDragSelectionEnabled = true + //isDragSelectionEnabled = true } - setupRecyclerViewListener() } else { val state = (songs_list.layoutManager as LinearLayoutManager).onSaveInstanceState() (currAdapter as SongAdapter).apply { @@ -334,28 +332,6 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener { toast(R.string.no_storage_permissions) } - private fun setupRecyclerViewListener() { - songs_list.listener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { - override fun zoomIn() { - - } - - override fun zoomOut() { - - } - - override fun selectItem(position: Int) { - getRecyclerAdapter().selectItem(position) - } - - override fun selectRange(initialSelection: Int, lastDraggedIndex: Int, minReached: Int, maxReached: Int) { - getRecyclerAdapter().selectRange(initialSelection, lastDraggedIndex, minReached, maxReached) - } - } - } - - private fun getRecyclerAdapter() = (songs_list.adapter as SongAdapter) - private val itemOperationsListener = object : SongAdapter.ItemOperationsListener { override fun itemLongClicked(position: Int) { songs_list.setDragSelectActive(position) diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/WidgetConfigureActivity.kt index 7f1c1bdf..9b3f546e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/WidgetConfigureActivity.kt @@ -20,7 +20,7 @@ import kotlinx.android.synthetic.main.widget.* import kotlinx.android.synthetic.main.widget_config.* import kotlinx.android.synthetic.main.widget_controls.* -class WidgetConfigureActivity : AppCompatActivity() { +class WidgetConfigureActivity : SimpleActivity() { private var mBgAlpha = 0.0f private var mWidgetId = 0 private var mBgColor = 0 @@ -28,6 +28,7 @@ class WidgetConfigureActivity : AppCompatActivity() { private var mTextColor = 0 public override fun onCreate(savedInstanceState: Bundle?) { + useDynamicTheme = false super.onCreate(savedInstanceState) setResult(Activity.RESULT_CANCELED) setContentView(R.layout.widget_config) diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/MyWidgetProvider.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/MyWidgetProvider.kt index 83edde5b..de83a167 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/MyWidgetProvider.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/helpers/MyWidgetProvider.kt @@ -8,7 +8,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import android.widget.RemoteViews -import com.simplemobiletools.commons.extensions.getColoredIcon +import com.simplemobiletools.commons.extensions.getColoredBitmap import com.simplemobiletools.commons.extensions.setBackgroundColor import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.activities.SplashActivity @@ -97,7 +97,7 @@ class MyWidgetProvider : AppWidgetProvider() { private fun updatePlayPauseButton(views: RemoteViews, isPlaying: Boolean) { val drawableId = if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play val widgetTextColor = mContext!!.config.widgetTextColor - val icon = mContext!!.resources.getColoredIcon(widgetTextColor, drawableId) + val icon = mContext!!.resources.getColoredBitmap(drawableId, widgetTextColor) views.setImageViewBitmap(R.id.play_pause_btn, icon) } @@ -111,8 +111,8 @@ class MyWidgetProvider : AppWidgetProvider() { setBackgroundColor(R.id.widget_holder, widgetBgColor) setTextColor(R.id.song_title, widgetTextColor) setTextColor(R.id.song_artist, widgetTextColor) - setImageViewBitmap(R.id.previous_btn, res.getColoredIcon(widgetTextColor, R.drawable.ic_previous)) - setImageViewBitmap(R.id.next_btn, res.getColoredIcon(widgetTextColor, R.drawable.ic_next)) + setImageViewBitmap(R.id.previous_btn, res.getColoredBitmap(R.drawable.ic_previous, widgetTextColor)) + setImageViewBitmap(R.id.next_btn, res.getColoredBitmap(R.drawable.ic_next, widgetTextColor)) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt index f2a16f98..549485f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/services/MusicService.kt @@ -15,7 +15,7 @@ import android.net.Uri import android.os.Handler import android.os.PowerManager import android.provider.MediaStore -import android.support.v7.app.NotificationCompat +import android.support.v4.app.NotificationCompat import android.telephony.PhoneStateListener import android.telephony.TelephonyManager import android.util.Log @@ -307,7 +307,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr } val notification = NotificationCompat.Builder(this) - .setStyle(NotificationCompat.MediaStyle().setShowActionsInCompactView(playPauseButtonPosition, nextButtonPosition)) + .setStyle(android.support.v4.media.app.NotificationCompat.MediaStyle().setShowActionsInCompactView(playPauseButtonPosition, nextButtonPosition)) .setContentTitle(title) .setContentText(artist) .setSmallIcon(R.drawable.ic_headset_small) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 707a31e4..bfc694e6 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -100,7 +100,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/song_progress"> -