-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
|
||
android { | ||
compileSdkVersion 29 | ||
|
||
defaultConfig { | ||
applicationId "com.akash.newzz_compose" | ||
minSdkVersion 21 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
Properties properties = new Properties() | ||
properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
def apiKey = properties.getProperty("api_key") | ||
buildConfigField("String", "API_KEY", apiKey) | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
buildFeatures { | ||
compose true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424" | ||
kotlinCompilerExtensionVersion "0.1.0-dev12" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'androidx.core:core-ktx:1.3.0' | ||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
|
||
/* ---------------------JetPack Compose-----------------------------*/ | ||
implementation("androidx.compose:compose-runtime:$compose_version") | ||
implementation("androidx.ui:ui-core:$compose_version") | ||
implementation "androidx.ui:ui-layout:$compose_version" | ||
implementation "androidx.ui:ui-material:$compose_version" | ||
implementation "androidx.ui:ui-tooling:$compose_version" | ||
implementation "androidx.ui:ui-livedata:$compose_version" | ||
|
||
/* ---------------------JetPack Compose-----------------------------*/ | ||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" | ||
|
||
|
||
/* ---------------------Kotlin-coroutines---------------------------*/ | ||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" | ||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" | ||
|
||
/*---------------------Network and Moshi----------------------------*/ | ||
implementation 'com.squareup.retrofit2:retrofit:2.6.2' | ||
implementation 'com.squareup.okhttp3:okhttp:4.2.1' | ||
implementation 'com.squareup.retrofit2:converter-moshi:2.6.2' | ||
implementation 'com.squareup.moshi:moshi:1.9.1' | ||
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.9.1' | ||
|
||
|
||
/*-----------------------Koin-------------------------------------*/ | ||
implementation "org.koin:koin-android:$koin_version" | ||
implementation "org.koin:koin-android-viewmodel:$koin_version" | ||
|
||
/*-----------------------Glide-----------------------------*/ | ||
implementation 'com.github.bumptech.glide:glide:4.11.0' | ||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' | ||
|
||
/*---------------------ChromeCustomTab------------------------------*/ | ||
implementation 'androidx.browser:browser:1.3.0-alpha01' | ||
|
||
/*---------------------CoilImageLoader------------------------------*/ | ||
implementation "dev.chrisbanes.accompanist:accompanist-coil:0.1.3" | ||
|
||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.1' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.akash.newzz_compose | ||
|
||
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.akash.newzz_compose", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.akash.newzz_compose"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:name=".NewsApplication" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".ui.NewzzActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.akash.newzz_compose | ||
|
||
import androidx.annotation.StringDef | ||
|
||
/** | ||
* Created by Akash on 06/06/20 | ||
*/ | ||
|
||
@Retention(AnnotationRetention.SOURCE) | ||
@StringDef(value = [Category.GENERAL, Category.BUSINESS, Category.TECH]) | ||
internal annotation class Category { | ||
companion object { | ||
const val GENERAL = "general" | ||
const val BUSINESS = "business" | ||
const val TECH = "technology" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.akash.newzz_compose | ||
|
||
/** | ||
* Created by Akash on 06/06/20 | ||
*/ | ||
object Constants { | ||
val API_KEY: String | ||
get() = BuildConfig.API_KEY | ||
val COUNTRY: String | ||
get() = "in" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.akash.newzz_compose | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import android.net.ConnectivityManager | ||
import com.akash.newzz_compose.di.appModule | ||
import org.koin.android.ext.koin.androidContext | ||
import org.koin.android.ext.koin.androidLogger | ||
import org.koin.core.context.startKoin | ||
|
||
/** | ||
* Created by Akash on 06/06/20 | ||
*/ | ||
class NewsApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
instances = this | ||
startKoin{ | ||
androidLogger() | ||
androidContext(this@NewsApplication) | ||
modules(appModule) | ||
} | ||
} | ||
|
||
|
||
companion object { | ||
lateinit var instances: NewsApplication | ||
|
||
|
||
fun isNetworkConnected(): Boolean { | ||
val connectivityManager = | ||
instances.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
val networkInfo = connectivityManager.activeNetworkInfo | ||
return networkInfo != null && networkInfo.isConnected | ||
} | ||
} | ||
} |