├── .eslintignore ├── lintchecks ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── eltos │ └── lintchecks │ ├── SimpleDialogFragmentIssueRegistry.java │ └── DialogMethodCallLintDetector.java ├── testApp ├── .gitignore ├── src │ └── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ ├── drawable │ │ │ ├── image_sample.png │ │ │ ├── tall_image_sample.png │ │ │ ├── wide_image_sample.png │ │ │ └── ic_info.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values-night │ │ │ └── colors.xml │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── plurals.xml │ │ │ ├── arrays.xml │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ └── activity_flat_fragment.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── eltos │ │ └── simpledialogfragments │ │ ├── TestLintDialog.java │ │ ├── FlatColorFragment.java │ │ ├── ClipboardCopyDialog.java │ │ ├── RecursiveDialog.java │ │ ├── KotlinActivity.kt │ │ └── FlatFragmentActivity.java ├── proguard-rules.pro └── build.gradle ├── simpledialogfragments ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── tile.png │ │ │ ├── tiles.xml │ │ │ └── arrow_mark.xml │ │ ├── values │ │ │ ├── color.xml │ │ │ ├── plurals.xml │ │ │ ├── dimens.xml │ │ │ ├── attrs.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── color_pallets.xml │ │ ├── values-de │ │ │ ├── plurals.xml │ │ │ └── strings.xml │ │ ├── values-fr │ │ │ ├── plurals.xml │ │ │ └── strings.xml │ │ ├── color │ │ │ └── primary_color_state.xml │ │ ├── values-night │ │ │ └── styles.xml │ │ ├── drawable-anydpi │ │ │ ├── ic_check.xml │ │ │ ├── ic_arrow_forward.xml │ │ │ ├── ic_arrow_forward_accent.xml │ │ │ ├── ic_clear_search.xml │ │ │ └── ic_palette_color.xml │ │ ├── anim │ │ │ ├── zoom_out.xml │ │ │ └── zoom_show.xml │ │ ├── layout │ │ │ ├── simpledialogfragment_list_item.xml │ │ │ ├── simpledialogfragment_form_item_hint.xml │ │ │ ├── simpledialogfragment_form_item_check.xml │ │ │ ├── simple_list_item.xml │ │ │ ├── simpledialogfragment_check_box.xml │ │ │ ├── simple_list_item_single_choice.xml │ │ │ ├── simple_list_item_multiple_choice.xml │ │ │ ├── simple_list_item_action.xml │ │ │ ├── simpledialogfragment_form_item_spinner.xml │ │ │ ├── simpledialogfragment_form.xml │ │ │ ├── simpledialogfragment_color_item.xml │ │ │ ├── simpledialogfragment_image_vert_scroll.xml │ │ │ ├── simpledialogfragment_image_hor_scroll.xml │ │ │ ├── simpledialogfragment_form_item_input.xml │ │ │ ├── simpledialogfragment_image.xml │ │ │ ├── simpledialogfragment_input.xml │ │ │ ├── dialog_fullscreen.xml │ │ │ ├── simpledialogfragment_grid.xml │ │ │ ├── simpledialogfragment_list.xml │ │ │ ├── simpledialogfragment_form_item_color.xml │ │ │ ├── simpledialogfragment_pin.xml │ │ │ ├── simpledialogfragment_custom_view.xml │ │ │ ├── simpledialogfragment_progress.xml │ │ │ ├── simpledialogfragment_form_item_datetime.xml │ │ │ └── simpledialogfragment_progress_circle.xml │ │ ├── menu │ │ │ └── dialog_buttons.xml │ │ ├── values-ja │ │ │ └── strings.xml │ │ ├── values-pl │ │ │ ├── strings.xml │ │ │ └── plurals.xml │ │ └── values-nl │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── eltos │ │ └── simpledialogfragment │ │ ├── form │ │ ├── CustomSpinnerView.java │ │ ├── HintViewHolder.java │ │ ├── Hint.java │ │ ├── FormElementViewHolder.java │ │ ├── FormElement.java │ │ ├── CheckViewHolder.java │ │ └── Check.java │ │ ├── input │ │ ├── SimpleEMailDialog.java │ │ └── TextInputAutoCompleteTextView.java │ │ ├── list │ │ ├── SimpleListItem.java │ │ └── AdvancedSectionAdapter.java │ │ ├── SimpleTimeDialog.java │ │ ├── SimpleProgressTask.java │ │ └── SimpleCheckDialog.java ├── proguard-rules.pro ├── build.gradle └── publish.gradle ├── docs ├── javadoc │ ├── legal │ │ ├── LICENSE │ │ ├── ASSEMBLY_EXCEPTION │ │ ├── ADDITIONAL_LICENSE_INFO │ │ ├── jquery.md │ │ └── jqueryUI.md │ ├── module-search-index.js │ ├── resources │ │ ├── x.png │ │ └── glass.png │ ├── tag-search-index.js │ ├── element-list │ ├── package-search-index.js │ ├── overview-summary.html │ ├── script-dir │ │ └── jquery-ui.min.css │ ├── copy.svg │ ├── link.svg │ ├── type-search-index.js │ ├── allpackages-index.html │ ├── search.html │ └── index.html ├── README.md └── _config.yml ├── settings.gradle ├── media ├── logo.png ├── screenshot.png ├── logo_named_bottom.png ├── logo_named_right.png ├── logo_named_right_darkmode.png └── logo_named_bottom_darkmode.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .jitpack.yml ├── .idea ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── gradle.xml ├── copyright │ └── Apache_2_0__Philipp_Niedermayer__eltos_.xml └── runConfigurations │ ├── Generate_Javadoc.xml │ ├── Upload_to_Sonatype.xml │ ├── Release_new_version.xml │ └── testApp.xml ├── .github ├── workflows │ ├── build.yml │ └── codeql-analysis.yml ├── ISSUE_TEMPLATE │ ├── documentation_issue.md │ ├── feature_request.md │ └── bug_report.md └── build │ └── action.yml ├── .codeclimate.yml ├── gradle.properties ├── gradlew.bat ├── .gitignore ├── publish.gradle └── .eslintrc /.eslintignore: -------------------------------------------------------------------------------- 1 | **/*{.,-}min.js 2 | -------------------------------------------------------------------------------- /lintchecks/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /testApp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /simpledialogfragments/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /docs/javadoc/legal/LICENSE: -------------------------------------------------------------------------------- 1 | Please see ..\java.base\LICENSE 2 | -------------------------------------------------------------------------------- /docs/javadoc/module-search-index.js: -------------------------------------------------------------------------------- 1 | moduleSearchIndex = [];updateSearchResults(); -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':testApp', ':simpledialogfragments', ':lintchecks' 2 | -------------------------------------------------------------------------------- /docs/javadoc/legal/ASSEMBLY_EXCEPTION: -------------------------------------------------------------------------------- 1 | Please see ..\java.base\ASSEMBLY_EXCEPTION 2 | -------------------------------------------------------------------------------- /media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/logo.png -------------------------------------------------------------------------------- /docs/javadoc/legal/ADDITIONAL_LICENSE_INFO: -------------------------------------------------------------------------------- 1 | Please see ..\java.base\ADDITIONAL_LICENSE_INFO 2 | -------------------------------------------------------------------------------- /media/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/screenshot.png -------------------------------------------------------------------------------- /media/logo_named_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/logo_named_bottom.png -------------------------------------------------------------------------------- /media/logo_named_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/logo_named_right.png -------------------------------------------------------------------------------- /docs/javadoc/resources/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/docs/javadoc/resources/x.png -------------------------------------------------------------------------------- /docs/javadoc/resources/glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/docs/javadoc/resources/glass.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /media/logo_named_right_darkmode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/logo_named_right_darkmode.png -------------------------------------------------------------------------------- /docs/javadoc/tag-search-index.js: -------------------------------------------------------------------------------- 1 | tagSearchIndex = [{"l":"Konstantenfeldwerte","h":"","u":"constant-values.html"}];updateSearchResults(); -------------------------------------------------------------------------------- /media/logo_named_bottom_darkmode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/media/logo_named_bottom_darkmode.png -------------------------------------------------------------------------------- /testApp/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /testApp/src/main/res/drawable/image_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/drawable/image_sample.png -------------------------------------------------------------------------------- /testApp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /testApp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /testApp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /testApp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/simpledialogfragments/src/main/res/drawable/tile.png -------------------------------------------------------------------------------- /testApp/src/main/res/drawable/tall_image_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/drawable/tall_image_sample.png -------------------------------------------------------------------------------- /testApp/src/main/res/drawable/wide_image_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/drawable/wide_image_sample.png -------------------------------------------------------------------------------- /testApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eltos/SimpleDialogFragments/HEAD/testApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.jitpack.yml: -------------------------------------------------------------------------------- 1 | # Configuration file for jitpack.io 2 | 3 | 4 | # Specify JAVA version 5 | # https://jitpack.io/docs/BUILDING/#java-version 6 | jdk: 7 | - openjdk17 8 | 9 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /docs/javadoc/element-list: -------------------------------------------------------------------------------- 1 | eltos.simpledialogfragment 2 | eltos.simpledialogfragment.color 3 | eltos.simpledialogfragment.form 4 | eltos.simpledialogfragment.input 5 | eltos.simpledialogfragment.list 6 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #FFD50000 5 | 6 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | **[Javadoc API](https://eltos.github.io/SimpleDialogFragments/javadoc)** 4 | 5 | **[Github wiki](https://github.com/eltos/SimpleDialogFragments/wiki)** 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /testApp/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #7986CB 4 | #9FA8DA 5 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable/tiles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /testApp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #ff9800 6 | 7 | -------------------------------------------------------------------------------- /testApp/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal 2 | title: Simple Dialog Fragments 3 | logo: https://raw.githubusercontent.com/eltos/SimpleDialogFragments/master/media/logo_named_right.png 4 | description: A collection of easy to use and extendable DialogFragment's for Android 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 30 18:40:20 CEST 2025 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Min 1 char 6 | Min %1$d chars 7 | 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | 3 | name: Build 4 | 5 | on: [push, pull_request, workflow_call] 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: ./.github/build 15 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-de/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Min 1 Zeichen 6 | Min %1$d Zeichen 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/javadoc/package-search-index.js: -------------------------------------------------------------------------------- 1 | packageSearchIndex = [{"l":"Alle Packages","u":"allpackages-index.html"},{"l":"eltos.simpledialogfragment"},{"l":"eltos.simpledialogfragment.color"},{"l":"eltos.simpledialogfragment.form"},{"l":"eltos.simpledialogfragment.input"},{"l":"eltos.simpledialogfragment.list"}];updateSearchResults(); -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-fr/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Au moins %1$d caractère 6 | Au moins %1$d caractères 7 | 8 | 9 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/color/primary_color_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable/arrow_mark.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16dp 6 | 16dp 7 | 8 | 50dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /testApp/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation_issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation issue or question 3 | about: Suggest a change to help us improve the documentation 4 | title: '' 5 | labels: docu 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe what information is missing/wrong and what you would like to know or did not understand 11 | 12 | 13 | **Link** 14 | Add a link to the wiki or javadoc page 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable-anydpi/ic_check.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /testApp/src/main/res/values/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %1$d selected 6 | %1$d selected 7 | 8 | 9 | 10 | Delete one message? 11 | Delete %1$d messages? 12 | 13 | 14 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable-anydpi/ic_arrow_forward.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable-anydpi/ic_arrow_forward_accent.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /testApp/src/main/res/drawable/ic_info.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable-anydpi/ic_clear_search.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | 2 | name: "CodeQL" 3 | 4 | on: [push, pull_request] 5 | 6 | jobs: 7 | codeQL: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout repository 11 | uses: actions/checkout@v2 12 | 13 | - name: Initialize CodeQL 14 | uses: github/codeql-action/init@v2 15 | with: 16 | languages: java 17 | 18 | - uses: ./.github/build 19 | 20 | - name: Perform CodeQL Analysis 21 | uses: github/codeql-action/analyze@v2 22 | 23 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/anim/zoom_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 15 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/anim/zoom_show.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest a feature to help us improve 4 | title: '' 5 | labels: idea 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe your idea and use case, possibly considering constraints and synergies 11 | 12 | 13 | **Design** 14 | If applicable, add images supporting your proposal 15 | 16 | 17 | ```java 18 | If applicable, add proposed method signatures 19 | ``` 20 | 21 | 22 | **Links** 23 | If applicable, add links where examples or further information can be found 24 | 25 | -------------------------------------------------------------------------------- /lintchecks/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | apply plugin: 'com.android.lint' 3 | 4 | dependencies { 5 | // If the Gradle plugin version is X.Y.Z, then the Lint library version is X+23.Y.Z 6 | compileOnly 'com.android.tools.lint:lint-api:31.13.0' 7 | compileOnly 'com.android.tools.lint:lint-checks:31.13.0' 8 | } 9 | 10 | jar { 11 | manifest { 12 | // Only use the "-v2" key here if your checks have been updated to the 13 | // new 3.0 APIs (including UAST) 14 | attributes("Lint-Registry-v2": "eltos.lintchecks.SimpleDialogFragmentIssueRegistry") 15 | } 16 | } -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | -------------------------------------------------------------------------------- /simpledialogfragments/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # Keep TAG field, so it can be found by the SimpleDialog.show() method 13 | -keepclassmembers class * extends eltos.simpledialogfragment.SimpleDialog { 14 | public static final java.lang.String TAG; 15 | } -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_hint.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /testApp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/menu/dialog_buttons.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 14 | 19 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_check.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simple_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | duplication: 3 | enabled: true 4 | config: 5 | languages: 6 | - java 7 | checks: 8 | Similar code: 9 | enabled: false 10 | checkstyle: 11 | enabled: false 12 | channel: "beta" 13 | checks: 14 | com.puppycrawl.tools.checkstyle.checks.javadoc: 15 | enabled: false 16 | fixme: 17 | enabled: true 18 | 19 | checks: 20 | argument-count: 21 | enabled: false 22 | complex-logic: 23 | enabled: false 24 | file-lines: 25 | enabled: false 26 | method-complexity: 27 | enabled: false 28 | method-count: 29 | enabled: false 30 | method-lines: 31 | enabled: false 32 | 33 | ratings: 34 | paths: 35 | - "**.java" 36 | - "**.xml" 37 | exclude_paths: ["docs/**", "**.png", "testApp/**"] 38 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_check_box.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 15 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.github/build/action.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | description: Builds the Application 3 | 4 | runs: 5 | using: 'composite' 6 | steps: 7 | - name: Set up JDK 17 8 | uses: actions/setup-java@v3 9 | with: 10 | java-version: '17' 11 | distribution: 'adopt' 12 | 13 | - name: Grant execute permission for gradlew 14 | shell: bash 15 | run: chmod +x gradlew 16 | 17 | - name: Gradle Wrapper Validation 18 | uses: gradle/wrapper-validation-action@v1 19 | 20 | - name: Setup Cache 21 | uses: actions/cache@v3 22 | with: 23 | path: | 24 | ~/.gradle/caches/ 25 | ~/.gradle/wrapper/ 26 | key: cache-gradle-${{ hashFiles('**/*.gradle') }} 27 | 28 | - name: Build with Gradle 29 | shell: bash 30 | run: ./gradlew build -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe the bug here, the expected behaviour and what you actually observed as detailed as possible 11 | 12 | 13 | **To Reproduce** 14 | ```java 15 | Paste a minimal code example that causes the bug 16 | ``` 17 | 18 | 1. Describe the steps to reproduce the bug 19 | 2. ... 20 | 21 | 22 | **Stack Trace** 23 | ``` 24 | If applicable, paste the full stack trace here 25 | ``` 26 | 27 | 28 | **Screenshots** 29 | If applicable, add screenshots to help explain your problem 30 | 31 | 32 | **Environment** 33 | | Android version | Library version | 34 | | --------------- | --------------- | 35 | | API 00 | 0.0.0 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simple_list_item_single_choice.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simple_list_item_multiple_choice.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simple_list_item_action.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /testApp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/copyright/Apache_2_0__Philipp_Niedermayer__eltos_.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | メールアドレスが無効 4 | メールアドレス 5 | 透明性 6 | 必須 7 | パスワード 8 | 指定されたオプションを入力しない 9 | 名前 10 | 電話番号 11 | ログイン 12 | ユーザー 13 | パスワードは、数字、小文字と大文字や特殊文字が含まれている必要があり 14 | アルファベットのみ 15 | 英数字のみ 16 | ピン 17 | 間違ったピン 18 | 19 | -------------------------------------------------------------------------------- /docs/javadoc/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | simpledialogfragments 3.10 API 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 |
19 | 22 |

