commit 89c45e0de7e143af2881b27184336420f9b814eb Author: shabinder Date: Mon Dec 28 15:41:36 2020 +0530 Initial Commit diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 00000000..7a5e3730 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,117 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' + id 'kotlin-kapt' +} + +kapt { + correctErrorTypes = true + useBuildCache = true +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.example.composelearn" + minSdkVersion 22 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true + + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + useIR = true + } + + buildFeatures { + compose true + } + + composeOptions { + kotlinCompilerExtensionVersion compose_version + kotlinCompilerVersion '1.4.21' + } +} + +dependencies { + + //Android + implementation "androidx.core:core-ktx:1.5.0-alpha05" + implementation "androidx.palette:palette-ktx:1.0.0" + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.2.1' + + //Compose + implementation "androidx.compose.ui:ui:$compose_version" + implementation "androidx.compose.material:material:$compose_version" + implementation "androidx.compose.material:material-icons-extended:$compose_version" + implementation "androidx.compose.ui:ui-tooling:$compose_version" + + //Lifecycle + implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-extensions-ktx:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" + + //Coroutines + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" + + //Room + kapt "androidx.room:room-compiler:$room_version" + implementation "androidx.room:room-runtime-ktx:$room_version" + implementation "androidx.room:room-ktx:$room_version" + + //Okhttp + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + + //Retrofit + implementation 'com.squareup.retrofit2:retrofit:2.9.0' + + //Json + implementation 'com.squareup.moshi:moshi:1.11.0' + implementation 'com.squareup.moshi:moshi-kotlin:1.11.0' + implementation "com.squareup.retrofit2:converter-moshi:2.9.0" + implementation "com.squareup.retrofit2:converter-scalars:2.9.0" + implementation 'com.beust:klaxon:5.4' + + //Coil-Image Loading + implementation "dev.chrisbanes.accompanist:accompanist-coil:$coil_version" + implementation "dev.chrisbanes.accompanist:accompanist-insets:$coil_version" + + //Extras + implementation 'me.xdrop:fuzzywuzzy:1.3.1' + implementation 'com.mpatric:mp3agic:0.9.1' + implementation "androidx.tonyodev.fetch2:xfetch2:3.1.5" + implementation 'com.github.sealedtx:java-youtube-downloader:2.4.4' + + //Test + testImplementation 'junit:junit:4.13.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + //Desugaring + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.1" +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 00000000..cdc313f0 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/composelearn/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/composelearn/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..86e089c6 --- /dev/null +++ b/app/src/androidTest/java/com/example/composelearn/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.composelearn + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.composelearn", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..ee1bc357 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/MainActivity.kt b/app/src/main/java/com/example/composelearn/MainActivity.kt new file mode 100644 index 00000000..802d4ca0 --- /dev/null +++ b/app/src/main/java/com/example/composelearn/MainActivity.kt @@ -0,0 +1,47 @@ +package com.example.composelearn + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Surface +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.setContent +import androidx.compose.ui.tooling.preview.Preview +import androidx.core.view.WindowCompat +import com.example.composelearn.ui.ComposeLearnTheme + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // This app draws behind the system bars, so we want to handle fitting system windows + WindowCompat.setDecorFitsSystemWindows(window, false) + + setContent { + ComposeLearnTheme { + // A surface container using the 'background' color from the theme + Surface( + color = MaterialTheme.colors.background, + modifier = Modifier.fillMaxSize() + ) { + Statusbar() + } + } + } + } +} + +@Composable +fun Statusbar() { + +} + +@Preview(showBackground = true) +@Composable +fun DefaultPreview() { + ComposeLearnTheme { + Statusbar() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Color.kt b/app/src/main/java/com/example/composelearn/ui/Color.kt new file mode 100644 index 00000000..64124434 --- /dev/null +++ b/app/src/main/java/com/example/composelearn/ui/Color.kt @@ -0,0 +1,8 @@ +package com.example.composelearn.ui + +import androidx.compose.ui.graphics.Color + +val purple200 = Color(0xFFBB86FC) +val purple500 = Color(0xFF6200EE) +val purple700 = Color(0xFF3700B3) +val teal200 = Color(0xFF03DAC5) \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Shape.kt b/app/src/main/java/com/example/composelearn/ui/Shape.kt new file mode 100644 index 00000000..84e597a9 --- /dev/null +++ b/app/src/main/java/com/example/composelearn/ui/Shape.kt @@ -0,0 +1,11 @@ +package com.example.composelearn.ui + +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Shapes +import androidx.compose.ui.unit.dp + +val shapes = Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(4.dp), + large = RoundedCornerShape(0.dp) +) \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Theme.kt b/app/src/main/java/com/example/composelearn/ui/Theme.kt new file mode 100644 index 00000000..5c00ce20 --- /dev/null +++ b/app/src/main/java/com/example/composelearn/ui/Theme.kt @@ -0,0 +1,44 @@ +package com.example.composelearn.ui + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material.MaterialTheme +import androidx.compose.material.darkColors +import androidx.compose.material.lightColors +import androidx.compose.runtime.Composable + +private val DarkColorPalette = darkColors( + primary = purple200, + primaryVariant = purple700, + secondary = teal200 +) + +private val LightColorPalette = lightColors( + primary = purple500, + primaryVariant = purple700, + secondary = teal200 + + /* Other default colors to override + background = Color.White, + surface = Color.White, + onPrimary = Color.White, + onSecondary = Color.Black, + onBackground = Color.Black, + onSurface = Color.Black, + */ +) + +@Composable +fun ComposeLearnTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) { + val colors = if (darkTheme) { + DarkColorPalette + } else { + LightColorPalette + } + + MaterialTheme( + colors = colors, + typography = typography, + shapes = shapes, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Type.kt b/app/src/main/java/com/example/composelearn/ui/Type.kt new file mode 100644 index 00000000..6a5bd381 --- /dev/null +++ b/app/src/main/java/com/example/composelearn/ui/Type.kt @@ -0,0 +1,28 @@ +package com.example.composelearn.ui + +import androidx.compose.material.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val typography = Typography( + body1 = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp + ) + /* Other default text styles to override + button = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.W500, + fontSize = 14.sp + ), + caption = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 12.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a571e600 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..61da551c Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..6dba46da Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..da31a871 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..e96783cc Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..2533f951 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..2d3f8be6 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + ComposeLearn + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..a5a9d820 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,25 @@ + + + + + + +