Skip to content

Commit dde94af

Browse files
committed
add example module and update documentation
1 parent 93e1884 commit dde94af

File tree

25 files changed

+838
-438
lines changed

25 files changed

+838
-438
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributing to Madifiers
2+
Madifiers is an open source project for the community. We invite your participation through issues, and pull requests!
3+
4+
# Ways to Contribute
5+
You can contribute by optimizing existing code or adding more libraries can checkout a sample module
6+
[here](/madifiers-example) or opening issues.
7+
8+
# Preparing a pull request for review
9+
Ensure to maintain the project structure:
10+
11+
if adding more features to new category
12+
```
13+
├── madifiers-<category>
14+
│ ├── module name
15+
```
16+
and for existing categories add modules to the respective category
17+
and ensure your code is properly formatted by running:
18+
```bash
19+
./gradlew spotlessApply
20+
```
21+
---
22+
And Thank you for considering contributing to madifiers 💚

README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
11
![banner art](/art/banner%20art%20-%20madifiers.png)
22

33
# What is *Madifiers*?
4-
54
Madifiers is bunch of pre-made composable, modifiers, extension functions etc...
65
Basically Anything and everything to make jetpack compose development easy and straight forward
76

8-
# Features
9-
- [Bionic Text](/text/bionicText)
10-
- [Animate TextUnit](/text/animateTextUnitAsState)
11-
- [Window Info](/window/windowUtils)
7+
# Libraries
8+
## [Bionic Text](/madifiers-text/bionicText) - ![Maven Central](https://img.shields.io/maven-central/v/pro.jayeshseth.madifiers/windowUtils?style=flat-square)
9+
applies bionic reading affect on text
10+
11+
## [AnimateTextUnitAsState](/madifiers-text/animateTextUnitAsState) - ![Maven Central](https://img.shields.io/maven-central/v/pro.jayeshseth.madifiers/animateTextUnitAsState?style=flat-square)
12+
animates text units like `sp` and `em` to the provided target value
13+
14+
## [Window Util](/madifiers-window/windowUtils) - ![Maven Central](https://img.shields.io/maven-central/v/pro.jayeshseth.madifiers/windowUtils?style=flat-square)
15+
window utils to get usable screen height, width and more in `dp` and `px`
1216

1317
# Project Structure
14-
```kotlin
15-
TODO()
18+
```
19+
Madifiers # Root Project
20+
├── app # Sample App showcasing library usage
21+
├── art # contains screenshots and videos of the library usage
22+
├── build-logic # contains conventional plugins to mitigate code duplication
23+
├── buildSrc # used to manage versioning of modules
24+
├── scripts # contains scripts to publish modules to maven central
25+
26+
├── madifiers-example # an example module for developers to help contribute new modules
27+
├── madifiers-text # directory for all text or string related modules
28+
│ ├── animateTextUnitAsState # animates text units like sp and em to the provided target value
29+
│ ├── bionicText # applies bionic reading affect on text
30+
│ ├── extensions # TODO
31+
32+
├── madifiers-window # directory for window related modules
33+
│ ├── windowUtils # window utils to get usable screen height, width and more in dp and px
1634
```
1735

36+
# Blog
37+
You can check out how madifiers came to life and make your own single or multi module library
38+
for android and publish it to maven central here(coming soon)
39+
1840
# How & Why "Madifiers"?
19-
When i first tried and learned jetpack compose and on **June 5th, 2021** and was learning about "modifiers",
20-
my brain went "more like madifiers" so since then i wanted to build a library for compose and name it
21-
"Madifiers" and when i saw [Super Extension](https://github.com/AbhishekDoshi26/super_extensions) for flutter
22-
by Abhishek Doshi and [VelocityX](https://velocityx.dev/) by pawan kumar. So, I got an idea of why
23-
not make a library with bunch of modifier, extensions, and composables for jetpack compose.
24-
And that's how **Madifiers** came into into life.
25-
26-
# Contribute
27-
```kotlin
28-
TODO()
29-
```
41+
On **June 5th, 2021** while learning about "modifiers" in jetpack compose, I had a thought that the
42+
term "modifiers" could be playfully referred to as **"madifiers"**. This sparked an idea to create a
43+
library for jetpack compose, which i would name **"Madifiers"**. After discovering libraries like
44+
[Super Extension](https://github.com/AbhishekDoshi26/super_extensions) by Abhishek Doshi and
45+
[VelocityX](https://velocityx.dev/) by pawan kumar, I was inspired to create a library that would include
46+
a collection of modifiers, extensions and composables which makes jetpack compose development easy and
47+
straight forward. Thus, Madifiers was born.
48+
49+
# Contribution
50+
Learn about contribution [here](/CONTRIBUTING.md).
3051

3152
# License
3253
```
Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
/*
2+
* Copyright 2023 Jayesh Seth
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+
*/
116
package pro.jayeshseth.madifiers
217