index.html

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_color_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 26 | 27 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Generate_Javadoc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | 22 | 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | android.useAndroidX=true 20 | android.defaults.buildfeatures.buildconfig=true 21 | android.nonTransitiveRClass=false 22 | android.nonFinalResIds=false -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_image_vert_scroll.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_image_hor_scroll.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-pl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Adres email 4 | Niepoprawny email 5 | Przezroczystość 6 | Hasło 7 | Wymagane 8 | Nieprawidłowa wartość 9 | Nazwa 10 | Numer telefonu 11 | Login 12 | Użytkownik 13 | Musi zawierać cyfrę, małą i wielką literę oraz znak specjalny 14 | Może zawierać jedynie litery (A-Z) 15 | Może zawierać tylko znaki alfanumeryczne 16 | Kod PIN 17 | Niepoprawny PIN 18 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-pl/plurals.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | Minimalnie 1 znak 22 | Minimalnie %1$d znaki 23 | Minimalnie %1$d znaków 24 | 25 | 26 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Transparantie 4 | E-mail adres 5 | Ongeldig e-mail adres 6 | Verplicht 7 | Paswoord 8 | Gebruiker 9 | Login 10 | Telefoonnummer 11 | Naam 12 | Moet alleen alfanumerieke tekens bevatten 13 | Input niet een bepaalde optie 14 | Moet alleen letters A-Z bevatten 15 | Moet een nummer, een hoofdletter en een hoofdletter en een speciaal teken bevatten 16 | Pincode 17 | Pin verkeerd 18 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 23 | 24 | 32 | 33 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | E-Mail Adresse 4 | Ungültige E-Mail Adresse 5 | Transparenz 6 | Passwort 7 | Erforderlich 8 | Eingabe nicht gelistet 9 | Name 10 | Telefonnummer 11 | Anmelden 12 | Benutzer 13 | Muss eine Zahl, einen Groß- und Kleinbuchstaben und ein Sonderzeichen enthalten 14 | Nur Buchstaben (A-Z) erlaubt 15 | Nur alphanumerische Zeichen erlaubt 16 | PIN-Code 17 | Falsche PIN 18 | Datum 19 | Zeit 20 | Löschen 21 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Upload_to_Sonatype.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | 22 | 24 | 25 | -------------------------------------------------------------------------------- /docs/javadoc/legal/jquery.md: -------------------------------------------------------------------------------- 1 | ## jQuery v3.7.1 2 | 3 | ### jQuery License 4 | ``` 5 | jQuery v 3.7.1 6 | Copyright OpenJS Foundation and other contributors, https://openjsf.org/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | ``` 27 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Transparence 4 | Adresse e-mail 5 | Adresse e-mail invalide 6 | Mot de passe 7 | Champs obligatoires 8 | Nom 9 | Numéro de téléphone 10 | Login 11 | Usager 12 | Ne peut contenir que des lettres (A-Z) 13 | Ne peut contenir que des lettres alphanumériques 14 | Il doit contenir un numéro, une lettre majuscule et à faible revenu et un caractère spécial 15 | Ne saisissez pas une option donnée 16 | Code PIN 17 | Faux code 18 | Date 19 | Temps 20 | Clair 21 | -------------------------------------------------------------------------------- /testApp/src/main/java/eltos/simpledialogfragments/TestLintDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragments; 18 | 19 | import android.os.Bundle; 20 | import android.view.View; 21 | 22 | import eltos.simpledialogfragment.CustomViewDialog; 23 | 24 | public class TestLintDialog extends CustomViewDialog { 25 | 26 | //public static String TAG = "my-tag"; 27 | 28 | //public static TestLintDialog build(){ 29 | // return new TestLintDialog(); 30 | //} 31 | 32 | @Override 33 | protected View onCreateContentView(Bundle savedInstanceState) { 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/dialog_fullscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 22 | 23 | 24 | 25 | 31 | 32 | -------------------------------------------------------------------------------- /testApp/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | namespace 'eltos.simpledialogfragments' 8 | 9 | 10 | defaultConfig { 11 | applicationId 'eltos.simpledialogfragments.test' 12 | compileSdkVersion 36 13 | minSdkVersion 21 14 | targetSdkVersion 34 15 | versionCode rootProject.ext['VERSION_NR'] 16 | versionName rootProject.ext['VERSION'] 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | repositories { 27 | //mavenLocal() 28 | //maven { url 'https://jitpack.io' } 29 | } 30 | 31 | dependencies { 32 | testImplementation 'junit:junit:4.13.2' 33 | implementation 'androidx.appcompat:appcompat:1.7.1' 34 | implementation 'com.google.android.material:material:1.13.0' 35 | implementation 'com.google.android.flexbox:flexbox:3.0.0' 36 | implementation 'com.google.zxing:core:3.5.3' 37 | 38 | // sonatype maven 39 | //implementation 'io.github.eltos:simpledialogfragments:3.5.1' 40 | 41 | // jitpack 42 | //implementation 'com.github.eltos:simpledialogfragments:v3.5' 43 | 44 | // local project 45 | api project(path: ':simpledialogfragments') 46 | 47 | } 48 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Invalid email address 4 | Email address 5 | HEX: 6 | Transparency 7 | Required 8 | Password 9 | Input not a given option 10 | Name 11 | Phone number 12 | Login 13 | User 14 | Must contain a number, a lower- and uppercase letter and a special character 15 | May only contain letters (A-Z) 16 | May only contain alphanumerical chars 17 | RRGGBB 18 | Pin code 19 | Wrong pin 20 | Date 21 | Time 22 | Clear 23 | Color picker 24 | Clear color 25 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Release_new_version.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | true 19 | true 20 | false 21 | false 22 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/form/CustomSpinnerView.java: -------------------------------------------------------------------------------- 1 | package eltos.simpledialogfragment.form; 2 | 3 | 4 | import android.content.Context; 5 | import android.util.AttributeSet; 6 | import androidx.appcompat.widget.AppCompatSpinner; 7 | 8 | public class CustomSpinnerView extends AppCompatSpinner { 9 | private OnSpinnerOpenListener mListener; 10 | 11 | public CustomSpinnerView(Context context, AttributeSet attrs, int defStyleAttr, int mode) { 12 | super(context, attrs, defStyleAttr, mode); 13 | } 14 | 15 | public CustomSpinnerView(Context context, AttributeSet attrs, int defStyleAttr) { 16 | super(context, attrs, defStyleAttr); 17 | } 18 | 19 | public CustomSpinnerView(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public CustomSpinnerView(Context context, int mode) { 24 | super(context, mode); 25 | } 26 | 27 | public CustomSpinnerView(Context context) { 28 | super(context); 29 | } 30 | 31 | public interface OnSpinnerOpenListener { 32 | void onOpen(); 33 | } 34 | 35 | @Override 36 | public boolean performClick() { 37 | if (mListener != null) { 38 | mListener.onOpen(); 39 | } 40 | return super.performClick(); 41 | } 42 | 43 | public void setSpinnerEventsListener(OnSpinnerOpenListener onSpinnerEventsListener) { 44 | mListener = onSpinnerEventsListener; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /lintchecks/src/main/java/eltos/lintchecks/SimpleDialogFragmentIssueRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.lintchecks; 18 | 19 | import com.android.tools.lint.client.api.IssueRegistry; 20 | import com.android.tools.lint.detector.api.Issue; 21 | 22 | import org.jetbrains.annotations.NotNull; 23 | 24 | import java.util.Arrays; 25 | import java.util.List; 26 | 27 | /* 28 | * The list of issues that will be checked when running lint. 29 | */ 30 | @SuppressWarnings("UnstableApiUsage") 31 | public class SimpleDialogFragmentIssueRegistry extends IssueRegistry { 32 | @NotNull 33 | @Override 34 | public List getIssues() { 35 | return Arrays.asList( 36 | DialogExtendLintDetector.BUILD_OVERWRITE, 37 | DialogExtendLintDetector.TAG, 38 | DialogMethodCallLintDetector.BUILD_CALL); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_grid.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 19 | 20 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 22 | 23 | 24 | 28 | 29 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /testApp/src/main/java/eltos/simpledialogfragments/FlatColorFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragments; 18 | 19 | 20 | import android.os.Bundle; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import android.view.LayoutInflater; 25 | import android.view.View; 26 | import android.view.ViewGroup; 27 | 28 | import eltos.simpledialogfragment.color.SimpleColorDialog; 29 | 30 | /** 31 | * Wrapper class to use the contents of a dialog as a normal ("flat") fragment 32 | * somewhere in an activity 33 | * 34 | */ 35 | public class FlatColorFragment extends SimpleColorDialog { 36 | 37 | @Override 38 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 39 | return extractContentView(savedInstanceState); 40 | } 41 | 42 | public boolean callResultListener() { 43 | return super.callResultListener(BUTTON_POSITIVE, null); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/drawable-anydpi/ic_palette_color.xml: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_pin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_custom_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | 20 | 25 | 26 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /docs/javadoc/script-dir/jquery-ui.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.13.2 - 2023-02-27 2 | * http://jqueryui.com 3 | * Includes: core.css, autocomplete.css, menu.css 4 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 | 6 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;-ms-filter:"alpha(opacity=0)"}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} -------------------------------------------------------------------------------- /docs/javadoc/copy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 27 | 28 | 29 | 31 | 33 | 34 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 22 | 23 | 30 | 31 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/layout/simpledialogfragment_form_item_datetime.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 23 | 24 | 25 | 26 | 33 | 34 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /testApp/src/main/res/layout/activity_flat_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 28 | 29 | 34 | 35 | 36 | 27 | 28 | 37 | 38 | 45 | 46 | 47 | 48 |
49 |
50 |
51 |

Alle Packages

52 |
53 |
Packageübersicht
54 |
55 |
Package
56 |
Beschreibung
57 | 58 |
 
59 | 60 |
 
61 | 62 |
 
63 | 64 |
 
65 | 66 |
 
67 |
68 |
69 |
70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/javadoc/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Suchen (simpledialogfragments 3.10 API) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 22 |
23 | 44 |
45 |
46 |

Suchen

47 |
48 | 49 | 50 |
51 | Zusätzliche Ressourcen 52 |
53 |
54 |
55 |

Die Hilfeseite enthält eine Einführung in den Umfang und die Syntax der JavaDoc-Suche.

56 |

Sie können die <STRG>- oder <CMD>-Taste zusammen mit den Pfeiltasten nach links und rechts verwenden, um zwischen Ergebnisregisterkarten auf dieser Seite zu wechseln.

57 |

Mit der URL-Vorlage unten können Sie diese Seite als Suchmaschine in Browsern konfigurieren, die dieses Feature unterstützen. Das Feature wurde erfolgreich mit Google Chrome und Mozilla Firefox getestet. Beachten Sie, dass andere Browser dieses Feature möglicherweise nicht unterstützen oder ein anderes URL-Format erfordern.

58 | link 59 |

60 | 61 |

62 |
63 |

Suchindex wird geladen...

