From 4d31c4ccc3f0a9a6ecfe0c571b1de57337a61534 Mon Sep 17 00:00:00 2001 From: Prathamesh More Date: Tue, 14 Dec 2021 23:18:42 +0530 Subject: [PATCH] Updated Open Source Licenses --- app/src/main/assets/oldindex.html | 38 +++++++++------ .../retromusic/activities/LicenseActivity.kt | 31 ++++++------ .../retromusic/activities/WhatsNewActivity.kt | 12 +++-- .../monkey/retromusic/helper/M3UWriter.kt | 48 +++++++++---------- app/src/main/res/layout/activity_license.xml | 19 ++++---- 5 files changed, 78 insertions(+), 70 deletions(-) diff --git a/app/src/main/assets/oldindex.html b/app/src/main/assets/oldindex.html index 367da632a..7f6f8d8f8 100644 --- a/app/src/main/assets/oldindex.html +++ b/app/src/main/assets/oldindex.html @@ -24,40 +24,48 @@ padding-top: 8px; } - - -

Phonograph by Karim Abou Zeid

-

Material Dialogs and Cab - by Aidan Michael Follestad

AOSP Support Librariesby AOSP contributors

+ title="AOSP Support Libraries">AOSP Support Libraries by AOSP contributors

Glide by Sam Judd

Retrofit by Square team

+

OkHttp by Square team

+

Koin by Arnaud Giuliani

+

Material Dialogs and Cab + by Aidan Michael Follestad

Material Contextual Action Bar by Aidan Michael Follestad

-

OkHttp by Square team

-

- CircleImageView by Henning Dodenhof

-

- MaterialProgressBar by Zhang Hai

Android In-App Billing v3 Library by Henning Dodenhof

Advanced RecyclerView by Haruki Hasegawa

-

Android-ObservableScrollView by Soichiro - Kashima

+

Custom Activity on Crash by Eduard Ereza Martínez +

+

NanoHttpd by NanoHttpd Team

+

Circular Seekbar by Tankery

+

jAudioTagger by Kanedias

+

Android Fast Scroll by Zhang Hai

+

Image Picker by Dhaval Patel

+

Material Intro by Jan Heinrich Reimer

+

Slidr by Drew Heavner

Icons by Austin Andrews

Material Design City Wallpaper

- diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/LicenseActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/LicenseActivity.kt index 11cd201ca..52498d447 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/LicenseActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/LicenseActivity.kt @@ -16,8 +16,6 @@ package code.name.monkey.retromusic.activities import android.graphics.Color import android.os.Bundle import android.view.MenuItem -import android.webkit.WebView -import androidx.appcompat.widget.Toolbar import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor import code.name.monkey.appthemehelper.util.ATHUtil.isWindowBackgroundDark import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor @@ -25,29 +23,31 @@ import code.name.monkey.appthemehelper.util.ColorUtil.lightenColor import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.base.AbsThemeActivity +import code.name.monkey.retromusic.databinding.ActivityLicenseBinding +import code.name.monkey.retromusic.extensions.drawAboveSystemBars +import code.name.monkey.retromusic.extensions.drawAboveSystemBarsWithPadding import java.io.BufferedReader import java.io.InputStreamReader import java.nio.charset.StandardCharsets /** Created by hemanths on 2019-09-27. */ class LicenseActivity : AbsThemeActivity() { + private lateinit var binding: ActivityLicenseBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_license) - val toolbar = findViewById(R.id.toolbar) - setSupportActionBar(toolbar) - ToolbarContentTintHelper.colorBackButton(toolbar) - toolbar.setBackgroundColor(resolveColor(this, R.attr.colorSurface)) - val webView = findViewById(R.id.license) + binding = ActivityLicenseBinding.inflate(layoutInflater) + setContentView(binding.root) + setSupportActionBar(binding.toolbar) + ToolbarContentTintHelper.colorBackButton(binding.toolbar) try { val buf = StringBuilder() val json = assets.open("oldindex.html") - val br = BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8)) - var str: String? - while (br.readLine().also { str = it } != null) { - buf.append(str) + BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8)).use { br -> + var str: String? + while (br.readLine().also { str = it } != null) { + buf.append(str) + } } - br.close() // Inject color values for WebView body background and links val isDark = isWindowBackgroundDark(this) @@ -72,12 +72,13 @@ class LicenseActivity : AbsThemeActivity() { lightenColor(accentColor(this)) ) ) - webView.loadData(changeLog, "text/html", "UTF-8") + binding.license.loadData(changeLog, "text/html", "UTF-8") } catch (e: Throwable) { - webView.loadData( + binding.license.loadData( "

Unable to load

" + e.localizedMessage + "

