Skip to content

Commit

Permalink
feat: split astring implementation into separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
tynn committed Jun 11, 2021
1 parent d2ee97c commit 8ed6c6f
Show file tree
Hide file tree
Showing 25 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions astring/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
10 changes: 10 additions & 0 deletions astring/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'com.android.library'
id 'maven-publish'
}

dependencies {
api 'androidx.fragment:fragment:1.3.4'

testImplementation project(':testing')
}
1 change: 1 addition & 0 deletions astring/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="xyz.tynn.astring" />
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

/**
* A {@link String} abstraction for <i>Android</i>.
*
* <p>
* The purpose of this type is to provide context sensitive strings.
* This could be a plain {@link CharSequence} or a {@link android.text.Spannable},
* a string resource or a formatted quantity string.
*
* <p>
* {@code AString} is almost always used from the main thread,
* therefore all implementations must be non-blocking since
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public CharSequence invoke(@Nullable Context context) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
return o != null && getClass() == o.getClass();
return o instanceof NullValueWrapper;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
}

dependencies {
api project(':astring')
api 'androidx.core:core:1.5.0'
api 'androidx.fragment:fragment:1.3.4'

testImplementation project(':testing')
}
6 changes: 4 additions & 2 deletions core/src/main/kotlin/xyz/tynn/astring/core/AStringView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
package xyz.tynn.astring.core

import android.view.View
import androidx.core.view.ViewCompat.*
import androidx.core.view.ViewCompat.setAccessibilityPaneTitle
import androidx.core.view.ViewCompat.setTooltipText
import xyz.tynn.astring.AString
import androidx.core.view.ViewCompat.setStateDescription as setStateDescriptionCompat

/**
* Sets the accessibility pane title
Expand Down Expand Up @@ -36,7 +38,7 @@ fun View.setContentDescription(
*/
fun View.setStateDescription(
stateDescription: AString,
) = setStateDescription(
) = setStateDescriptionCompat(
this,
stateDescription(context),
)
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pluginManagement {
}

include ':bom'
include ':astring'
include ':testing'

include ':core'
Expand Down

0 comments on commit 8ed6c6f

Please sign in to comment.