├── .gitignore ├── .idea └── copyright │ ├── Diagonal_Drawable_MIT_License.xml │ └── profiles_settings.xml ├── LICENSE.md ├── README.md ├── art └── sample.gif ├── build.gradle ├── deploy ├── configuration.json └── updateReadme.gradle ├── diagonaldrawable ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── com │ └── massivedisaster │ └── drawable │ └── DiagonalDrawable.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── massivedisaster │ │ └── sample │ │ ├── DialogExample.kt │ │ └── MainActivity.kt │ └── res │ ├── drawable-v19 │ ├── button_transparent.xml │ ├── button_transparent_normal.xml │ └── button_transparent_pressed.xml │ ├── drawable-v21 │ └── button_transparent.xml │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_launcher_background.xml │ └── ic_whatshot.xml │ ├── layout │ ├── activity_main.xml │ └── dialog_example.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/android,java,macos 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # Intellij 40 | *.iml 41 | 42 | ## Directory-based project format: 43 | .idea/* 44 | 45 | # Track copyright configuration 46 | !.idea/copyright 47 | .idea/copyright/* 48 | !.idea/copyright/Diagonal_Drawable_MIT_License.xml 49 | !.idea/copyright/profiles_settings.xml 50 | 51 | # Keystore files 52 | *.jks 53 | 54 | ### Android Patch ### 55 | gen-external-apklibs 56 | 57 | 58 | ### macOS ### 59 | *.DS_Store 60 | .AppleDouble 61 | .LSOverride 62 | 63 | # Icon must end with two \r 64 | Icon 65 | 66 | 67 | # Thumbnails 68 | ._* 69 | 70 | # Files that might appear in the root of a volume 71 | .DocumentRevisions-V100 72 | .fseventsd 73 | .Spotlight-V100 74 | .TemporaryItems 75 | .Trashes 76 | .VolumeIcon.icns 77 | .com.apple.timemachine.donotpresent 78 | 79 | # Directories potentially created on remote AFP share 80 | .AppleDB 81 | .AppleDesktop 82 | Network Trash Folder 83 | Temporary Items 84 | .apdisk 85 | 86 | 87 | ### Java ### 88 | *.class 89 | 90 | # Mobile Tools for Java (J2ME) 91 | .mtj.tmp/ 92 | 93 | # Package Files # 94 | *.jar 95 | *.war 96 | *.ear 97 | 98 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 99 | hs_err_pid* 100 | 101 | # Allow anything in the gradle wrapper folder 102 | !gradle/wrapper/* 103 | !gradle/wrapper/gradle-wrapper.jar 104 | !gradle/wrapper/gradle-wrapper.properties 105 | -------------------------------------------------------------------------------- /.idea/copyright/Diagonal_Drawable_MIT_License.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright © `2017` `copyright massivedisaster` 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the “Software”), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DiagonalDrawable 2 | [ ![Download](https://api.bintray.com/packages/massivedisaster/drawable/diagonaldrawable/images/download.svg) ](https://bintray.com/massivedisaster/drawable/diagonaldrawable/_latestVersion) 3 | [![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16) 4 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 5 | 6 | A Diagonal Drawable for backgrounds, etc. 7 | 8 |
9 | 10 |
11 | 12 | ### Download 13 | 14 | Gradle: 15 | 16 | ```gradle 17 | dependencies { 18 | implementation 'com.massivedisaster.drawable:diagonaldrawable:0.1.0' 19 | } 20 | ``` 21 | 22 | ### Usage 23 | 24 | ```java 25 | DiagonalDrawable(ContextCompat.getColor(context, R.color.left), 26 | ContextCompat.getColor(context, R.color.right), 27 | DiagonalDrawable.Orientation.LEFT_RIGHT) 28 | ``` 29 | 30 | Orientations available: 31 | 32 | ``` 33 | DiagonalDrawable.Orientation.LEFT_RIGHT 34 | DiagonalDrawable.Orientation.RIGHT_LEFT 35 | ``` 36 | 37 | ### License 38 | [MIT LICENSE](LICENSE.md) -------------------------------------------------------------------------------- /art/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/DiagonalDrawable/e2886077c17fcde3c5f8f710b88528f11b0e38dc/art/sample.gif -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 27 | 28 | apply from: "$project.rootDir/deploy/updateReadme.gradle" 29 | 30 | ext { 31 | userOrgBase = 'massivedisaster' 32 | websiteBase = 'https://github.com/massivedisaster/DiagonalDrawable' 33 | licensesBase = ['MIT'] 34 | packageBase = 'com.massivedisaster' 35 | moduleBase = packageBase + '.drawable' 36 | repoNameBase = "drawable" 37 | isLibrary = true 38 | libraryVersionCode = 1 39 | libraryVersionName = project.libraryVersionName 40 | librarySnaphotEnabled = false 41 | 42 | libraryVersionString = { 43 | return libraryVersionName + (librarySnaphotEnabled ? '-SNAPSHOT' : '') 44 | } 45 | } 46 | 47 | buildscript { 48 | repositories { 49 | google() 50 | jcenter() 51 | } 52 | dependencies { 53 | classpath 'com.android.tools.build:gradle:3.0.1' 54 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.kotlinVersion" 55 | classpath 'com.novoda:bintray-release:0.8.0' 56 | } 57 | } 58 | 59 | allprojects { 60 | repositories { 61 | google() 62 | jcenter() 63 | } 64 | 65 | tasks.withType(Javadoc) { 66 | excludes = ['**/*.kt'] 67 | } 68 | } 69 | 70 | task version { 71 | println "Current version: " + libraryVersionString() 72 | } 73 | 74 | task updateReadme() { 75 | doLast { 76 | processUpdateReadme file("$project.rootDir"), ".md", libraryVersionName 77 | } 78 | } 79 | 80 | task clean(type: Delete) { 81 | delete rootProject.buildDir 82 | } 83 | -------------------------------------------------------------------------------- /deploy/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "../", 3 | "version": "0.1.0", 4 | "extraTasks": [ 5 | "updateReadme" 6 | ], 7 | "modules": [ 8 | "diagonaldrawable" 9 | ] 10 | } -------------------------------------------------------------------------------- /deploy/updateReadme.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import java.nio.charset.Charset 27 | import java.nio.file.Files 28 | import java.nio.file.Paths 29 | 30 | /** 31 | * Reads a file as string. 32 | * 33 | * @param path path to the file. 34 | * @return the string with the file contents. 35 | * @throws IOException if file don’t exist. 36 | */ 37 | private static String readFileAsString(String path) throws IOException { 38 | byte[] encoded = Files.readAllBytes(Paths.get(path)) 39 | return new String(encoded, Charset.defaultCharset()) 40 | } 41 | 42 | /** 43 | * Replace every semantic version occurrence in specified file. 44 | * 45 | * @param newVersion version to replace. 46 | * @param fileName the file to search. 47 | * @throws IOException if file don’t exist. 48 | */ 49 | private static void replaceAllSemVerInFile(String newVersion, String fileName) throws IOException { 50 | String readme = readFileAsString(fileName) 51 | String readmeVersionReplaced = readme.replaceAll("(\\d+(\\.\\d+){2})(\\-[\\w\\d\\.\\-]*)?(\\+[\\w\\d\\.\\-]*)?", newVersion) 52 | 53 | PrintWriter output = new PrintWriter(fileName) 54 | output.print(readmeVersionReplaced) 55 | output.close() 56 | } 57 | 58 | ext { 59 | processUpdateReadme = { File resDir, String extension, String libraryVersionName -> 60 | resDir.eachFileRecurse { file -> 61 | if (file.name.endsWith(extension)) { 62 | replaceAllSemVerInFile(libraryVersionName, file.absolutePath) 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /diagonaldrawable/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /diagonaldrawable/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'com.android.library' 27 | apply plugin: 'com.novoda.bintray-release' 28 | apply plugin: 'kotlin-android' 29 | apply plugin: 'kotlin-android-extensions' 30 | 31 | android { 32 | compileSdkVersion project.targetSdkVersion.toInteger() 33 | buildToolsVersion project.buildToolsVersion 34 | 35 | 36 | defaultConfig { 37 | minSdkVersion project.minSdkVersion.toInteger() 38 | targetSdkVersion project.targetSdkVersion.toInteger() 39 | versionCode libraryVersionCode 40 | versionName libraryVersionName 41 | } 42 | 43 | sourceSets { 44 | main.java.srcDirs += 'src/main/kotlin' 45 | androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) 46 | } 47 | } 48 | 49 | dependencies { 50 | implementation "com.android.support:appcompat-v7:$project.supportVersion" 51 | implementation "com.android.support:design:$project.supportVersion" 52 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.kotlinVersion" 53 | } 54 | 55 | publish { 56 | userOrg = userOrgBase 57 | groupId = moduleBase 58 | artifactId = 'diagonaldrawable' 59 | repoName = repoNameBase 60 | publishVersion = libraryVersionString() 61 | desc = 'A Diagonal Drawable for backgrounds, etc.' 62 | website = websiteBase 63 | licences = licensesBase 64 | } 65 | 66 | apply plugin: 'kotlin-android' 67 | apply plugin: 'kotlin-android-extensions' -------------------------------------------------------------------------------- /diagonaldrawable/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /diagonaldrawable/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /diagonaldrawable/src/main/kotlin/com/massivedisaster/drawable/DiagonalDrawable.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.drawable 27 | 28 | import android.graphics.* 29 | import android.graphics.drawable.Drawable 30 | import android.support.annotation.Nullable 31 | 32 | class DiagonalDrawable(private val colorLeft: Int, 33 | private val colorRight: Int, 34 | private val orientation: Orientation = Orientation.LEFT_RIGHT) : Drawable() { 35 | 36 | enum class Orientation { 37 | LEFT_RIGHT, 38 | RIGHT_LEFT 39 | } 40 | 41 | private val paint = Paint() 42 | private lateinit var pathRight: Path 43 | private lateinit var pathLeft: Path 44 | 45 | private lateinit var rectBounds: Rect 46 | 47 | init { 48 | paint.style = Paint.Style.FILL 49 | paint.isAntiAlias = true 50 | } 51 | 52 | override fun onBoundsChange(bounds: Rect) { 53 | super.onBoundsChange(bounds) 54 | rectBounds = bounds 55 | 56 | pathLeft = Path() 57 | pathLeft.moveTo(0F, 0F) 58 | 59 | pathRight = Path() 60 | pathRight.moveTo(bounds.right.toFloat(), 0F) 61 | 62 | if (orientation == Orientation.LEFT_RIGHT) { 63 | pathLeft.lineTo(0F, bounds.bottom.toFloat()) 64 | pathLeft.lineTo(bounds.right.toFloat(), bounds.bottom.toFloat()) 65 | 66 | pathRight.lineTo(0F, 0F) 67 | pathRight.lineTo(bounds.right.toFloat(), bounds.bottom.toFloat()) 68 | } else { 69 | pathRight.lineTo(0F, bounds.bottom.toFloat()) 70 | pathRight.lineTo(bounds.right.toFloat(), bounds.bottom.toFloat()) 71 | 72 | pathLeft.lineTo(0F, bounds.bottom.toFloat()) 73 | pathLeft.lineTo(bounds.right.toFloat(), 0F) 74 | } 75 | 76 | pathLeft.moveTo(0F, 0F) 77 | pathLeft.close() 78 | 79 | pathLeft.moveTo(bounds.right.toFloat(), 0F) 80 | pathLeft.close() 81 | } 82 | 83 | override fun draw(canvas: Canvas) { 84 | paint.color = colorLeft 85 | canvas.drawPath(pathLeft, paint) 86 | paint.color = colorRight 87 | canvas.drawPath(pathRight, paint) 88 | 89 | if (orientation == Orientation.LEFT_RIGHT) { 90 | canvas.drawLine(0F, 0F, bounds.right.toFloat(), bounds.bottom.toFloat(), paint) 91 | } else { 92 | canvas.drawLine(bounds.right.toFloat(), 0F, 0F, bounds.bottom.toFloat(), paint) 93 | } 94 | } 95 | 96 | override fun setAlpha(alpha: Int) {} 97 | 98 | override fun setColorFilter(@Nullable colorFilter: ColorFilter?) {} 99 | 100 | override fun getOpacity(): Int { 101 | return PixelFormat.UNKNOWN 102 | } 103 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | # 4 | # Copyright (c) 2018 DiagonalDrawable 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | # Project-wide Gradle settings. 27 | 28 | # IDE (e.g. Android Studio) users: 29 | # Gradle settings configured through the IDE *will override* 30 | # any settings specified in this file. 31 | 32 | # For more details on how to configure your build environment visit 33 | # http://www.gradle.org/docs/current/userguide/build_environment.html 34 | 35 | # Specifies the JVM arguments used for the daemon process. 36 | # The setting is particularly useful for tweaking memory settings. 37 | org.gradle.jvmargs=-Xmx1536m 38 | 39 | # When configured, Gradle will run in incubating parallel mode. 40 | # This option should only be used with decoupled projects. More details, visit 41 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 42 | # org.gradle.parallel=true 43 | 44 | # General properties 45 | minSdkVersion=16 46 | targetSdkVersion=27 47 | buildToolsVersion=27.0.3 48 | 49 | # Dependencies versions 50 | supportVersion=27.0.2 51 | kotlinVersion=1.2.21 52 | 53 | # Library version 54 | libraryVersionName=0.0.0 55 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/DiagonalDrawable/e2886077c17fcde3c5f8f710b88528f11b0e38dc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | # 4 | # Copyright (c) 2018 DiagonalDrawable 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | #Tue Oct 24 21:14:15 BST 2017 27 | distributionBase=GRADLE_USER_HOME 28 | distributionPath=wrapper/dists 29 | zipStoreBase=GRADLE_USER_HOME 30 | zipStorePath=wrapper/dists 31 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 32 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'com.android.application' 27 | apply plugin: 'kotlin-android' 28 | apply plugin: 'kotlin-android-extensions' 29 | 30 | android { 31 | compileSdkVersion project.targetSdkVersion.toInteger() 32 | buildToolsVersion project.buildToolsVersion 33 | 34 | defaultConfig { 35 | applicationId "com.massivedisaster.sample" 36 | minSdkVersion project.minSdkVersion.toInteger() 37 | targetSdkVersion project.targetSdkVersion.toInteger() 38 | versionCode libraryVersionCode 39 | versionName libraryVersionName 40 | } 41 | 42 | buildTypes { 43 | release { 44 | minifyEnabled false 45 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 46 | } 47 | } 48 | 49 | sourceSets { 50 | main.java.srcDirs += 'src/main/kotlin' 51 | androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) 52 | } 53 | } 54 | 55 | dependencies { 56 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.kotlinVersion" 57 | implementation "com.android.support:appcompat-v7:$project.supportVersion" 58 | implementation "com.android.support:design:$project.supportVersion" 59 | implementation project(':diagonaldrawable') 60 | } 61 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 28 | 29 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /sample/src/main/java/com/massivedisaster/sample/DialogExample.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.sample 27 | 28 | import android.app.AlertDialog 29 | import android.content.Context 30 | import android.support.v4.content.ContextCompat 31 | import android.view.Window 32 | import com.massivedisaster.drawable.DiagonalDrawable 33 | import kotlinx.android.synthetic.main.dialog_example.* 34 | 35 | class DialogExample(context: Context) : AlertDialog(context) { 36 | 37 | init { 38 | requestWindowFeature(Window.FEATURE_NO_TITLE) 39 | } 40 | 41 | override fun show() { 42 | super.show() 43 | setContentView(R.layout.dialog_example) 44 | 45 | frmRoot.background = DiagonalDrawable(ContextCompat.getColor(context, R.color.left), 46 | ContextCompat.getColor(context, R.color.right), 47 | DiagonalDrawable.Orientation.LEFT_RIGHT) 48 | } 49 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/massivedisaster/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * DiagonalDrawable - A Diagonal Drawable for backgrounds, etc.. 3 | * 4 | * Copyright (c) 2018 DiagonalDrawable 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.sample 27 | 28 | import android.os.Bundle 29 | import android.support.v7.app.AppCompatActivity 30 | import kotlinx.android.synthetic.main.activity_main.* 31 | 32 | class MainActivity : AppCompatActivity() { 33 | 34 | override fun onCreate(savedInstanceState: Bundle?) { 35 | super.onCreate(savedInstanceState) 36 | setContentView(R.layout.activity_main) 37 | 38 | btnOpenDialog.setOnClickListener({ openDialog() }) 39 | } 40 | 41 | private fun openDialog() { 42 | val dialog = DialogExample(this) 43 | dialog.show() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v19/button_transparent.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v19/button_transparent_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 29 | 32 | 33 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v19/button_transparent_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | 37 | 38 | 40 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v21/button_transparent.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 32 | 37 | 38 | 44 | 47 | 50 | 51 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 32 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 190 | 195 | 196 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_whatshot.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 31 | 34 | 35 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 31 | 32 |