Skip to content

Commit

Permalink
Merge pull request #19 from onstonboy/develop
Browse files Browse the repository at this point in the history
1.0.6
  • Loading branch information
onstonboy authored Oct 1, 2019
2 parents 5f49197 + 112f134 commit 338ba2c
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 70 deletions.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/jarAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
256 changes: 188 additions & 68 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/src/main/java/com/ccc/countrycodepicker/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MainActivity : AppCompatActivity(), OnCountryPickedListener {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

countryCodePicker.setLanguageCode(Locale.getDefault().language)
countryCodePicker.refreshDefaultData()
countryCodePicker.setCountryPicked(countryCodePicker.getCountry(Locale.getDefault().country))
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
android:layout_height="50dp"
app:flagHeight="24dp"
app:flagWidth="24dp"
app:langCode="vi"
app:showPhoneCode="false"
android:onClick="onPickerClick"
/>
Expand Down
2 changes: 1 addition & 1 deletion ccp/src/main/java/com/ccc/ccp/Country.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ data class Country(
} catch (e: Exception) {
Log.e(TAG, "error", e)
}
return countries.sortedBy { it.name }
return countries.sortedBy { it.name.removeAccent() }
}

fun getFlagMasterResID(countryCode: Country): Int {
Expand Down
11 changes: 11 additions & 0 deletions ccp/src/main/java/com/ccc/ccp/StringExtension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.ccc.ccp

import java.text.Normalizer
import java.util.regex.Pattern

fun String.removeAccent(): String {
val temp = Normalizer.normalize(this, Normalizer.Form.NFD)
val pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+")
return pattern.matcher(temp).replaceAll("").replace('đ', 'd')
.replace('Đ', 'D')
}

0 comments on commit 338ba2c

Please sign in to comment.