hbb20 / CountryCodePickerProject

Country Code Picker (CCP) is an android library which provides an easy way to search and select country or international phone code. Also supports Android EditText phone mask and international phone validation.
Apache License 2.0
1.51k stars 502 forks source link

arrow does not shown above version 2.4.0 #470

Open mdluhosch opened 3 years ago

mdluhosch commented 3 years ago

Version 2.4.0 is the last one where I can see the arrow. For newer Versions I only see white where it should be. I also tried the following:

        val img : ImageView = ccp.findViewById(R.id.imageView_arrow)
        img.setBackgroundColor(0x3A3535)
        img.visibility = View.VISIBLE

But the arrow just does not want to show up above 2.4.0.

Also with all of the versions I tested I get a compilation error when I try to set the attribute ccpDialog_backgroundColor.

hbb20 commented 3 years ago

Can you please try 2.5.0. It seems to be working for 2.5.0 if not can you post the xml and all the java/kotlin code where ccp is used.

mdluhosch commented 3 years ago

Also with 2.5.0 the arrow won't show. XML:

        <com.hbb20.CountryCodePicker
            android:id="@+id/modify_country"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:inputType="text"
            app:ccp_autoDetectCountry="true"
            app:ccp_autoDetectLanguage="true"
            app:ccp_countryPreference="DE,US,GB"
            app:ccp_defaultLanguage="ENGLISH"
            app:ccp_defaultNameCode="DE"
            app:ccp_showArrow="true"
            app:ccp_showFlag="true"
            app:ccp_showFullName="true"
            app:ccp_showNameCode="false"
            app:ccp_showPhoneCode="false"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/modify_country_lbl" />

In the Code I don't do anything specific just reading and setting the country code:

val code = view?.modify_country?.selectedCountryNameCode ?: ""

And in the onCreateView:

v.modify_country.setCountryForNameCode("DE")

andre-sonect commented 3 years ago

Not showing on 2.5.3 as well.


<com.hbb20.CountryCodePicker
                android:id="@+id/country_picker_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                app:ccpDialog_backgroundColor="#888"
                app:ccpDialog_searchEditTextTint="#fff"
                app:ccpDialog_showTitle="false"
                app:ccpDialog_textColor="#fff"
                app:ccp_arrowColor="#fff"
                app:ccp_arrowSize="30dp"
                app:ccp_autoDetectLanguage="true"
                app:ccp_contentColor="#fff"
                app:ccp_showArrow="true"
                app:ccp_showFullName="true"
                app:ccp_showNameCode="false"
                app:ccp_showPhoneCode="false"
                app:ccp_textGravity="LEFT"
                app:ccp_textSize="18sp" />
BerkkanB commented 2 years ago

Did you find any solution ?

mdluhosch commented 2 years ago

I finally narrowed it down. I created a new Android app from Android Studio (Basic Activity). Then I added the country code picker to the fragment_first.xml and everything was working with 2.5.0. Then I switched the Activity type inside MainActivity.kt into a FragmentActivity (was AppCompatActivity) which caused the arrow to disappear!

I found out that AppCompatActivity extends the FragmentActivity so I will propaply switch my app to also use the AppCompatActivity. So from my point of view you can close the issue.

Edit: I just checked and also in your Example application it is enough to switch the ExampleActivity.kt from AppCompatActivity to FragmentActivity and all the Arrows disappear.