3-
import androidx.test.platform.app.InstrumentationRegistry
418
import androidx.test.ext.junit.runners.AndroidJUnit4
19+
import androidx.test.platform.app.InstrumentationRegistry
20+
import org.junit.Assert.assertEquals
521
import org.junit.Test
622
import org.junit.runner.RunWith
7-
import org.junit.Assert.*
823

924
/**
1025
* Instrumented test, which will execute on an Android device.
@@ -13,10 +28,10 @@ import org.junit.Assert.*
1328
*/
1429
@RunWith(AndroidJUnit4::class)
1530
class ExampleInstrumentedTest {
16-
@Test
17-
fun useAppContext() {
18-
// Context of the app under test.
19-
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
20-
assertEquals("in.realogs.madifiers", appContext.packageName)
21-
}
22-
}
31+
@Test
32+
fun useAppContext() {
33+
// Context of the app under test.
34+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
35+
assertEquals("in.realogs.madifiers", appContext.packageName)
36+
}
37+
}
Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2023 Jayesh Seth
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+
*/
116
package pro.jayeshseth.madifiers
217

318
import android.os.Bundle
@@ -13,27 +28,27 @@ import pro.jayeshseth.bionicText.BionicText
1328
import pro.jayeshseth.madifiers.ui.theme.MadifiersTheme
1429

1530
class MainActivity : ComponentActivity() {
16-
override fun onCreate(savedInstanceState: Bundle?) {
17-
super.onCreate(savedInstanceState)
18-
setContent {
19-
MadifiersTheme {
20-
// A surface container using the 'background' color from the theme
21-
Surface(
22-
modifier = Modifier.fillMaxSize(),
23-
color = MaterialTheme.colorScheme.background
24-
) {
25-
Greeting("Android")
26-
}
27-
}
31+
override fun onCreate(savedInstanceState: Bundle?) {
32+
super.onCreate(savedInstanceState)
33+
setContent {
34+
MadifiersTheme {
35+
// A surface container using the 'background' color from the theme
36+
Surface(
37+
modifier = Modifier.fillMaxSize(),
38+
color = MaterialTheme.colorScheme.background,
39+
) {
40+
Greeting("Android")
2841
}
42+
}
2943
}
44+
}
3045
}
3146

3247
@Composable
3348
fun Greeting(name: String, modifier: Modifier = Modifier) {
34-
BionicText(text = "hi there")
35-
Text(
36-
text = "Hello $name!",
37-
modifier = modifier
38-
)
49+
BionicText(text = "hi there")
50+
Text(
51+
text = "Hello $name!",
52+
modifier = modifier,
53+
)
3954
}
Lines changed: 67 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2023 Jayesh Seth
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+
*/
116
package pro.jayeshseth.madifiers.ui.screens
217

318
import androidx.compose.animation.core.LinearEasing
@@ -27,74 +42,74 @@ import pro.jayeshseth.madifiers.ui.theme.MadifiersTheme
2742

2843
@Composable
2944
fun AnimateTextUnitScreen() {
30-
var animateTween by remember { mutableStateOf(true) }
31-
var animateSpring by remember { mutableStateOf(true) }
45+
var animateTween by remember { mutableStateOf(true) }
46+
var animateSpring by remember { mutableStateOf(true) }
3247

33-
val textSizeTween by animateTextUnitAsState(
34-
targetValue = if (animateTween) 30.sp else 16.sp,
35-
animationSpec = tween(
36-
durationMillis = 1000,
37-
easing = LinearEasing
38-
)
48+
val textSizeTween by animateTextUnitAsState(
49+
targetValue = if (animateTween) 30.sp else 16.sp,
50+
animationSpec = tween(
51+
durationMillis = 1000,
52+
easing = LinearEasing,
53+
),
54+
)
55+
val textSizeSpring by animateTextUnitAsState(
56+
targetValue = if (animateSpring) 30.sp else 16.sp,
57+
animationSpec = spring(
58+
dampingRatio = Spring.DampingRatioHighBouncy,
59+
stiffness = Spring.StiffnessLow,
60+
),
61+
)
62+
63+
Column {
64+
TextCard(
65+
text = "Animate Text - tween",
66+
onClick = { animateTween = !animateTween },
67+
fontSize = textSizeTween,
3968
)
40-
val textSizeSpring by animateTextUnitAsState(
41-
targetValue = if (animateSpring) 30.sp else 16.sp,
42-
animationSpec = spring(
43-
dampingRatio = Spring.DampingRatioHighBouncy,
44-
stiffness = Spring.StiffnessLow
45-
)
69+
TextCard(
70+
text = "Animate Text - spring",
71+
onClick = { animateSpring = !animateSpring },
72+
fontSize = textSizeSpring,
4673
)
47-
48-
Column {
49-
TextCard(
50-
text = "Animate Text - tween",
51-
onClick = { animateTween = !animateTween },
52-
fontSize = textSizeTween
53-
)
54-
TextCard(
55-
text = "Animate Text - spring",
56-
onClick = { animateSpring = !animateSpring },
57-
fontSize = textSizeSpring
58-
)
59-
}
74+
}
6075
}
6176

6277
@Composable
6378
fun TextCard(
64-
text: String,
65-
fontSize: TextUnit = 16.sp,
66-
onClick: () -> Unit
79+
text: String,
80+
fontSize: TextUnit = 16.sp,
81+
onClick: () -> Unit,
6782
) {
68-
Card(modifier = Modifier.padding(8.dp)) {
69-
Column(
70-
Modifier
71-
.fillMaxWidth()
72-
.padding(8.dp),
73-
horizontalAlignment = Alignment.CenterHorizontally
74-
) {
75-
Text(
76-
text = text,
77-
fontSize = fontSize,
78-
style = MaterialTheme.typography.titleLarge,
79-
modifier = Modifier.padding(20.dp)
80-
)
81-
Button(onClick = onClick, modifier = Modifier.fillMaxWidth()) {
82-
Text(text = "Change Size")
83-
}
84-
}
83+
Card(modifier = Modifier.padding(8.dp)) {
84+
Column(
85+
Modifier
86+
.fillMaxWidth()
87+
.padding(8.dp),
88+
horizontalAlignment = Alignment.CenterHorizontally,
89+
) {
90+
Text(
91+
text = text,
92+
fontSize = fontSize,
93+
style = MaterialTheme.typography.titleLarge,
94+
modifier = Modifier.padding(20.dp),
95+
)
96+
Button(onClick = onClick, modifier = Modifier.fillMaxWidth()) {
97+
Text(text = "Change Size")
98+
}
8599
}
100+
}
86101
}
87102

88103
@Preview(showBackground = true)
89104
@Composable
90105
fun PreviewTextCard() {
91-
TextCard(text = "Text Size", onClick = {})
106+
TextCard(text = "Text Size", onClick = {})
92107
}
93108

94109
@Preview
95110
@Composable
96111
fun PreviewAnimateTextUnitScreen() {
97-
MadifiersTheme {
98-
AnimateTextUnitScreen()
99-
}
100-
}
112+
MadifiersTheme {
113+
AnimateTextUnitScreen()
114+
}
115+
}

0 commit comments

Comments
 (0)