Skip to content

Commit

Permalink
Rename attributes in stripecardscan
Browse files Browse the repository at this point in the history
  • Loading branch information
tillh-stripe committed Apr 27, 2023
1 parent 70faa85 commit 289db63
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
10 changes: 5 additions & 5 deletions camera-core/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<declare-styleable name="CameraView" tools:ignore="ResourceName">
<declare-styleable name="StripeCameraView">
<!--defines the shape, aspect ratio of the viewfinder-->
<attr name="viewFinderType" format="enum">
<attr name="stripeViewFinderType" format="enum">
<!--viewFinder fills previewView, no background/hole drawn-->
<enum name="fill" value="0" />
<!--viewFinder has aspect ratio for credit card, a hole is drawn to highlight the viewfinder-->
Expand All @@ -13,11 +13,11 @@
<enum name="passport" value="3" />
</attr>
<!--defines the imageView of the border-->
<attr name="borderDrawable" format="reference" />
<attr name="stripeBorderDrawable" format="reference" />
</declare-styleable>

<declare-styleable name="ViewFinderBackground" tools:ignore="ResourceName">
<attr name="backgroundColor" format="color" />
<declare-styleable name="StripeViewFinderBackground">
<attr name="stripeBackgroundColor" format="color" />
</declare-styleable>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import kotlin.math.roundToInt
* and [ScanFlow].
*
* Has the following styleable parameters to configure in xml
* [R.styleable.CameraView_viewFinderType] - a enum to decide the type of [ViewFinderType], which dictates the aspect ratio of [viewFinderWindowView].
* [R.styleable.CameraView_borderDrawable] - an optional reference for [viewFinderBorderView]'s drawable resource.
* [R.styleable.StripeCameraView_stripeViewFinderType] - a enum to decide the type of [ViewFinderType], which dictates the aspect ratio of [viewFinderWindowView].
* [R.styleable.StripeCameraView_stripeBorderDrawable] - an optional reference for [viewFinderBorderView]'s drawable resource.
*
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
Expand Down Expand Up @@ -123,13 +123,13 @@ class CameraView : ConstraintLayout {
private fun initFromXML(context: Context, attrs: AttributeSet? = null) {
context.withStyledAttributes(
attrs,
R.styleable.CameraView
R.styleable.StripeCameraView
) {
viewFinderType =
ViewFinderType.values()[getInt(R.styleable.CameraView_viewFinderType, 0)]
ViewFinderType.values()[getInt(R.styleable.StripeCameraView_stripeViewFinderType, 0)]
borderDrawable =
getResourceId(
R.styleable.CameraView_borderDrawable,
R.styleable.StripeCameraView_stripeBorderDrawable,
NO_BORDER
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class ViewFinderBackground(

private val theme = context.theme
private val attributes =
theme.obtainStyledAttributes(attrs, R.styleable.ViewFinderBackground, 0, 0)
theme.obtainStyledAttributes(attrs, R.styleable.StripeViewFinderBackground, 0, 0)
private val backgroundColor =
attributes.getColor(
R.styleable.ViewFinderBackground_backgroundColor,
R.styleable.StripeViewFinderBackground_stripeBackgroundColor,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
resources.getColor(R.color.stripeNotFoundBackground, theme)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import java.util.Locale
import kotlin.test.Ignore
import kotlin.test.Test

/**
Expand Down
4 changes: 2 additions & 2 deletions stripecardscan/res/layout/stripe_activity_cardscan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:borderDrawable="@drawable/stripe_card_border_not_found"
app:viewFinderType="creditCard" />
app:stripeBorderDrawable="@drawable/stripe_card_border_not_found"
app:stripeViewFinderType="creditCard" />

<ImageView
android:id="@+id/close_button"
Expand Down
2 changes: 1 addition & 1 deletion stripecardscan/res/layout/stripe_fragment_cardscan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:viewFinderType="creditCard" />
app:stripeViewFinderType="creditCard" />

<ImageView
android:id="@+id/close_button"
Expand Down
4 changes: 2 additions & 2 deletions stripecardscan/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar">
<style name="StripeBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>

<!-- Base application theme. -->
<style name="stripeDefaultTheme" parent="Theme.AppCompat.Light.NoActionBar.FullScreen">
<style name="StripeDefaultTheme" parent="StripeBaseTheme">
<item name="background">@color/stripeNotFoundBackground</item>

<item name="stripeNotFoundBackgroundColor">@color/stripeNotFoundBackground</item>
Expand Down
4 changes: 2 additions & 2 deletions stripecardscan/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<activity
android:name=".cardimageverification.CardImageVerificationActivity"
android:screenOrientation="nosensor"
android:theme="@style/stripeDefaultTheme" />
android:theme="@style/StripeDefaultTheme" />

<activity
android:name=".cardscan.CardScanActivity"
android:screenOrientation="nosensor"
android:theme="@style/stripeDefaultTheme" />
android:theme="@style/StripeDefaultTheme" />
</application>
</manifest>

0 comments on commit 289db63

Please sign in to comment.