Skip to content

Commit

Permalink
Added gif file for to add in readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuppan committed Mar 24, 2020
1 parent 58d9c74 commit 437b8e4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
10 changes: 10 additions & 0 deletions example/src/main/java/com/ancient/example/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.ancient.country.model.CountryModel
import com.ancient.country.utils.RequestCode
Expand All @@ -14,12 +16,16 @@ import com.google.android.material.snackbar.Snackbar
class MainActivity : AppCompatActivity() {

private lateinit var button: Button
private lateinit var countryImageView: ImageView
private lateinit var countryName: TextView

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_activity)

button = findViewById(R.id.search_activity)
countryImageView = findViewById(R.id.country_image)
countryName = findViewById(R.id.country_name)

button.setOnClickListener {
startActivityForResult(
Expand All @@ -39,6 +45,10 @@ class MainActivity : AppCompatActivity() {
val country: CountryModel? = getParcelableExtra(RequestParam.SELECTED_VALUE)

if (country != null) {

countryImageView.setImageDrawable(country.getImage(this@MainActivity))
countryName.text = country.countryName

Snackbar.make(
button,
"Selected Country [ name, code ] [${country.countryName} , ${country.countryCode}]",
Expand Down
40 changes: 36 additions & 4 deletions example/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<Button
android:id="@+id/search_activity"
android:layout_width="match_parent"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/country_search_as_activity" />
</LinearLayout>
android:backgroundTint="@color/colorAccent"
android:text="@string/country_search_as_activity"
android:textColor="@color/icon_white_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/country_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_marginStart="@dimen/app_margin_16dp"
android:src="@color/grey_light"
android:contentDescription="@string/country"
app:layout_constraintBottom_toTopOf="@+id/search_activity"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/country_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/app_margin_16dp"
android:layout_marginEnd="@dimen/app_margin_16dp"
android:text="@string/country_placeholder"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/search_activity"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/country_image"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 2 additions & 0 deletions example/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<resources>
<string name="app_name">Country Example</string>
<string name="country_search_as_activity">Country Search As Activity</string>
<string name="country">country</string>
<string name="country_placeholder">[Country Name]</string>
</resources>
Binary file added screenshots/country.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 437b8e4

Please sign in to comment.