update Commons, kotlin, gradle etc

This commit is contained in:
tibbi 2017-11-30 00:01:54 +01:00
parent ff3fc6c93a
commit 1a752eb757
9 changed files with 30 additions and 60 deletions

View file

@ -3,15 +3,16 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 26 compileSdkVersion 27
buildToolsVersion "26.0.2" buildToolsVersion "27.0.1"
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.musicplayer" applicationId "com.simplemobiletools.musicplayer"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 26 targetSdkVersion 27
versionCode 32 versionCode 32
versionName "2.3.0" versionName "2.3.0"
setProperty("archivesBaseName", "music-player")
} }
signingConfigs { signingConfigs {
@ -37,26 +38,12 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.35.4' implementation 'com.simplemobiletools:commons:3.0.3'
compile 'com.squareup:otto:1.3.8' implementation 'com.squareup:otto:1.3.8'
compile 'com.facebook.stetho:stetho:1.4.2' implementation 'com.facebook.stetho:stetho:1.5.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }
buildscript { Properties props = new Properties()
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()
def propFile = new File('signing.properties') def propFile = new File('signing.properties')
if (propFile.canRead()) { if (propFile.canRead()) {
props.load(new FileInputStream(propFile)) props.load(new FileInputStream(propFile))

View file

@ -2,7 +2,8 @@
<manifest <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.simplemobiletools.musicplayer"> package="com.simplemobiletools.musicplayer"
android:installLocation="auto">
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

View file

@ -17,7 +17,6 @@ import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.commons.models.Release import com.simplemobiletools.commons.models.Release
import com.simplemobiletools.commons.views.MyScalableRecyclerView
import com.simplemobiletools.musicplayer.BuildConfig import com.simplemobiletools.musicplayer.BuildConfig
import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.adapters.SongAdapter import com.simplemobiletools.musicplayer.adapters.SongAdapter
@ -283,9 +282,8 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
setDrawable(context.resources.getDrawable(R.drawable.divider)) setDrawable(context.resources.getDrawable(R.drawable.divider))
addItemDecoration(this) addItemDecoration(this)
} }
isDragSelectionEnabled = true //isDragSelectionEnabled = true
} }
setupRecyclerViewListener()
} else { } else {
val state = (songs_list.layoutManager as LinearLayoutManager).onSaveInstanceState() val state = (songs_list.layoutManager as LinearLayoutManager).onSaveInstanceState()
(currAdapter as SongAdapter).apply { (currAdapter as SongAdapter).apply {
@ -334,28 +332,6 @@ class MainActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListener {
toast(R.string.no_storage_permissions) 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 { private val itemOperationsListener = object : SongAdapter.ItemOperationsListener {
override fun itemLongClicked(position: Int) { override fun itemLongClicked(position: Int) {
songs_list.setDragSelectActive(position) songs_list.setDragSelectActive(position)

View file

@ -20,7 +20,7 @@ import kotlinx.android.synthetic.main.widget.*
import kotlinx.android.synthetic.main.widget_config.* import kotlinx.android.synthetic.main.widget_config.*
import kotlinx.android.synthetic.main.widget_controls.* import kotlinx.android.synthetic.main.widget_controls.*
class WidgetConfigureActivity : AppCompatActivity() { class WidgetConfigureActivity : SimpleActivity() {
private var mBgAlpha = 0.0f private var mBgAlpha = 0.0f
private var mWidgetId = 0 private var mWidgetId = 0
private var mBgColor = 0 private var mBgColor = 0
@ -28,6 +28,7 @@ class WidgetConfigureActivity : AppCompatActivity() {
private var mTextColor = 0 private var mTextColor = 0
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setResult(Activity.RESULT_CANCELED) setResult(Activity.RESULT_CANCELED)
setContentView(R.layout.widget_config) setContentView(R.layout.widget_config)

View file

@ -8,7 +8,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.RemoteViews 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.commons.extensions.setBackgroundColor
import com.simplemobiletools.musicplayer.R import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.activities.SplashActivity import com.simplemobiletools.musicplayer.activities.SplashActivity
@ -97,7 +97,7 @@ class MyWidgetProvider : AppWidgetProvider() {
private fun updatePlayPauseButton(views: RemoteViews, isPlaying: Boolean) { private fun updatePlayPauseButton(views: RemoteViews, isPlaying: Boolean) {
val drawableId = if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play val drawableId = if (isPlaying) R.drawable.ic_pause else R.drawable.ic_play
val widgetTextColor = mContext!!.config.widgetTextColor 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) views.setImageViewBitmap(R.id.play_pause_btn, icon)
} }
@ -111,8 +111,8 @@ class MyWidgetProvider : AppWidgetProvider() {
setBackgroundColor(R.id.widget_holder, widgetBgColor) setBackgroundColor(R.id.widget_holder, widgetBgColor)
setTextColor(R.id.song_title, widgetTextColor) setTextColor(R.id.song_title, widgetTextColor)
setTextColor(R.id.song_artist, widgetTextColor) setTextColor(R.id.song_artist, widgetTextColor)
setImageViewBitmap(R.id.previous_btn, res.getColoredIcon(widgetTextColor, R.drawable.ic_previous)) setImageViewBitmap(R.id.previous_btn, res.getColoredBitmap(R.drawable.ic_previous, widgetTextColor))
setImageViewBitmap(R.id.next_btn, res.getColoredIcon(widgetTextColor, R.drawable.ic_next)) setImageViewBitmap(R.id.next_btn, res.getColoredBitmap(R.drawable.ic_next, widgetTextColor))
} }
} }

View file

@ -15,7 +15,7 @@ import android.net.Uri
import android.os.Handler import android.os.Handler
import android.os.PowerManager import android.os.PowerManager
import android.provider.MediaStore import android.provider.MediaStore
import android.support.v7.app.NotificationCompat import android.support.v4.app.NotificationCompat
import android.telephony.PhoneStateListener import android.telephony.PhoneStateListener
import android.telephony.TelephonyManager import android.telephony.TelephonyManager
import android.util.Log import android.util.Log
@ -307,7 +307,7 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
} }
val notification = NotificationCompat.Builder(this) val notification = NotificationCompat.Builder(this)
.setStyle(NotificationCompat.MediaStyle().setShowActionsInCompactView(playPauseButtonPosition, nextButtonPosition)) .setStyle(android.support.v4.media.app.NotificationCompat.MediaStyle().setShowActionsInCompactView(playPauseButtonPosition, nextButtonPosition))
.setContentTitle(title) .setContentTitle(title)
.setContentText(artist) .setContentText(artist)
.setSmallIcon(R.drawable.ic_headset_small) .setSmallIcon(R.drawable.ic_headset_small)

View file

@ -100,7 +100,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/song_progress"> android:layout_below="@+id/song_progress">
<com.simplemobiletools.commons.views.MyScalableRecyclerView <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/songs_list" android:id="@+id/songs_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -145,7 +145,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:alpha="0.7" android:alpha="0.7"
android:background="@drawable/breadcrumb_gradient" android:background="@drawable/button_background"
android:gravity="center" android:gravity="center"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:text="@string/add_folder_to_playlist" android:text="@string/add_folder_to_playlist"

View file

@ -1,11 +1,16 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.2.0'
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@ -15,8 +20,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
google()
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
} }
} }

View file

@ -1,6 +1,6 @@
#Wed Mar 22 20:27:07 CET 2017 #Wed Nov 29 23:51:25 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip