Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akashkamble committed Jun 7, 2020
0 parents commit 01e02f4
Show file tree
Hide file tree
Showing 70 changed files with 2,111 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .idea/codeStyles

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/dictionaries/nbt762.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/render.experimental.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
94 changes: 94 additions & 0 deletions app/build.gradle
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'

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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)
}
}
28 changes: 28 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
17 changes: 17 additions & 0 deletions app/src/main/java/com/akash/newzz_compose/Category.kt
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"
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/com/akash/newzz_compose/Constants.kt
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"
}
38 changes: 38 additions & 0 deletions app/src/main/java/com/akash/newzz_compose/NewsApplication.kt
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
}
}
}
Loading

0 comments on commit 01e02f4

Please sign in to comment.