64 | 68 |
69 |
70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/res/values/color_pallets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | #fff44336 8 | #ffe91e63 9 | #ff9c27b0 10 | #ff673ab7 11 | #ff3f51b5 12 | #ff2196f3 13 | #ff03a9f4 14 | #ff00bcd4 15 | #ff009688 16 | #ff4caf50 17 | #ff8bc34a 18 | #ffcddc39 19 | #ffffeb3b 20 | #ffffc107 21 | #ffff9800 22 | #ffff5722 23 | #ff795548 24 | #ff9e9e9e 25 | #ff607d8b 26 | 27 | 28 | 29 | #FFEF9A9A 30 | #FFF48FB1 31 | #FFCE93D8 32 | #FFB39DDB 33 | #FF9FA8DA 34 | #FF90CAF9 35 | #FF81D4FA 36 | #FF80DEEA 37 | #FF80CBC4 38 | #FFA5D6A7 39 | #FFC5E1A5 40 | #FFE6EE9C 41 | #FFFFF59D 42 | #FFFFE082 43 | #FFFFCC80 44 | #FFFFAB91 45 | #FFBCAAA4 46 | #FFEEEEEE 47 | #FFB0BEC5 48 | 49 | 50 | 51 | #FFB71C1C 52 | #FF880E4F 53 | #FF4A148C 54 | #FF311B92 55 | #FF1A237E 56 | #FF0D47A1 57 | #FF01579B 58 | #FF006064 59 | #FF004D40 60 | #FF1B5E20 61 | #FF33691E 62 | #FF827717 63 | #FFF57F17 64 | #FFFF6F00 65 | #FFE65100 66 | #FFBF360C 67 | #FF3E2723 68 | #FF212121 69 | #FF263238 70 | 71 | 72 | 73 | #ffb06660 74 | #ffd9a88f 75 | #ffeac3b8 76 | #ffab9c73 77 | #ffd2be96 78 | #ffe3dcc0 79 | #ff5e7703 80 | #ff9baf8e 81 | #ffc1cc89 82 | #ffb4a851 83 | #ffdfd27c 84 | #ffe7e3b5 85 | #ff405980 86 | #ff6a7d8e 87 | #ffaebbc7 88 | #ffc1d2d6 89 | #ff846d74 90 | #ffb7a6ad 91 | #ffd3c9ce 92 | #ffd9b8a2 93 | #ffbf8686 94 | #ffb33050 95 | 96 | 97 | 98 | #ffff8c9d 99 | #ffffd08c 100 | #fffff78c 101 | #ffc0ff8c 102 | #ff8ceaff 103 | #ffff00a0 104 | #fffe9507 105 | #fffbff00 106 | #ff00ff61 107 | #ff00a0ff 108 | #ffc12552 109 | #ffff6000 110 | #fff5c700 111 | #ff6a961f 112 | #ff1d7fb9 113 | #ffb36435 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /testApp/src/main/java/eltos/simpledialogfragments/KotlinActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package eltos.simpledialogfragments 17 | 18 | import android.os.Bundle 19 | import android.os.SystemClock 20 | import android.util.Log 21 | import android.view.View 22 | import android.widget.Toast 23 | import androidx.appcompat.app.AppCompatActivity 24 | import eltos.simpledialogfragment.SimpleDialog 25 | import eltos.simpledialogfragment.SimpleDialog.OnDialogResultListener 26 | import eltos.simpledialogfragment.SimpleProgressDialog 27 | import eltos.simpledialogfragment.SimpleProgressTask 28 | 29 | @Suppress("UNUSED_PARAMETER") 30 | class KotlinActivity : AppCompatActivity(), OnDialogResultListener { 31 | 32 | fun showInfo(view: View?) { 33 | SimpleDialog.build() 34 | .title(R.string.message) 35 | .msg(R.string.hello_world) 36 | .show(this) 37 | } 38 | 39 | @Suppress("Unused") 40 | fun lintTest(){ 41 | // The following produces a lint error 42 | //TestLintDialog.build().show(this) 43 | } 44 | 45 | 46 | fun showProgressTask(view: View?) { 47 | val task = MyProgressTask() 48 | task.execute() 49 | SimpleProgressDialog.buildBar() 50 | .title(R.string.login) 51 | .msg(R.string.creating_user_profile_wait) 52 | .task(task, true, false) 53 | .show(this, PROGRESS_DIALOG) 54 | } 55 | 56 | internal class MyProgressTask : SimpleProgressTask() { 57 | override fun doInBackground(vararg params: Void?): Void? { 58 | SystemClock.sleep(500) 59 | var i = 0 60 | while (!isCancelled && i < 100) { 61 | publishProgress(i + 25, 150) 62 | SystemClock.sleep(10) 63 | i += 1 64 | } 65 | return null 66 | } 67 | } 68 | 69 | 70 | // == R E S U L T S == 71 | /** 72 | * Let the hosting fragment or activity implement this interface 73 | * to receive results from the dialog 74 | * 75 | * @param dialogTag the tag passed to [SimpleDialog.show] 76 | * @param which result type, one of [.BUTTON_POSITIVE], [.BUTTON_NEGATIVE], 77 | * [.BUTTON_NEUTRAL] or [.CANCELED] 78 | * @param extras the extras passed to [SimpleDialog.extra] 79 | * @return true if the result was handled, false otherwise 80 | */ 81 | override fun onResult(dialogTag: String, which: Int, extras: Bundle): Boolean { 82 | Log.d("onResult", "Dialog with tag '" + dialogTag + "' has result: " + which + " (" + 83 | (if (which == OnDialogResultListener.BUTTON_POSITIVE) "BUTTON_POSITIVE" else if (which == OnDialogResultListener.BUTTON_NEUTRAL) "BUTTON_NEUTRAL" else if (which == OnDialogResultListener.BUTTON_NEGATIVE) "BUTTON_NEGATIVE" else if (which == OnDialogResultListener.CANCELED) "CANCELED" else "?") + ")") 84 | 85 | 86 | if (PROGRESS_DIALOG == dialogTag) { 87 | when (which) { 88 | SimpleProgressDialog.COMPLETED -> { 89 | Toast.makeText(this, R.string.completed, Toast.LENGTH_SHORT).show() 90 | return true 91 | } 92 | } 93 | } 94 | 95 | return false 96 | } 97 | 98 | companion object { 99 | private const val PROGRESS_DIALOG = "dialogProgress" 100 | } 101 | } -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | 18 | ^$ 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | xmlns:.* 28 | 29 | ^$ 30 | 31 | 32 | BY_NAME 33 | 34 |
35 |
36 | 37 | 38 | 39 | .*:id 40 | 41 | http://schemas.android.com/apk/res/android 42 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | .*:name 51 | 52 | http://schemas.android.com/apk/res/android 53 | 54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | name 62 | 63 | ^$ 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | style 73 | 74 | ^$ 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | .* 84 | 85 | ^$ 86 | 87 | 88 | BY_NAME 89 | 90 |
91 |
92 | 93 | 94 | 95 | .* 96 | 97 | http://schemas.android.com/apk/res/android 98 | 99 | 100 | ANDROID_ATTRIBUTE_ORDER 101 | 102 |
103 |
104 | 105 | 106 | 107 | .* 108 | 109 | .* 110 | 111 | 112 | BY_NAME 113 | 114 |
115 |
116 |
117 |
118 | 119 | 121 |
122 |
-------------------------------------------------------------------------------- /docs/javadoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Überblick (simpledialogfragments 3.10 API) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 22 |
23 | 48 |
49 |
50 |
51 |

simpledialogfragments 3.10 API

52 |
53 |
54 |
Packages
55 |
56 |
Package
57 |
Beschreibung
58 | 59 |
 
60 | 61 |
 
62 | 63 |
 
64 | 65 |
 
66 | 67 |
 
