diff --git a/gradle.properties b/gradle.properties
index 0c0630e..f15fb4e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# POM
GROUP=com.algolia.instantsearch
-VERSION_NAME=1.1.0
+VERSION_NAME=1.2.0
POM_DESCRIPTION=An overlay that gets your user's voice permission and input as text
POM_URL=https://github.com/algolia/voice-overlay-android
POM_SCM_URL=https://github.com/algolia/voice-overlay-android
diff --git a/voice/build.gradle b/voice/build.gradle
index 7d5e139..7bbb153 100644
--- a/voice/build.gradle
+++ b/voice/build.gradle
@@ -25,6 +25,8 @@ android {
kotlinOptions {
freeCompilerArgs += '-Xexplicit-api=strict'
}
+
+ resourcePrefix = "alg_"
}
dependencies {
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/RippleView.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/AlgRippleView.kt
similarity index 89%
rename from voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/RippleView.kt
rename to voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/AlgRippleView.kt
index e59dc90..f9e5ed6 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/RippleView.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/AlgRippleView.kt
@@ -9,7 +9,7 @@ import android.view.View
import com.algolia.instantsearch.voice.R
/** A View displaying a ripple effect. */
-public class RippleView : View {
+public class AlgRippleView : View {
public enum class State {
None,
@@ -91,12 +91,12 @@ public class RippleView : View {
@SuppressLint("Recycle")
private fun init(attrs: AttributeSet) {
- context.obtainStyledAttributes(attrs, R.styleable.RippleView, 0, 0).also {
- val drawable = it.getDrawable(R.styleable.RippleView_drawable)!!
- delay = it.getInt(R.styleable.RippleView_delay, 500).toLong()
- duration = it.getInt(R.styleable.RippleView_duration, 500).toLong()
- size = it.getDimensionPixelSize(R.styleable.RippleView_size, 0)
- radius = it.getFloat(R.styleable.RippleView_radius_value, 1f)
+ context.obtainStyledAttributes(attrs, R.styleable.AlgRippleView, 0, 0).also {
+ val drawable = it.getDrawable(R.styleable.AlgRippleView_alg_drawable)!!
+ delay = it.getInt(R.styleable.AlgRippleView_alg_delay, 500).toLong()
+ duration = it.getInt(R.styleable.AlgRippleView_alg_duration, 500).toLong()
+ size = it.getDimensionPixelSize(R.styleable.AlgRippleView_alg_size, 0)
+ radius = it.getFloat(R.styleable.AlgRippleView_alg_radius, 1f)
circleCount = duration / delay
circles = (0 until circleCount).map { DrawableSprite(drawable, size, Opacity.p0) }
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/Voice.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/Voice.kt
index f06ccef..dfe0e4d 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/Voice.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/Voice.kt
@@ -77,8 +77,8 @@ public object Voice {
whyAllow: CharSequence? = null,
buttonAllow: CharSequence? = null
) {
- val whyText = whyAllow ?: getString(R.string.permission_rationale)
- val buttonText = (buttonAllow ?: getString(R.string.permission_button_again))
+ val whyText = whyAllow ?: getString(R.string.alg_permission_rationale)
+ val buttonText = (buttonAllow ?: getString(R.string.alg_permission_button_again))
Snackbar.make(anchor, whyText, Snackbar.LENGTH_LONG)
.setAction(buttonText) { requestRecordingPermission() }.show()
}
@@ -98,9 +98,9 @@ public object Voice {
howEnable: CharSequence? = null
) {
val context = anchor.context
- val whyText = (whyEnable ?: context.getText(R.string.permission_enable_rationale))
- val buttonText = (buttonEnable ?: context.getText(R.string.permission_button_enable))
- val howText = (howEnable ?: context.getText(R.string.permission_enable_instructions))
+ val whyText = (whyEnable ?: context.getText(R.string.alg_permission_enable_rationale))
+ val buttonText = (buttonEnable ?: context.getText(R.string.alg_permission_button_enable))
+ val howText = (howEnable ?: context.getText(R.string.alg_permission_enable_instructions))
val snackbar = Snackbar.make(anchor, whyText, Snackbar.LENGTH_LONG).setAction(buttonText) {
Snackbar.make(anchor, howText, Snackbar.LENGTH_SHORT)
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceAndroidView.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceAndroidView.kt
index 2f6eb47..c20741c 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceAndroidView.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceAndroidView.kt
@@ -19,10 +19,10 @@ public class VoiceAndroidView(
private val View.subtitle: TextView get() = findViewById(R.id.subtitle)
private val View.suggestions: TextView? get() = findViewById(R.id.suggestions)
private val View.hint: TextView get() = findViewById(R.id.hint)
- private val View.ripple: RippleView get() = findViewById(R.id.ripple)
+ private val View.ripple: AlgRippleView get() = findViewById(R.id.ripple)
override val formatterSuggestion: (String) -> String = { suggestion: String ->
- context.getString(R.string.format_voice_suggestion_html, suggestion)
+ context.getString(R.string.alg_format_voice_suggestion_html, suggestion)
}
override fun setOnClickListenerClose(onClickListener: View.OnClickListener) {
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceInputDialogFragment.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceInputDialogFragment.kt
index 1946165..2060668 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceInputDialogFragment.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceInputDialogFragment.kt
@@ -51,7 +51,7 @@ public class VoiceInputDialogFragment : DialogFragment() {
// region Lifecycle
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setStyle(STYLE_NORMAL, R.style.VoiceDialogTheme)
+ setStyle(STYLE_NORMAL, R.style.AlgVoiceDialogTheme)
speechRecognizer = VoiceSpeechRecognizer(requireContext())
suggestions = arguments?.getStringArray(Field.Suggestions.name)
}
@@ -61,7 +61,7 @@ public class VoiceInputDialogFragment : DialogFragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View? =
- inflater.inflate(R.layout.voice_input, container, false)
+ inflater.inflate(R.layout.alg_voice_input, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@@ -86,7 +86,7 @@ public class VoiceInputDialogFragment : DialogFragment() {
}
suggestions?.let {
androidView.setSuggestions(it)
- androidView.setSubtitle(resources.getString(R.string.input_subtitle_listening))
+ androidView.setSubtitle(resources.getString(R.string.alg_input_subtitle_listening))
}
speechRecognizer.setRecognitionListener(presenter)
speechRecognizer.stateListener = presenter
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceMicrophone.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceMicrophone.kt
index 357b8c5..3e0091d 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceMicrophone.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceMicrophone.kt
@@ -16,8 +16,8 @@ public class VoiceMicrophone(context: Context, attrs: AttributeSet) : AppCompatI
Deactivated
}
- private val white = ContextCompat.getColor(context, R.color.white)
- private val blue = ContextCompat.getColor(context, R.color.blue_dark)
+ private val white = ContextCompat.getColor(context, R.color.alg_white)
+ private val blue = ContextCompat.getColor(context, R.color.alg_blue_dark)
public var state: State = State.Deactivated
set(value) {
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoicePermissionDialogFragment.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoicePermissionDialogFragment.kt
index 4cb195f..1c2d6c8 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoicePermissionDialogFragment.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoicePermissionDialogFragment.kt
@@ -16,7 +16,7 @@ public class VoicePermissionDialogFragment : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setStyle(STYLE_NORMAL, R.style.VoiceDialogTheme)
+ setStyle(STYLE_NORMAL, R.style.AlgVoiceDialogTheme)
}
override fun onCreateView(
@@ -24,7 +24,7 @@ public class VoicePermissionDialogFragment : DialogFragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- return inflater.inflate(R.layout.voice_permission, container, false)
+ return inflater.inflate(R.layout.alg_voice_permission, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
diff --git a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceUI.kt b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceUI.kt
index e2b433e..ea53b1a 100644
--- a/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceUI.kt
+++ b/voice/src/main/kotlin/com/algolia/instantsearch/voice/ui/VoiceUI.kt
@@ -9,13 +9,13 @@ public interface VoiceUI {
public val formatterSuggestion: (String) -> String
public enum class Title(public val resource: Int) {
- Listen(R.string.input_title_listening),
- Error(R.string.input_title_error)
+ Listen(R.string.alg_input_title_listening),
+ Error(R.string.alg_input_title_error)
}
public enum class Subtitle(public val resource: Int) {
- Error(R.string.input_subtitle_error),
- Listen(R.string.input_subtitle_listening)
+ Error(R.string.alg_input_subtitle_error),
+ Listen(R.string.alg_input_subtitle_listening)
}
public fun setOnClickListenerClose(onClickListener: View.OnClickListener)
diff --git a/voice/src/main/res/drawable-v21/button_negative_background_ripple.xml b/voice/src/main/res/drawable-v21/alg_button_negative_background_ripple.xml
similarity index 70%
rename from voice/src/main/res/drawable-v21/button_negative_background_ripple.xml
rename to voice/src/main/res/drawable-v21/alg_button_negative_background_ripple.xml
index 5f97e4b..9a75c9f 100644
--- a/voice/src/main/res/drawable-v21/button_negative_background_ripple.xml
+++ b/voice/src/main/res/drawable-v21/alg_button_negative_background_ripple.xml
@@ -3,5 +3,5 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable-v21/button_positive_background_ripple.xml b/voice/src/main/res/drawable-v21/alg_button_positive_background_ripple.xml
similarity index 70%
rename from voice/src/main/res/drawable-v21/button_positive_background_ripple.xml
rename to voice/src/main/res/drawable-v21/alg_button_positive_background_ripple.xml
index cd73824..ac9feb4 100644
--- a/voice/src/main/res/drawable-v21/button_positive_background_ripple.xml
+++ b/voice/src/main/res/drawable-v21/alg_button_positive_background_ripple.xml
@@ -3,5 +3,5 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable-v21/microphone_background_ripple.xml b/voice/src/main/res/drawable-v21/alg_microphone_background_ripple.xml
similarity index 71%
rename from voice/src/main/res/drawable-v21/microphone_background_ripple.xml
rename to voice/src/main/res/drawable-v21/alg_microphone_background_ripple.xml
index b110780..3ac7624 100644
--- a/voice/src/main/res/drawable-v21/microphone_background_ripple.xml
+++ b/voice/src/main/res/drawable-v21/alg_microphone_background_ripple.xml
@@ -3,5 +3,5 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/button_negative_background.xml b/voice/src/main/res/drawable/alg_button_negative_background.xml
similarity index 84%
rename from voice/src/main/res/drawable/button_negative_background.xml
rename to voice/src/main/res/drawable/alg_button_negative_background.xml
index c86b55a..dd8e573 100644
--- a/voice/src/main/res/drawable/button_negative_background.xml
+++ b/voice/src/main/res/drawable/alg_button_negative_background.xml
@@ -7,6 +7,6 @@
+ android:color="@color/alg_white"/>
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/button_positive_background_ripple.xml b/voice/src/main/res/drawable/alg_button_negative_background_ripple.xml
similarity index 62%
rename from voice/src/main/res/drawable/button_positive_background_ripple.xml
rename to voice/src/main/res/drawable/alg_button_negative_background_ripple.xml
index fcf7db4..491861e 100644
--- a/voice/src/main/res/drawable/button_positive_background_ripple.xml
+++ b/voice/src/main/res/drawable/alg_button_negative_background_ripple.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/button_positive_background.xml b/voice/src/main/res/drawable/alg_button_positive_background.xml
similarity index 72%
rename from voice/src/main/res/drawable/button_positive_background.xml
rename to voice/src/main/res/drawable/alg_button_positive_background.xml
index 9c1d7cb..4e63ec6 100644
--- a/voice/src/main/res/drawable/button_positive_background.xml
+++ b/voice/src/main/res/drawable/alg_button_positive_background.xml
@@ -5,8 +5,8 @@
diff --git a/voice/src/main/res/drawable/microphone_background_ripple.xml b/voice/src/main/res/drawable/alg_button_positive_background_ripple.xml
similarity index 62%
rename from voice/src/main/res/drawable/microphone_background_ripple.xml
rename to voice/src/main/res/drawable/alg_button_positive_background_ripple.xml
index 2a2bbd8..f2ec505 100644
--- a/voice/src/main/res/drawable/microphone_background_ripple.xml
+++ b/voice/src/main/res/drawable/alg_button_positive_background_ripple.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/ic_close.xml b/voice/src/main/res/drawable/alg_ic_close.xml
similarity index 100%
rename from voice/src/main/res/drawable/ic_close.xml
rename to voice/src/main/res/drawable/alg_ic_close.xml
diff --git a/voice/src/main/res/drawable/ic_microphone.xml b/voice/src/main/res/drawable/alg_ic_microphone.xml
similarity index 100%
rename from voice/src/main/res/drawable/ic_microphone.xml
rename to voice/src/main/res/drawable/alg_ic_microphone.xml
diff --git a/voice/src/main/res/drawable/microphone_background.xml b/voice/src/main/res/drawable/alg_microphone_background.xml
similarity index 68%
rename from voice/src/main/res/drawable/microphone_background.xml
rename to voice/src/main/res/drawable/alg_microphone_background.xml
index b7ed09c..77fbb1b 100644
--- a/voice/src/main/res/drawable/microphone_background.xml
+++ b/voice/src/main/res/drawable/alg_microphone_background.xml
@@ -6,6 +6,6 @@
+ android:startColor="@color/alg_blue_dark"
+ android:endColor="@color/alg_blue_cyan"/>
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/button_negative_background_ripple.xml b/voice/src/main/res/drawable/alg_microphone_background_ripple.xml
similarity index 63%
rename from voice/src/main/res/drawable/button_negative_background_ripple.xml
rename to voice/src/main/res/drawable/alg_microphone_background_ripple.xml
index dd9e620..c9fddef 100644
--- a/voice/src/main/res/drawable/button_negative_background_ripple.xml
+++ b/voice/src/main/res/drawable/alg_microphone_background_ripple.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/voice/src/main/res/drawable/ripple.xml b/voice/src/main/res/drawable/alg_ripple.xml
similarity index 68%
rename from voice/src/main/res/drawable/ripple.xml
rename to voice/src/main/res/drawable/alg_ripple.xml
index 45aaa53..88b6b43 100644
--- a/voice/src/main/res/drawable/ripple.xml
+++ b/voice/src/main/res/drawable/alg_ripple.xml
@@ -4,7 +4,7 @@
android:shape="oval">
\ No newline at end of file
diff --git a/voice/src/main/res/layout/voice_input.xml b/voice/src/main/res/layout/alg_voice_input.xml
similarity index 76%
rename from voice/src/main/res/layout/voice_input.xml
rename to voice/src/main/res/layout/alg_voice_input.xml
index e5e6d1a..91d6c79 100644
--- a/voice/src/main/res/layout/voice_input.xml
+++ b/voice/src/main/res/layout/alg_voice_input.xml
@@ -1,124 +1,123 @@
-
+ android:clipToPadding="false"
+ android:fitsSystemWindows="true">
-
+ app:layout_constraintTop_toTopOf="@+id/microphone" />
+ app:layout_constraintVertical_bias="0.55"
+ app:srcCompat="@drawable/alg_ic_microphone" />
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0"
+ app:srcCompat="@drawable/alg_ic_close" />
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.4"
+ app:layout_constraintVertical_chainStyle="packed" />
+ app:layout_constraintTop_toBottomOf="@+id/title" />
+ tools:text="•\tiPhone Case \n•\tRunning shoes" />
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/microphone"
+ app:layout_constraintVertical_bias="0" />
\ No newline at end of file
diff --git a/voice/src/main/res/layout/voice_permission.xml b/voice/src/main/res/layout/alg_voice_permission.xml
similarity index 89%
rename from voice/src/main/res/layout/voice_permission.xml
rename to voice/src/main/res/layout/alg_voice_permission.xml
index 22ffe57..f1b0906 100644
--- a/voice/src/main/res/layout/voice_permission.xml
+++ b/voice/src/main/res/layout/alg_voice_permission.xml
@@ -22,9 +22,9 @@
android:layout_marginLeft="12dp"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:padding="4dp"
- android:tint="@color/white"
+ android:tint="@color/alg_white"
app:layout_constraintHorizontal_bias="1"
- app:srcCompat="@drawable/ic_close"
+ app:srcCompat="@drawable/alg_ic_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -34,7 +34,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="@tools:sample/lorem/random"
- android:text="@string/permission_title"
+ android:text="@string/alg_permission_title"
android:textAppearance="?attr/textAppearanceHeadline6"
android:maxLines="3"
app:layout_constraintVertical_chainStyle="packed"
@@ -49,7 +49,7 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/voice/src/main/res/values/colors.xml b/voice/src/main/res/values/colors.xml
index 66a3780..756b92b 100644
--- a/voice/src/main/res/values/colors.xml
+++ b/voice/src/main/res/values/colors.xml
@@ -1,9 +1,9 @@
- #01adff
- #3369e6
- #1cc7d0
- #ffffff
- #42ffffff
- #D9000000
+ #01adff
+ #3369e6
+ #1cc7d0
+ #ffffff
+ #42ffffff
+ #D9000000
diff --git a/voice/src/main/res/values/strings.xml b/voice/src/main/res/values/strings.xml
index 7da9b52..5d58a6c 100644
--- a/voice/src/main/res/values/strings.xml
+++ b/voice/src/main/res/values/strings.xml
@@ -1,32 +1,32 @@
- Listening…
- Say something
- Say something like:
- Sorry, we didn\'t quite get that.
- Try repeating your request.
- Try again
+ Listening…
+ Say something
+ Say something like:
+ Sorry, we didn\'t quite get that.
+ Try repeating your request.
+ Try again
- You can use voice search to find products.
- May we access your device’s microphone to enable voice search?
- Allow microphone access
- No
+ You can use voice search to find products.
+ May we access your device’s microphone to enable voice search?
+ Allow microphone access
+ No
- Voice search requires this permission.
- Request again?
+ Voice search requires this permission.
+ Request again?
- Permission denied, allow it to use voice search.
- Allow recording
- On the next screen, tap Permissions then Microphone.
+ Permission denied, allow it to use voice search.
+ Allow recording
+ On the next screen, tap Permissions then Microphone.
- ]]>
+ ]]>
diff --git a/voice/src/main/res/values/styles.xml b/voice/src/main/res/values/styles.xml
index 17322ab..081048f 100644
--- a/voice/src/main/res/values/styles.xml
+++ b/voice/src/main/res/values/styles.xml
@@ -1,11 +1,11 @@
-