Skip to content

Commit

Permalink
Merge pull request #13 from onstonboy/develop
Browse files Browse the repository at this point in the history
1.0.3
  • Loading branch information
onstonboy authored Sep 30, 2019
2 parents 7c3c691 + 6b01f64 commit 86244ad
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 45 deletions.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
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.
82 changes: 40 additions & 42 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MainActivity : AppCompatActivity(), OnCountryPickedListener {
val fm = supportFragmentManager
val newFragment =
com.ccc.ccp.CountryCodePickerFragment.getInstance(country, Locale.getDefault().language)
newFragment.setOnCountryPickedListener(this)
newFragment.show(fm, com.ccc.ccp.CountryCodePickerFragment.TAG)
}
}
10 changes: 10 additions & 0 deletions ccp/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
*.iml
.gradle
/local.properties
/.idea
/release
/keystores
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
23 changes: 21 additions & 2 deletions ccp/src/main/java/com/ccc/ccp/CountryCodePickerFragment.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ccc.ccp

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -18,6 +18,20 @@ class CountryCodePickerFragment : DialogFragment(), CountryCodeAdapter.OnItemCli

private var mOnCountryPicked: OnCountryPickedListener? = null

override fun onAttach(context: Context) {
super.onAttach(context)
if (mOnCountryPicked == null && context is OnCountryPickedListener) {
mOnCountryPicked = context
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (mOnCountryPicked == null && parentFragment is OnCountryPickedListener) {
mOnCountryPicked = parentFragment as? OnCountryPickedListener
}
}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
Expand Down Expand Up @@ -70,7 +84,12 @@ class CountryCodePickerFragment : DialogFragment(), CountryCodeAdapter.OnItemCli
val manager = LinearLayoutManager(context)
mView.recyclerView.layoutManager = manager
mView.recyclerView.adapter = mAdapter
mAdapter.updateData(Country.loadCountryDataFromXML(context, arguments?.getString("LanguageCode")?: Locale.getDefault().language))
mAdapter.updateData(
Country.loadCountryDataFromXML(
context,
arguments?.getString("LanguageCode") ?: Locale.getDefault().language
)
)
mAdapter.setOnItemClickListener(this)
}

Expand Down

0 comments on commit 86244ad

Please sign in to comment.