Skip to content

Commit

Permalink
feat: view as a separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyMuse committed May 26, 2021
1 parent 332f3d7 commit 81e3852
Show file tree
Hide file tree
Showing 63 changed files with 268 additions and 340 deletions.
21 changes: 0 additions & 21 deletions activity/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ dependencies {

//android apis
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "com.google.android.material:material:$material"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:$swipeRefresh"
implementation "androidx.appcompat:appcompat:$appCompat"
implementation "androidx.documentfile:documentfile:$documentFile"

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ buildscript {
recyclerview = '1.2.0'
annotationVersion = '1.2.0'
documentFile = '1.0.1'
swipeRefresh = '1.1.0'


//app only
Expand Down
21 changes: 0 additions & 21 deletions bytearray/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
@@ -1,11 +1,8 @@
package com.crazylegend.kotlinextensions.builders
package com.crazylegend.bytearray


/**
* Created by hristijan on 8/5/19 to long live and prosper !
*/

/**
* Helper class to assist with building byte arrays. Works similarly to
* [StringBuilder].
*/
Expand Down Expand Up @@ -88,5 +85,5 @@ class ByteArrayBuilder(initialCap: Int = 128) {
* }.toBase64String()
* ```
*/
fun buildByteArray(block: ByteArrayBuilder.() -> Unit): ByteArray =
inline fun buildByteArray(block: ByteArrayBuilder.() -> Unit): ByteArray =
ByteArrayBuilder().apply { block(this) }.build()
21 changes: 0 additions & 21 deletions common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
@@ -1,4 +1,4 @@
package com.crazylegend.kotlinextensions.basehelpers
package com.crazylegend.common


/**
Expand Down Expand Up @@ -52,7 +52,8 @@ object InMemoryCache {
* get All the InMemoryCache of an Specific Type.
*/
fun getAllByType(clazz: Class<*>) = getAll().filter {
it.value != null && it.value!!::class.java == clazz
val classValue = it.value
classValue != null && classValue::class.java == clazz
}
}

Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/com/crazylegend/common/OtherUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.annotation.ColorInt
import androidx.annotation.IntRange
import androidx.annotation.RequiresPermission
import androidx.collection.LruCache
import com.crazylegend.common.device.DefaultUserAgent
import java.io.Closeable
import java.math.BigInteger
import java.net.InetAddress
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.crazylegend.common
package com.crazylegend.common.device

import android.annotation.SuppressLint
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.crazylegend.kotlinextensions.basehelpers
package com.crazylegend.common.device


import android.annotation.SuppressLint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.crazylegend.common
package com.crazylegend.common.string

import android.os.Build
import android.text.Html
Expand Down
21 changes: 0 additions & 21 deletions context/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
21 changes: 0 additions & 21 deletions contextGetters/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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,31 @@
package com.crazylegend.coroutines

import android.view.View
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch

/**
* Created by Hristijan, date 5/26/21
*/

suspend fun doParallel(vararg blocks: suspend () -> Any) = coroutineScope {
blocks
.map { async { it() } }
.forEach { it.await() }
}

suspend fun <T> doParallelWithResult(vararg blocks: suspend () -> T) = coroutineScope {
val result = mutableListOf<T>()
blocks
.map { async { it() } }
.forEach { result.add(it.await()) }

return@coroutineScope result
}


fun View.setOnClickCoroutine(owner: LifecycleOwner, listener: suspend (view: View) -> Unit) =
this.setOnClickListener { owner.lifecycleScope.launch { listener(it) } }
21 changes: 0 additions & 21 deletions dataStructuresAndAlgorithms/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
21 changes: 0 additions & 21 deletions file/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
19 changes: 19 additions & 0 deletions file/src/main/java/com/crazylegend/file/FileExtensions3.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.crazylegend.file

import java.io.File
import java.net.URLConnection

/**
* Created by Hristijan, date 5/26/21
*/

fun File.mediaType(): String {
return URLConnection.getFileNameMap().getContentTypeFor(name) ?: when (extension.lowercase()) {
"json" -> "application/json"
"js" -> "application/javascript"
"apk" -> "application/vnd.android.package-archive"
"md" -> "text/x-markdown"
"webp" -> "image/webp"
else -> "application/octet-stream"
}
}
1 change: 1 addition & 0 deletions http/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
3 changes: 3 additions & 0 deletions http/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

dependencies {
}
Empty file added http/consumer-rules.pro
Empty file.
Empty file added http/proguard-rules.pro
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.crazylegend.http

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.crazylegend.http.test", appContext.packageName)
}
}
5 changes: 5 additions & 0 deletions http/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.crazylegend.http">

</manifest>
11 changes: 11 additions & 0 deletions http/src/main/java/com/crazylegend/http/HttpExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.crazylegend.http

import java.io.File
import java.net.URLConnection.getFileNameMap


/**
* Created by hristijan on 7/30/19 to long live and prosper !
*/


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

import java.io.IOException
import java.io.InputStream
Expand Down
17 changes: 17 additions & 0 deletions http/src/test/java/com/crazylegend/http/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.crazylegend.http

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
21 changes: 0 additions & 21 deletions internetDetector/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# 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
Loading

0 comments on commit 81e3852

Please sign in to comment.