Skip to content

Commit 81e3852

Browse files
author
FunkyMuse
committed
feat: view as a separate module
1 parent 332f3d7 commit 81e3852

File tree

63 files changed

+268
-340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+268
-340
lines changed

activity/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ dependencies {
106106

107107
//android apis
108108
implementation 'androidx.viewpager2:viewpager2:1.0.0'
109-
implementation 'com.google.android.material:material:1.3.0'
110-
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
109+
implementation "com.google.android.material:material:$material"
110+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:$swipeRefresh"
111111
implementation "androidx.appcompat:appcompat:$appCompat"
112112
implementation "androidx.documentfile:documentfile:$documentFile"
113113

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ buildscript {
1919
recyclerview = '1.2.0'
2020
annotationVersion = '1.2.0'
2121
documentFile = '1.0.1'
22+
swipeRefresh = '1.1.0'
2223

2324

2425
//app only

bytearray/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile

kotlinextensions/src/main/java/com/crazylegend/kotlinextensions/builders/ByteArrayBuilder.kt bytearray/src/main/java/com/crazylegend/bytearray/ByteArrayBuilder.kt

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
package com.crazylegend.kotlinextensions.builders
1+
package com.crazylegend.bytearray
22

33

44
/**
55
* Created by hristijan on 8/5/19 to long live and prosper !
6-
*/
7-
8-
/**
96
* Helper class to assist with building byte arrays. Works similarly to
107
* [StringBuilder].
118
*/
@@ -88,5 +85,5 @@ class ByteArrayBuilder(initialCap: Int = 128) {
8885
* }.toBase64String()
8986
* ```
9087
*/
91-
fun buildByteArray(block: ByteArrayBuilder.() -> Unit): ByteArray =
88+
inline fun buildByteArray(block: ByteArrayBuilder.() -> Unit): ByteArray =
9289
ByteArrayBuilder().apply { block(this) }.build()

common/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.crazylegend.kotlinextensions.basehelpers
1+
package com.crazylegend.common
22

33

44
/**
@@ -52,7 +52,8 @@ object InMemoryCache {
5252
* get All the InMemoryCache of an Specific Type.
5353
*/
5454
fun getAllByType(clazz: Class<*>) = getAll().filter {
55-
it.value != null && it.value!!::class.java == clazz
55+
val classValue = it.value
56+
classValue != null && classValue::class.java == clazz
5657
}
5758
}
5859

common/src/main/java/com/crazylegend/common/OtherUtils.kt

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import androidx.annotation.ColorInt
2828
import androidx.annotation.IntRange
2929
import androidx.annotation.RequiresPermission
3030
import androidx.collection.LruCache
31+
import com.crazylegend.common.device.DefaultUserAgent
3132
import java.io.Closeable
3233
import java.math.BigInteger
3334
import java.net.InetAddress

common/src/main/java/com/crazylegend/common/DefaultUserAgent.kt common/src/main/java/com/crazylegend/common/device/DefaultUserAgent.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.crazylegend.common
1+
package com.crazylegend.common.device
22

33
import android.annotation.SuppressLint
44
import android.content.Context

kotlinextensions/src/main/java/com/crazylegend/kotlinextensions/basehelpers/DeviceUtils.kt common/src/main/java/com/crazylegend/common/device/DeviceUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.crazylegend.kotlinextensions.basehelpers
1+
package com.crazylegend.common.device
22

33

44
import android.annotation.SuppressLint

common/src/main/java/com/crazylegend/common/CommonStringExtensions.kt common/src/main/java/com/crazylegend/common/string/CommonStringExtensions.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.crazylegend.common
1+
package com.crazylegend.common.string
22

33
import android.os.Build
44
import android.text.Html

context/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile

contextGetters/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.crazylegend.coroutines
2+
3+
import android.view.View
4+
import androidx.lifecycle.LifecycleOwner
5+
import androidx.lifecycle.lifecycleScope
6+
import kotlinx.coroutines.async
7+
import kotlinx.coroutines.coroutineScope
8+
import kotlinx.coroutines.launch
9+
10+
/**
11+
* Created by Hristijan, date 5/26/21
12+
*/
13+
14+
suspend fun doParallel(vararg blocks: suspend () -> Any) = coroutineScope {
15+
blocks
16+
.map { async { it() } }
17+
.forEach { it.await() }
18+
}
19+
20+
suspend fun <T> doParallelWithResult(vararg blocks: suspend () -> T) = coroutineScope {
21+
val result = mutableListOf<T>()
22+
blocks
23+
.map { async { it() } }
24+
.forEach { result.add(it.await()) }
25+
26+
return@coroutineScope result
27+
}
28+
29+
30+
fun View.setOnClickCoroutine(owner: LifecycleOwner, listener: suspend (view: View) -> Unit) =
31+
this.setOnClickListener { owner.lifecycleScope.launch { listener(it) } }
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile

file/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.crazylegend.file
2+
3+
import java.io.File
4+
import java.net.URLConnection
5+
6+
/**
7+
* Created by Hristijan, date 5/26/21
8+
*/
9+
10+
fun File.mediaType(): String {
11+
return URLConnection.getFileNameMap().getContentTypeFor(name) ?: when (extension.lowercase()) {
12+
"json" -> "application/json"
13+
"js" -> "application/javascript"
14+
"apk" -> "application/vnd.android.package-archive"
15+
"md" -> "text/x-markdown"
16+
"webp" -> "image/webp"
17+
else -> "application/octet-stream"
18+
}
19+
}

http/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

http/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
dependencies {
3+
}

http/consumer-rules.pro

Whitespace-only changes.

http/proguard-rules.pro

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.crazylegend.http
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.crazylegend.http.test", appContext.packageName)
23+
}
24+
}

http/src/main/AndroidManifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.crazylegend.http">
4+
5+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.crazylegend.http
2+
3+
import java.io.File
4+
import java.net.URLConnection.getFileNameMap
5+
6+
7+
/**
8+
* Created by hristijan on 7/30/19 to long live and prosper !
9+
*/
10+
11+

kotlinextensions/src/main/java/com/crazylegend/kotlinextensions/http/HttpsUtils.kt http/src/main/java/com/crazylegend/http/HttpsUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.crazylegend.kotlinextensions.http
1+
package com.crazylegend.http
22

33
import java.io.IOException
44
import java.io.InputStream
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.crazylegend.http
2+
3+
import org.junit.Test
4+
5+
import org.junit.Assert.*
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* See [testing documentation](http://d.android.com/tools/testing).
11+
*/
12+
class ExampleUnitTest {
13+
@Test
14+
fun addition_isCorrect() {
15+
assertEquals(4, 2 + 2)
16+
}
17+
}

internetDetector/proguard-rules.pro

-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +0,0 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)