├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── layout_item.xml
│ │ │ │ ├── activity_context.xml
│ │ │ │ └── layout_item_two.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── programmersbox
│ │ │ │ └── helpfultools
│ │ │ │ ├── JavaDslMarker.java
│ │ │ │ ├── TypeToGo.kt
│ │ │ │ ├── JavaDslBuilder.java
│ │ │ │ ├── TestApp.kt
│ │ │ │ ├── Linting.java
│ │ │ │ ├── ColorApi.kt
│ │ │ │ ├── MoreActivity.kt
│ │ │ │ ├── contextutility
│ │ │ │ └── ContextActivity.kt
│ │ │ │ └── broadcast
│ │ │ │ └── BroadcastActivity.kt
│ │ └── AndroidManifest.xml
│ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── helpfultools
│ │ │ └── ExampleInstrumentedTest.kt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── helpfultools
│ │ └── ExampleUnitTest.kt
└── proguard-rules.pro
├── dragswipe
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── dragswipe
│ │ │ └── DragSwipeDiffUtil.kt
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── dragswipe
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── dragswipe
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── flowutils
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── flowutils
│ │ │ └── FlowItem.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── flowutils
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
├── README.md
└── build.gradle
├── funutils
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── ic_check_box_outline_blank_black_24dp.xml
│ │ │ │ ├── ic_indeterminate_check_box_black_24dp.xml
│ │ │ │ ├── ic_check_box_black_24dp.xml
│ │ │ │ └── checkbox_selector.xml
│ │ │ └── layout
│ │ │ │ └── table_adapter_item.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── funutils
│ │ │ ├── funutilities
│ │ │ ├── TimedSequenceMaker.kt
│ │ │ └── SequenceMaker.kt
│ │ │ └── cards
│ │ │ └── Card.kt
│ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── funutils
│ │ │ └── ExampleInstrumentedTest.kt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── funutils
│ │ └── ExampleUnitTest.kt
├── proguard-rules.pro
├── README.md
└── build.gradle
├── gsonutils
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── gsonutils
│ │ └── ApiUtils.kt
├── proguard-rules.pro
├── build.gradle
└── README.md
├── rxutils
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── rxutils
│ │ │ ├── RxContextUtils.kt
│ │ │ └── RxControlsProviderService.kt
│ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── rxutils
│ │ │ └── ExampleInstrumentedTest.kt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── rxutils
│ │ └── ExampleUnitTest.kt
├── proguard-rules.pro
├── README.md
└── build.gradle
├── dslannotations
├── .gitignore
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── dslannotations
│ │ ├── DslClass.kt
│ │ └── DslField.kt
└── build.gradle
├── dslprocessor
├── .gitignore
└── build.gradle
├── helpfulutils
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── helpfulutils
│ │ ├── NumberAndroidUtils.kt
│ │ ├── QuickAdapter.kt
│ │ └── views
│ │ └── OverScrollBehavior.kt
├── proguard-rules.pro
└── build.gradle
├── loggingutils
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── loggingutils
│ │ │ └── LogedInterceptor.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── loggingutils
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── loggingutilslint
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ │ └── META-INF
│ │ │ │ └── services
│ │ │ │ └── com.android.tools.lint.client.api.IssueRegistry
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── loggingutilslint
│ │ │ ├── LogedIssueRegistry.kt
│ │ │ └── AndroidLogDetector.kt
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── loggingutilslint
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── loggingutilslint
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── thirdpartyutils
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── thirdpartyutils
│ │ │ ├── PaletteUtils.kt
│ │ │ ├── LottieUtils.kt
│ │ │ └── GlideUtils.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── thirdpartyutils
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
├── README.md
└── build.gradle
├── testingplayground
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── testingplayground
│ │ │ ├── AnsiColor.kt
│ │ │ ├── RxDeckOfCards.kt
│ │ │ └── FlowDeckOfCards.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── testingplayground
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
├── sampledata
│ └── sample_colors
└── build.gradle
├── testingplaygroundapp
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── ace1.png
│ │ │ │ ├── ace2.png
│ │ │ │ ├── ace3.png
│ │ │ │ ├── ace4.png
│ │ │ │ ├── b1fv.png
│ │ │ │ ├── six1.png
│ │ │ │ ├── six2.png
│ │ │ │ ├── six3.png
│ │ │ │ ├── six4.png
│ │ │ │ ├── ten1.png
│ │ │ │ ├── ten2.png
│ │ │ │ ├── ten3.png
│ │ │ │ ├── ten4.png
│ │ │ │ ├── two1.png
│ │ │ │ ├── two2.png
│ │ │ │ ├── two3.png
│ │ │ │ ├── two4.png
│ │ │ │ ├── clear.png
│ │ │ │ ├── eight1.png
│ │ │ │ ├── eight2.png
│ │ │ │ ├── eight3.png
│ │ │ │ ├── eight4.png
│ │ │ │ ├── five1.png
│ │ │ │ ├── five2.png
│ │ │ │ ├── five3.png
│ │ │ │ ├── five4.png
│ │ │ │ ├── four1.png
│ │ │ │ ├── four2.png
│ │ │ │ ├── four3.png
│ │ │ │ ├── four4.png
│ │ │ │ ├── jack1.png
│ │ │ │ ├── jack2.png
│ │ │ │ ├── jack3.png
│ │ │ │ ├── jack4.png
│ │ │ │ ├── king1.png
│ │ │ │ ├── king2.png
│ │ │ │ ├── king3.png
│ │ │ │ ├── king4.png
│ │ │ │ ├── nine1.png
│ │ │ │ ├── nine2.png
│ │ │ │ ├── nine3.png
│ │ │ │ ├── nine4.png
│ │ │ │ ├── queen1.png
│ │ │ │ ├── queen2.png
│ │ │ │ ├── queen3.png
│ │ │ │ ├── queen4.png
│ │ │ │ ├── seven1.png
│ │ │ │ ├── seven2.png
│ │ │ │ ├── seven3.png
│ │ │ │ ├── seven4.png
│ │ │ │ ├── three1.png
│ │ │ │ ├── three2.png
│ │ │ │ ├── three3.png
│ │ │ │ ├── three4.png
│ │ │ │ └── border.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimen.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── collapsed_notification.xml
│ │ │ │ ├── expanded_notification.xml
│ │ │ │ ├── activity_table.xml
│ │ │ │ ├── card_item.xml
│ │ │ │ ├── test_item.xml
│ │ │ │ ├── binding_test_item.xml
│ │ │ │ ├── ui_test_file.xml
│ │ │ │ └── activity_main.xml
│ │ │ ├── xml
│ │ │ │ └── pref_ui_test.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── programmersbox
│ │ │ │ └── testingplaygroundapp
│ │ │ │ ├── JavaDslMarker.java
│ │ │ │ ├── Games.kt
│ │ │ │ ├── TestApp.kt
│ │ │ │ ├── JavaDslBuilder.java
│ │ │ │ ├── Linting.java
│ │ │ │ ├── Views.kt
│ │ │ │ ├── PeopleBuilder.kt
│ │ │ │ ├── WIPUtils.kt
│ │ │ │ ├── cardgames
│ │ │ │ ├── poker
│ │ │ │ │ └── PokerHand.kt
│ │ │ │ └── CardUtils.kt
│ │ │ │ └── BindingActivity.kt
│ │ └── AndroidManifest.xml
│ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── programmersbox
│ │ │ └── testingplaygroundapp
│ │ │ └── ExampleInstrumentedTest.kt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── programmersbox
│ │ └── testingplaygroundapp
│ │ └── ResourceMaker.kt
├── proguard-rules.pro
└── build.gradle
├── _config.yml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── scopes
│ └── ReadMe.xml
├── codeStyles
│ └── codeStyleConfig.xml
├── dictionaries
├── vcs.xml
├── misc.xml
├── $CACHE_FILE$
├── gradle.xml
├── jarRepositories.xml
└── markdown-navigator-enh.xml
├── .gitignore
├── settings.gradle
├── versions.gradle
├── .github
├── dependabot.yml
└── FUNDING.yml
├── gradle.properties
├── publish.gradle
├── README.md
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/dragswipe/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/dragswipe/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/flowutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/flowutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/funutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/funutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gsonutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/gsonutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/rxutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/rxutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dslannotations/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/dslprocessor/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/helpfulutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/helpfulutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/loggingutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/loggingutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/loggingutilslint/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/thirdpartyutils/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/loggingutilslint/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/testingplayground/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/testingplayground/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/testingplaygroundapp/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/thirdpartyutils/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-midnight
--------------------------------------------------------------------------------
/funutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/rxutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dragswipe/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/flowutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gsonutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/helpfulutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/loggingutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | HelpfulTools
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/loggingutilslint/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | /
4 |
--------------------------------------------------------------------------------
/thirdpartyutils/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | /
4 |
--------------------------------------------------------------------------------
/testingplayground/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | /
4 |
--------------------------------------------------------------------------------
/.idea/scopes/ReadMe.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/loggingutilslint/src/main/res/META-INF/services/com.android.tools.lint.client.api.IssueRegistry:
--------------------------------------------------------------------------------
1 | com.programmersbox.loggingutilslint.LogedIssueRegistry
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ace1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ace1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ace2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ace2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ace3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ace3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ace4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ace4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/b1fv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/b1fv.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/six1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/six1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/six2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/six2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/six3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/six3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/six4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/six4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ten1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ten1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ten2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ten2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ten3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ten3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/ten4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/ten4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/two1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/two1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/two2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/two2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/two3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/two3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/two4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/two4.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/clear.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/eight1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/eight1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/eight2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/eight2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/eight3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/eight3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/eight4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/eight4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/five1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/five1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/five2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/five2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/five3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/five3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/five4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/five4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/four1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/four1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/four2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/four2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/four3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/four3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/four4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/four4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/jack1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/jack1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/jack2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/jack2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/jack3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/jack3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/jack4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/jack4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/king1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/king1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/king2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/king2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/king3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/king3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/king4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/king4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/nine1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/nine1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/nine2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/nine2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/nine3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/nine3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/nine4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/nine4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/queen1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/queen1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/queen2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/queen2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/queen3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/queen3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/queen4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/queen4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/seven1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/seven1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/seven2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/seven2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/seven3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/seven3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/seven4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/seven4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/three1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/three1.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/three2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/three2.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/three3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/three3.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/three4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/drawable/three4.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.idea/dictionaries:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jakepurple13/HelpfulTools/HEAD/testingplaygroundapp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/JavaDslMarker.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools;
2 |
3 | import kotlin.DslMarker;
4 |
5 | @DslMarker
6 | public @interface JavaDslMarker {
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/JavaDslMarker.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp;
2 |
3 | import kotlin.DslMarker;
4 |
5 | @DslMarker
6 | public @interface JavaDslMarker {
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed May 05 06:51:11 EDT 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/values/dimen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 20dp
4 | 20dp
5 | 12dp
6 |
--------------------------------------------------------------------------------
/dslannotations/src/main/java/com/programmersbox/dslannotations/DslClass.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.dslannotations
2 |
3 | import kotlin.reflect.KClass
4 |
5 | @Retention(AnnotationRetention.SOURCE)
6 | @Target(AnnotationTarget.CLASS)
7 | annotation class DslClass(val dslMarker: KClass<*> = DslFieldMarker::class)
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TestingPlaygroundApp
3 | Settings
4 | Open system settings
5 | Home
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/dslannotations/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 | apply plugin: 'kotlin'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group='com.github.jakepurple13'
5 | dependencies {
6 | implementation fileTree(dir: 'libs', include: ['*.jar'])
7 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
8 | }
9 |
10 | sourceCompatibility = "1.7"
11 | targetCompatibility = "1.7"
--------------------------------------------------------------------------------
/dslannotations/src/main/java/com/programmersbox/dslannotations/DslField.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.dslannotations
2 |
3 | import kotlin.reflect.KClass
4 |
5 | @Retention(AnnotationRetention.SOURCE)
6 | @Target(AnnotationTarget.FIELD)
7 | annotation class DslField(val name: String, val dslMarker: KClass<*> = DslFieldMarker::class, val comment: String = "")
8 |
9 | @DslMarker
10 | annotation class DslFieldMarker
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':thirdpartyutils'
2 | include ':dslannotations'
3 | include ':dslprocessor'
4 | include ':loggingutilslint'
5 | include ':testingplaygroundapp'
6 | include ':funutils'
7 | include ':dragswipe'
8 | include ':testingplayground'
9 | include ':rxutils'
10 | include ':gsonutils'
11 | include ':helpfulutils'
12 | include ':flowutils'
13 | include ':loggingutils'
14 | include ':app'
15 | rootProject.name = "HelpfulTools"
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable/border.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
12 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/collapsed_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/expanded_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/funutils/src/main/res/drawable/ic_check_box_outline_blank_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/funutils/src/main/res/drawable/ic_indeterminate_check_box_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/helpfulutils/src/main/java/com/programmersbox/helpfulutils/NumberAndroidUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfulutils
2 |
3 | import android.graphics.Color
4 | import android.os.Handler
5 | import androidx.core.os.postDelayed
6 |
7 | fun Colors.ARGB.toColor() = Color.argb(a, r, g, b)
8 | fun Colors.RGB.toColor() = Color.rgb(r, g, b)
9 | fun Colors.CMYK.toColor() = toARGB().toColor()
10 |
11 | fun Number.wait(block: () -> Unit) = Handler().postDelayed(this.toLong(), action = block)
12 |
--------------------------------------------------------------------------------
/rxutils/src/main/java/com/programmersbox/rxutils/RxContextUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.rxutils
2 |
3 | import androidx.fragment.app.FragmentActivity
4 | import com.programmersbox.helpfulutils.PermissionInfo
5 | import com.programmersbox.helpfulutils.requestPermissions
6 | import io.reactivex.Single
7 |
8 | fun FragmentActivity.rxRequestPermissions(vararg permissions: String) =
9 | Single.create { emitter -> requestPermissions(*permissions, onResult = emitter::onSuccess) }
--------------------------------------------------------------------------------
/funutils/src/main/res/drawable/ic_check_box_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/loggingutilslint/src/test/java/com/programmersbox/loggingutilslint/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.loggingutilslint
2 |
3 | import org.junit.Assert.assertEquals
4 | import org.junit.Test
5 |
6 | /**
7 | * Example local unit test, which will execute on the development machine (host).
8 | *
9 | * See [testing documentation](http://d.android.com/tools/testing).
10 | */
11 | class ExampleUnitTest {
12 | @Test
13 | fun addition_isCorrect() {
14 | assertEquals(4, 2 + 2)
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/TypeToGo.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
2 |
3 | import com.programmersbox.helpfultools.broadcast.BroadcastActivity
4 | import com.programmersbox.helpfultools.contextutility.ContextActivity
5 |
6 | enum class TypeToGo(val text: String, val clazz: Class<*>) {
7 | BLACKJACK("Sequence Maker", MoreActivity::class.java),
8 | BROADCAST("Broadcast Receivers", BroadcastActivity::class.java),
9 | CONTEXT("Context Utils", ContextActivity::class.java)
10 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/xml/pref_ui_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/versions.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | ext {
3 | recyclerview = "androidx.recyclerview:recyclerview:1.2.0"
4 | coreKTX = "androidx.core:core-ktx:1.3.2"
5 | appcompat = 'androidx.appcompat:appcompat:1.2.0'
6 | material = 'com.google.android.material:material:1.3.0'
7 | rxkotlin = "io.reactivex.rxjava2:rxkotlin:2.4.0"
8 | rxjava = "io.reactivex.rxjava2:rxandroid:2.1.1"
9 | rxjavaBinding = 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
10 | rxkotlinBinding = 'com.jakewharton.rxbinding2:rxbinding-kotlin:2.2.0'
11 | }*/
12 |
--------------------------------------------------------------------------------
/loggingutilslint/src/main/java/com/programmersbox/loggingutilslint/LogedIssueRegistry.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.loggingutilslint
2 |
3 | import com.android.tools.lint.client.api.IssueRegistry
4 | import com.android.tools.lint.detector.api.CURRENT_API
5 |
6 | /*
7 | * The list of issues that will be checked when running lint.
8 | */
9 | @Suppress("UnstableApiUsage")
10 | class LogedIssueRegistry : IssueRegistry() {
11 | override val issues = AndroidLogDetector.issues
12 | override val api: Int get() = CURRENT_API
13 | }
--------------------------------------------------------------------------------
/dragswipe/src/test/java/com/programmersbox/dragswipe/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.dragswipe
2 |
3 | import org.junit.Assert.assertEquals
4 | import org.junit.Test
5 |
6 | /**
7 | * Example local unit test, which will execute on the development machine (host).
8 | *
9 | * See [testing documentation](http://d.android.com/tools/testing).
10 | */
11 | class ExampleUnitTest {
12 | @Test
13 | fun addition_isCorrect() {
14 | assertEquals(4, 2 + 2)
15 | Direction.DOWN or Direction.UP or Direction.START
16 | }
17 | }
--------------------------------------------------------------------------------
/funutils/src/main/res/drawable/checkbox_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/Games.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | import com.programmersbox.testingplaygroundapp.cardgames.blackjack.BlackjackActivity
4 | import com.programmersbox.testingplaygroundapp.cardgames.uno.UnoActivity
5 |
6 | enum class Games(val text: String, val clazz: Class<*>) {
7 | BLACKJACK("Blackjack", BlackjackActivity::class.java),
8 | UNO("Uno", UnoActivity::class.java),
9 | CHECKBOX("CheckBox", CheckboxTestActivity::class.java),
10 | CUSTOM_VIEW("Custom Views", CustomViewActivity::class.java),
11 | TABLE("Table", TableActivity::class.java)
12 | }
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: gradle
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | time: '08:00'
8 | timezone: America/New_York
9 | open-pull-requests-limit: 10
10 | reviewers:
11 | - jakepurple13
12 | ignore:
13 | - dependency-name: com.android.tools.build:gradle
14 | versions:
15 | - ">= 4.1.a, < 4.2"
16 | - dependency-name: com.squareup.okhttp3:okhttp
17 | versions:
18 | - "> 4.7.0, < 4.8"
19 | - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
20 | versions:
21 | - "> 1.3.5, < 2"
22 | - dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
23 | versions:
24 | - "> 1.3.5, < 2"
25 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: jakepurple13 # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: V7V3D3JI
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/activity_table.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_context.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/funutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/rxutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/dragswipe/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/flowutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/gsonutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/helpfulutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/loggingutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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/src/androidTest/java/com/programmersbox/helpfultools/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
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.programmersbox.helpfultools", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/loggingutilslint/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/testingplayground/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/thirdpartyutils/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/dragswipe/src/androidTest/java/com/programmersbox/dragswipe/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.dragswipe
2 |
3 | import androidx.test.ext.junit.runners.AndroidJUnit4
4 | import androidx.test.platform.app.InstrumentationRegistry
5 | import org.junit.Assert.assertEquals
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | /**
10 | * Instrumented test, which will execute on an Android device.
11 | *
12 | * See [testing documentation](http://d.android.com/tools/testing).
13 | */
14 | @RunWith(AndroidJUnit4::class)
15 | class ExampleInstrumentedTest {
16 | @Test
17 | fun useAppContext() {
18 | // Context of the app under test.
19 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
20 | assertEquals("com.programmersbox.dragswipe.test", appContext.packageName)
21 | }
22 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/loggingutils/src/androidTest/java/com/programmersbox/loggingutils/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.loggingutils
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.programmersbox.loggingutils.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/thirdpartyutils/src/androidTest/java/com/programmersbox/thirdpartyutils/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.thirdpartyutils
2 |
3 | import androidx.test.ext.junit.runners.AndroidJUnit4
4 | import androidx.test.platform.app.InstrumentationRegistry
5 | import org.junit.Assert.assertEquals
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | /**
10 | * Instrumented test, which will execute on an Android device.
11 | *
12 | * See [testing documentation](http://d.android.com/tools/testing).
13 | */
14 | @RunWith(AndroidJUnit4::class)
15 | class ExampleInstrumentedTest {
16 | @Test
17 | fun useAppContext() {
18 | // Context of the app under test.
19 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
20 | assertEquals("com.programmersbox.thirdpartyutils.test", appContext.packageName)
21 | }
22 | }
--------------------------------------------------------------------------------
/loggingutilslint/src/androidTest/java/com/programmersbox/loggingutilslint/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.loggingutilslint
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.programmersbox.loggingutilslint.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/TestApp.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | import android.app.Application
4 | import com.programmersbox.loggingutils.LogLevel
5 | import com.programmersbox.loggingutils.Loged
6 | import com.programmersbox.loggingutils.LogedInterceptor
7 |
8 | class TestApp : Application() {
9 | override fun onCreate() {
10 | super.onCreate()
11 | Loged.FILTER_BY_PACKAGE_NAME = "programmersbox"
12 | Loged.TAG = "TestApp"
13 | Loged.logedInterceptor { _, _, _ -> true }
14 | Loged.logedInterceptor = Interceptor()
15 | Loged.r("Hello")
16 | }
17 | }
18 |
19 | class Interceptor : LogedInterceptor {
20 | override fun log(level: LogLevel, tag: String, msg: String): Boolean {
21 | //println("${level.name[0]}/$tag/$msg")
22 | return true
23 | }
24 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/JavaDslBuilder.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp;
2 |
3 | import kotlin.Unit;
4 | import kotlin.jvm.functions.Function0;
5 | import kotlin.jvm.functions.Function1;
6 |
7 | //@DslClass(dslMarker = JavaDslMarker.class)
8 | public class JavaDslBuilder {
9 | int num = 4;
10 |
11 | //@DslField(name = "javaName", comment = "This is a java one")
12 | String name = "";
13 |
14 | Function0 function = () -> null;
15 |
16 | //@DslField(name = "functionOne", comment = "This is a java one")
17 | Function0 function1 = () -> null;
18 |
19 | static void javaDslBuild(Function1 block) {
20 | JavaDslBuilder dsl = new JavaDslBuilder();
21 | block.invoke(dsl);
22 | dsl.function.invoke();
23 | dsl.function1.invoke();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/.idea/$CACHE_FILE$:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Android
10 |
11 |
12 | JUnitJava
13 |
14 |
15 | Java
16 |
17 |
18 | LintAndroid
19 |
20 |
21 | PerformanceLintAndroid
22 |
23 |
24 |
25 |
26 | Android
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/dslprocessor/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 | apply plugin: 'kotlin'
3 | apply plugin: 'kotlin-kapt'
4 | //apply plugin: 'com.github.dcendents.android-maven'
5 | //group='com.github.jakepurple13'
6 | repositories {
7 | mavenCentral()
8 | }
9 | compileKotlin {
10 | kotlinOptions {
11 | jvmTarget = "1.8"
12 | }
13 | }
14 | compileTestKotlin {
15 | kotlinOptions {
16 | jvmTarget = "1.8"
17 | }
18 | }
19 |
20 | dependencies {
21 | implementation 'com.squareup:kotlinpoet:1.8.0'
22 | implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.20"
23 | implementation 'com.google.auto.service:auto-service:1.0-rc7'
24 | annotationProcessor 'com.google.auto.service:auto-service:1.0-rc6'
25 | kapt 'com.google.auto.service:auto-service:1.0-rc6'
26 | //implementation "me.eugeniomarletti.kotlin.metadata:kotlin-metadata:1.4.0"
27 | implementation project(':dslannotations')
28 | }
29 |
--------------------------------------------------------------------------------
/funutils/src/main/res/layout/table_adapter_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
11 |
14 |
15 |
18 |
19 |
20 |
28 |
29 |
--------------------------------------------------------------------------------
/flowutils/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
2 | ```gradle
3 | implementation 'com.github.jakepurple13.HelpfulTools:flowutils:{version}'
4 | ```
5 | # [FlowUtils](https://github.com/jakepurple13/HelpfulTools/tree/master/flowutils/src/main/java/com/programmersbox/flowutils)
6 |
7 | ## [FlowItem](https://github.com/jakepurple13/HelpfulTools/blob/master/flowutils/src/main/java/com/programmersbox/flowutils/FlowItem.kt)
8 | This acts like an Rx PublishSubject but uses Flow.
9 | ```kotlin
10 | val item = FlowItem(4)
11 | item.setValue(5)
12 | item.collectOnUI { println(it) }
13 | item(6)
14 | val num: Int = item()
15 | ```
16 |
17 | ## [UI Flow](https://github.com/jakepurple13/HelpfulTools/blob/master/flowutils/src/main/java/com/programmersbox/flowutils/UIFlowExtensions.kt)
18 | These are just like RxBindings.
19 | ```kotlin
20 | view.clicks().collectOnUi { println("Button was pressed") }
21 | ```
22 |
--------------------------------------------------------------------------------
/gsonutils/src/main/java/com/programmersbox/gsonutils/ApiUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.gsonutils
2 |
3 | import androidx.annotation.WorkerThread
4 | import okhttp3.OkHttpClient
5 |
6 | @WorkerThread
7 | fun getApi(url: String, builder: okhttp3.Request.Builder.() -> Unit = {}): String? {
8 | val request = okhttp3.Request.Builder()
9 | .url(url)
10 | .apply(builder)
11 | .get()
12 | .build()
13 | val response = OkHttpClient().newCall(request).execute()
14 | return if (response.code == 200) response.body!!.string() else null
15 | }
16 |
17 | @WorkerThread
18 | inline fun getJsonApi(url: String, noinline builder: okhttp3.Request.Builder.() -> Unit = {}) = getApi(url, builder).fromJson()
19 |
20 | fun okhttp3.Request.Builder.header(pair: Pair) = header(pair.first, pair.second)
21 | fun okhttp3.Request.Builder.header(vararg pair: Pair) = apply { pair.forEach { header(it.first, it.second) } }
22 |
--------------------------------------------------------------------------------
/loggingutils/src/main/java/com/programmersbox/loggingutils/LogedInterceptor.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.loggingutils
2 |
3 | import android.util.Log
4 |
5 | fun interface LogedInterceptor {
6 | /**
7 | * The log interceptor
8 | * @param level The level of the log.
9 | * @param tag The tag.
10 | * @param msg The msg.
11 | * @return true if you want the log to be printed to the console, false if you don't
12 | * @see LogLevel
13 | */
14 | fun log(level: LogLevel, tag: String, msg: String): Boolean
15 | }
16 |
17 | enum class LogLevel {
18 | WARN, ASSERT, INFO, VERBOSE, ERROR, DEBUG;
19 |
20 | companion object {
21 | operator fun invoke(level: Int) = when (level) {
22 | Log.WARN -> WARN
23 | Log.ASSERT -> ASSERT
24 | Log.INFO -> INFO
25 | Log.VERBOSE -> VERBOSE
26 | Log.ERROR -> ERROR
27 | Log.DEBUG -> DEBUG
28 | else -> INFO
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/PaletteUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.thirdpartyutils
2 |
3 | import android.graphics.Bitmap
4 | import android.graphics.Canvas
5 | import android.graphics.Color
6 | import android.graphics.drawable.ColorDrawable
7 | import android.graphics.drawable.Drawable
8 | import androidx.core.graphics.drawable.toBitmap
9 | import androidx.palette.graphics.Palette
10 |
11 | fun Drawable.getPalette() = Palette.from(toBitmap()).generate()
12 | fun Bitmap.getPalette() = Palette.from(this).generate()
13 |
14 | fun Int.getPaletteFromColor(): Palette {
15 | val b = Bitmap.createBitmap(5, 5, Bitmap.Config.ARGB_8888)
16 | Canvas(b).drawColor(this@getPaletteFromColor)
17 | return b.getPalette()
18 | }
19 |
20 | fun String.getPaletteFromHexColor(): Palette = Color.parseColor(this@getPaletteFromHexColor).getPaletteFromColor()
21 |
22 | fun Int.toColorDrawable() = ColorDrawable(this)
23 | fun String.toColorDrawable() = ColorDrawable(Color.parseColor(this))
--------------------------------------------------------------------------------
/funutils/src/main/java/com/programmersbox/funutils/funutilities/TimedSequenceMaker.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.funutils.funutilities
2 |
3 | import android.os.CountDownTimer
4 |
5 | open class TimedSequenceMaker(sequence: List, private val timeout: Long = 5000, sequenceListener: SequenceListener?) :
6 | SequenceMaker(sequence, sequenceListener) {
7 | constructor(vararg sequence: T, timeout: Long = 5000, sequenceListener: SequenceListener?) : this(sequence.toList(), timeout, sequenceListener)
8 |
9 | private val timeoutTimer: CountDownTimer? = if (timeout <= 0) null else object : CountDownTimer(timeout, 1000) {
10 | override fun onTick(millisUntilFinished: Long) = Unit
11 | override fun onFinish(): Unit = resetSequence().also { this@TimedSequenceMaker.sequenceListener?.onFail() }
12 | }
13 |
14 | override fun nextItem(item: T) = timeoutTimer?.start().let { }
15 | override fun addNewItem(item: T) {
16 | timeoutTimer?.cancel()
17 | super.addNewItem(item)
18 | }
19 | }
--------------------------------------------------------------------------------
/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/LottieUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.thirdpartyutils
2 |
3 | import android.animation.ValueAnimator
4 | import android.graphics.PorterDuff
5 | import android.graphics.PorterDuffColorFilter
6 | import androidx.annotation.ColorInt
7 | import com.airbnb.lottie.LottieAnimationView
8 | import com.airbnb.lottie.LottieProperty
9 | import com.airbnb.lottie.model.KeyPath
10 |
11 | var LottieAnimationView.checked: Boolean
12 | get() = progress == 1f
13 | set(value) = check(value)
14 |
15 | fun LottieAnimationView.check(checked: Boolean) {
16 | val endProgress = if (checked) 1f else 0f
17 | val animator = ValueAnimator.ofFloat(progress, endProgress).apply {
18 | addUpdateListener { animation: ValueAnimator -> progress = animation.animatedValue as Float }
19 | }
20 | animator.start()
21 | }
22 |
23 | fun LottieAnimationView.changeTint(@ColorInt newColor: Int) =
24 | addValueCallback(KeyPath("**"), LottieProperty.COLOR_FILTER) { PorterDuffColorFilter(newColor, PorterDuff.Mode.SRC_ATOP) }
25 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/card_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/JavaDslBuilder.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools;
2 |
3 | //import com.programmersbox.dslannotations.DslClass;
4 | //import com.programmersbox.dslannotations.DslField;
5 |
6 | import kotlin.Unit;
7 | import kotlin.jvm.functions.Function0;
8 | import kotlin.jvm.functions.Function1;
9 |
10 | //@DslClass(dslMarker = JavaDslMarker.class)
11 | public class JavaDslBuilder {
12 | int num = 4;
13 |
14 | //@DslField(name = "javaName", comment = "This is a java one")
15 | String name = "";
16 |
17 | Function0 function = () -> null;
18 |
19 | //@DslField(name = "functionOne", comment = "This is a java one")
20 | Function0 function1 = new Function0() {
21 | @Override
22 | public Unit invoke() {
23 | return null;
24 | }
25 | };
26 |
27 | static void javaDslBuild(Function1 block) {
28 | JavaDslBuilder dsl = new JavaDslBuilder();
29 | block.invoke(dsl);
30 | dsl.function.invoke();
31 | dsl.function1.invoke();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/test_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/TestApp.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
2 |
3 | import android.app.Application
4 | import com.programmersbox.helpfulutils.createNotificationChannel
5 | import com.programmersbox.helpfulutils.createNotificationGroup
6 | import com.programmersbox.helpfulutils.defaultSharedPrefName
7 | import com.programmersbox.loggingutils.LogLevel
8 | import com.programmersbox.loggingutils.Loged
9 | import com.programmersbox.loggingutils.LogedInterceptor
10 |
11 | class TestApp : Application() {
12 |
13 | override fun onCreate() {
14 | super.onCreate()
15 | Loged.FILTER_BY_PACKAGE_NAME = "com.programmersbox.helpfultools"
16 | Loged.TAG = "HelpfulTools"
17 | Loged.logedInterceptor = Interceptor()
18 | defaultSharedPrefName = "DefaultPrefNameTest"
19 | createNotificationChannel("testChannel")
20 | createNotificationGroup("testGroup")
21 | }
22 |
23 | }
24 |
25 | class Interceptor : LogedInterceptor {
26 | override fun log(level: LogLevel, tag: String, msg: String) {
27 | println("${level.name[0]}/$tag/$msg")
28 | }
29 | }
--------------------------------------------------------------------------------
/funutils/src/androidTest/java/com/programmersbox/funutils/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.funutils
2 |
3 | import android.view.View
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 | import androidx.test.platform.app.InstrumentationRegistry
6 | import com.programmersbox.funutils.funutilities.TimedSequenceMaker
7 | import com.programmersbox.funutils.views.setOnFingerDetector
8 | import org.junit.Assert.assertEquals
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * See [testing documentation](http://d.android.com/tools/testing).
16 | */
17 | @RunWith(AndroidJUnit4::class)
18 | class ExampleInstrumentedTest {
19 | @Test
20 | fun useAppContext() {
21 | // Context of the app under test.
22 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
23 | assertEquals("com.programmersbox.funutils.test", appContext.packageName)
24 |
25 | TimedSequenceMaker(1, 2, 3, 400L) {
26 |
27 | }
28 |
29 | View(appContext).setOnFingerDetector(4) { fingers, fingerIndex ->
30 |
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/rxutils/src/androidTest/java/com/programmersbox/rxutils/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.rxutils
2 |
3 | import androidx.test.ext.junit.runners.AndroidJUnit4
4 | import androidx.test.platform.app.InstrumentationRegistry
5 | import io.reactivex.subjects.PublishSubject
6 | import org.junit.Assert.assertEquals
7 | import org.junit.Test
8 | import org.junit.runner.RunWith
9 |
10 | /**
11 | * Instrumented test, which will execute on an Android device.
12 | *
13 | * See [testing documentation](http://d.android.com/tools/testing).
14 | */
15 | @RunWith(AndroidJUnit4::class)
16 | class ExampleInstrumentedTest {
17 | @Test
18 | fun useAppContext() {
19 | // Context of the app under test.
20 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
21 | assertEquals("com.programmersbox.rxutils.test", appContext.packageName)
22 | val publish = PublishSubject.create()
23 | publish
24 | .ioMain()
25 | .doOnError { println(it) }
26 | .doOnComplete { println("Done") }
27 | .subscribe { println(it) }
28 | publish("Hello")
29 | publish.onNext("World")
30 | publish()
31 | publish(Throwable("Error!"))
32 | }
33 | }
--------------------------------------------------------------------------------
/dragswipe/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group='com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 23
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation coreKTX
31 | implementation appcompat
32 | testImplementation 'junit:junit:4.13.2'
33 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
34 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
35 | implementation recyclerview
36 | }
37 |
38 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/loggingutilslint/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 | apply plugin: 'kotlin'
3 | apply plugin: 'com.android.lint'
4 |
5 | lintOptions {
6 | htmlReport true
7 | htmlOutput file("lint-report.html")
8 | textReport true
9 | absolutePaths false
10 | ignoreTestSources true
11 | }
12 |
13 | dependencies {
14 | // For a description of the below dependencies, see the main project README
15 | def lintVersion = '27.1.0-alpha02'
16 | compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
17 | compileOnly "com.android.tools.lint:lint-api:$lintVersion"
18 | compileOnly "com.android.tools.lint:lint-checks:$lintVersion"
19 | testImplementation 'junit:junit:4.13.2'
20 | testImplementation "com.android.tools.lint:lint:$lintVersion"
21 | testImplementation "com.android.tools.lint:lint-tests:$lintVersion"
22 | testImplementation "com.android.tools:testutils:$lintVersion"
23 | }
24 |
25 | sourceCompatibility = "1.8"
26 | targetCompatibility = "1.8"
27 |
28 | jar {
29 | manifest {
30 | attributes("Lint-Registry-v2": "com.programmersbox.loggingutilslint.LogedIssueRegistry")
31 | }
32 | }
33 |
34 | task install(type: Copy) {
35 | from configurations.lintChecks
36 | into System.getProperty('user.home') + '/.android/lint/'
37 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_item_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
29 |
30 |
--------------------------------------------------------------------------------
/rxutils/src/main/java/com/programmersbox/rxutils/RxControlsProviderService.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.rxutils
2 |
3 | import android.os.Build
4 | import android.service.controls.Control
5 | import android.service.controls.ControlsProviderService
6 | import androidx.annotation.RequiresApi
7 | import io.reactivex.processors.ReplayProcessor
8 | import org.reactivestreams.FlowAdapters
9 | import org.reactivestreams.Publisher
10 | import java.util.concurrent.Flow
11 |
12 | @RequiresApi(Build.VERSION_CODES.R)
13 | abstract class RxControlsProviderService : ControlsProviderService() {
14 | private lateinit var updatePublisher: ReplayProcessor
15 | abstract fun createPublisherForAllAvailableControls(): Publisher
16 | override fun createPublisherForAllAvailable(): Flow.Publisher = FlowAdapters.toFlowPublisher(createPublisherForAllAvailableControls())
17 | abstract fun createPublisherForIds(publisher: Publisher, controlIds: MutableList)
18 | override fun createPublisherFor(controlIds: MutableList): Flow.Publisher {
19 | updatePublisher = ReplayProcessor.create()
20 | createPublisherForIds(updatePublisher, controlIds)
21 | return FlowAdapters.toFlowPublisher(updatePublisher)
22 | }
23 |
24 | protected fun publish(control: Control) = if (::updatePublisher.isInitialized) updatePublisher.onNext(control) else Unit
25 | }
--------------------------------------------------------------------------------
/gsonutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group = 'com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 16
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation coreKTX
31 | implementation appcompat
32 | testImplementation 'junit:junit:4.13.2'
33 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
34 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
35 | implementation 'com.google.code.gson:gson:2.8.7'
36 | implementation "com.squareup.okhttp3:okhttp:4.9.1"
37 | implementation project(":helpfulutils")
38 | }
39 |
40 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/funutils/src/main/java/com/programmersbox/funutils/cards/Card.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.funutils.cards
2 |
3 | enum class CardColor { BLACK, RED }
4 | data class Card(val value: Int, val suit: Suit) {
5 | val color: CardColor get() = suit.color
6 | val symbol: String
7 | get() = when (value) {
8 | 13 -> "K"
9 | 12 -> "Q"
10 | 11 -> "J"
11 | 1 -> "A"
12 | else -> "$value"
13 | }
14 |
15 | fun toSymbolString() = "$symbol${suit.unicodeSymbol}"
16 | fun toLetterString() = "$symbol${suit.symbol}"
17 | fun toNameString() = "$symbol of ${suit.printableName}"
18 |
19 | companion object {
20 | val RandomCard: Card get() = Card((1..13).random(), Suit.values().random())
21 | operator fun get(suit: Suit) = Card((1..13).random(), suit)
22 | operator fun get(vararg suit: Suit) = suit.map { Card((1..13).random(), it) }
23 | operator fun get(num: Int) = Card(num, Suit.values().random())
24 | operator fun get(vararg num: Int) = num.map { Card(it, Suit.values().random()) }
25 | }
26 | }
27 |
28 | enum class Suit(val printableName: String, val symbol: String, val unicodeSymbol: String, val color: CardColor) {
29 | SPADES("Spades", "S", "♠", CardColor.BLACK),
30 | CLUBS("Clubs", "C", "♣", CardColor.BLACK),
31 | DIAMONDS("Diamonds", "D", "♦", CardColor.RED),
32 | HEARTS("Hearts", "H", "♥", CardColor.RED);
33 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/Linting.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp;
2 |
3 | import android.util.Log;
4 |
5 | import com.programmersbox.loggingutils.Loged;
6 |
7 | class Linting {
8 | void test() {
9 | Log.v("Hello", "World");
10 | Log.i("Hello", "World");
11 | Log.d("Hello", "World");
12 | Log.wtf("Hello", "World");
13 | Log.w("Hello", "World");
14 | Log.e("Hello", "World");
15 |
16 | Loged.INSTANCE.w("World", "Hello", true, true);
17 | Loged.INSTANCE.a("World", "Hello", true, true);
18 | Loged.INSTANCE.i("World", "Hello", true, true);
19 | Loged.INSTANCE.v("World", "Hello", true, true);
20 | Loged.INSTANCE.e("World", "Hello", true, true);
21 | Loged.INSTANCE.d("World", "Hello", true, true);
22 | Loged.INSTANCE.wtf("World", "Hello", true, true);
23 | Loged.INSTANCE.r("World", "Hello", true, true, 2, 3, 4, 5, 6, 7);
24 |
25 | Loged.w("World", "Hello", true, true);
26 | Loged.a("World", "Hello", true, true);
27 | Loged.i("World", "Hello", true, true);
28 | Loged.v("World", "Hello", true, true);
29 | Loged.e("World", "Hello", true, true);
30 | Loged.d("World", "Hello", true, true);
31 | Loged.wtf("World", "Hello", true, true);
32 | Loged.r("World", "Hello", true, true, 2, 3, 4, 5, 6, 7);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/loggingutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group='com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 16
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | lintOptions {
26 | abortOnError false
27 | checkReleaseBuilds false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: "libs", include: ["*.jar"])
33 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
34 | implementation coreKTX
35 | implementation appcompat
36 | testImplementation 'junit:junit:4.13.2'
37 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
39 | //lintRuntimeOnly project(':loggingutilslint')
40 | lintChecks project(':loggingutilslint')
41 | }
42 |
43 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/rxutils/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
2 | ```gradle
3 | implementation 'com.github.jakepurple13.HelpfulTools:rxutils:{version}'
4 | ```
5 |
6 | # [RxUtils](https://github.com/jakepurple13/HelpfulTools/blob/master/rxutils/src/main/java/com/programmersbox/rxutils)
7 |
8 | ```kotlin
9 | val publish = PublishSubject.create()
10 | publish
11 | .ioMain()
12 | .doOnError { println(it) }
13 | .doOnComplete { println("Done") }
14 | .subscribe { println(it) }
15 | //added some some invoke functions
16 | //calls onNext
17 | publish("Hello")
18 | //calls onComplete
19 | publish()
20 | //calls onError
21 | publish(Throwable("Error!"))
22 |
23 | //calls the requestPermissions method in HelpfulUtils but wraps it in a Single
24 | FragmentActivity.rxRequestPermissions(Manifest.permission.RECORD_AUDIO)
25 | .doOnError { it.printStackTrace() }
26 | .subscribeBy { println(it) }
27 | .addTo(disposable)
28 |
29 | //added a delegate to BehaviorSubject so that you set/get a variable that references a BehaviorSubject
30 | val publish = BehaviorSubject.create()
31 | publish
32 | .doOnError { println(it) }
33 | .subscribe { println(it) }
34 | var item: String? by behaviorDelegate(publish)
35 | var item2: String? by publish.toDelegate()
36 | println(item)
37 | item = "Hello"
38 | item = "World"
39 | println(item)
40 | ```
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/funutils/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
2 | ```gradle
3 | implementation 'com.github.jakepurple13.HelpfulTools:funutils:{version}'
4 | ```
5 |
6 | # [FunUtils](https://github.com/jakepurple13/HelpfulTools/blob/master/funutils/src/main/java/com/programmersbox/funutils)
7 |
8 | ## [Cards](https://github.com/jakepurple13/HelpfulTools/blob/master/funutils/src/main/java/com/programmersbox/funutils/cards)
9 | ```kotlin
10 | val c = Card(1, Suit.SPADES)
11 | val d = Deck.defaultDeck() //a deck of Cards
12 | val deckOfStrings = Deck()
13 | deckOfStrings+=listOf("Hello", "World")
14 | ```
15 |
16 | ## [SequenceMaker](https://github.com/jakepurple13/HelpfulTools/blob/master/funutils/src/main/java/com/programmersbox/funutils/funutilities)
17 | ```kotlin
18 | val s = SequenceMaker(1, 2, 3, 4, 5, object : SequenceListener {
19 | override fun onAchieved() {
20 |
21 | }
22 |
23 | override fun onFail() {
24 |
25 | }
26 |
27 | override fun onReset() {
28 |
29 | }
30 | })
31 | ```
32 |
33 | ## [Views](https://github.com/jakepurple13/HelpfulTools/blob/master/funutils/src/main/java/com/programmersbox/funutils/views)
34 |
35 | ## [TableAdapter](https://github.com/jakepurple13/HelpfulTools/blob/master/funutils/src/main/java/com/programmersbox/funutils/views/TableAdapter.kt)
36 | To use most efficiently, make sure you use a RecyclerView with a vertical orientation and a LinearLayoutManager
37 |
--------------------------------------------------------------------------------
/rxutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group = 'com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 23
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation coreKTX
31 | implementation appcompat
32 | testImplementation 'junit:junit:4.13.2'
33 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
34 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
35 | implementation rxkotlin
36 | implementation rxjava
37 | implementation rxjavaBinding
38 | implementation rxkotlinBinding
39 | implementation project(":helpfulutils")
40 | implementation "org.reactivestreams:reactive-streams:1.0.3"
41 | }
42 |
43 |
44 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/flowutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group = 'com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 23
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | kotlinOptions { jvmTarget = "1.8" }
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(dir: "libs", include: ["*.jar"])
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
31 | implementation coreKTX
32 | implementation appcompat
33 | testImplementation 'junit:junit:4.13.2'
34 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
36 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
37 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
38 | implementation recyclerview
39 | }
40 |
41 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/Linting.java:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools;
2 |
3 | import android.os.CountDownTimer;
4 | import android.util.Log;
5 |
6 | import com.programmersbox.funutils.cards.Card;
7 | import com.programmersbox.funutils.cards.Deck;
8 | import com.programmersbox.helpfulutils.DeviceInfo;
9 | import com.programmersbox.helpfulutils.EasyCountDownTimer;
10 | import com.programmersbox.loggingutils.Loged;
11 |
12 | class Linting {
13 | void test() {
14 | Log.w("Hello", "World");
15 | Log.wtf("Hello", "World");
16 | Log.i("Hello", "World");
17 | Log.v("Hello", "World");
18 | Log.e("Hello", "World");
19 | Log.d("Hello", "World");
20 |
21 | Loged.w("World", "Hello");
22 | Loged.a("World", "Hello", true);
23 | Loged.i("World", "Hello", true, true);
24 | Loged.v("World", "Hello", true, true);
25 | Loged.e("World");
26 | Loged.d();
27 | Loged.wtf("World", "Hello", true, true);
28 | Loged.r("World", "Hello", true, true, 2, 3, 4, 5, 6, 7);
29 | }
30 |
31 | void test2() {
32 | Log.d("Gson", new DeviceInfo.Info().toString());
33 | Loged.d(new DeviceInfo.Info(), "Gson", true, true);
34 | }
35 |
36 | void test3() {
37 | CountDownTimer timer = EasyCountDownTimer.invoke(1000L, () -> {
38 | System.out.println("Finished");
39 | return null;
40 | });
41 |
42 | Deck deck = Deck.defaultDeck();
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/ColorApi.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
2 |
3 | data class ColorApi(
4 | val hex: Hex?,
5 | val rgb: Rgb?,
6 | val hsl: Hsl?,
7 | val hsv: Hsv?,
8 | val name: Name?,
9 | val cmyk: Cmyk?,
10 | val XYZ: XYZ?,
11 | val image: Image?,
12 | val contrast: Contrast?,
13 | val _links: _links?,
14 | val _embedded: _embedded?
15 | )
16 |
17 | data class Cmyk(val fraction: Fraction?, val value: String?, val c: Number?, val m: Number?, val y: Number?, val k: Number?)
18 |
19 | data class Contrast(val value: String?)
20 |
21 | data class Fraction(val c: Number?, val m: Number?, val y: Number?, val k: Number?)
22 |
23 | data class Hex(val value: String?, val clean: String?)
24 |
25 | data class Hsl(val fraction: Fraction?, val h: Number?, val s: Number?, val l: Number?, val value: String?)
26 |
27 | data class Hsv(val fraction: Fraction?, val value: String?, val h: Number?, val s: Number?, val v: Number?)
28 |
29 | data class Image(val bare: String?, val named: String?)
30 |
31 | data class Name(val value: String?, val closest_named_hex: String?, val exact_match_name: Boolean?, val distance: Number?)
32 |
33 | data class Rgb(val fraction: Fraction?, val r: Number?, val g: Number?, val b: Number?, val value: String?)
34 |
35 | data class Self(val href: String?)
36 |
37 | data class XYZ(val fraction: Fraction?, val value: String?, val X: Number?, val Y: Number?, val Z: Number?)
38 |
39 | class _embedded()
40 |
41 | data class _links(val self: Self?)
--------------------------------------------------------------------------------
/funutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-kapt'
4 | //apply plugin: 'com.github.dcendents.android-maven'
5 | //group = 'com.github.jakepurple13'
6 | apply plugin: 'maven-publish'
7 |
8 | android {
9 | compileSdkVersion latest_sdk
10 | buildToolsVersion build_version
11 |
12 | defaultConfig {
13 | minSdkVersion 23
14 | targetSdkVersion latest_sdk
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | consumerProguardFiles "consumer-rules.pro"
18 | }
19 |
20 | buildFeatures {
21 | dataBinding true
22 | }
23 |
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 |
31 | kotlinOptions { jvmTarget = "1.8" }
32 |
33 | }
34 |
35 | dependencies {
36 | implementation fileTree(dir: "libs", include: ["*.jar"])
37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38 | implementation coreKTX
39 | implementation appcompat
40 | testImplementation 'junit:junit:4.13.2'
41 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
42 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
43 | implementation material
44 | implementation project(":helpfulutils")
45 | implementation project(':dragswipe')
46 | }
47 |
48 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/flowutils/src/androidTest/java/com/programmersbox/flowutils/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.flowutils
2 |
3 | import android.view.View
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 | import androidx.test.platform.app.InstrumentationRegistry
6 | import kotlinx.coroutines.flow.map
7 | import kotlinx.coroutines.runBlocking
8 | import org.junit.Assert.assertEquals
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 | import kotlin.random.Random
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * See [testing documentation](http://d.android.com/tools/testing).
17 | */
18 | @RunWith(AndroidJUnit4::class)
19 | class ExampleInstrumentedTest {
20 | private val flowItem = FlowItem(5)
21 |
22 | @Test
23 | fun useAppContext() {
24 | // Context of the app under test.
25 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
26 | assertEquals("com.programmersbox.flowutils.test", appContext.packageName)
27 | }
28 |
29 | @Test
30 | fun flowTest() = runBlocking {
31 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
32 | val view = View(appContext)
33 | flowItem.bindToUI(view) { println(it) }
34 | flowItem.collectOnUI { println(it) }
35 | flowItem.flow.collectOnUi { println(it) }
36 | view
37 | .clicks()
38 | .map { Random.nextBoolean() }
39 | .collectOnUi { println("Clicked $it") }
40 | view.performClick()
41 | }.let { Unit }
42 | }
--------------------------------------------------------------------------------
/testingplayground/sampledata/sample_colors:
--------------------------------------------------------------------------------
1 | #ff0bf4f3
2 | #ff6c09da
3 | #ff9bcd2b
4 | #ff8a6cfe
5 | #ff9e5703
6 | #ff9533cf
7 | #ff651e94
8 | #ff2e1136
9 | #ff7ac1dd
10 | #ff06890b
11 | #ff04f31e
12 | #fff9cf26
13 | #ff3378c9
14 | #ffdafa25
15 | #ff21dbf8
16 | #ff1558b8
17 | #fffb2f5d
18 | #ffd633bf
19 | #fff3661c
20 | #ff6536b6
21 | #ff995310
22 | #ffe65af4
23 | #ffc4de4e
24 | #ff44c9f5
25 | #ffaf8816
26 | #fff4f59f
27 | #ffa72d59
28 | #ff846532
29 | #ffe57391
30 | #ff32a86a
31 | #ffde86aa
32 | #ffa7c9d7
33 | #ff592d0e
34 | #ff14b4b3
35 | #ffb5e338
36 | #ffe0917b
37 | #ff63f153
38 | #ff6e603d
39 | #ffe782b9
40 | #ff674e48
41 | #ff5bf07d
42 | #ff6bb0b6
43 | #ffb6ed27
44 | #ffa56c18
45 | #ff7d5171
46 | #ffb62504
47 | #ff2e2e9a
48 | #ff191c7f
49 | #ff8dc49a
50 | #ffb7566c
51 | #ffad4768
52 | #fffbd785
53 | #ff1f3ff4
54 | #ffc0ab7f
55 | #ff200aa4
56 | #ff7b3b52
57 | #ff8fbe6f
58 | #ffda86e5
59 | #ffbbe4df
60 | #ffc35488
61 | #ff051c9c
62 | #ff209be9
63 | #ff1c4541
64 | #ff30998a
65 | #ffad6ca7
66 | #ffdc52db
67 | #fff1a2e9
68 | #ffbf227c
69 | #ff7d5bb1
70 | #ff016747
71 | #ff3c58b2
72 | #ff33e829
73 | #ff7f825f
74 | #ff4c29f5
75 | #ff39d128
76 | #ff8c13a4
77 | #ff88bad7
78 | #ff0410bc
79 | #ffbfbcea
80 | #fff5a8c6
81 | #ffced5f3
82 | #ff507e22
83 | #ffbe4d50
84 | #fff4157a
85 | #ff7049da
86 | #ff20ead3
87 | #ff07ad5a
88 | #ff5a6fd6
89 | #ff74b3d3
90 | #ffe4dae0
91 | #ff4832fe
92 | #ff746d03
93 | #ff2f477f
94 | #ffb348d4
95 | #ff5002bb
96 | #ff0e5afb
97 | #ff35854e
98 | #ff0c7096
99 | #ff6c1f81
100 | #ff0ba714
101 | #ff4dd254
--------------------------------------------------------------------------------
/testingplayground/src/main/java/com/programmersbox/testingplayground/AnsiColor.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplayground
2 |
3 | object AnsiColor {
4 | const val prefix = "\u001B"
5 | const val RESET = "$prefix[0m"
6 | private val isCompatible = !System.getProperty("os.name")?.toLowerCase()?.contains("win")!!
7 | fun getColor(r: Int, g: Int, b: Int) = "[38;2;$r;$g;$b"
8 | fun regularColor(r: Int, g: Int, b: Int) = if (isCompatible) "$prefix${getColor(r, g, b)}m" else ""
9 | fun regularColor(color: Int) = color.valueOf().let { regularColor(it.first, it.second, it.third) }
10 | fun regularColor(color: Long) = color.valueOf().let { regularColor(it.first, it.second, it.third) }
11 | fun colorText(s: String, color: Int) = "${regularColor(color)}$s$RESET"
12 | fun colorText(s: String, color: Long) = "${regularColor(color)}$s$RESET"
13 | fun colorText(s: String, r: Int, g: Int, b: Int) = "${regularColor(r, g, b)}$s$RESET"
14 | private fun Int.valueOf(): Triple {
15 | val r = (this shr 16 and 0xff)// / 255.0f
16 | val g = (this shr 8 and 0xff)// / 255.0f
17 | val b = (this and 0xff)// / 255.0f
18 | return Triple(r, g, b)
19 | }
20 |
21 | private fun Long.valueOf(): Triple {
22 | val r = (this shr 16 and 0xff)// / 255.0f
23 | val g = (this shr 8 and 0xff)// / 255.0f
24 | val b = (this and 0xff)// / 255.0f
25 | return Triple(r.toInt(), g.toInt(), b.toInt())
26 | }
27 | }
28 |
29 | fun String.color(color: Int) = AnsiColor.colorText(this, color)
30 | fun String.color(color: Long) = AnsiColor.colorText(this, color)
31 | fun String.color(r: Int, g: Int, b: Int) = AnsiColor.colorText(this, r, g, b)
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/Views.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import com.programmersbox.funutils.views.SlideValuePicker
6 | import kotlinx.coroutines.flow.MutableStateFlow
7 | import kotlinx.coroutines.flow.distinctUntilChanged
8 |
9 | class FlowSlidePicker @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
10 | SlideValuePicker(context, attrs, defStyleAttr) {
11 |
12 | private val prog = MutableStateFlow(0.5f)
13 |
14 | fun toFlow() = prog.distinctUntilChanged { old, new -> old == new }
15 |
16 | override fun progressChanged(progress: Float) {
17 | super.progressChanged(progress)
18 | prog.value = progress
19 | }
20 |
21 | }
22 |
23 | open class SwitchSlidePicker @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
24 | SlideValuePicker(context, attrs, defStyleAttr) {
25 |
26 | var checked = false
27 |
28 | private var listener: Listener? = null
29 |
30 | override fun progressChanged(progress: Float) {
31 | super.progressChanged(progress)
32 | checked = when (progress) {
33 | 1.0f -> true
34 | 0.0f -> false
35 | else -> checked
36 | }
37 | listener?.onChecked(checked)
38 | }
39 |
40 | interface Listener {
41 | fun onChecked(checked: Boolean)
42 | }
43 |
44 | fun setCheckedListener(checked: (Boolean) -> Unit) {
45 | listener = object : Listener {
46 | override fun onChecked(checked: Boolean) = checked(checked)
47 | }
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/testingplayground/src/main/java/com/programmersbox/testingplayground/RxDeckOfCards.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplayground
2 |
3 | import com.programmersbox.funutils.cards.AbstractDeck
4 | import com.programmersbox.funutils.cards.Card
5 | import com.programmersbox.funutils.cards.Suit
6 | import com.programmersbox.rxutils.invoke
7 | import io.reactivex.subjects.PublishSubject
8 |
9 | fun Iterable.toRxDeck() = RxDeck(this)
10 | fun Array.toRxDeck() = RxDeck(*this)
11 | class RxDeck : AbstractDeck {
12 |
13 | constructor(cards: Iterable = emptyList()) : super(cards)
14 | constructor(vararg cards: T) : super(cards.toList())
15 |
16 | private val onAddPublisher = PublishSubject.create>()
17 | private val onDrawPublisher = PublishSubject.create()
18 | private val onShufflePublisher = PublishSubject.create()
19 |
20 | inner class DrawInfo(val card: T, val size: Int)
21 |
22 | override fun cardAdded(vararg card: T) = onAddPublisher(card.toList())
23 | override fun cardDrawn(card: T, size: Int) = onDrawPublisher(DrawInfo(card, size))
24 | override fun deckShuffled() = onShufflePublisher(Unit)
25 |
26 | fun onAddSubscribe() = onAddPublisher
27 | fun onDrawSubscribe() = onDrawPublisher
28 | fun onShuffleSubscribe() = onShufflePublisher
29 |
30 | companion object {
31 | /**
32 | * A default card_games.Deck of Playing Cards
33 | */
34 | fun defaultDeck() = RxDeck(*Suit.values().map { suit -> (1..13).map { value -> Card(value, suit) } }.flatten().toTypedArray())
35 |
36 | /**
37 | * Create a deck by adding a card to it!
38 | */
39 | operator fun plus(card: T) = RxDeck(card)
40 | }
41 | }
--------------------------------------------------------------------------------
/helpfulutils/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //group='com.github.jakepurple13'
5 | apply plugin: 'maven-publish'
6 |
7 | android {
8 | compileSdkVersion latest_sdk
9 | buildToolsVersion build_version
10 |
11 | defaultConfig {
12 | minSdkVersion 16
13 | targetSdkVersion latest_sdk
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 |
31 | kotlinOptions {
32 | jvmTarget = JavaVersion.VERSION_1_8.toString()
33 | }
34 | }
35 |
36 | dependencies {
37 | implementation fileTree(dir: "libs", include: ["*.jar"])
38 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
39 | implementation coreKTX
40 | implementation appcompat
41 | implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
42 | testImplementation 'junit:junit:4.13.2'
43 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
44 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
45 | implementation recyclerview
46 | implementation 'androidx.biometric:biometric:1.1.0'
47 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
48 | }
49 |
50 | apply from: '../publish.gradle'
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
34 |
35 |
--------------------------------------------------------------------------------
/testingplayground/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'kotlinx-serialization'
5 |
6 | android {
7 | compileSdkVersion latest_sdk
8 | buildToolsVersion build_version
9 |
10 | defaultConfig {
11 | minSdkVersion 27
12 | targetSdkVersion latest_sdk
13 |
14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15 | consumerProguardFiles "consumer-rules.pro"
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(dir: "libs", include: ["*.jar"])
28 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
29 | implementation coreKTX
30 | implementation appcompat
31 | testImplementation 'junit:junit:4.13.2'
32 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
34 | implementation project(':flowutils')
35 | implementation project(':gsonutils')
36 | implementation project(':helpfulutils')
37 | implementation project(':loggingutils')
38 | implementation project(':rxutils')
39 | implementation project(':funutils')
40 | implementation rxkotlin
41 | implementation rxjava
42 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
43 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
44 | implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0"
45 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/binding_test_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
16 |
17 |
28 |
29 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/publish.gradle:
--------------------------------------------------------------------------------
1 | /*// build a jar with source files
2 | task sourcesJar(type: Jar) {
3 | from android.sourceSets.main.java.srcDirs
4 | classifier = 'sources'
5 | }
6 |
7 | task javadoc(type: Javadoc) {
8 | failOnError false
9 | source = android.sourceSets.main.java.sourceFiles
10 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
11 | classpath += configurations.compile
12 | }
13 |
14 | // build a jar with javadoc
15 | task javadocJar(type: Jar, dependsOn: javadoc) {
16 | classifier = 'javadoc'
17 | from javadoc.destinationDir
18 | }
19 |
20 | artifacts {
21 | archives(sourcesJar)
22 | archives(javadocJar)
23 | }*/
24 |
25 | // Because the components are created only during the afterEvaluate phase, you must
26 | // configure your publications using the afterEvaluate() lifecycle method.
27 | afterEvaluate {
28 | publishing {
29 | publications {
30 | // Creates a Maven publication called "release".
31 | release(MavenPublication) {
32 | // Applies the component for the release build variant.
33 | from components.release
34 |
35 | // You can then customize attributes of the publication as shown below.
36 | groupId = 'com.github.jakepurple13'
37 | artifactId = 'final'
38 | version = '10.7.0'
39 | }
40 | // Creates a Maven publication called “debug”.
41 | debug(MavenPublication) {
42 | // Applies the component for the debug build variant.
43 | from components.debug
44 |
45 | groupId = 'com.github.jakepurple13'
46 | artifactId = 'final-debug'
47 | version = '10.7.0'
48 | }
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/dragswipe/src/main/java/com/programmersbox/dragswipe/DragSwipeDiffUtil.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.dragswipe
2 |
3 | import androidx.recyclerview.widget.DiffUtil
4 | import androidx.recyclerview.widget.RecyclerView
5 |
6 | open class DragSwipeDiffUtil(private val oldList: List, private val newList: List) : DiffUtil.Callback() {
7 | override fun getOldListSize(): Int = oldList.size
8 | override fun getNewListSize(): Int = newList.size
9 |
10 | open fun areItemsTheSame(oldItem: T, newItem: T): Boolean = oldItem == newItem
11 | override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean =
12 | areItemsTheSame(oldList[oldItemPosition], newList[newItemPosition])
13 |
14 | open fun areContentsTheSame(oldItem: T, newItem: T): Boolean = oldItem === newItem
15 | override fun areContentsTheSame(oldPosition: Int, newPosition: Int): Boolean = areContentsTheSame(oldList[oldPosition], newList[newPosition])
16 | }
17 |
18 | fun > DragSwipeAdapter.setData(newList: List, diffUtil: (oldList: List, newList: List) -> R) {
19 | val diffResult = DiffUtil.calculateDiff(diffUtil(dataList, newList))
20 | dataList.clear()
21 | dataList.addAll(newList)
22 | diffResult.dispatchUpdatesTo(this)
23 | }
24 |
25 | abstract class DragSwipeDiffUtilAdapter(dataList: MutableList = mutableListOf()) :
26 | DragSwipeAdapter(dataList) {
27 |
28 | protected abstract val dragSwipeDiffUtil: (oldList: List, newList: Collection) -> DragSwipeDiffUtil
29 |
30 | override fun setListNotify(genericList: Collection) {
31 | val diffResult = DiffUtil.calculateDiff(dragSwipeDiffUtil(dataList, genericList))
32 | dataList.clear()
33 | dataList.addAll(genericList)
34 | diffResult.dispatchUpdatesTo(this)
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/layout/ui_test_file.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/testingplayground/src/androidTest/java/com/programmersbox/testingplayground/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplayground
2 |
3 | import android.graphics.Color
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 | import androidx.test.platform.app.InstrumentationRegistry
6 | import org.junit.Assert.assertEquals
7 | import org.junit.Test
8 | import org.junit.runner.RunWith
9 |
10 | /**
11 | * Instrumented test, which will execute on an Android device.
12 | *
13 | * See [testing documentation](http://d.android.com/tools/testing).
14 | */
15 | @RunWith(AndroidJUnit4::class)
16 | class ExampleInstrumentedTest {
17 | @Test
18 | fun useAppContext() {
19 | // Context of the app under test.
20 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
21 | assertEquals("com.programmersbox.testingplayground.test", appContext.packageName)
22 |
23 | }
24 |
25 | @Test
26 | fun other7() {
27 | val list = listOf(
28 | "#FAFAFA",
29 | "#FAFAFA",
30 | "#000000",
31 | "#de605e",
32 | "#F2ACAC",
33 | "#C16363",
34 | "#FAFAFA",
35 | "#B61F1E",
36 | "#951A18",
37 | "#CC2523",
38 | "#ffd5d5",
39 | "#FFCECE",
40 | "#FFE1E1",
41 | "#FFD5D5",
42 | "#D64542",
43 | "#8E3230",
44 | "#D6403D",
45 | "#DB3D38",
46 | "#FFC1BF",
47 | "#D58582"
48 | ).shuffled()
49 |
50 | list.forEach { println(it.color(Color.parseColor(it))) }
51 |
52 | val f = list.sortedBy {
53 | val array = floatArrayOf(0f, 0f, 0f)
54 | Color.colorToHSV(Color.parseColor(it), array)
55 | array[0]
56 | }
57 |
58 | f.forEach { println(it.color(Color.parseColor(it))) }
59 | }
60 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # [HelpfulTools](https://github.com/jakepurple13/HelpfulTools/wiki)
2 |
3 | 
4 | 
5 | 
6 |
7 | 
8 |
9 | Just some small simple tools that I have found myself copying+pasting to almost all projects I do.
10 |
11 | First, add JitPack:
12 | ```groovy
13 | allprojects {
14 | repositories {
15 | //...
16 | maven { url 'https://jitpack.io' }
17 | }
18 | }
19 | ```
20 |
21 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
22 |
23 | ```groovy
24 | implementation 'com.github.jakepurple13.HelpfulTools:flowutils:{version}'
25 | implementation 'com.github.jakepurple13.HelpfulTools:gsonutils:{version}'
26 | implementation 'com.github.jakepurple13.HelpfulTools:helpfulutils:{version}'
27 | implementation 'com.github.jakepurple13.HelpfulTools:loggingutils:{version}'
28 | implementation 'com.github.jakepurple13.HelpfulTools:rxutils:{version}'
29 | implementation 'com.github.jakepurple13.HelpfulTools:dragswipe:{version}'
30 | implementation 'com.github.jakepurple13.HelpfulTools:funutils:{version}'
31 | implementation "com.github.jakepurple13.HelpfulTools:thirdpartyutils:{version}"
32 | ```
33 |
34 | These aren't working right now. Use version 10.2.3 if you want to use them
35 | For the dslprocessor module, also include:
36 | ```groovy
37 | //To allow kapt
38 | apply plugin: 'kotlin-kapt'
39 | //For the Annotations
40 | implementation 'com.github.jakepurple13.HelpfulTools:dslannotations:{version}'
41 | //For the actual generation
42 | kapt "com.github.jakepurple13.HelpfulTools:dslprocessor:{version}"
43 | ```
44 |
--------------------------------------------------------------------------------
/gsonutils/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
2 | ```groovy
3 | implementation 'com.github.jakepurple13.HelpfulTools:gsonutils:{version}'
4 | ```
5 |
6 | # [Gson](https://github.com/jakepurple13/HelpfulTools/blob/master/gsonutils/src/main/java/com/programmersbox/gsonutils/GsonUtils.kt)
7 |
8 | Super easy way to convert objects to json and json string's to objects!
9 |
10 | To use:
11 | ```kotlin
12 | data class AnotherObject(val item: String)
13 | data class GsonObject(val string: String, val int: Int, val anotherObject: AnotherObject)
14 |
15 | val item = GsonObject("Hello", 5, AnotherObject("World"))
16 | val jsonString: String = item.toJson()
17 | val jsonPrettyString: String = item.toPrettyJson()
18 | val gsonObject: GsonObject = jsonString.fromJson()
19 | ```
20 |
21 | Also added a couple other functions for Intents and SharedPreferences:
22 | ```kotlin
23 | val intent = Intent(/*...*/).apply {
24 | putExtra("key", item)
25 | }
26 | val item2 = intent.getObjectExtra("key", null)
27 |
28 | getSharedPreferences("SharedPreferences", Context.MODE_PRIVATE).edit().putObject("gson", item).apply()
29 | val item3 = getSharedPreferences("SharedPreferences", Context.MODE_PRIVATE).getObject("gson")
30 | ```
31 |
32 |
33 | Along with some [network](https://github.com/jakepurple13/HelpfulTools/blob/master/gsonutils/src/main/java/com/programmersbox/gsonutils/ApiUtils.kt) methods:
34 | ```kotlin
35 | val string = getApi("api url")
36 | val apiObject = getJsonApi("api url")
37 | ```
38 |
39 |
40 | Also added a method to tie in with the [SharedPrefDelegate](https://github.com/jakepurple13/HelpfulTools/blob/master/helpfulutils/src/main/java/com/programmersbox/helpfulutils/ContextUtils.kt#L103) called [sharedPrefObjectDelegate](https://github.com/jakepurple13/HelpfulTools/blob/master/gsonutils/src/main/java/com/programmersbox/gsonutils/GsonUtils.kt#L120):
41 | ```kotlin
42 | var Context.gsonObject: GsonObject? by sharedPrefObjectDelegate()
43 | ```
--------------------------------------------------------------------------------
/funutils/src/main/java/com/programmersbox/funutils/funutilities/SequenceMaker.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.funutils.funutilities
2 |
3 | import androidx.annotation.CallSuper
4 |
5 | open class SequenceMaker(private val sequence: List, protected var sequenceListener: SequenceListener? = null) {
6 | constructor(vararg sequence: T, sequenceListener: SequenceListener? = null) : this(sequence.toList(), sequenceListener)
7 |
8 | private val currentSequence = mutableListOf()
9 | fun setListener(listener: SequenceListener?) = apply { sequenceListener = listener }
10 | fun resetSequence() = currentSequence.clear().also { sequenceListener?.onReset() }
11 | private fun validateSequence() = currentSequence.lastIndex.let { currentSequence[it] == sequence[it] }
12 | private fun isAchieved() = currentSequence == sequence
13 | protected open fun nextItem(item: T) = Unit
14 | fun currentSequence() = currentSequence.toList()
15 | fun correctSequence() = sequence.toList()
16 | operator fun plusAssign(order: T) = add(order)
17 | operator fun plusAssign(list: Iterable) = add(list)
18 | operator fun plusAssign(items: Array) = add(*items)
19 | operator fun contains(item: T) = item in currentSequence
20 | fun add(list: Iterable) = list.forEach(::addNewItem)
21 | fun add(vararg items: T) = items.forEach(::addNewItem)
22 |
23 | @CallSuper
24 | protected open fun internalAchieved() {
25 | sequenceListener?.onAchieved()
26 | }
27 |
28 | @CallSuper
29 | open fun addNewItem(item: T) = addItem(item)
30 |
31 | private fun addItem(item: T) {
32 | currentSequence += item
33 | if (validateSequence()) {
34 | nextItem(item)
35 | if (isAchieved()) {
36 | internalAchieved()
37 | resetSequence()
38 | }
39 | } else sequenceListener?.onFail().also { resetSequence() }
40 | }
41 | }
42 |
43 | fun interface SequenceListener {
44 | fun onAchieved()
45 | fun onFail() {}
46 | fun onReset() {}
47 | }
48 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/PeopleBuilder.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | @DslMarker
4 | annotation class PersonMarker
5 |
6 | @DslMarker
7 | annotation class PersonMarker2
8 |
9 | data class Person(val name: String, var age: Int, private val birthday: (Int) -> Int) {
10 | fun birthday() {
11 | age = birthday(age)
12 | }
13 | }
14 |
15 | class PersonBuilder {
16 |
17 | //@DslField("personName", PersonMarker::class)
18 | var name: String = ""
19 |
20 | //@DslField("personAge", PersonMarker::class)
21 | var age = 0
22 |
23 | //@DslField("birthdayParty", PersonMarker::class)
24 | var birthday: (Int) -> Int = { it }
25 |
26 | private fun build() = Person(name, age, birthday)
27 |
28 | companion object {
29 | fun builder(block: PersonBuilder.() -> Unit) = PersonBuilder().apply(block).build()
30 | }
31 |
32 | }
33 |
34 | //@DslClass(PersonMarker2::class)
35 | class PersonBuilder2 {
36 | //@DslField("birthdayParty", comment = "Set what happens on his birthday party")
37 | var birthday: (Int) -> Int = { it }
38 | var name: String = ""
39 | var age = 0
40 |
41 | private fun build() = Person(name, age, birthday)
42 |
43 | companion object {
44 | fun builder(block: PersonBuilder2.() -> Unit) = PersonBuilder2().apply(block).build()
45 | }
46 |
47 | }
48 |
49 | class PersonBuilder3 {
50 |
51 | private var birthday: (Int) -> Int = { it }
52 |
53 | @PersonMarker2
54 | fun birthdayParty(block: (Int) -> Int) {
55 | birthday = block
56 | }
57 |
58 | private var name: String = ""
59 |
60 | @PersonMarker2
61 | fun name(s: String) {
62 | name = s
63 | }
64 |
65 | private var age = 0
66 |
67 | @PersonMarker2
68 | fun age(num: Int) {
69 | age = num
70 | }
71 |
72 | private fun build() = Person(name, age, birthday)
73 |
74 | companion object {
75 | fun builder(block: PersonBuilder3.() -> Unit) = PersonBuilder3().apply(block).build()
76 | }
77 |
78 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
13 |
14 |
20 |
21 |
32 |
33 |
41 |
42 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/GlideUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.thirdpartyutils
2 |
3 | import android.graphics.drawable.Drawable
4 | import androidx.annotation.NonNull
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.bumptech.glide.ListPreloader
7 | import com.bumptech.glide.RequestBuilder
8 | import com.bumptech.glide.request.target.CustomTarget
9 | import com.bumptech.glide.request.transition.Transition
10 | import com.programmersbox.dragswipe.DragSwipeAdapter
11 | import kotlin.properties.Delegates
12 |
13 | @DslMarker
14 | annotation class GlideMarker
15 |
16 | fun RequestBuilder.into(target: CustomTargetBuilder.() -> Unit) = into(CustomTargetBuilder().apply(target).build())
17 |
18 | class CustomTargetBuilder internal constructor() {
19 |
20 | private var resourceReady: (T, Transition?) -> Unit by Delegates.notNull()
21 |
22 | @GlideMarker
23 | fun resourceReady(block: (image: T, transition: Transition?) -> Unit) = run { resourceReady = block }
24 |
25 | private var loadCleared: (Drawable?) -> Unit = {}
26 |
27 | @GlideMarker
28 | fun loadCleared(block: (placeHolder: Drawable?) -> Unit) = run { loadCleared = block }
29 |
30 | fun build() = object : CustomTarget() {
31 | override fun onLoadCleared(placeholder: Drawable?) = loadCleared(placeholder)
32 | override fun onResourceReady(resource: T, transition: Transition?) = resourceReady(resource, transition)
33 | }
34 |
35 | }
36 |
37 | abstract class DragSwipeGlideAdapter(
38 | dataList: MutableList = mutableListOf()
39 | ) : DragSwipeAdapter(dataList), ListPreloader.PreloadModelProvider {
40 |
41 | protected abstract val fullRequest: RequestBuilder
42 | protected abstract val thumbRequest: RequestBuilder
43 | protected abstract val itemToModel: (T) -> Model
44 |
45 | @NonNull
46 | override fun getPreloadItems(position: Int): List = dataList.subList(position, position + 1).map(itemToModel).toList()
47 |
48 | @NonNull
49 | override fun getPreloadRequestBuilder(item: Model): RequestBuilder? = fullRequest.thumbnail(thumbRequest.load(item)).load(item)
50 | }
--------------------------------------------------------------------------------
/.idea/markdown-navigator-enh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/WIPUtils.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | import android.content.Context
4 | import androidx.databinding.ViewDataBinding
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.programmersbox.dragswipe.DragSwipeAdapter
7 |
8 | abstract class BindingViewHolder(protected val binding: B) : RecyclerView.ViewHolder(binding.root) {
9 |
10 | /**
11 | * Call `binding.(model name) = item` here
12 | * along with any other variable setting you want to do
13 | */
14 | abstract fun setModel(item: T)
15 |
16 | fun bind(item: T) {
17 | setModel(item)
18 | binding.executePendingBindings()
19 | render(item)
20 | }
21 |
22 | open fun render(item: T) = Unit
23 | }
24 |
25 | abstract class BindingDragSwipe>(dataList: MutableList = mutableListOf()) : DragSwipeAdapter(dataList) {
26 | override fun B.onBind(item: T, position: Int) = bind(item)
27 | }
28 |
29 | class TimeCounter(context: Context, val max: Int, val resetAfter: Long) {
30 | private var id = 0//counter
31 |
32 | private val prefs by lazy { context.getSharedPreferences("timeCounter$id", Context.MODE_PRIVATE) }
33 |
34 | var count: Int
35 | get() = prefs.getInt("timeCounterCount", 0)
36 | private set(value) = if (value <= max) prefs.edit().putInt("timeCounterCount", value).apply() else Unit
37 |
38 | var lastTimeSaved: Long
39 | get() = prefs.getLong("timeCounterLastTimeSaved", System.currentTimeMillis())
40 | private set(value) = prefs.edit().putLong("timeCounterLastTimeSaved", value).apply()
41 |
42 | init {
43 | checkReset()
44 | counter++
45 | }
46 |
47 | fun checkReset() {
48 | if (lastTimeSaved + resetAfter < System.currentTimeMillis()) count = 0
49 | }
50 |
51 | fun plusOne() {
52 | count += 1
53 | if (count == 1)
54 | lastTimeSaved = System.currentTimeMillis()
55 | }
56 |
57 | fun belowMax() = count < max
58 | fun reachedMax() = count >= max
59 |
60 | override fun toString(): String = "TimeCounter(max=$max, resetAfter=$resetAfter, count=$count, lastTimeSaved=$lastTimeSaved)"
61 |
62 | companion object {
63 | private var counter: Int = 0
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/testingplayground/src/main/java/com/programmersbox/testingplayground/FlowDeckOfCards.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplayground
2 |
3 | import com.programmersbox.funutils.cards.AbstractDeck
4 | import com.programmersbox.funutils.cards.Card
5 | import com.programmersbox.funutils.cards.Suit
6 | import kotlinx.coroutines.CoroutineScope
7 | import kotlinx.coroutines.GlobalScope
8 | import kotlinx.coroutines.channels.BroadcastChannel
9 | import kotlinx.coroutines.flow.asFlow
10 | import kotlinx.coroutines.launch
11 |
12 | fun Iterable.toFlowDeck() = FlowDeck(this)
13 | fun Array.toFlowDeck() = FlowDeck(*this)
14 | class FlowDeck : AbstractDeck {
15 |
16 | constructor(cards: Iterable = emptyList()) : super(cards)
17 | constructor(vararg cards: T) : super(cards.toList())
18 |
19 | private val onAddChannel = BroadcastChannel>(1)
20 | private val onDrawChannel = BroadcastChannel(1)
21 | private val onShuffleChannel = BroadcastChannel(1)
22 |
23 | var channelMove = FlowDeckMoveType.SEND
24 | var coroutineScope: CoroutineScope = GlobalScope
25 |
26 | enum class FlowDeckMoveType { SEND, OFFER }
27 |
28 | inner class DrawInfo(val card: T, val size: Int)
29 |
30 | private fun sendChannel(channel: BroadcastChannel, item: R) = coroutineScope.launch {
31 | when (channelMove) {
32 | FlowDeckMoveType.SEND -> channel.send(item)
33 | FlowDeckMoveType.OFFER -> channel.trySend(item).isSuccess
34 | }
35 | }.let { Unit }
36 |
37 | override fun cardAdded(vararg card: T) = sendChannel(onAddChannel, card.toList())
38 | override fun cardDrawn(card: T, size: Int) = sendChannel(onDrawChannel, DrawInfo(card, size))
39 | override fun deckShuffled() = sendChannel(onShuffleChannel, Unit)
40 |
41 | fun onAddCollect() = onAddChannel.asFlow()
42 | fun onDrawCollect() = onDrawChannel.asFlow()
43 | fun onShuffleCollect() = onShuffleChannel.asFlow()
44 |
45 | companion object {
46 | /**
47 | * A default card_games.Deck of Playing Cards
48 | */
49 | fun defaultDeck() = FlowDeck(*Suit.values().map { suit -> (1..13).map { value -> Card(value, suit) } }.flatten().toTypedArray())
50 |
51 | /**
52 | * Create a deck by adding a card to it!
53 | */
54 | operator fun plus(card: T) = FlowDeck(card)
55 | }
56 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/androidTest/java/com/programmersbox/testingplaygroundapp/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp
2 |
3 | import android.content.Context
4 | import androidx.core.app.TaskStackBuilder
5 | import androidx.test.ext.junit.runners.AndroidJUnit4
6 | import androidx.test.platform.app.InstrumentationRegistry
7 | import com.programmersbox.gsonutils.toJson
8 | import com.programmersbox.helpfulutils.*
9 | import kotlinx.coroutines.GlobalScope
10 | import kotlinx.coroutines.launch
11 | import org.junit.Assert.assertEquals
12 | import org.junit.Test
13 | import org.junit.runner.RunWith
14 |
15 | /**
16 | * Instrumented test, which will execute on an Android device.
17 | *
18 | * See [testing documentation](http://d.android.com/tools/testing).
19 | */
20 | @RunWith(AndroidJUnit4::class)
21 | class ExampleInstrumentedTest {
22 |
23 | private val appContext = InstrumentationRegistry.getInstrumentation().targetContext
24 |
25 | private var Context.asdf: String? by sharedPrefDelegate("")
26 | private var Context.a: Int? by sharedPrefDelegate(9, "thisIsTheKey")
27 | private var Context.abc: Int by sharedPrefNotNullDelegate(9, "thisIsTheKey")
28 |
29 | @Test
30 | fun useAppContext() {
31 | // Context of the app under test.
32 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
33 | assertEquals("com.programmersbox.testingplaygroundapp", appContext.packageName)
34 | with(appContext) {
35 | //var f: String? by sharedPrefDelegate("0")
36 |
37 | asdf = "5"
38 | println(asdf)
39 | println(defaultSharedPref.all.entries)
40 |
41 | println(defaultSharedPref.get("asdf", "9"))
42 |
43 | a = 54
44 | println("$a")
45 |
46 | val z: String? = defaultSharedPref["asdf"]
47 | println(z)
48 |
49 | defaultSharedPref["asdf"] = "Hello World"
50 | }
51 |
52 | }
53 |
54 | @Test
55 | fun nextTry() {
56 | appContext.powerManager.addThermalStatusListener { }
57 |
58 | GlobalScope.launch {
59 |
60 | }
61 | }
62 |
63 | @Test
64 | fun gsonTaskTest() {
65 | val f = TaskStackBuilder.create(appContext)
66 | //.addNextIntent(Intent(appContext, MainActivity::class.java))
67 | .toJson()
68 | println(f)
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/helpfulutils/src/main/java/com/programmersbox/helpfulutils/QuickAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfulutils
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.annotation.LayoutRes
8 | import androidx.recyclerview.widget.RecyclerView
9 |
10 | /**
11 | * A quick way to add items to the recyclerview.
12 | * If the current adapter is not a [QuickAdapter], it will replace the current adapter with a new [QuickAdapter]
13 | */
14 | @Suppress("UNCHECKED_CAST")
15 | fun RecyclerView.quickAdapter(@LayoutRes layout: Int? = null, vararg item: T, setup: (View.(T) -> Unit)? = null) {
16 | adapter = (adapter as? QuickAdapter) ?: QuickAdapter(context)
17 | if (layout != null && setup != null && item.isNotEmpty()) (adapter as QuickAdapter).add(layout, *item, setup = setup)
18 | }
19 |
20 | /**
21 | * A quick way to make an adapter and add data of a type to it
22 | * This is a super basic adapter.
23 | */
24 | class QuickAdapter(private val context: Context) : RecyclerView.Adapter() {
25 | class QuickHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
26 | private data class QuickAdapterItem(@LayoutRes val layout: Int, val item: T, val setup: View.(T) -> Unit) {
27 | fun renderItem(view: View) = view.setup(item)
28 | }
29 |
30 | private val data = mutableListOf>()
31 | val dataList get() = data.map(QuickAdapterItem::item)
32 |
33 | fun add(@LayoutRes layout: Int, vararg item: T, setup: View.(T) -> Unit) =
34 | data.addAll(item.map { QuickAdapterItem(layout, it, setup) }).also { notifyDataSetChanged() }
35 |
36 | fun remove(index: Int = data.size - 1) = data.removeAt(index).also { notifyItemRemoved(index) }.item
37 | operator fun contains(item: T) = data.any { it.item == item }
38 | operator fun get(index: Int) = data[index].item
39 | operator fun set(index: Int, item: T) {
40 | data[index] = data[index].copy(item = item)
41 | notifyItemChanged(index)
42 | }
43 |
44 | override fun getItemViewType(position: Int): Int = data[position].layout
45 | override fun getItemCount(): Int = data.size
46 | override fun onBindViewHolder(holder: QuickHolder, position: Int) = data[position].renderItem(holder.itemView)
47 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuickHolder =
48 | QuickHolder(LayoutInflater.from(context).inflate(viewType, parent, false))
49 | }
--------------------------------------------------------------------------------
/testingplaygroundapp/src/main/java/com/programmersbox/testingplaygroundapp/cardgames/poker/PokerHand.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.testingplaygroundapp.cardgames.poker
2 |
3 | import com.programmersbox.funutils.cards.Card
4 |
5 | enum class Hand(val stringName: String, val defaultWinning: Int) {
6 | ROYAL_FLUSH("Royal Flush", 250),
7 | STRAIGHT_FLUSH("Straight Flush", 50),
8 | FOUR_KIND("Four of a Kind", 25),
9 | FULL_HOUSE("Full House", 9),
10 | FLUSH("Flush", 6),
11 | STRAIGHT("Straight", 4),
12 | THREE_KIND("Three of a Kind", 3),
13 | TWO_PAIR("Two Pair", 2),
14 | PAIR("Pair", 1),
15 | NOTHING("Nothing", 0)
16 | }
17 |
18 | object PokerHand {
19 |
20 | fun getWinningHand(cards: List): Hand = when {
21 | royalFlush(cards) -> Hand.ROYAL_FLUSH
22 | straightFlush(cards) -> Hand.STRAIGHT_FLUSH
23 | fourKind(cards) -> Hand.FOUR_KIND
24 | fullHouse(cards) -> Hand.FULL_HOUSE
25 | flush(cards) -> Hand.FLUSH
26 | straight(cards) -> Hand.STRAIGHT
27 | threeKind(cards) -> Hand.THREE_KIND
28 | twoPair(cards) -> Hand.TWO_PAIR
29 | pair(cards) -> Hand.PAIR
30 | else -> Hand.NOTHING
31 | }
32 |
33 | private fun List.groupByValue() = groupBy(Card::value)
34 |
35 | private fun royalFlush(cards: List): Boolean = cards.sortedBy(Card::value)
36 | .let { it[1].value == 10 && it[2].value == 11 && it[3].value == 12 && it[4].value == 13 && it[0].value == 1 && flush(it) }
37 |
38 | private fun straightFlush(cards: List) = straight(cards) && flush(cards)
39 | private fun fourKind(cards: List) = cards.groupByValue().any { it.value.size == 4 }
40 | private fun fullHouse(cards: List) = threeKind(cards) && pair(cards)
41 | private fun flush(cards: List) = cards.all { it.suit == cards[0].suit }
42 | private fun straight(cards: List): Boolean {
43 | val h = cards.sortedBy(Card::value)
44 | for (i in 0 until h.size - 1) {
45 | var value = h[i].value
46 | if (value == 1) if (h[i + 1].value == 10) value = 9 //ace check
47 | if (value + 1 != h[i + 1].value) return false
48 | }
49 | return true
50 | }
51 |
52 | private fun threeKind(cards: List) = cards.groupByValue().any { it.value.size == 3 }
53 | private fun twoPair(cards: List) = cards.groupByValue().entries.count { it.value.size == 2 } == 2
54 | private fun pair(cards: List) = cards.groupByValue().any { it.value.size == 2 }
55 |
56 | }
--------------------------------------------------------------------------------
/thirdpartyutils/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#jakepurple13/HelpfulTools)
2 | ```groovy
3 | implementation 'com.github.jakepurple13.HelpfulTools:thirdpartyutils:{version}'
4 | ```
5 |
6 | These are some ThirdParty Utils that I use every now and then when I use the libraries.
7 |
8 | # [Lottie](https://github.com/jakepurple13/HelpfulTools/blob/master/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/LottieUtils.kt)
9 | ```kotlin
10 | //Easy way to change the tint
11 | com.airbnb.lottie.LottieAnimationView.changeTint(android.graphics.Color.BLUE)
12 |
13 | //Easy ways to check if the view's progress is 1f or 0f
14 | com.airbnb.lottie.LottieAnimationView.checked = true
15 | if(com.airbnb.lottie.LottieAnimationView.checked) println("Its true!")
16 | //will automatically animate the view from currentProgress-1f if true or currentProgress-0f if false
17 | com.airbnb.lottie.LottieAnimationView.check(true)
18 | ```
19 |
20 | # [Palette](https://github.com/jakepurple13/HelpfulTools/blob/master/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/PaletteUtils.kt)
21 | ```kotlin
22 | //Get the palette from any drawable easily
23 | android.graphics.drawable.Drawable.getPalette()
24 | ```
25 |
26 | # [Glide](https://github.com/jakepurple13/HelpfulTools/blob/master/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/GlideUtils.kt)
27 | ```kotlin
28 | //An easy to
29 | Glide.with(context)
30 | .asBitmap() //Whatever this is
31 | .load(url)
32 | .into { //this has to match
33 | loadCleared { } //You don't need to put this one in
34 | resourceReady { image, _ -> println("Image is a bitmap!") }
35 | }
36 | ```
37 |
38 | # [CustomChromeTabs](https://github.com/jakepurple13/HelpfulTools/blob/master/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/BrowserUtils.kt)
39 | ```kotlin
40 | //Opens a url in a custom chrome tab
41 | Context.openInCustomChromeBrowser("https://www.google.com") {
42 | //modify the tab
43 | }
44 |
45 | //Also have it working for TextViews
46 | val tv = TextView(context)
47 |
48 | tv.transformationMethod = ChromeCustomTabTransformationMethod(context) {
49 | //modify the tab
50 | setStartAnimations(context, R.anim.slide_in_right, R.anim.slide_out_left)
51 | }
52 | tv.movementMethod = LinkMovementMethod.getInstance()
53 | ```
54 |
55 | # [Retrofit](https://github.com/jakepurple13/HelpfulTools/blob/master/thirdpartyutils/src/main/java/com/programmersbox/thirdpartyutils/RetrofitUtils.kt)
56 | ```kotlin
57 | //wip
58 | ```
--------------------------------------------------------------------------------
/app/src/test/java/com/programmersbox/helpfultools/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
2 |
3 | import com.programmersbox.flowutils.FlowItem
4 | import com.programmersbox.gsonutils.getJsonApi
5 | import com.programmersbox.helpfulutils.stringForTime
6 | import com.programmersbox.helpfulutils.toHexString
7 | import com.programmersbox.loggingutils.FrameType
8 | import com.programmersbox.loggingutils.Loged
9 | import com.programmersbox.loggingutils.f
10 | import com.programmersbox.loggingutils.frame
11 | import org.junit.Before
12 | import org.junit.Test
13 | import kotlin.math.cos
14 | import kotlin.system.measureNanoTime
15 |
16 | /**
17 | * Example local unit test, which will execute on the development machine (host).
18 | *
19 | * See [testing documentation](http://d.android.com/tools/testing).
20 | */
21 | class ExampleUnitTest {
22 |
23 | @Before
24 | fun setup() {
25 | Loged.UNIT_TESTING = true
26 | Loged.FILTER_BY_PACKAGE_NAME = "com.programmersbox.helpfultools"
27 | }
28 |
29 | @Test
30 | fun colorApi() {
31 | val f = getJsonApi("http://thecolorapi.com/id?hex=${0x0450505.toHexString().drop(1)}")
32 | println(f)
33 | }
34 |
35 | @Test
36 | fun stringTimeTest() {
37 | Loged.f(100000L.stringForTime())
38 | Loged.f(FlowItem(100).toString())
39 | println(Names.names.size)
40 | val group = Names.names.groupBy { it[0] }
41 | group.entries.forEach {
42 | println(it.key)
43 | println(it.value.frame(FrameType.BOX.copy(top = "Letter: ${it.key}")))
44 | }
45 | }
46 |
47 | fun cached2(f: (In) -> Out): (In) -> Out = mutableMapOf().let { { `in`: In -> it.computeIfAbsent(`in`, f) } }
48 |
49 | fun cached(f: (In) -> Out): (In) -> Out {
50 | val cache = mutableMapOf()
51 | return { input: In -> cache.computeIfAbsent(input, f) }
52 | }
53 |
54 | @Test
55 | fun pureFunction() {
56 | val cachedCos = cached { x: Double -> cos(x) }
57 |
58 | println(measureNanoTime { cachedCos(Math.PI * 2) }) // 329378 ns
59 |
60 | /* value of cos for 2π is now cached */
61 |
62 | println(measureNanoTime { cachedCos(Math.PI * 2) }) // 6286 ns
63 |
64 | val cachedCos2 = cached2 { x: Double -> cos(x) }
65 |
66 | println(measureNanoTime { cachedCos2(Math.PI * 2) }) // 329378 ns
67 |
68 | /* value of cos for 2π is now cached */
69 |
70 | println(measureNanoTime { cachedCos2(Math.PI * 2) }) // 6286 ns
71 | }
72 |
73 | }
--------------------------------------------------------------------------------
/funutils/src/test/java/com/programmersbox/funutils/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.funutils
2 |
3 | import com.programmersbox.funutils.cards.Card
4 | import com.programmersbox.funutils.cards.Deck
5 | import com.programmersbox.funutils.funutilities.SequenceMaker
6 | import com.programmersbox.funutils.views.TableModel
7 | import org.junit.Test
8 |
9 | /**
10 | * Example local unit test, which will execute on the development machine (host).
11 | *
12 | * See [testing documentation](http://d.android.com/tools/testing).
13 | */
14 | class ExampleUnitTest {
15 | @Test
16 | fun addition_isCorrect() {
17 | //assertEquals(4, 2 + 2)
18 | Deck(Card.RandomCard)
19 | val f = SequenceMaker(1, 2, 3) {
20 |
21 | }
22 |
23 | val cell = TableModel.CellModel("asdf" to "asd;lfj")
24 | println(cell)
25 | val header = TableModel.HeaderModel("asdf" to "asd;lfj")
26 | println(header)
27 | val t = cell as TableModel
28 | println(t)
29 | }
30 |
31 | @Test
32 | fun deckPinchTest() {
33 | fun pinchList(list: MutableList) {
34 | val newList = list.pinch()
35 | println("$list -> $newList")
36 | }
37 | pinchList(mutableListOf(1, 2, 3, 4, 5, 6))
38 | pinchList(mutableListOf(1, 2, 3, 4, 5, 6, 7))
39 | pinchList(mutableListOf(9, 7, 5, 3, 1, 2, 4, 6, 8, 10))
40 | pinchList(mutableListOf(1, 1, 2, 1, 2))
41 | pinchList(mutableListOf())
42 | println("-".repeat(50))
43 | fun pinchList2(list: MutableList) {
44 | val newList = list.pinch2()
45 | println("$list -> $newList")
46 | }
47 | pinchList2(mutableListOf(1, 2, 3, 4, 5, 6))
48 | pinchList2(mutableListOf(1, 2, 3, 4, 5, 6, 7))
49 | pinchList2(mutableListOf(9, 7, 5, 3, 1, 2, 4, 6, 8, 10))
50 | pinchList2(mutableListOf(1, 1, 2, 1, 2))
51 | pinchList2(mutableListOf())
52 | }
53 |
54 | private fun MutableList.pinch(): List {
55 | val newList = mutableListOf()
56 | while (isNotEmpty()) {
57 | newList.add(0, removeAt(lastIndex))
58 | if (isNotEmpty()) newList.add(0, removeAt(0))
59 | }
60 | return newList
61 | }
62 |
63 | private tailrec fun MutableList.pinch2(newList: MutableList = mutableListOf()): List {
64 | if (isNotEmpty()) newList.add(0, removeAt(lastIndex))
65 | if (isNotEmpty()) newList.add(0, removeAt(0))
66 | return if (isEmpty()) newList else pinch2(newList)
67 | }
68 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/flowutils/src/main/java/com/programmersbox/flowutils/FlowItem.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.flowutils
2 |
3 | import android.view.View
4 | import kotlinx.coroutines.ExperimentalCoroutinesApi
5 | import kotlinx.coroutines.FlowPreview
6 | import kotlinx.coroutines.GlobalScope
7 | import kotlinx.coroutines.channels.SendChannel
8 | import kotlinx.coroutines.flow.Flow
9 | import kotlinx.coroutines.flow.MutableStateFlow
10 | import kotlinx.coroutines.flow.collect
11 | import kotlinx.coroutines.launch
12 |
13 | /**
14 | * Use this if you want to set an object up with flow easily
15 | */
16 | @FlowPreview
17 | @ExperimentalCoroutinesApi
18 | @Deprecated("As of 1.3.6, Native coroutines have something similar/probably better", ReplaceWith("MutableStateFlow(startingValue)"))
19 | class FlowItem(startingValue: T, capacity: Int = 1) {
20 | private val itemBroadcast = MutableStateFlow(startingValue)//BroadcastChannel(capacity)
21 | private val itemFlow = itemBroadcast//itemBroadcast.asFlow().onStart { emit(flowItem) }
22 |
23 | /**
24 | * the flow
25 | */
26 | val flow get() = itemFlow
27 | private var flowItem: T = startingValue
28 | set(value) = run { field = value }.also { itemBroadcast.tryEmit(value) }
29 |
30 | /**
31 | * collect from the flow
32 | */
33 | fun collect(action: suspend (value: T) -> Unit) = itemFlow.flowQuery(action)
34 |
35 | /**
36 | * binds this value to update with a view
37 | */
38 | fun bindToUI(view: R, action: R.(T) -> Unit) = itemFlow.flowQuery { view.post { view.action(it) } }
39 |
40 | /**
41 | * calls [getValue]
42 | * @see getValue
43 | */
44 | operator fun invoke() = getValue()
45 |
46 | /**
47 | * calls [setValue]
48 | * @see setValue
49 | */
50 | operator fun invoke(value: T) = setValue(value)
51 |
52 | /**
53 | * get the current value
54 | */
55 | fun getValue() = flowItem
56 |
57 | /**
58 | * set the value
59 | */
60 | fun setValue(value: T) = run { flowItem = value }
61 |
62 | /**
63 | * set the flow to itself just to get a call
64 | */
65 | fun now() = setValue(flowItem)
66 |
67 | private fun SendChannel.sendLaunch(value: T) = GlobalScope.launch { send(value) }
68 | private fun Flow.flowQuery(block: suspend (T) -> Unit) = GlobalScope.launch { collect(block) }
69 |
70 | override fun toString(): String = "FlowItem(value=$flowItem)"
71 | }
72 |
73 | @FlowPreview
74 | @ExperimentalCoroutinesApi
75 | @Deprecated("As of 1.3.6, Native coroutines have something similar/probably better", ReplaceWith("this.asStateFlow()"))
76 | fun T.asFlowItem() = FlowItem(this)
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/programmersbox/helpfultools/MoreActivity.kt:
--------------------------------------------------------------------------------
1 | package com.programmersbox.helpfultools
2 |
3 | import android.os.Bundle
4 | import android.widget.Button
5 | import android.widget.Toast
6 | import androidx.appcompat.app.AppCompatActivity
7 | import com.programmersbox.flowutils.clicks
8 | import com.programmersbox.flowutils.collectOnUi
9 | import com.programmersbox.funutils.funutilities.SequenceListener
10 | import com.programmersbox.funutils.funutilities.SequenceMaker
11 | import com.programmersbox.funutils.funutilities.TimedSequenceMaker
12 | import kotlinx.android.synthetic.main.activity_more.*
13 | import kotlinx.coroutines.flow.map
14 |
15 | class MoreActivity : AppCompatActivity() {
16 |
17 | private val sequenceList = listOf(Directions.UP, Directions.DOWN, Directions.LEFT, Directions.RIGHT)
18 | private val achieved = { Toast.makeText(this, "You did it!", Toast.LENGTH_SHORT).show() }
19 | private val sequenceReset = { Toast.makeText(this, "Sequenced Reset", Toast.LENGTH_SHORT).show() }
20 |
21 | private val sequenceMaker = SequenceMaker(sequenceList, object : SequenceListener {
22 | override fun onAchieved() = achieved()
23 | override fun onReset() = sequenceReset()
24 | })
25 | private val timedSequenceMaker = TimedSequenceMaker(sequenceList, 2000, object : SequenceListener {
26 | override fun onAchieved() = achieved()
27 | override fun onReset() = sequenceReset()
28 | })
29 |
30 | private var sequence: SequenceMaker? = null
31 |
32 | override fun onCreate(savedInstanceState: Bundle?) {
33 | super.onCreate(savedInstanceState)
34 | setContentView(R.layout.activity_more)
35 |
36 | useSequence
37 | .clicks()
38 | .map { sequence = sequenceMaker }
39 | .collectOnUi { sequence?.resetSequence() }
40 |
41 | useTimed
42 | .clicks()
43 | .map { sequence = timedSequenceMaker }
44 | .collectOnUi { sequence?.resetSequence() }
45 |
46 | resetSequence
47 | .clicks()
48 | .collectOnUi { sequence?.resetSequence() }
49 |
50 | arrowSetup(
51 | upArrow to Directions.UP,
52 | downArrow to Directions.DOWN,
53 | leftArrow to Directions.LEFT,
54 | rightArrow to Directions.RIGHT
55 | )
56 |
57 | }
58 |
59 | private fun arrowSetup(vararg pairs: Pair