From 0f3b5525375e7eab2dc64325c80d919cce67240d Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 17 Dec 2018 11:53:00 +0530 Subject: [PATCH 1/2] removed bug in onClick on track in trackinfo --- app/build.gradle | 2 +- .../bhandari/m/trackInfo/TrackInfoActivity.kt | 23 +++++++++++++++---- app/version.properties | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8f989482..e3045f41 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ buildscript { apply plugin: 'com.github.triplet.play' // Load keystore -def keystorePropertiesFile = rootProject.file("C:\\Users\\Captain Jack\\AndroidStudioProjects\\keys\\keystore.properties") +def keystorePropertiesFile = rootProject.file("/Users/amit/studioprojects/keys/keystore.properties") def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) diff --git a/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt b/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt index bb4812df..b98d1b7d 100644 --- a/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt +++ b/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt @@ -159,7 +159,7 @@ class TrackInfoActivity: AppCompatActivity() , TrackInfo.Callback{ trackInfo.similarTracks ?.track ?.map { TracksAdapter.TrackItem(it.name - , "Match ${it.match*100}%" + , "${it.artist.name} | Match ${String.format("%.3f", it.match*100)}%" , it.image.last().text , it.url) } ?: listOf()) recyclerSimilarTracks.layoutManager = LinearLayoutManager(this) @@ -179,10 +179,16 @@ class TrackInfoActivity: AppCompatActivity() , TrackInfo.Callback{ } - fun launchLyricsView(){ + fun launchLyricsView(trackTitle: String, trackArtist: String){ val intent = Intent(this, ActivityLyricView::class.java) - intent.putExtra("track_title", trackItem.title) - intent.putExtra("artist", trackItem.artist) + intent.putExtra("track_title", trackTitle) + if(trackArtist.isEmpty()){ + //clicked on album traklist item + intent.putExtra("artist", trackItem.artist) + }else{ + //clicked on one of track from similar tracklist + intent.putExtra("artist", trackArtist) + } startActivity(intent) overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left) } @@ -244,7 +250,14 @@ class TrackInfoActivity: AppCompatActivity() , TrackInfo.Callback{ override fun onClick(p0: View?) { when(p0?.id){ - R.id.trackInfo, R.id.playCount, R.id.imageView -> (context as TrackInfoActivity).launchLyricsView() + R.id.trackInfo, R.id.playCount, R.id.imageView -> { + //below code is ugly, but it works. Will refactor later + if(secondaryText.text.contains("Duration")) + (context as TrackInfoActivity).launchLyricsView(tracks[adapterPosition].trackTitle, "") + else + (context as TrackInfoActivity).launchLyricsView(tracks[adapterPosition].trackTitle + , tracks[adapterPosition].secondaryText.substring(0,tracks[adapterPosition].secondaryText.indexOf('|'))) + } R.id.more -> (context as TrackInfoActivity).openUrl(Uri.parse(tracks[adapterPosition].clickUrl)) } diff --git a/app/version.properties b/app/version.properties index 949e1b6e..0853ec1c 100644 --- a/app/version.properties +++ b/app/version.properties @@ -1,4 +1,4 @@ -#Sun Dec 16 12:09:06 IST 2018 +#Mon Dec 17 11:49:44 IST 2018 VERSION_NUMBER=187 -VERSION_BUILD=366 +VERSION_BUILD=372 VERSION_PATCH=0 From 1651319d4303eb41248f7e0a3b7e19ed42d47e74 Mon Sep 17 00:00:00 2001 From: Amit Date: Mon, 17 Dec 2018 11:58:08 +0530 Subject: [PATCH 2/2] added new release text --- .../music/player/bhandari/m/trackInfo/TrackInfoActivity.kt | 2 +- app/src/main/res/values/strings.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt b/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt index b98d1b7d..7c2fec1f 100644 --- a/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt +++ b/app/src/main/java/com/music/player/bhandari/m/trackInfo/TrackInfoActivity.kt @@ -159,7 +159,7 @@ class TrackInfoActivity: AppCompatActivity() , TrackInfo.Callback{ trackInfo.similarTracks ?.track ?.map { TracksAdapter.TrackItem(it.name - , "${it.artist.name} | Match ${String.format("%.3f", it.match*100)}%" + , "${it.artist.name} | Match ${String.format("%.2f", it.match*100)}%" , it.image.last().text , it.url) } ?: listOf()) recyclerSimilarTracks.layoutManager = LinearLayoutManager(this) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0d79d178..5eed0339 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -611,8 +611,9 @@ #43abc9 -