Skip to content

Commit

Permalink
Kotlin Conversion amit-bhandari#1
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaaatt committed Dec 19, 2021
1 parent bb4f82c commit 5042a0a
Show file tree
Hide file tree
Showing 246 changed files with 42,107 additions and 38,272 deletions.
30 changes: 8 additions & 22 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ android {
}
}

buildFeatures {
viewBinding true
}

lintOptions {
abortOnError = false
disable 'MissingTranslation'
Expand All @@ -54,25 +58,12 @@ android {
dataBinding {
enabled = true
}

kapt {
generateStubs = true
}
}

dependencies {
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.4.0'
//noinspection GradleCompatible
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//noinspection GradleCompatible
implementation 'com.google.android.material:material:1.4.0'
//noinspection GradleCompatible
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.13.2'

//small animations for lyric loading
implementation 'com.wang.avi:library:2.1.3'

//slide up panel for now playing view
implementation 'com.sothree.slidinguppanel:library:3.4.0'
Expand Down Expand Up @@ -100,11 +91,6 @@ dependencies {
//shine animation after clicking fav
implementation 'com.sackcentury:shinebutton:1.0.0'

//dialogs
//implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation project(':dialogs')

//firebase
//implementation 'com.google.firebase:firebase-ads:17.1.3'
implementation 'com.google.firebase:firebase-core:20.0.2'
implementation 'com.google.android.gms:play-services-auth:20.0.0'
Expand All @@ -128,12 +114,9 @@ dependencies {
implementation 'com.jakewharton:butterknife:10.2.3'
kapt 'com.jakewharton:butterknife-compiler:10.2.3'

//font
//implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//implementation 'com.github.takahirom.downloadable.calligraphy:downloadable-calligraphy:0.1.3'

implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
implementation 'com.wang.avi:library:2.1.3'

//flow layout
implementation 'com.google.android:flexbox:1.0.0'
Expand All @@ -142,4 +125,7 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.3'

//Tests
testImplementation 'junit:junit:4.13.2'
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.music.player.bhandari.m.DBHelper

import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import com.google.gson.Gson
import com.music.player.bhandari.m.equalizer.EqualizerSetting

/**
* Copyright 2017 Amit Bhandari AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class DbHelperEqualizer constructor(context: Context?) :
SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {

override fun onCreate(db: SQLiteDatabase) {
db.execSQL(TABLE_CREATE)
val cursor: Cursor = db.query(TABLE_NAME, null, null, null, null, null, null)
//insert default presets if not already added
if (cursor.count == 0) {
insertPreset(db, "Flat", EqualizerSetting(16, 16, 16, 16, 16, 16,
16, 0, 0, 0))
insertPreset(db, "Bass Only", EqualizerSetting(31, 31, 31, 0, 0, 0,
31, 0, 0, 0))
insertPreset(db, "Treble Only", EqualizerSetting(0, 0, 0, 31, 31, 31,
0, 0, 0, 0))
insertPreset(db, "Rock", EqualizerSetting(16, 18, 16, 17, 19, 20,
22, 0, 0, 0))
insertPreset(db, "Grunge", EqualizerSetting(13, 16, 18, 19, 20, 17,
13, 0, 0, 0))
insertPreset(db, "Metal", EqualizerSetting(12, 16, 16, 16, 20, 24,
16, 0, 0, 0))
insertPreset(db, "Dance", EqualizerSetting(14, 18, 20, 17, 16, 20,
23, 0, 0, 0))
insertPreset(db, "Country", EqualizerSetting(16, 16, 18, 20, 17, 19,
20, 0, 0, 0))
insertPreset(db, "Jazz", EqualizerSetting(16, 16, 18, 18, 18, 16,
20, 0, 0, 0))
insertPreset(db, "Speech", EqualizerSetting(14, 16, 17, 14, 13, 15,
16, 0, 0, 0))
insertPreset(db, "Classical", EqualizerSetting(16, 18, 18, 16, 16, 17,
18, 0, 0, 0))
insertPreset(db, "Blues", EqualizerSetting(16, 18, 19, 20, 17, 18,
16, 0, 0, 0))
insertPreset(db, "Opera", EqualizerSetting(16, 17, 19, 20, 16, 24,
18, 0, 0, 0))
insertPreset(db, "Swing", EqualizerSetting(15, 16, 18, 20, 18, 17,
16, 0, 0, 0))
insertPreset(db, "Acoustic", EqualizerSetting(17, 18, 16, 19, 17, 17,
14, 0, 0, 0))
insertPreset(db, "New Age", EqualizerSetting(16, 19, 15, 18, 16, 16,
18, 0, 0, 0))
}
cursor.close()
}

override fun onUpgrade(db: SQLiteDatabase, i: Int, i1: Int) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME)
onCreate(db)
}

fun insertPreset(
db: SQLiteDatabase,
preset_name: String?,
equalizerSetting: EqualizerSetting?
) {
val values: ContentValues = ContentValues()
values.put(EQU_PRESET_NAME, preset_name)
values.put(EQU_SETTING_STRING, Gson().toJson(equalizerSetting))
db.insert(TABLE_NAME, null, values)
}

companion object {
private val DATABASE_VERSION: Int = 3
private val DATABASE_NAME: String = "equalizer_setting"

//EQUALIZER SETTING OBJECT WILL BE STORED AS STRING
private val EQU_ID: String = "_id"
val EQU_PRESET_NAME: String = "equ_preset_name"
val EQU_SETTING_STRING: String = "equ_setting_string"
val TABLE_NAME: String = "equalizer_table"
private var TABLE_CREATE: String = ""
}

init {
TABLE_CREATE =
"CREATE TABLE IF NOT EXISTS $TABLE_NAME ($EQU_ID INTEGER PRIMARY KEY, $EQU_PRESET_NAME TEXT, $EQU_SETTING_STRING TEXT);"
}
}

This file was deleted.

Loading

0 comments on commit 5042a0a

Please sign in to comment.