", "text/html", "UTF-8" ) } + binding.license.drawAboveSystemBars() } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.kt index 40200eba0..b1c979076 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/WhatsNewActivity.kt @@ -17,6 +17,7 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.activities.base.AbsThemeActivity import code.name.monkey.retromusic.databinding.ActivityWhatsNewBinding import code.name.monkey.retromusic.extensions.accentColor +import code.name.monkey.retromusic.extensions.drawAboveSystemBars import code.name.monkey.retromusic.extensions.setLightStatusBarAuto import code.name.monkey.retromusic.extensions.setTaskDescriptionColorAuto import code.name.monkey.retromusic.util.PreferenceUtil.lastVersion @@ -38,12 +39,12 @@ class WhatsNewActivity : AbsThemeActivity() { try { val buf = StringBuilder() val json = assets.open("retro-changelog.html") - val br = BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8)) - var str: String? - while (br.readLine().also { str = it } != null) { - buf.append(str) + BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8)).use { br -> + var str: String? + while (br.readLine().also { str = it } != null) { + buf.append(str) + } } - br.close() // Inject color values for WebView body background and links val isDark = isWindowBackgroundDark(this) @@ -100,6 +101,7 @@ class WhatsNewActivity : AbsThemeActivity() { binding.tgFab.extend() } } + binding.webView.drawAboveSystemBars() } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt b/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt index f6044b2de..c1b6cfee3 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt @@ -31,15 +31,15 @@ object M3UWriter : M3UConstants { val file = File(dir, playlist.name + "." + M3UConstants.EXTENSION) val songs = playlist.getSongs() if (songs.isNotEmpty()) { - val bw = BufferedWriter(FileWriter(file)) - bw.write(M3UConstants.HEADER) - for (song in songs) { - bw.newLine() - bw.write(M3UConstants.ENTRY + song.duration + M3UConstants.DURATION_SEPARATOR + song.artistName + " - " + song.title) - bw.newLine() - bw.write(song.data) + BufferedWriter(FileWriter(file)).use { bw -> + bw.write(M3UConstants.HEADER) + for (song in songs) { + bw.newLine() + bw.write(M3UConstants.ENTRY + song.duration + M3UConstants.DURATION_SEPARATOR + song.artistName + " - " + song.title) + bw.newLine() + bw.write(song.data) + } } - bw.close() } return file } @@ -54,15 +54,15 @@ object M3UWriter : M3UConstants { it.songPrimaryKey }.toSongs() if (songs.isNotEmpty()) { - val bufferedWriter = BufferedWriter(FileWriter(file)) - bufferedWriter.write(M3UConstants.HEADER) - songs.forEach { - bufferedWriter.newLine() - bufferedWriter.write(M3UConstants.ENTRY + it.duration + M3UConstants.DURATION_SEPARATOR + it.artistName + " - " + it.title) - bufferedWriter.newLine() - bufferedWriter.write(it.data) + BufferedWriter(FileWriter(file)).use { bw-> + bw.write(M3UConstants.HEADER) + songs.forEach { + bw.newLine() + bw.write(M3UConstants.ENTRY + it.duration + M3UConstants.DURATION_SEPARATOR + it.artistName + " - " + it.title) + bw.newLine() + bw.write(it.data) + } } - bufferedWriter.close() } return file } @@ -72,15 +72,15 @@ object M3UWriter : M3UConstants { it.songPrimaryKey }.toSongs() if (songs.isNotEmpty()) { - val bufferedWriter = outputStream.bufferedWriter() - bufferedWriter.write(M3UConstants.HEADER) - songs.forEach { - bufferedWriter.newLine() - bufferedWriter.write(M3UConstants.ENTRY + it.duration + M3UConstants.DURATION_SEPARATOR + it.artistName + " - " + it.title) - bufferedWriter.newLine() - bufferedWriter.write(it.data) + outputStream.bufferedWriter().use{ bw-> + bw.write(M3UConstants.HEADER) + songs.forEach { + bw.newLine() + bw.write(M3UConstants.ENTRY + it.duration + M3UConstants.DURATION_SEPARATOR + it.artistName + " - " + it.title) + bw.newLine() + bw.write(it.data) + } } - bufferedWriter.close() } outputStream.flush() outputStream.close() diff --git a/app/src/main/res/layout/activity_license.xml b/app/src/main/res/layout/activity_license.xml index 25569ea28..57555118e 100644 --- a/app/src/main/res/layout/activity_license.xml +++ b/app/src/main/res/layout/activity_license.xml @@ -6,23 +6,17 @@ android:layout_height="match_parent" android:orientation="vertical"> - - + android:background="?attr/colorSurface" + android:fitsSystemWindows="true"> + android:layout_height="wrap_content" + android:scrollbars="none" + android:fitsSystemWindows="true" + app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />