Skip to content

Commit

Permalink
add: java lib and refactoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
amirisback committed Feb 27, 2022
1 parent a4b2bd6 commit dda44d7
Show file tree
Hide file tree
Showing 33 changed files with 163 additions and 52 deletions.
10 changes: 7 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.compose") version Dependency.COMPOSE_MULTIPLATFORM_VERSION
id("kotlin-kapt")
}

Expand Down Expand Up @@ -103,9 +104,12 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.activity:activity-compose:1.4.0")

implementation("androidx.compose.ui:ui:${Dependency.COMPOSE_VERSION}")
implementation("androidx.compose.material:material:${Dependency.COMPOSE_VERSION}")
implementation("androidx.compose.ui:ui-tooling-preview:${Dependency.COMPOSE_VERSION}")
implementation(compose.ui)
implementation(compose.runtime)
implementation(compose.preview)
implementation(compose.uiTooling)
implementation(compose.material)
implementation(compose.materialIconsExtended)

implementation("com.google.code.gson:gson:2.8.9")
implementation("com.google.android.material:material:1.5.0")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/frogobox/appsdk/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.frogobox.appsdk

import android.os.Bundle
import androidx.viewbinding.ViewBinding
import com.frogobox.sdk.core.FrogoActivity
import com.frogobox.sdk.FrogoActivity

/*
* Created by faisalamir on 02/08/21
Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ plugins {
id("com.android.application") version "7.1.2" apply false
id("com.android.library") version "7.1.2" apply false
id("org.jetbrains.kotlin.android") version Dependency.KOTLIN_VERSION apply false
id("org.jetbrains.kotlin.jvm") version "1.6.10" apply false
}

buildscript {
dependencies {
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
}
}

tasks.register("clean", Delete::class) {
Expand Down
16 changes: 11 additions & 5 deletions buildSrc/src/main/kotlin/Dependency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@
object Dependency {

// dependencies version

const val KOTLIN_VERSION = "1.5.31"
const val COMPOSE_VERSION = "1.0.5"

const val KOIN_VERSION = "3.1.4"
const val ROOM_VERSION = "2.4.1"

const val ACTIVITY_KTX_VERSION = "1.2.3"
const val FRAGMENT_KTX_VERSION = "1.3.5"

const val KOTLIN_VERSION = "1.6.10"
const val COMPOSE_MULTIPLATFORM_VERSION = "1.0.1"

const val ACTIVITY_KTX_VERSION = "1.4.0"
const val FRAGMENT_KTX_VERSION = "1.4.0"

const val RETROFIT_VERSION = "2.9.0"
const val GSON_VERSION = "2.8.9"

const val COROUTINES_VERSION = "1.5.2"

}
29 changes: 19 additions & 10 deletions buildSrc/src/main/kotlin/ProjectSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,39 @@
object ProjectSetting {
// project settings
const val NAME_APP = "Frogo SDK"
val NAME_APK = NAME_APP.toLowerCase().replace(" ", "-")

val NAME_DB = NAME_APP.toLowerCase().replace(" ", "_")
val DB = "\"$NAME_DB.db\""

const val APP_DOMAIN = "com"
const val APP_PLAY_CONSOLE = "frogobox"
const val APP_NAME = "appsdk"

const val LIBRARY_NAME = "sdk"

const val VERSION_MAJOR = 2
const val VERSION_MAJOR = 1
const val VERSION_MINOR = 0
const val VERSION_PATCH = 8
const val VERSION_PATCH = 0

const val PROJECT_COMPILE_SDK = 31
const val PROJECT_MIN_SDK = 21
const val PROJECT_TARGET_SDK = PROJECT_COMPILE_SDK

const val PROJECT_APP_ID = "$APP_DOMAIN.$APP_PLAY_CONSOLE.$APP_NAME"
const val PROJECT_LIB_ID = "$APP_DOMAIN.$APP_PLAY_CONSOLE.$LIBRARY_NAME"
const val BASE_PACAKGE_NAME = "$APP_DOMAIN.$APP_PLAY_CONSOLE"

const val LIBRARY_NAME_SDK = "sdk"
const val LIBRARY_NAME_CORE_SDK = "coresdk"

const val MODULE_NAME_SDK = "frogosdk"
const val MODULE_NAME_CORE_SDK = "frogocoresdk"

const val PROJECT_APP_ID = "$BASE_PACAKGE_NAME.$APP_NAME"
const val PROJECT_LIB_ID_SDK = "$BASE_PACAKGE_NAME.$LIBRARY_NAME_SDK"
const val PROJECT_LIB_ID_CORE_SDK = "$BASE_PACAKGE_NAME.$LIBRARY_NAME_CORE_SDK"

const val PROJECT_VERSION_CODE = (VERSION_MAJOR * 100) + (VERSION_MINOR * 10) + (VERSION_PATCH * 1)
const val PROJECT_VERSION_NAME = "$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"

val NAME_APK = NAME_APP.toLowerCase().replace(" ", "-")

val NAME_DB = NAME_APP.toLowerCase().replace(" ", "_")
val DB = "\"$NAME_DB.db\""

// Key Store
const val PLAYSTORE_STORE_FILE = "frogoboxmedia.jks"
const val PLAYSTORE_STORE_PASSWORD = "amirisback"
Expand Down
1 change: 1 addition & 0 deletions frogocoresdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
74 changes: 74 additions & 0 deletions frogocoresdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.compose") version Dependency.COMPOSE_MULTIPLATFORM_VERSION
`maven-publish`
}

group = ProjectSetting.PROJECT_LIB_ID_CORE_SDK
version = ProjectSetting.PROJECT_VERSION_NAME

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
}

dependencies {

implementation(compose.ui)
implementation(compose.runtime)
implementation(compose.preview)
implementation(compose.uiTooling)
implementation(compose.material)
implementation(compose.materialIconsExtended)

implementation("com.google.code.gson:gson:${Dependency.GSON_VERSION}")

implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.2")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.3")

implementation("com.squareup.retrofit2:retrofit:${Dependency.RETROFIT_VERSION}")
implementation("com.squareup.retrofit2:converter-gson:${Dependency.RETROFIT_VERSION}")
implementation("com.squareup.retrofit2:adapter-rxjava:${Dependency.RETROFIT_VERSION}")
implementation("com.squareup.retrofit2:adapter-rxjava2:${Dependency.RETROFIT_VERSION}")

implementation("io.insert-koin:koin-core:${Dependency.KOIN_VERSION}") // Koin core features

implementation("io.reactivex.rxjava2:rxjava:2.2.21")
}

publishing {

publications {

// Creates a Maven publication called "release".
register("release", MavenPublication::class) {

from(components["java"])

// Library Package Name (Example : "com.frogobox.androidfirstlib")
// NOTE : Different GroupId For Each Library / Module, So That Each Library Is Not Overwritten
groupId = ProjectSetting.PROJECT_LIB_ID_CORE_SDK

// Library Name / Module Name (Example : "androidfirstlib")
// NOTE : Different ArtifactId For Each Library / Module, So That Each Library Is Not Overwritten
artifactId = ProjectSetting.MODULE_NAME_CORE_SDK

// Version Library Name (Example : "1.0.0")
version = ProjectSetting.PROJECT_VERSION_NAME

}

}

repositories {
maven { url = uri("https://jitpack.io") }
}

}
4 changes: 4 additions & 0 deletions frogocoresdk/src/main/java/com/frogobox/coresdk/MyClass.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.frogobox.coresdk

class MyClass {
}
14 changes: 9 additions & 5 deletions frogosdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.compose") version Dependency.COMPOSE_MULTIPLATFORM_VERSION
id("kotlin-kapt")
`maven-publish`
}
Expand Down Expand Up @@ -64,9 +65,12 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.legacy:legacy-support-v4:1.0.0")

implementation("androidx.compose.ui:ui:${Dependency.COMPOSE_VERSION}")
implementation("androidx.compose.material:material:${Dependency.COMPOSE_VERSION}")
implementation("androidx.compose.ui:ui-tooling-preview:${Dependency.COMPOSE_VERSION}")
implementation(compose.ui)
implementation(compose.runtime)
implementation(compose.preview)
implementation(compose.uiTooling)
implementation(compose.material)
implementation(compose.materialIconsExtended)

implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.activity:activity-compose:1.4.0")
Expand Down Expand Up @@ -133,11 +137,11 @@ afterEvaluate {

// Library Package Name (Example : "com.frogobox.androidfirstlib")
// NOTE : Different GroupId For Each Library / Module, So That Each Library Is Not Overwritten
groupId = ProjectSetting.PROJECT_LIB_ID
groupId = ProjectSetting.PROJECT_LIB_ID_SDK

// Library Name / Module Name (Example : "androidfirstlib")
// NOTE : Different ArtifactId For Each Library / Module, So That Each Library Is Not Overwritten
artifactId = ProjectSetting.NAME_APK
artifactId = ProjectSetting.MODULE_NAME_SDK

// Version Library Name (Example : "1.0.0")
version = ProjectSetting.PROJECT_VERSION_NAME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Intent
import android.os.Bundle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import io.reactivex.Observer
import io.reactivex.disposables.Disposable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Context
import android.util.Log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import androidx.activity.ComponentActivity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.os.Environment

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.os.Build
import android.text.format.DateFormat
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Intent
import android.os.Bundle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.app.AlertDialog
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.os.Environment
import android.os.Handler
import com.frogobox.sdk.R
import com.frogobox.sdk.core.FrogoConstant.Dir.DIR_NAME
import com.frogobox.sdk.core.FrogoConstant.Dir.VIDEO_FILE_NAME
import com.frogobox.sdk.FrogoConstant.Dir.DIR_NAME
import com.frogobox.sdk.FrogoConstant.Dir.VIDEO_FILE_NAME
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import java.io.BufferedReader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.util.Log
import androidx.annotation.MainThread
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import com.google.gson.Gson
import io.reactivex.SingleObserver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Context
import android.media.MediaPlayer
Expand All @@ -16,7 +16,7 @@ import android.util.Log
* All rights reserved
*
*/
object FrogoMusic : IFrogoMusic{
object FrogoMusic : IFrogoMusic {

private val TAG = FrogoMusic::class.java.simpleName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.app.Activity
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Context
import android.content.SharedPreferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

/*
* Created by faisalamir on 26/07/21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.app.Application
import androidx.lifecycle.AndroidViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.view.View
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

/*
* Created by faisalamir on 23/08/21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

/*
* Created by faisalamir on 28/07/21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.view.View
import androidx.fragment.app.Fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Context
import java.util.ArrayList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.sdk.core
package com.frogobox.sdk

import android.content.Context
import android.media.MediaPlayer
Expand Down
Loading

0 comments on commit dda44d7

Please sign in to comment.