68 |
69 |
70 |
71 |
72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/SimpleTimeDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment; 18 | 19 | import android.os.Bundle; 20 | import android.text.format.DateFormat; 21 | import android.view.View; 22 | import android.widget.TimePicker; 23 | 24 | /** 25 | * A time-picker dialog 26 | *

27 | * Created by eltos on 02.02.2017. 28 | */ 29 | public class SimpleTimeDialog extends CustomViewDialog 30 | implements TimePicker.OnTimeChangedListener { 31 | 32 | public static final String TAG = "SimpleTimeDialog."; 33 | 34 | public static final String 35 | HOUR = TAG + "HOUR", 36 | MINUTE = TAG + "MINUTE"; 37 | 38 | 39 | public static SimpleTimeDialog build(){ 40 | return new SimpleTimeDialog(); 41 | } 42 | 43 | 44 | /** 45 | * Specify the initially set hour 46 | * 47 | * @param hour initial hour (0-23) 48 | * @return this instance 49 | */ 50 | public SimpleTimeDialog hour(int hour){ return setArg(HOUR, hour); } 51 | 52 | /** 53 | * Specify the initially set minute 54 | * 55 | * @param minute initial minute (0-59) 56 | * @return this instance 57 | */ 58 | public SimpleTimeDialog minute(int minute){ return setArg(MINUTE, minute); } 59 | 60 | /** 61 | * Changes the hour display mode between 24 and AM/PM 62 | * 63 | * @param view24Hour true to use 24 hour mode, false to use AM/PM 64 | * @return this instance 65 | */ 66 | public SimpleTimeDialog set24HourView(boolean view24Hour){ return setArg(VIEW_24_HOUR, view24Hour); } 67 | 68 | 69 | 70 | protected static final String 71 | VIEW_24_HOUR = TAG + "VIEW_24_HOUR"; 72 | 73 | private TimePicker picker; 74 | 75 | 76 | @SuppressWarnings("deprecation") 77 | @Override 78 | protected View onCreateContentView(Bundle savedInstanceState) { 79 | 80 | picker = new TimePicker(getContext()); 81 | 82 | if (savedInstanceState != null){ 83 | picker.setCurrentHour(savedInstanceState.getInt(HOUR)); 84 | picker.setCurrentMinute(savedInstanceState.getInt(MINUTE)); 85 | 86 | } else { 87 | if (getArgs().containsKey(HOUR)) { 88 | picker.setCurrentHour(getArgs().getInt(HOUR)); 89 | } 90 | if (getArgs().containsKey(MINUTE)) { 91 | picker.setCurrentMinute(getArgs().getInt(MINUTE)); 92 | } 93 | } 94 | 95 | if (getArgs().containsKey(VIEW_24_HOUR)) { 96 | picker.setIs24HourView(getArgs().getBoolean(VIEW_24_HOUR)); 97 | } else { 98 | picker.setIs24HourView(DateFormat.is24HourFormat(getContext())); // system default 99 | } 100 | picker.setOnTimeChangedListener(this); 101 | 102 | return picker; 103 | } 104 | 105 | 106 | @Override 107 | public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { 108 | // currently not used 109 | } 110 | 111 | @SuppressWarnings("deprecation") 112 | @Override 113 | public void onSaveInstanceState(Bundle outState) { 114 | outState.putInt(HOUR, picker.getCurrentHour()); 115 | outState.putInt(MINUTE, picker.getCurrentMinute()); 116 | super.onSaveInstanceState(outState); 117 | } 118 | 119 | 120 | @SuppressWarnings("deprecation") 121 | @Override 122 | protected Bundle onResult(int which) { 123 | Bundle results = new Bundle(); 124 | results.putInt(HOUR, picker.getCurrentHour()); 125 | results.putInt(MINUTE, picker.getCurrentMinute()); 126 | return results; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/SimpleProgressTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment; 18 | 19 | import android.os.AsyncTask; 20 | import android.util.Pair; 21 | 22 | import androidx.annotation.CallSuper; 23 | 24 | /** 25 | * An {@link AsyncTask} for use with {@link SimpleProgressDialog} 26 | * 27 | * Automatically reflects the task's states in the dialog. 28 | *

29 | * Created by eltos on 27.05.21. 30 | */ 31 | public abstract class SimpleProgressTask extends AsyncTask { 32 | 33 | protected SimpleProgressDialog mDialog; 34 | 35 | protected void registerDialog(SimpleProgressDialog dialog){ 36 | mDialog = dialog; 37 | } 38 | 39 | @Override 40 | @CallSuper 41 | protected void onPreExecute() { 42 | if (mDialog != null) { 43 | mDialog.updateIndeterminate(); 44 | } 45 | } 46 | 47 | @Override 48 | @CallSuper 49 | protected void onPostExecute(Result result) { 50 | if (mDialog != null) { 51 | mDialog.updateFinished(); 52 | } 53 | } 54 | 55 | /** 56 | * Updates the progress dialog by trying to guess the meaning of the supplied parameter(s): 57 | *

58 | * - if values is of numeric type 59 | * - if values[0] < 0, then progress is indeterminate 60 | * - if values[0] >= 0, then (int) values[0] is set as progress 61 | * - if values[1] > 0, then (int) values[1] is set as max, otherwise max defaults to 100 62 | * - if values[2] >= 0, then (int) values[2] is set as secondary progress 63 | * - if values is of CharSequence type, then values[0] is set as info text and progress to indeterminate 64 | * - if values is a {@link Pair} of a {@link Number} and a {@link String}, the above is applied to either value of the pair 65 | */ 66 | @Override 67 | protected void onProgressUpdate(Progress... values) { 68 | if (mDialog != null && values.length > 0){ 69 | int v0 = -1, v1 = -1, v2 = -1; 70 | String s0 = null; 71 | 72 | if (values instanceof Number[]){ 73 | Number[] val = (Number[]) values; 74 | v0 = val[0].intValue(); 75 | if (values.length > 1) v1 = val[1].intValue(); 76 | if (values.length > 2) v2 = val[2].intValue(); 77 | } 78 | if (values instanceof String[]){ 79 | s0 = (String) values[0]; 80 | mDialog.updateIndeterminate(); 81 | } 82 | if (values instanceof Pair[]){ 83 | Pair[] val = (Pair[]) values; 84 | Pair val0 = val[0]; 85 | if (val0.first instanceof Number) v0 = ((Number) val0.first).intValue(); 86 | if (val0.second instanceof String) s0 = (String) val0.second; 87 | if (val.length > 1){ 88 | Pair val1 = val[1]; 89 | if (val1.first instanceof Number) v1 = ((Number) val1.first).intValue(); 90 | } 91 | if (val.length > 2){ 92 | Pair val2 = val[2]; 93 | if (val2.first instanceof Number) v2 = ((Number) val2.first).intValue(); 94 | } 95 | } 96 | 97 | if (v0 >= 0) mDialog.updateProgress(v0); 98 | if (v0 < 0) mDialog.updateIndeterminate(); 99 | if (v1 > 0) mDialog.updateMax(v1); 100 | if (v2 >= 0) mDialog.updateSecondaryProgress(v2); 101 | mDialog.updateInfoText(s0); 102 | 103 | } 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /lintchecks/src/main/java/eltos/lintchecks/DialogMethodCallLintDetector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.lintchecks; 18 | 19 | import com.android.tools.lint.detector.api.Category; 20 | import com.android.tools.lint.detector.api.Detector; 21 | import com.android.tools.lint.detector.api.Implementation; 22 | import com.android.tools.lint.detector.api.Issue; 23 | import com.android.tools.lint.detector.api.JavaContext; 24 | import com.android.tools.lint.detector.api.Scope; 25 | import com.android.tools.lint.detector.api.Severity; 26 | import com.android.tools.lint.detector.api.TypeEvaluator; 27 | import com.intellij.psi.PsiClass; 28 | import com.intellij.psi.PsiClassType; 29 | import com.intellij.psi.PsiMethod; 30 | import com.intellij.psi.PsiType; 31 | 32 | import org.jetbrains.uast.UCallExpression; 33 | import org.jetbrains.uast.UExpression; 34 | 35 | import java.util.Collections; 36 | import java.util.List; 37 | 38 | /** 39 | * This code checks calls on SimpleDialogs methods for the issues listed below 40 | */ 41 | @SuppressWarnings("UnstableApiUsage") 42 | public class DialogMethodCallLintDetector extends Detector implements Detector.UastScanner { 43 | 44 | private static String BUILD_CALL_MESSAGE = "%1$s does not implement a `build` method. " + 45 | "A **%2$s** will be created instead!\n" + 46 | "Implement the method in %1$s or call `%2$s.build()` instead."; 47 | public static final Issue BUILD_CALL = Issue.create("BuildNotImplemented", 48 | "Calling not implemented build", 49 | """ 50 | This check checks for calls to static build methods on classes extending \ 51 | `SimpleDialog` that do not implement the build method itself. 52 | 53 | This will create an instance of the superclass instead of the intended dialog. 54 | """, 55 | Category.CORRECTNESS, 6, Severity.ERROR, 56 | new Implementation(DialogMethodCallLintDetector.class, Scope.JAVA_FILE_SCOPE)); 57 | 58 | 59 | 60 | @Override 61 | public List getApplicableMethodNames() { 62 | return Collections.singletonList("build"); 63 | } 64 | 65 | @Override 66 | public void visitMethod(JavaContext context, UCallExpression node, PsiMethod method) { 67 | 68 | if (context.getEvaluator().isMemberInSubClassOf(method, 69 | "eltos.simpledialogfragment.SimpleDialog", false)) { 70 | 71 | PsiClass definingClass = method.getContainingClass(); 72 | UExpression callingExpression = node.getReceiver(); 73 | 74 | if (definingClass != null && callingExpression != null) { 75 | 76 | PsiType type = TypeEvaluator.evaluate(callingExpression); 77 | if (type instanceof PsiClassType) { 78 | // when called on instance of a class 79 | PsiClass callingClass = ((PsiClassType) type).resolve(); 80 | 81 | if (!definingClass.equals(callingClass)) { 82 | 83 | context.report(BUILD_CALL, context.getLocation(node), String.format( 84 | BUILD_CALL_MESSAGE, callingClass.getName(), definingClass.getName())); 85 | } 86 | 87 | } else { 88 | // when called as static reference 89 | if (!callingExpression.asSourceString().equals(definingClass.getName())) { 90 | context.report(BUILD_CALL, context.getLocation(node), String.format( 91 | BUILD_CALL_MESSAGE, callingExpression.asSourceString(), definingClass.getName())); 92 | } 93 | } 94 | 95 | } 96 | 97 | 98 | 99 | } 100 | 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/form/FormElementViewHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment.form; 18 | 19 | import android.content.Context; 20 | import android.os.Bundle; 21 | import androidx.annotation.LayoutRes; 22 | import android.view.View; 23 | 24 | import eltos.simpledialogfragment.SimpleDialog.OnDialogResultListener; 25 | 26 | /** 27 | * The Base class for all ViewHolders 28 | *

29 | * This class is used to create the View that represents the corresponding {@link FormElement} 30 | * and to maintain it's functionality 31 | *

32 | * Created by eltos on 23.02.17. 33 | */ 34 | 35 | @SuppressWarnings("WeakerAccess") 36 | public abstract class FormElementViewHolder { 37 | 38 | /** 39 | * The FormElement that this ViewHolder represents. 40 | */ 41 | protected E field; 42 | 43 | 44 | protected FormElementViewHolder(E field){ 45 | this.field = field; 46 | } 47 | 48 | /** 49 | * Implement this method to return a custom layout resource id for this view 50 | * 51 | * @return layout string resource 52 | */ 53 | protected abstract @LayoutRes int getContentViewLayout(); 54 | 55 | /** 56 | * Implement this method to setup your view for the first time or after a 57 | * {@link FormElementViewHolder#saveState} 58 | * 59 | * @param view The view that was inflated using the layout from 60 | * {@link FormElementViewHolder#getContentViewLayout()} 61 | * @param context The context of this view 62 | * @param savedInstanceState A bundle containing everything that was saved in 63 | * {@link FormElementViewHolder#saveState(Bundle)} 64 | * @param actions A callback for convenient methods. See {@link SimpleFormDialog.DialogActions} 65 | */ 66 | protected abstract void setUpView(View view, Context context, Bundle savedInstanceState, 67 | SimpleFormDialog.DialogActions actions); 68 | 69 | /** 70 | * Method to save this elements state 71 | * Bundles are maintained on a per-view basis, so that keys can be arbitrary 72 | * 73 | * @param outState The bundle to save the state to 74 | */ 75 | protected abstract void saveState(Bundle outState); 76 | 77 | /** 78 | * Method to publish results from this view in 79 | * {@link OnDialogResultListener#onResult} 80 | * 81 | * @param results The bundle to save the results to 82 | * @param key The key that has to be used when storing results in the bundle 83 | */ 84 | protected abstract void putResults(Bundle results, String key); 85 | 86 | /** 87 | * Method to focus this element 88 | * 89 | * @param actions An object providing useful callbacks, see {@link SimpleFormDialog.FocusActions} 90 | * 91 | * @return Whether this view or one of its descendants actually took focus. 92 | */ 93 | protected abstract boolean focus(SimpleFormDialog.FocusActions actions); 94 | 95 | /** 96 | * Method to check for empty input, (un-)checked state etc. 97 | * Only simple (and fast) checks here, no error displaying! 98 | * This is used only for single element forms. 99 | * 100 | * @param context A context 101 | * 102 | * @return true if positive button can be enabled 103 | */ 104 | protected abstract boolean posButtonEnabled(Context context); 105 | 106 | /** 107 | * Method to validate input, state etc. and display an error message or indicator 108 | * 109 | * @param context A context 110 | * 111 | * @return true if the input, state etc. is valid, false otherwise 112 | */ 113 | protected abstract boolean validate(Context context); 114 | 115 | } -------------------------------------------------------------------------------- /testApp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 30 | 31 | 32 | 38 | 42 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 66 | 69 | 72 | 77 | 78 | 80 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/SimpleCheckDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment; 18 | 19 | import android.os.Bundle; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.StringRes; 23 | import android.view.View; 24 | import android.widget.CheckBox; 25 | 26 | /** 27 | * An simple dialog with a checkbox that can be set as required before proceeding 28 | *

29 | * Created by eltos on 14.10.2015. 30 | */ 31 | public class SimpleCheckDialog extends CustomViewDialog { 32 | 33 | public static final String TAG = "SimpleCheckDialog."; 34 | 35 | public static final String 36 | CHECKED = TAG + "CHECKED"; 37 | 38 | 39 | public static SimpleCheckDialog build(){ 40 | return new SimpleCheckDialog(); 41 | } 42 | 43 | 44 | /** 45 | * Sets the initial check state 46 | * 47 | * @param preset checkbox initial state 48 | * @return this instance 49 | */ 50 | public SimpleCheckDialog check(boolean preset){ return setArg(CHECKED, preset); } 51 | 52 | /** 53 | * Sets the checkbox's label 54 | * 55 | * @param checkBoxLabel the label as string 56 | * @return this instance 57 | */ 58 | public SimpleCheckDialog label(CharSequence checkBoxLabel){ return setArg(CHECKBOX_LABEL, checkBoxLabel); } 59 | 60 | /** 61 | * Sets the checkbox's label 62 | * 63 | * @param checkBoxLabelResourceId the label as android string resource 64 | * @return this instance 65 | */ 66 | public SimpleCheckDialog label(@StringRes int checkBoxLabelResourceId){ return setArg(CHECKBOX_LABEL, checkBoxLabelResourceId); } 67 | 68 | /** 69 | * Whether the check is required. The positive button will be disabled until the checkbox 70 | * got checked 71 | * 72 | * @param required whether checking the checkbox is required 73 | * @return this instance 74 | */ 75 | public SimpleCheckDialog checkRequired(boolean required){ return setArg(CHECKBOX_REQUIRED, required); } 76 | 77 | 78 | 79 | 80 | 81 | protected static final String CHECKBOX_LABEL = "simpleCheckDialog.check_label"; 82 | protected static final String CHECKBOX_REQUIRED = "simpleCheckDialog.check_required"; 83 | 84 | private CheckBox mCheckBox; 85 | 86 | 87 | private boolean canGoAhead() { 88 | return mCheckBox.isChecked() || !getArgs().getBoolean(CHECKBOX_REQUIRED); 89 | } 90 | 91 | @Override 92 | public View onCreateContentView(Bundle savedInstanceState) { 93 | // inflate and set your custom view here 94 | 95 | View view = inflate(R.layout.simpledialogfragment_check_box); 96 | mCheckBox = view.findViewById(R.id.checkBox); 97 | 98 | mCheckBox.setText(getArgString(CHECKBOX_LABEL)); 99 | 100 | if (savedInstanceState != null){ 101 | mCheckBox.setChecked(savedInstanceState.getBoolean(CHECKED, false)); 102 | } else { 103 | mCheckBox.setChecked(getArgs().getBoolean(CHECKED, false)); 104 | } 105 | 106 | mCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> setPositiveButtonEnabled(canGoAhead())); 107 | 108 | return view; 109 | } 110 | 111 | @Override 112 | protected void onDialogShown() { 113 | setPositiveButtonEnabled(canGoAhead()); 114 | } 115 | 116 | @Override 117 | public Bundle onResult(int which) { 118 | Bundle result = new Bundle(); 119 | result.putBoolean(CHECKED, mCheckBox.isChecked()); 120 | return result; 121 | } 122 | 123 | @Override 124 | public void onSaveInstanceState(@NonNull Bundle outState) { 125 | super.onSaveInstanceState(outState); 126 | outState.putBoolean(CHECKED, mCheckBox.isChecked()); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/form/FormElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment.form; 18 | 19 | import android.content.Context; 20 | import android.os.Parcel; 21 | import android.os.Parcelable; 22 | import androidx.annotation.Nullable; 23 | import androidx.annotation.StringRes; 24 | 25 | /** 26 | * Base-class for form elements to be used with {@link SimpleFormDialog} 27 | * 28 | * Each form element holds a {@link FormElement#resultKey} that is used to receive element 29 | * specific results in {@link SimpleFormDialog#onResult} 30 | * 31 | * Created by eltos on 20.02.17. 32 | */ 33 | 34 | @SuppressWarnings("WeakerAccess") 35 | public abstract class FormElement implements Parcelable { 36 | 37 | protected static final int NO_ID = -1; 38 | 39 | protected String resultKey; 40 | protected boolean required = false; 41 | private String text = null; 42 | private int textResourceId = NO_ID; 43 | 44 | 45 | protected FormElement(String resultKey){ 46 | this.resultKey = resultKey; 47 | } 48 | 49 | 50 | /** 51 | * Return your custom implementation of {@link FormElementViewHolder} here 52 | * 53 | * @return The view holder that can represent this form element 54 | */ 55 | public abstract V buildViewHolder(); 56 | 57 | 58 | /** 59 | * Mark this Field as required. 60 | * See {@link FormElement#required(boolean)} 61 | * 62 | * @return this instance 63 | */ 64 | public T required(){ 65 | return required(true); 66 | } 67 | 68 | /** 69 | * Set the required flag for this field. 70 | * This has different meanings depending on the element type 71 | *

72 | * Input fields will display an error message if their input is empty. 73 | * Check fields will be required to be checked 74 | * 75 | * @param required whether this field is required 76 | * @return this instance 77 | */ 78 | @SuppressWarnings("unchecked cast") 79 | public T required(boolean required){ 80 | this.required = required; 81 | return (T) this; 82 | } 83 | 84 | /** 85 | * Sets the label 86 | * 87 | * @param text label text as string 88 | * @return this instance 89 | */ 90 | @SuppressWarnings("unchecked cast") 91 | public T label(String text){ 92 | this.text = text; 93 | return (T) this; 94 | } 95 | 96 | /** 97 | * Sets the label 98 | * 99 | * @param textResourceId label text as android string resource 100 | * @return this instance 101 | */ 102 | @SuppressWarnings("unchecked cast") 103 | public T label(@StringRes int textResourceId){ 104 | this.textResourceId = textResourceId; 105 | return (T) this; 106 | } 107 | 108 | 109 | /////////////////////////////////////////////////////////////////////////////////////////// 110 | 111 | @Nullable 112 | protected String getText(Context context){ 113 | if (text != null) { 114 | return text; 115 | } else if (textResourceId != NO_ID){ 116 | return context.getString(textResourceId); 117 | } 118 | return null; 119 | } 120 | 121 | 122 | // Parcel implementation 123 | 124 | protected FormElement(Parcel in) { 125 | resultKey = in.readString(); 126 | required = in.readByte() != 0; 127 | text = in.readString(); 128 | textResourceId = in.readInt(); 129 | } 130 | 131 | @Override 132 | public int describeContents() { 133 | return 0; 134 | } 135 | 136 | @Override 137 | public void writeToParcel(Parcel dest, int flags) { 138 | dest.writeString(resultKey); 139 | dest.writeByte((byte) (required ? 1 : 0)); 140 | dest.writeString(text); 141 | dest.writeInt(textResourceId); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/form/CheckViewHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment.form; 18 | 19 | import android.content.Context; 20 | import android.content.res.TypedArray; 21 | import android.graphics.Color; 22 | import android.os.Bundle; 23 | import android.util.TypedValue; 24 | import android.view.View; 25 | import android.widget.CheckBox; 26 | 27 | import eltos.simpledialogfragment.R; 28 | 29 | /** 30 | * The ViewHolder class for {@link Check} 31 | * 32 | * This class is used to create a CheckBox and to maintain it's functionality 33 | *

34 | * Created by eltos on 23.02.17. 35 | */ 36 | 37 | class CheckViewHolder extends FormElementViewHolder { 38 | 39 | protected static final String SAVED_CHECK_STATE = "checked"; 40 | private CheckBox checkBox; 41 | 42 | public CheckViewHolder(Check field) { 43 | super(field); 44 | } 45 | 46 | @Override 47 | protected int getContentViewLayout() { 48 | return R.layout.simpledialogfragment_form_item_check; 49 | } 50 | 51 | @Override 52 | protected void setUpView(View view, Context context, Bundle savedInstanceState, 53 | final SimpleFormDialog.DialogActions actions) { 54 | 55 | checkBox = view.findViewById(R.id.checkBox); 56 | 57 | // Label 58 | checkBox.setText(field.getText(context)); 59 | 60 | // Check preset 61 | if (savedInstanceState != null) { 62 | checkBox.setChecked(savedInstanceState.getBoolean(SAVED_CHECK_STATE)); 63 | } else { 64 | checkBox.setChecked(field.getInitialState(context)); 65 | } 66 | 67 | // Positive button state for single element forms 68 | if (actions.isOnlyFocusableElement()) { 69 | checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> actions.updatePosButtonState()); 70 | } 71 | 72 | } 73 | 74 | 75 | @Override 76 | protected void saveState(Bundle outState) { 77 | outState.putBoolean(SAVED_CHECK_STATE, checkBox.isChecked()); 78 | } 79 | 80 | 81 | @Override 82 | protected void putResults(Bundle results, String key) { 83 | results.putBoolean(key, checkBox.isChecked()); 84 | } 85 | 86 | 87 | @Override 88 | protected boolean focus(final SimpleFormDialog.FocusActions actions) { 89 | actions.hideKeyboard(); 90 | 91 | // Temporary make this view focusable, so that we can scroll to it 92 | // and show a short flash of the box getting focused 93 | checkBox.setFocusableInTouchMode(true); 94 | 95 | checkBox.postDelayed(() -> { 96 | // finally remove focus 97 | checkBox.setFocusable(false); 98 | actions.clearCurrentFocus(); 99 | }, 100); 100 | 101 | return checkBox.requestFocus(); 102 | } 103 | 104 | 105 | @Override 106 | protected boolean posButtonEnabled(Context context) { 107 | return !field.required || checkBox.isChecked(); 108 | } 109 | 110 | 111 | @Override 112 | protected boolean validate(Context context) { 113 | boolean valid = posButtonEnabled(context); 114 | if (valid) { 115 | TypedValue value = new TypedValue(); 116 | checkBox.getContext().getTheme().resolveAttribute(android.R.attr.checkboxStyle, value, true); 117 | int[] attr = new int[] {android.R.attr.textColor}; 118 | TypedArray a = context.obtainStyledAttributes(value.data, attr); 119 | checkBox.setTextColor(a.getColor(0, Color.BLACK)); 120 | a.recycle(); 121 | 122 | } else { 123 | //noinspection deprecation 124 | checkBox.setTextColor(context.getResources().getColor(R.color.simpledialogfragment_error_color)); 125 | } 126 | // checkBox.setError(valid ? null : context.getString(R.string.required)); 127 | return valid; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /testApp/src/main/java/eltos/simpledialogfragments/FlatFragmentActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragments; 18 | 19 | import android.graphics.Color; 20 | import android.graphics.drawable.ColorDrawable; 21 | import android.os.Build; 22 | import androidx.annotation.ColorInt; 23 | import androidx.annotation.NonNull; 24 | import androidx.fragment.app.FragmentManager; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | import android.os.Bundle; 27 | import android.text.Spannable; 28 | import android.text.SpannableString; 29 | import android.text.style.ForegroundColorSpan; 30 | 31 | import eltos.simpledialogfragment.SimpleDialog; 32 | import eltos.simpledialogfragment.color.SimpleColorDialog; 33 | 34 | public class FlatFragmentActivity extends AppCompatActivity implements SimpleDialog.OnDialogResultListener { 35 | 36 | private static final String COLOR_FRAGMENT = "color_fragment"; 37 | 38 | @Override 39 | protected void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_flat_fragment); 42 | 43 | 44 | /** 45 | * This example shows how one could re-use the views from a dialog 46 | * in an activity, using a wrapper class like {@link FlatColorFragment} 47 | * 48 | */ 49 | 50 | FragmentManager fragmentManager = getSupportFragmentManager(); 51 | final FlatColorFragment fragment; 52 | 53 | if (savedInstanceState == null){ 54 | 55 | // instantiate and configure properties 56 | fragment = new FlatColorFragment(); 57 | fragment.allowCustom(true); 58 | fragment.colorPreset(0xFFCF4747); 59 | 60 | fragmentManager.beginTransaction().add(R.id.frame, fragment, COLOR_FRAGMENT).commit(); 61 | 62 | } else { 63 | fragment = (FlatColorFragment) fragmentManager.findFragmentByTag(COLOR_FRAGMENT); 64 | } 65 | 66 | // call result listener 67 | findViewById(R.id.ok).setOnClickListener(v -> fragment.callResultListener()); 68 | 69 | } 70 | 71 | // == R E S U L T S == 72 | 73 | 74 | /** 75 | * Let the hosting fragment or activity implement this interface 76 | * to receive results from the dialog 77 | * 78 | * @param dialogTag the tag passed to {@link SimpleDialog#show} 79 | * @param which result type, one of {@link #BUTTON_POSITIVE}, {@link #BUTTON_NEGATIVE}, 80 | * {@link #BUTTON_NEUTRAL} or {@link #CANCELED} 81 | * @param extras the extras passed to {@link SimpleDialog#extra(Bundle)} 82 | * @return true if the result was handled, false otherwise 83 | */ 84 | @Override 85 | public boolean onResult(@NonNull String dialogTag, int which, @NonNull Bundle extras) { 86 | 87 | // handle results as usual 88 | if (COLOR_FRAGMENT.equals(dialogTag) && which == BUTTON_POSITIVE) { 89 | @ColorInt int color = extras.getInt(SimpleColorDialog.COLOR); 90 | 91 | // Sets action bar colors 92 | if (getSupportActionBar() != null) { 93 | getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xFF000000 | color)); 94 | 95 | boolean dark = Color.red(color) * 0.299 + Color.green(color) * 0.587 + Color.blue(color) * 0.114 < 180; 96 | SpannableString s = new SpannableString(getSupportActionBar().getTitle()); 97 | s.setSpan(new ForegroundColorSpan(dark ? Color.WHITE : Color.BLACK), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 98 | getSupportActionBar().setTitle(s); 99 | } 100 | 101 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 102 | float[] hsv = new float[3]; 103 | Color.colorToHSV(color, hsv); 104 | hsv[2] *= 0.75f; 105 | getWindow().setStatusBarColor(Color.HSVToColor(hsv)); 106 | } 107 | 108 | return true; 109 | } 110 | return false; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | ecmaFeatures: 2 | modules: true 3 | jsx: true 4 | 5 | env: 6 | amd: true 7 | browser: true 8 | es6: true 9 | jquery: true 10 | node: true 11 | 12 | # http://eslint.org/docs/rules/ 13 | rules: 14 | # Possible Errors 15 | comma-dangle: [2, never] 16 | no-cond-assign: 2 17 | no-console: 0 18 | no-constant-condition: 2 19 | no-control-regex: 2 20 | no-debugger: 2 21 | no-dupe-args: 2 22 | no-dupe-keys: 2 23 | no-duplicate-case: 2 24 | no-empty: 2 25 | no-empty-character-class: 2 26 | no-ex-assign: 2 27 | no-extra-boolean-cast: 2 28 | no-extra-parens: 0 29 | no-extra-semi: 2 30 | no-func-assign: 2 31 | no-inner-declarations: [2, functions] 32 | no-invalid-regexp: 2 33 | no-irregular-whitespace: 2 34 | no-negated-in-lhs: 2 35 | no-obj-calls: 2 36 | no-regex-spaces: 2 37 | no-sparse-arrays: 2 38 | no-unexpected-multiline: 2 39 | no-unreachable: 2 40 | use-isnan: 2 41 | valid-jsdoc: 0 42 | valid-typeof: 2 43 | 44 | # Best Practices 45 | accessor-pairs: 2 46 | block-scoped-var: 0 47 | complexity: [2, 6] 48 | consistent-return: 0 49 | curly: 0 50 | default-case: 0 51 | dot-location: 0 52 | dot-notation: 0 53 | eqeqeq: 2 54 | guard-for-in: 2 55 | no-alert: 2 56 | no-caller: 2 57 | no-case-declarations: 2 58 | no-div-regex: 2 59 | no-else-return: 0 60 | no-empty-label: 2 61 | no-empty-pattern: 2 62 | no-eq-null: 2 63 | no-eval: 2 64 | no-extend-native: 2 65 | no-extra-bind: 2 66 | no-fallthrough: 2 67 | no-floating-decimal: 0 68 | no-implicit-coercion: 0 69 | no-implied-eval: 2 70 | no-invalid-this: 0 71 | no-iterator: 2 72 | no-labels: 0 73 | no-lone-blocks: 2 74 | no-loop-func: 2 75 | no-magic-number: 0 76 | no-multi-spaces: 0 77 | no-multi-str: 0 78 | no-native-reassign: 2 79 | no-new-func: 2 80 | no-new-wrappers: 2 81 | no-new: 2 82 | no-octal-escape: 2 83 | no-octal: 2 84 | no-proto: 2 85 | no-redeclare: 2 86 | no-return-assign: 2 87 | no-script-url: 2 88 | no-self-compare: 2 89 | no-sequences: 0 90 | no-throw-literal: 0 91 | no-unused-expressions: 2 92 | no-useless-call: 2 93 | no-useless-concat: 2 94 | no-void: 2 95 | no-warning-comments: 0 96 | no-with: 2 97 | radix: 2 98 | vars-on-top: 0 99 | wrap-iife: 2 100 | yoda: 0 101 | 102 | # Strict 103 | strict: 0 104 | 105 | # Variables 106 | init-declarations: 0 107 | no-catch-shadow: 2 108 | no-delete-var: 2 109 | no-label-var: 2 110 | no-shadow-restricted-names: 2 111 | no-shadow: 0 112 | no-undef-init: 2 113 | no-undef: 0 114 | no-undefined: 0 115 | no-unused-vars: 0 116 | no-use-before-define: 0 117 | 118 | # Node.js and CommonJS 119 | callback-return: 2 120 | global-require: 2 121 | handle-callback-err: 2 122 | no-mixed-requires: 0 123 | no-new-require: 0 124 | no-path-concat: 2 125 | no-process-exit: 2 126 | no-restricted-modules: 0 127 | no-sync: 0 128 | 129 | # Stylistic Issues 130 | array-bracket-spacing: 0 131 | block-spacing: 0 132 | brace-style: 0 133 | camelcase: 0 134 | comma-spacing: 0 135 | comma-style: 0 136 | computed-property-spacing: 0 137 | consistent-this: 0 138 | eol-last: 0 139 | func-names: 0 140 | func-style: 0 141 | id-length: 0 142 | id-match: 0 143 | indent: 0 144 | jsx-quotes: 0 145 | key-spacing: 0 146 | linebreak-style: 0 147 | lines-around-comment: 0 148 | max-depth: 0 149 | max-len: 0 150 | max-nested-callbacks: 0 151 | max-params: 0 152 | max-statements: [2, 30] 153 | new-cap: 0 154 | new-parens: 0 155 | newline-after-var: 0 156 | no-array-constructor: 0 157 | no-bitwise: 0 158 | no-continue: 0 159 | no-inline-comments: 0 160 | no-lonely-if: 0 161 | no-mixed-spaces-and-tabs: 0 162 | no-multiple-empty-lines: 0 163 | no-negated-condition: 0 164 | no-nested-ternary: 0 165 | no-new-object: 0 166 | no-plusplus: 0 167 | no-restricted-syntax: 0 168 | no-spaced-func: 0 169 | no-ternary: 0 170 | no-trailing-spaces: 0 171 | no-underscore-dangle: 0 172 | no-unneeded-ternary: 0 173 | object-curly-spacing: 0 174 | one-var: 0 175 | operator-assignment: 0 176 | operator-linebreak: 0 177 | padded-blocks: 0 178 | quote-props: 0 179 | quotes: 0 180 | require-jsdoc: 0 181 | semi-spacing: 0 182 | semi: 0 183 | sort-vars: 0 184 | space-after-keywords: 0 185 | space-before-blocks: 0 186 | space-before-function-paren: 0 187 | space-before-keywords: 0 188 | space-in-parens: 0 189 | space-infix-ops: 0 190 | space-return-throw-case: 0 191 | space-unary-ops: 0 192 | spaced-comment: 0 193 | wrap-regex: 0 194 | 195 | # ECMAScript 6 196 | arrow-body-style: 0 197 | arrow-parens: 0 198 | arrow-spacing: 0 199 | constructor-super: 0 200 | generator-star-spacing: 0 201 | no-arrow-condition: 0 202 | no-class-assign: 0 203 | no-const-assign: 0 204 | no-dupe-class-members: 0 205 | no-this-before-super: 0 206 | no-var: 0 207 | object-shorthand: 0 208 | prefer-arrow-callback: 0 209 | prefer-const: 0 210 | prefer-reflect: 0 211 | prefer-spread: 0 212 | prefer-template: 0 213 | require-yield: 0 214 | -------------------------------------------------------------------------------- /simpledialogfragments/src/main/java/eltos/simpledialogfragment/form/Check.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Philipp Niedermayer (github.com/eltos) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package eltos.simpledialogfragment.form; 18 | 19 | import android.content.Context; 20 | import android.os.Parcel; 21 | import androidx.annotation.BoolRes; 22 | import androidx.annotation.Nullable; 23 | import androidx.annotation.StringRes; 24 | 25 | import eltos.simpledialogfragment.SimpleDialog.OnDialogResultListener; 26 | 27 | /** 28 | * An checkbox form element to be used with {@link SimpleFormDialog} 29 | * 30 | * This is a CheckBox - what else? 31 | *

32 | * This will add a Boolean to resource bundle containing the checked state. 33 | *

34 | * Created by eltos on 21.02.17. 35 | */ 36 | 37 | public class Check extends FormElement { 38 | 39 | private String text = null; 40 | private int textResourceId = NO_ID; 41 | private Boolean preset = null; 42 | private int presetId = NO_ID; 43 | 44 | private Check(String resultKey) { 45 | super(resultKey); 46 | } 47 | 48 | /** 49 | * Factory method for a check field. 50 | * 51 | * @param key the key that can be used to receive the final state from the bundle in 52 | * {@link OnDialogResultListener#onResult} 53 | * @return this instance 54 | */ 55 | public static Check box(String key){ 56 | return new Check(key); 57 | } 58 | 59 | 60 | /** 61 | * Sets the initial state of the checkbox 62 | * 63 | * @param preset initial state 64 | * @return this instance 65 | */ 66 | public Check check(boolean preset){ 67 | this.preset = preset; 68 | return this; 69 | } 70 | 71 | /** 72 | * Sets the initial state of the checkbox 73 | * 74 | * @param preset initial state as boolean resource 75 | * @return this instance 76 | */ 77 | public Check check(@BoolRes int preset){ 78 | this.presetId = preset; 79 | return this; 80 | } 81 | 82 | /** 83 | * Sets the label 84 | * 85 | * @param text label text as string 86 | */ 87 | public Check label(String text){ 88 | this.text = text; 89 | return this; 90 | } 91 | 92 | /** 93 | * Sets the label 94 | * 95 | * @param textResourceId label text as android string resource 96 | */ 97 | public Check label(@StringRes int textResourceId){ 98 | this.textResourceId = textResourceId; 99 | return this; 100 | } 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | /////////////////////////////////////////////////////////////////////////////////////////// 115 | 116 | @Override 117 | public CheckViewHolder buildViewHolder() { 118 | return new CheckViewHolder(this); 119 | } 120 | 121 | /////////////////////////////////////////////////////////////////////////////////////////// 122 | 123 | @Nullable 124 | protected String getText(Context context){ 125 | if (text != null) { 126 | return text; 127 | } else if (textResourceId != NO_ID){ 128 | return context.getString(textResourceId); 129 | } 130 | return null; 131 | } 132 | 133 | protected boolean getInitialState(Context context){ 134 | if (preset != null) { 135 | return preset; 136 | } else if (presetId != NO_ID){ 137 | return context.getResources().getBoolean(presetId); 138 | } 139 | return false; 140 | } 141 | 142 | 143 | 144 | 145 | private Check(Parcel in) { 146 | super(in); 147 | text = in.readString(); 148 | textResourceId = in.readInt(); 149 | byte b = in.readByte(); 150 | preset = b < 0 ? null : b != 0; 151 | presetId = in.readInt(); 152 | } 153 | 154 | public static final Creator CREATOR = new Creator() { 155 | @Override 156 | public Check createFromParcel(Parcel in) { 157 | return new Check(in); 158 | } 159 | 160 | @Override 161 | public Check[] newArray(int size) { 162 | return new Check[size]; 163 | } 164 | }; 165 | 166 | @Override 167 | public int describeContents() { 168 | return 0; 169 | } 170 | 171 | @Override 172 | public void writeToParcel(Parcel dest, int flags) { 173 | super.writeToParcel(dest, flags); 174 | dest.writeString(text); 175 | dest.writeInt(textResourceId); 176 | dest.writeByte((byte) (preset == null ? -1 : (preset ? 1 : 0))); 177 | dest.writeInt(presetId); 178 | } 179 | 180 | 181 | } 182 | --------------------------------------------------------------------------------