Code Monkey home page Code Monkey logo

jetpack_compose_country_code_picker_emoji's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jetpack_compose_country_code_picker_emoji's Issues

Picker is focused by default

Is your feature request related to a problem? Please describe.
Maybe I am doing something wrong but the picker is always focused as soon as the composable is called. Hence also the keyboard is opened by default.

Describe the solution you'd like
Could this be fixed with an "isFocused" parameter, maybe? So that the keyboard does not open until you tap on the picker?

Describe alternatives you've considered

Additional context

Change the border colour of the container

I have tried looking through the information available on this GitHub repo but can't seem to find this, if it already exists please point me in the right direction.

Put simply I need to change the colour of the container in the unused, error and being used state, let me know if this is a possibility or where I could look into it myself

More publicly available features through library

When using the library only TogiCountryCodePicker is available to use which is an integrated component with country indicator, text field and dialog.

It would be more versatile and universal if you can make seperate components public. Like the TogiCodeDialog can be made available for someone who wants to implement the text field separately. Also the country data can be made public so that more customised stuff can be made and also future updates to the country list can be more easily updated to any project.

i have tried to use the CCP module directly in my projects and did my customisations there.

Support for Android TV

java.lang.AbstractMethodError: abstract method "void androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider.Item(int, java.lang.Object, androidx.compose.runtime.Composer, int)"

Add possibility to pass a text into composable

You lost one of the main features of this library, we are not able to pass the phone number for the textfield.
This may be useful for screens like "edit profile" where people can change their existing phone to another one, for now this is not possible

@Preview support requires mocking telephonyManager?

I want to be able to Preview TogiCountryCodePicker in my project so I can make quick edits to the UI. When I try, I get the same bug that shows up on TogiCountryCodePickerPreview in this file.

ccp/src/main/java/com/togitech/ccp/component/TogiCountryCodePicker.kt

java.lang.AssertionError: Unsupported Service: phone   at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:719)
com.togitech.ccp.data.utils.CountryCodeUtilsKt.getTelephonyManager(CountryCodeUtils.kt:41)
com.togitech.ccp.data.utils.CountryCodeUtilsKt.getUserIsoCode(CountryCodeUtils.kt:26)
com.togitech.ccp.component.TogiCountryCodePickerKt.configureInitialCountry(TogiCountryCodePicker.kt:273)
com.togitech.ccp.component.TogiCountryCodePickerKt.access$configureInitialCountry(TogiCountryCodePicker.kt:1)

I can briefly work around it wrapping the TogiCountryCodePicker with

if (!LocalInspectionMode.current) {

and setting the @Preview to this

@Preview(device = Devices.PIXEL_4, showBackground = true, showSystemUi = true)
@Composable
private fun TogiCountryCodePickerPreview() {
    TogiCountryCodePicker(
        onValueChange = { _, _ -> },
        showCountryCode = true,
        showCountryFlag = true,
        showPlaceholder = true,
        includeOnly = null,
    )
}

but then I just see a UI. If anyone knows how to mock the telephony service or even put a static variable in the country code field when in Preview mode... I'd love to be able to use the @Preview here. Thanks for a great codebase otherwise!

I feel like a simple static string could be set here

@Suppress("SwallowedException", "TooGenericExceptionCaught", "Deprecation")
internal fun getUserIsoCode(context: Context): Iso31661alpha2 = try {
    val telephonyManager = context.telephonyManager
    telephonyManager?.networkCountryIso ?: telephonyManager?.simCountryIso
} catch (ex: Exception) {
    null
}.takeIf { !it.isNullOrBlank() } ?: context.resources.configuration.locale.country

but I'm just not seeing it right now. Thought I'd leave this here for others to see / contribute / comment.

Backward compatibility

The lib is forcing me to compile agains SDK 34 which is super new. I would hate to restrict my users just because of this lib. Hopefully there is a version that could work with at leas SDK > 26.

Crash on 2nd Autofill

Describe the bug
Crash on autofill phone number

To Reproduce
Steps to reproduce the behavior:
I can consistently repro on v2.2.2
However this doesn't crash on the first autofill.

  1. Autofill on a composable screen1
  2. Navigate to screen 2
  3. Navigate back to screen1
  4. Autofill again --> Crash

Note that if I manually type in the phone number and press done on the keyboard, it doesn't crash.
both code paths do the same thing focusRequester.freeFocus()

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: Pixel 6 pro
  • OS: Android 13

Additional context

FATAL EXCEPTION: main
Process: com.solanamobile.solid, PID: 6684
java.lang.IllegalStateException: 
   FocusRequester is not initialized. Here are some possible fixes:

   1. Remember the FocusRequester: val focusRequester = remember { FocusRequester() }
   2. Did you forget to add a Modifier.focusRequester() ?
   3. Are you attempting to request focus during composition? Focus requests should be made in
   response to some event. Eg Modifier.clickable { focusRequester.requestFocus() }

	at androidx.compose.ui.focus.FocusRequester.freeFocus(FocusRequester.kt:121)
	at com.togitech.ccp.component.TogiCountryCodePickerKt$TogiCountryCodePicker$2.invoke(TogiCountryCodePicker.kt:184)
	at com.togitech.ccp.component.TogiCountryCodePickerKt$TogiCountryCodePicker$2.invoke(TogiCountryCodePicker.kt:170)
	at androidx.compose.ui.autofill.AutofillTree.performAutofill(AutofillTree.kt:50)
	at androidx.compose.ui.autofill.AndroidAutofill_androidKt.performAutofill(AndroidAutofill.android.kt:132)
	at androidx.compose.ui.platform.AndroidComposeView.autofill(AndroidComposeView.android.kt:1297)
	at android.view.autofill.AutofillManager.autofill(AutofillManager.java:2605)
	at android.view.autofill.AutofillManager.-$$Nest$mautofill(Unknown Source:0)
	at android.view.autofill.AutofillManager$AutofillManagerClient.lambda$autofill$1(AutofillManager.java:3804)
	at android.view.autofill.AutofillManager$AutofillManagerClient$$ExternalSyntheticLambda2.run(Unknown Source:10)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7866)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Reset text value

Can you introduce a way to pass a separate text to easily clear the text field?

val text by remember { mutableStateOf("") }

TogiCountryCodePicker( value = text, onValueChange = { (code, phone), isValid -> } )

Build errors

Tried to add this to my project, but it won't build, and throws the following error:

Execution failed for task ':androidApp:mergeExtDexDebug'.
> Could not resolve all files for configuration ':androidApp:debugRuntimeClasspath'.
   > Failed to transform jetpack_compose_country_code_picker_emoji-2.1.2.aar (com.github.jump-sdk:jetpack_compose_country_code_picker_emoji:2.1.2) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: C:\Users\charl\.gradle\caches\transforms-3\cad6f25fd016120a4f3cfbae963cfe16\transformed\jetpack_compose_country_code_picker_emoji-2.1.2-runtime.jar.
         > Error while dexing.
   > Failed to transform kotlin-stdlib-1.9.10.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.10) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: C:\Users\charl\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.9.10\72812e8a368917ab5c0a5081b56915ffdfec93b7\kotlin-stdlib-1.9.10.jar.
         > Error while dexing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.