├── .editorconfig ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── build.gradle ├── demo-main ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jaredrummler │ │ └── cyanea │ │ └── demo │ │ ├── MainApp.kt │ │ ├── activities │ │ ├── DrawerActivity.kt │ │ ├── MainActivity.kt │ │ └── RecyclerViewActivity.kt │ │ └── fragments │ │ ├── AboutFragment.kt │ │ ├── DialogsFragment.kt │ │ ├── OtherFragment.kt │ │ └── WidgetsFragment.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_apple_24dp.xml │ ├── ic_dialogs_24px.xml │ ├── ic_drawer_menu_24px.xml │ ├── ic_facebook_24dp.xml │ ├── ic_github_white_24dp.xml │ ├── ic_google_24dp.xml │ ├── ic_hamburger_menu_white_24dp.xml │ ├── ic_instagram_24dp.xml │ ├── ic_launcher_background.xml │ ├── ic_settings_white_24dp.xml │ ├── ic_share_white_24dp.xml │ ├── ic_theme_swithcer_24dp.xml │ └── ic_twitter_24dp.xml │ ├── font │ ├── font_raleway.xml │ ├── font_raleway_light.xml │ ├── font_raleway_medium.xml │ ├── font_raleway_semibold.xml │ ├── raleway_bold.ttf │ ├── raleway_light.ttf │ ├── raleway_medium.ttf │ ├── raleway_regular.ttf │ └── raleway_semibold.ttf │ ├── layout │ ├── activity_drawer.xml │ ├── activity_main.xml │ ├── activity_recycler_view.xml │ ├── cat_chip_topic.xml │ ├── drawer_header.xml │ ├── fragment_about.xml │ ├── fragment_dialogs.xml │ ├── fragment_other.xml │ ├── fragment_widgets.xml │ └── item_rv.xml │ ├── menu │ ├── bottom_bar_menu.xml │ ├── bottom_sheet_menu.xml │ ├── drawer_menu.xml │ ├── main_menu.xml │ └── popup_menu.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 ├── demo-simple-java ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── jaredrummler │ │ └── cyanea │ │ └── javademo │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_main.xml │ └── content_main.xml │ ├── menu │ └── menu_main.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 ├── demo.apk ├── gradle.properties ├── gradle ├── gradle-mvn-push.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── themes │ │ │ └── cyanea_themes.json │ ├── java │ │ └── com │ │ │ └── jaredrummler │ │ │ └── cyanea │ │ │ ├── Constants.kt │ │ │ ├── Cyanea.kt │ │ │ ├── CyaneaApp.kt │ │ │ ├── CyaneaResources.kt │ │ │ ├── CyaneaThemes.kt │ │ │ ├── Extensions.kt │ │ │ ├── app │ │ │ ├── BaseCyaneaActivity.kt │ │ │ ├── CyaneaActivity.kt │ │ │ ├── CyaneaAppCompatActivity.kt │ │ │ ├── CyaneaFragment.kt │ │ │ ├── CyaneaFragmentActivity.kt │ │ │ └── CyaneaPreferenceActivity.kt │ │ │ ├── delegate │ │ │ ├── BaseAppCompatDelegate.kt │ │ │ ├── CyaneaDelegate.kt │ │ │ ├── CyaneaDelegateImplBase.kt │ │ │ ├── CyaneaDelegateImplV19.kt │ │ │ ├── CyaneaDelegateImplV21.kt │ │ │ ├── CyaneaDelegateImplV23.kt │ │ │ ├── CyaneaDelegateImplV24.kt │ │ │ ├── CyaneaDelegateImplV26.kt │ │ │ └── CyaneaDelegateImplV29.kt │ │ │ ├── inflator │ │ │ ├── CyaneaContextWrapper.kt │ │ │ ├── CyaneaInflationDelegate.kt │ │ │ ├── CyaneaLayoutInflater.kt │ │ │ ├── CyaneaViewFactory.kt │ │ │ ├── CyaneaViewProcessor.kt │ │ │ └── decor │ │ │ │ ├── AttrsDecorator.kt │ │ │ │ ├── CyaneaDecorator.kt │ │ │ │ └── FontDecorator.kt │ │ │ ├── prefs │ │ │ ├── CyaneaSettingsActivity.kt │ │ │ ├── CyaneaSettingsFragment.kt │ │ │ ├── CyaneaTheme.kt │ │ │ ├── CyaneaThemePickerActivity.kt │ │ │ ├── CyaneaThemePickerAdapter.kt │ │ │ └── CyaneaThemePickerFragment.kt │ │ │ ├── tinting │ │ │ ├── CyaneaTinter.kt │ │ │ ├── EdgeEffectTint.kt │ │ │ ├── MenuTint.kt │ │ │ ├── SystemBarTint.kt │ │ │ └── WidgetTint.kt │ │ │ └── utils │ │ │ ├── ColorFilterCompat.kt │ │ │ ├── ColorUtils.kt │ │ │ └── Reflection.kt │ ├── res-public │ │ └── values │ │ │ └── public.xml │ └── res │ │ ├── color │ │ ├── cyanea_accent.xml │ │ ├── cyanea_accent_dark.xml │ │ ├── cyanea_accent_light.xml │ │ ├── cyanea_bg_dark.xml │ │ ├── cyanea_bg_dark_darker.xml │ │ ├── cyanea_bg_dark_lighter.xml │ │ ├── cyanea_bg_light.xml │ │ ├── cyanea_bg_light_darker.xml │ │ ├── cyanea_bg_light_lighter.xml │ │ ├── cyanea_primary.xml │ │ ├── cyanea_primary_dark.xml │ │ └── cyanea_primary_light.xml │ │ ├── drawable-hdpi │ │ └── cyanea_popup_background.9.png │ │ ├── drawable-mdpi │ │ └── cyanea_popup_background.9.png │ │ ├── drawable-v21 │ │ ├── cyanea_bg_button_accent.xml │ │ └── cyanea_bg_button_primary.xml │ │ ├── drawable-xhdpi │ │ └── cyanea_popup_background.9.png │ │ ├── drawable-xxhdpi │ │ └── cyanea_popup_background.9.png │ │ ├── drawable │ │ ├── cyanea_accent.xml │ │ ├── cyanea_bg_button_accent.xml │ │ ├── cyanea_bg_button_primary.xml │ │ ├── cyanea_bg_dark.xml │ │ ├── cyanea_bg_dark_darker.xml │ │ ├── cyanea_bg_dark_lighter.xml │ │ ├── cyanea_bg_light.xml │ │ ├── cyanea_bg_light_darker.xml │ │ ├── cyanea_bg_light_lighter.xml │ │ ├── cyanea_bg_popup_dark.xml │ │ ├── cyanea_bg_popup_light.xml │ │ ├── cyanea_check.xml │ │ ├── cyanea_fab_add.xml │ │ ├── cyanea_primary.xml │ │ └── cyanea_primary_dark.xml │ │ ├── layout │ │ ├── cyanea_item_theme.xml │ │ └── cyanea_theme_picker.xml │ │ ├── values-land │ │ └── dimens.xml │ │ ├── values-pt │ │ └── strings.xml │ │ ├── values │ │ ├── arrays.xml │ │ ├── attrs.xml │ │ ├── bools.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml │ │ └── xml │ │ └── pref_cyanea.xml │ └── test │ └── java │ └── com │ └── jaredrummler │ └── cyanea │ ├── CyaneaResourcesTest.kt │ ├── CyaneaTest.kt │ └── utils │ └── ReflectionTest.kt └── settings.gradle /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Gradle 2 | .gradle 3 | build 4 | 5 | ### IntelliJ IDEA 6 | .idea 7 | **.iml 8 | 9 | ### Local configuration file (sdk path, etc) 10 | local.properties 11 | 12 | ### Android 13 | *.jks 14 | *.dex 15 | 16 | ### Android Studio 17 | captures/ 18 | 19 | ### Java 20 | *.class 21 | 22 | ### Windows 23 | Desktop.ini 24 | Thumbs.db 25 | ehthumbs.db 26 | 27 | ### OSX 28 | .DS_Store 29 | 30 | ### Linux 31 | *~ 32 | .fuse_hidden* 33 | .directory 34 | .Trash-* -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | jdk: oraclejdk8 4 | 5 | install: 6 | - yes | sdkmanager "tools" &>/dev/null 7 | - yes | sdkmanager "platform-tools" &>/dev/null 8 | - yes | sdkmanager "platforms;android-28" &>/dev/null 9 | - yes | sdkmanager --update &>/dev/null 10 | - yes | sdkmanager --licenses &>/dev/null 11 | 12 | script: ./gradlew clean ktlintCheck assembleDebug testDebug -Pci -s 13 | 14 | branches: 15 | except: 16 | - gh-pages 17 | 18 | sudo: false 19 | 20 | before_cache: 21 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 22 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 23 | 24 | cache: 25 | directories: 26 | - $HOME/.gradle/caches/ 27 | - $HOME/.gradle/wrapper/ 28 | - $HOME/.android/build-cache 29 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | // ---- DEPENDENCIES ---- 3 | // @formatter:off 4 | ext.buildConfig = [ 5 | compileSdk : 29, 6 | targetSdk : 29, 7 | minSdk : 14, 8 | gradlePlugin : '4.0.0' 9 | ] 10 | 11 | ext.versions = [ 12 | kotlin : '1.3.72', 13 | androidx : '1.1.0', 14 | material : '1.1.0', 15 | preference : '1.0.0', 16 | constraintlayout : '1.1.3', 17 | colorpicker : '1.0.5', 18 | junit : '4.12', 19 | mockito_kotlin : '2.0.0', 20 | mockito_core : '2.23.4' 21 | ] 22 | 23 | ext.deps = [ 24 | 'androidx': [ 25 | 'appCompat' : "androidx.appcompat:appcompat:${versions.androidx}", 26 | 'constraintLayout' : "androidx.constraintlayout:constraintlayout:${versions.constraintlayout}", 27 | 'preferences' : "androidx.preference:preference:${versions.preference}" 28 | ], 29 | 'kotlin': [ 30 | 'stdlib': [ 31 | 'jdk' : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" 32 | ] 33 | ], 34 | 'material' : "com.google.android.material:material:${versions.material}", 35 | 'colorpicker' : "com.jaredrummler:colorpicker-compat:${versions.colorpicker}", 36 | 'junit' : "junit:junit:${versions.junit}", 37 | 'mockito': [ 38 | 'core' : "org.mockito:mockito-core:${versions.mockito_core}", 39 | 'kotlin' : "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" 40 | ] 41 | ] 42 | // @formatter:on 43 | 44 | repositories { 45 | google() 46 | gradlePluginPortal() 47 | } 48 | 49 | dependencies { 50 | classpath "com.android.tools.build:gradle:${buildConfig.gradlePlugin}" 51 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" 52 | classpath 'org.jlleitschuh.gradle:ktlint-gradle:8.0.0' 53 | } 54 | } 55 | 56 | allprojects { 57 | repositories { 58 | google() 59 | gradlePluginPortal() 60 | } 61 | 62 | apply plugin: 'org.jlleitschuh.gradle.ktlint' 63 | 64 | configurations.all { 65 | resolutionStrategy { 66 | eachDependency { details -> 67 | if (details.requested.group == 'org.jetbrains.kotlin') { 68 | details.useVersion versions.kotlin 69 | } 70 | } 71 | } 72 | } 73 | 74 | tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { 75 | kotlinOptions { 76 | allWarningsAsErrors = true 77 | } 78 | } 79 | } 80 | 81 | task clean(type: Delete) { 82 | delete rootProject.buildDir 83 | } 84 | -------------------------------------------------------------------------------- /demo-main/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo-main/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'org.jetbrains.kotlin.android' 3 | apply plugin: 'org.jetbrains.kotlin.android.extensions' 4 | 5 | android { 6 | compileSdkVersion buildConfig.compileSdk 7 | 8 | defaultConfig { 9 | applicationId 'com.jaredrummler.cyanea.demo' 10 | minSdkVersion buildConfig.minSdk 11 | targetSdkVersion buildConfig.targetSdk 12 | versionCode 1 13 | versionName '1.0' 14 | vectorDrawables.useSupportLibrary true 15 | } 16 | 17 | compileOptions { 18 | sourceCompatibility JavaVersion.VERSION_1_8 19 | targetCompatibility JavaVersion.VERSION_1_8 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation project(':library') 32 | implementation deps.kotlin.stdlib.jdk 33 | implementation deps.material 34 | implementation deps.androidx.constraintLayout 35 | } 36 | -------------------------------------------------------------------------------- /demo-main/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 | -------------------------------------------------------------------------------- /demo-main/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/MainApp.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo 2 | 3 | import android.app.Application 4 | import android.view.View 5 | import com.jaredrummler.cyanea.Cyanea 6 | import com.jaredrummler.cyanea.inflator.CyaneaViewProcessor 7 | import com.jaredrummler.cyanea.inflator.decor.CyaneaDecorator 8 | import com.jaredrummler.cyanea.inflator.decor.FontDecorator 9 | 10 | class MainApp : Application(), CyaneaDecorator.Provider, CyaneaViewProcessor.Provider { 11 | 12 | override fun onCreate() { 13 | super.onCreate() 14 | Cyanea.init(this, resources) 15 | Cyanea.loggingEnabled = true 16 | } 17 | 18 | override fun getViewProcessors(): Array> = arrayOf( 19 | // Add a view processor to manipulate a view when inflated. 20 | ) 21 | 22 | override fun getDecorators(): Array = arrayOf( 23 | // Add a decorator to apply custom attributes to any view 24 | FontDecorator() 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/activities/DrawerActivity.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo.activities 2 | 3 | import android.content.res.Configuration 4 | import android.os.Bundle 5 | import android.view.MenuItem 6 | import androidx.appcompat.app.ActionBarDrawerToggle 7 | import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity 8 | import com.jaredrummler.cyanea.demo.R 9 | import kotlinx.android.synthetic.main.activity_drawer.drawerLayout 10 | import kotlinx.android.synthetic.main.activity_drawer.navigationView 11 | import kotlinx.android.synthetic.main.activity_drawer.toolbar 12 | 13 | class DrawerActivity : CyaneaAppCompatActivity() { 14 | 15 | private lateinit var drawerToggle: ActionBarDrawerToggle 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContentView(R.layout.activity_drawer) 20 | setSupportActionBar(toolbar) 21 | 22 | supportActionBar?.apply { 23 | setDisplayHomeAsUpEnabled(true) 24 | setHomeButtonEnabled(true) 25 | } 26 | 27 | drawerToggle = ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_drawer, R.string.close_drawer) 28 | drawerLayout.addDrawerListener(drawerToggle) 29 | 30 | navigationView.post { navigationView.setCheckedItem(R.id.item_twitter) } 31 | 32 | navigationView.setNavigationItemSelectedListener { 33 | navigationView.setCheckedItem(it.itemId) 34 | false 35 | } 36 | } 37 | 38 | override fun onPostCreate(savedInstanceState: Bundle?) { 39 | super.onPostCreate(savedInstanceState) 40 | drawerToggle.syncState() 41 | } 42 | 43 | override fun onConfigurationChanged(newConfig: Configuration) { 44 | super.onConfigurationChanged(newConfig) 45 | drawerToggle.onConfigurationChanged(newConfig) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 49 | return drawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/activities/RecyclerViewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo.activities 2 | 3 | import android.annotation.SuppressLint 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.Toast 9 | import androidx.recyclerview.widget.DividerItemDecoration 10 | import androidx.recyclerview.widget.LinearLayoutManager 11 | import androidx.recyclerview.widget.RecyclerView 12 | import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity 13 | import com.jaredrummler.cyanea.demo.R.layout 14 | import kotlinx.android.synthetic.main.activity_recycler_view.recyclerView 15 | import kotlinx.android.synthetic.main.item_rv.view.subtitleText 16 | import kotlinx.android.synthetic.main.item_rv.view.titleText 17 | 18 | class RecyclerViewActivity : CyaneaAppCompatActivity() { 19 | 20 | override fun onCreate(savedInstanceState: Bundle?) { 21 | super.onCreate(savedInstanceState) 22 | setContentView(layout.activity_recycler_view) 23 | recyclerView.layoutManager = LinearLayoutManager(this) 24 | recyclerView.adapter = DemoAdapter() 25 | recyclerView.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL)) 26 | } 27 | 28 | class DemoAdapter : RecyclerView.Adapter() { 29 | 30 | override fun getItemCount(): Int = 100 31 | 32 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DemoViewHolder { 33 | LayoutInflater.from(parent.context).run { 34 | return DemoViewHolder(inflate(layout.item_rv, parent, false)) 35 | } 36 | } 37 | 38 | @SuppressLint("SetTextI18n") 39 | override fun onBindViewHolder(holder: DemoViewHolder, position: Int) { 40 | val number = position + 1 41 | holder.itemView.titleText.text = "Item #$number" 42 | holder.itemView.subtitleText.text = (when { 43 | number % 15 == 0 -> "FizzBuzz" 44 | number % 3 == 0 -> "Fizz" 45 | number % 5 == 0 -> "Buzz" 46 | else -> number.toString() 47 | }) 48 | } 49 | } 50 | 51 | class DemoViewHolder(view: View) : RecyclerView.ViewHolder(view) { 52 | init { 53 | itemView.setOnClickListener { 54 | Toast.makeText(it.context, "Clicked item #${adapterPosition + 1}", Toast.LENGTH_SHORT).show() 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/fragments/AboutFragment.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo.fragments 2 | 3 | import android.content.res.ColorStateList 4 | import android.graphics.Color 5 | import android.os.Bundle 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import com.google.android.material.chip.Chip 10 | import com.jaredrummler.cyanea.app.CyaneaFragment 11 | import com.jaredrummler.cyanea.demo.R 12 | import kotlinx.android.synthetic.main.fragment_about.cyaneaTopics 13 | 14 | class AboutFragment : CyaneaFragment() { 15 | 16 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { 17 | return inflater.inflate(R.layout.fragment_about, container, false) 18 | } 19 | 20 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 21 | loadTopics() 22 | } 23 | 24 | private fun loadTopics() { 25 | cyaneaTopics.removeAllViews() 26 | resources.getStringArray(R.array.cyanea_topics).forEach { text -> 27 | val chip = layoutInflater.inflate(R.layout.cat_chip_topic, cyaneaTopics, false) as Chip 28 | chip.chipBackgroundColor = ColorStateList.valueOf( 29 | if (cyanea.isDark) cyanea.backgroundColorLight else cyanea.backgroundColorDark 30 | ) 31 | chip.setTextColor(if (cyanea.isDark) Color.WHITE else Color.BLACK) 32 | chip.text = text 33 | cyaneaTopics.addView(chip) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/fragments/OtherFragment.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo.fragments 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.LinearLayout 9 | import androidx.annotation.StringRes 10 | import androidx.fragment.app.Fragment 11 | import com.google.android.material.button.MaterialButton 12 | import com.jaredrummler.cyanea.demo.activities.DrawerActivity 13 | import com.jaredrummler.cyanea.demo.R 14 | import com.jaredrummler.cyanea.demo.activities.RecyclerViewActivity 15 | 16 | class OtherFragment : Fragment() { 17 | 18 | private lateinit var container: ViewGroup 19 | 20 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { 21 | return inflater.inflate(R.layout.fragment_other, container, false) 22 | } 23 | 24 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 25 | container = view.findViewById(R.id.container) 26 | addButton(R.string.drawer_layout, { 27 | startActivity(Intent(requireActivity(), DrawerActivity::class.java)) 28 | }) 29 | addButton(R.string.recycler_view, { 30 | startActivity(Intent(requireActivity(), RecyclerViewActivity::class.java)) 31 | }) 32 | } 33 | 34 | private fun addButton( 35 | @StringRes stringResId: Int, 36 | action: () -> Unit, 37 | marginTop: Float = 8f, 38 | marginBottom: Float = 0f 39 | ) { 40 | val dialogLauncherButton = MaterialButton(requireActivity()) 41 | dialogLauncherButton.setOnClickListener { action() } 42 | dialogLauncherButton.setText(stringResId) 43 | val params = LinearLayout.LayoutParams( 44 | LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) 45 | params.topMargin = Math.round(marginTop * resources.displayMetrics.density) 46 | params.bottomMargin = Math.round(marginBottom * resources.displayMetrics.density) 47 | container.addView(dialogLauncherButton, params) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /demo-main/src/main/java/com/jaredrummler/cyanea/demo/fragments/WidgetsFragment.kt: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.demo.fragments 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.jaredrummler.cyanea.demo.R 9 | 10 | class WidgetsFragment : Fragment() { 11 | 12 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { 13 | return inflater.inflate(R.layout.fragment_widgets, container, false) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_apple_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_dialogs_24px.xml: -------------------------------------------------------------------------------- 1 | 16 | 22 | 25 | 28 | 31 | 32 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_drawer_menu_24px.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_facebook_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_github_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_google_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_hamburger_menu_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_instagram_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_settings_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 11 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_share_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_theme_swithcer_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/drawable/ic_twitter_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/font/font_raleway.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 17 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /demo-main/src/main/res/font/font_raleway_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 25 | 26 | -------------------------------------------------------------------------------- /demo-main/src/main/res/font/font_raleway_medium.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 17 | 18 | 26 | 27 | -------------------------------------------------------------------------------- /demo-main/src/main/res/font/font_raleway_semibold.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 17 | 18 | 26 | 27 | -------------------------------------------------------------------------------- /demo-main/src/main/res/font/raleway_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/font/raleway_bold.ttf -------------------------------------------------------------------------------- /demo-main/src/main/res/font/raleway_light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/font/raleway_light.ttf -------------------------------------------------------------------------------- /demo-main/src/main/res/font/raleway_medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/font/raleway_medium.ttf -------------------------------------------------------------------------------- /demo-main/src/main/res/font/raleway_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/font/raleway_regular.ttf -------------------------------------------------------------------------------- /demo-main/src/main/res/font/raleway_semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/font/raleway_semibold.ttf -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/activity_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 31 | 32 | 41 | 42 | 43 | 44 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 23 | 24 | 34 | 35 | 36 | 37 | 44 | 45 | 54 | 55 | 62 | 63 | 73 | 74 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/activity_recycler_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/cat_chip_topic.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/fragment_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 24 | 25 | 43 | 44 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/fragment_dialogs.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/fragment_other.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo-main/src/main/res/layout/item_rv.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 22 | 23 | 31 | 32 | -------------------------------------------------------------------------------- /demo-main/src/main/res/menu/bottom_bar_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /demo-main/src/main/res/menu/bottom_sheet_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /demo-main/src/main/res/menu/drawer_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo-main/src/main/res/menu/main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /demo-main/src/main/res/menu/popup_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | 28 | 33 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-main/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-main/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-main/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #14B09B 5 | 6 | #0359AE 7 | 8 | #EBE5D9 9 | #D4D4D4 10 | #EEE8DE 11 | 12 | -------------------------------------------------------------------------------- /demo-main/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 8dp 5 | 4dp 6 | 6dp 7 | 36sp 8 | 196dp 9 | 8dp 10 | 8dp 11 | 2dp 12 | 32dp 13 | 24dp 14 | 12dp 15 | -------------------------------------------------------------------------------- /demo-main/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demo-simple-java/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo-simple-java/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | applicationId 'com.jaredrummler.cyanea.javademo' 8 | minSdkVersion 22 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName '1.0' 12 | } 13 | compileOptions { 14 | sourceCompatibility JavaVersion.VERSION_1_8 15 | targetCompatibility JavaVersion.VERSION_1_8 16 | } 17 | } 18 | 19 | dependencies { 20 | implementation project(':library') 21 | implementation deps.material 22 | implementation deps.androidx.constraintLayout 23 | } 24 | -------------------------------------------------------------------------------- /demo-simple-java/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 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/java/com/jaredrummler/cyanea/javademo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.cyanea.javademo; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | import androidx.annotation.Nullable; 8 | import androidx.appcompat.widget.Toolbar; 9 | import com.google.android.material.floatingactionbutton.FloatingActionButton; 10 | import com.google.android.material.snackbar.Snackbar; 11 | import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity; 12 | import com.jaredrummler.cyanea.prefs.CyaneaSettingsActivity; 13 | 14 | public class MainActivity extends CyaneaAppCompatActivity { 15 | 16 | @Override protected void onCreate(@Nullable Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | Toolbar toolbar = findViewById(R.id.toolbar); 20 | FloatingActionButton fab = findViewById(R.id.fab); 21 | setSupportActionBar(toolbar); 22 | fab.setOnClickListener((v) -> 23 | Snackbar.make(v, "Replace with your own action", Snackbar.LENGTH_LONG) 24 | .setAction("Action", null).show() 25 | ); 26 | } 27 | 28 | @Override public boolean onCreateOptionsMenu(Menu menu) { 29 | getMenuInflater().inflate(R.menu.menu_main, menu); 30 | return super.onCreateOptionsMenu(menu); 31 | } 32 | 33 | @Override public boolean onOptionsItemSelected(MenuItem item) { 34 | switch (item.getItemId()) { 35 | case R.id.action_settings: 36 | startActivity(new Intent(this, CyaneaSettingsActivity.class)); 37 | return true; 38 | default: 39 | return super.onOptionsItemSelected(item); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 24 | 25 | 26 | 27 | 28 | 29 | 37 | 38 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 22 | 23 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/Cyanea/2a7dc7b915cd987893b103b9bfad6c23d223681e/demo-simple-java/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #0288D1 4 | #FFA000 5 | 6 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Java Demo 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /demo-simple-java/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 61 | 62 | 63 | 64 | 67 | 68 | -------------------------------------------------------------------------------- /library/src/main/res/xml/pref_cyanea.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 14 | 15 | 22 | 23 | 30 | 31 | 40 | 41 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /library/src/test/java/com/jaredrummler/cyanea/CyaneaResourcesTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jared Rummler 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 com.jaredrummler.cyanea 18 | 19 | import android.app.Application 20 | import android.content.res.Resources 21 | import android.graphics.drawable.ColorDrawable 22 | import androidx.annotation.ColorInt 23 | import com.jaredrummler.cyanea.utils.Reflection 24 | import com.nhaarman.mockitokotlin2.mock 25 | import com.nhaarman.mockitokotlin2.whenever 26 | import org.hamcrest.CoreMatchers.instanceOf 27 | import org.junit.Assert.assertEquals 28 | import org.junit.Assert.assertThat 29 | import org.junit.Before 30 | import org.junit.Test 31 | import org.junit.runner.RunWith 32 | import org.mockito.ArgumentMatchers.anyInt 33 | import org.mockito.ArgumentMatchers.anyString 34 | import org.mockito.Mock 35 | import org.mockito.junit.MockitoJUnitRunner 36 | 37 | @RunWith(MockitoJUnitRunner.Silent::class) 38 | class CyaneaResourcesTest { 39 | 40 | @Mock private lateinit var app: Application 41 | @Mock private lateinit var res: Resources 42 | private lateinit var cyanea: Cyanea 43 | 44 | @Before fun setUp() { 45 | whenever(app.getSharedPreferences(anyString(), anyInt())) 46 | .thenReturn(mock()) 47 | Cyanea.init(app, res) 48 | cyanea = Cyanea.instance 49 | } 50 | 51 | @Test fun `should return color drawables for background colors`() { 52 | val resources = CyaneaResources(res) 53 | 54 | val drawableIds = arrayOf( 55 | R.drawable.cyanea_bg_dark, 56 | R.drawable.cyanea_bg_dark_lighter, 57 | R.drawable.cyanea_bg_dark_darker, 58 | R.drawable.cyanea_bg_light, 59 | R.drawable.cyanea_bg_light_lighter, 60 | R.drawable.cyanea_bg_light_darker 61 | ) 62 | 63 | drawableIds.forEach { resid -> 64 | @Suppress("DEPRECATION") 65 | val drawable = resources.getDrawable(resid) 66 | assertThat(drawable, instanceOf(ColorDrawable::class.java)) 67 | } 68 | } 69 | 70 | @Test fun `cyanea resources should return cyanea primary color`() { 71 | val resources = CyaneaResources(res) 72 | 73 | setCyaneaColor(0xFF0099CC.toInt(), "primary") 74 | @Suppress("DEPRECATION") 75 | val color = resources.getColor(R.color.cyanea_primary) 76 | 77 | assertEquals(cyanea.primary, color) 78 | } 79 | 80 | @Test fun `cyanea resources should return cyanea accent color`() { 81 | val resources = CyaneaResources(res) 82 | 83 | setCyaneaColor(0xFF0099CC.toInt(), "accent") 84 | @Suppress("DEPRECATION") 85 | val color = resources.getColor(R.color.cyanea_accent) 86 | 87 | assertEquals(cyanea.accent, color) 88 | } 89 | 90 | private fun setCyaneaColor(@ColorInt color: Int, name: String) { 91 | Reflection.getField(cyanea, name)?.let { field -> 92 | Reflection.setFieldValue(field, cyanea, color) 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /library/src/test/java/com/jaredrummler/cyanea/CyaneaTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jared Rummler 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 com.jaredrummler.cyanea 18 | 19 | import android.app.Application 20 | import android.content.res.Resources 21 | import com.jaredrummler.cyanea.Cyanea.BaseTheme 22 | import com.nhaarman.mockitokotlin2.mock 23 | import com.nhaarman.mockitokotlin2.whenever 24 | import org.junit.Assert.assertEquals 25 | import org.junit.Assert.assertNotNull 26 | import org.junit.Before 27 | import org.junit.Test 28 | import org.junit.runner.RunWith 29 | import org.mockito.ArgumentMatchers.anyInt 30 | import org.mockito.ArgumentMatchers.anyString 31 | import org.mockito.Mock 32 | import org.mockito.junit.MockitoJUnitRunner 33 | 34 | @RunWith(MockitoJUnitRunner.Silent::class) 35 | class CyaneaTest { 36 | 37 | @Mock private lateinit var application: Application 38 | @Mock private lateinit var resources: Resources 39 | 40 | @Before fun setUp() { 41 | whenever(application.getSharedPreferences(anyString(), anyInt())) 42 | .thenReturn(mock()) 43 | 44 | Cyanea.init(application, resources) 45 | } 46 | 47 | @Test fun `should return singleton instance`() { 48 | assertNotNull(Cyanea.instance) 49 | } 50 | 51 | @Test fun `should return dark background when base theme is dark`() { 52 | val cyanea = Cyanea.instance 53 | val expectedColor = 0xFF000000.toInt() 54 | 55 | cyanea.apply { 56 | baseTheme = BaseTheme.DARK 57 | backgroundDark = 0xFF000000.toInt() 58 | } 59 | 60 | assertEquals(expectedColor, cyanea.backgroundColor) 61 | } 62 | 63 | @Test fun `should return light background when base theme is light`() { 64 | val cyanea = Cyanea.instance 65 | val expectedColor = 0xFFFFFFFF.toInt() 66 | 67 | cyanea.apply { 68 | baseTheme = BaseTheme.LIGHT 69 | backgroundLight = 0xFFFFFFFF.toInt() 70 | } 71 | 72 | assertEquals(expectedColor, cyanea.backgroundColor) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /library/src/test/java/com/jaredrummler/cyanea/utils/ReflectionTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jared Rummler 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 com.jaredrummler.cyanea.utils 18 | 19 | import com.jaredrummler.cyanea.utils.Reflection.Companion.getMethod 20 | import org.junit.Assert.assertEquals 21 | import org.junit.Assert.assertNotNull 22 | import org.junit.Test 23 | import kotlin.Int 24 | import kotlin.NullPointerException 25 | import kotlin.String 26 | import kotlin.arrayOf 27 | 28 | class ReflectionTest { 29 | 30 | @Test fun `should get method via reflection`() { 31 | val method = getMethod(StringBuilder(), "append", Int::class.java) 32 | 33 | val expectedName = "append" 34 | val expectedReturnType = StringBuilder::class.java 35 | 36 | assertEquals(expectedName, method?.name) 37 | assertEquals(expectedReturnType, method?.returnType) 38 | } 39 | 40 | @Test fun `should get field via reflection`() { 41 | val field = Reflection.getField(Class.forName("java.lang.Boolean"), "TRUE") 42 | 43 | val expectedType = "java.lang.Boolean" 44 | val expectedName = "TRUE" 45 | 46 | assertNotNull(field) 47 | assertEquals(expectedName, field?.name) 48 | assertEquals(expectedType, field?.type?.name) 49 | } 50 | 51 | @Test fun `should set field via reflection`() { 52 | val field = Reflection.getField(Class.forName("java.lang.Boolean"), "TRUE") ?: throw NullPointerException() 53 | Reflection.setFieldValue(field, null, java.lang.Boolean.FALSE) 54 | assertEquals(java.lang.Boolean.FALSE, java.lang.Boolean.TRUE) 55 | } 56 | 57 | @Test fun `should invoke method via reflection`() { 58 | val obj = "foo" 59 | val types = arrayOf>(CharSequence::class.java, CharSequence::class.java) 60 | val result = Reflection.invoke(obj, "replace", types, "foo", "bar") 61 | assertEquals("bar", result) 62 | 63 | val string = "baz" 64 | val length = Reflection.invoke(string, "length") 65 | assertEquals(string.length, length) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Cyanea' 2 | 3 | include ':demo-main' 4 | include ':demo-simple-java' 5 | include ':library' 6 | --------------------------------------------------------------------------------