Skip to content

Commit 3a7536a

Browse files
committed
Updated Intent Module
1 parent 8c3a97e commit 3a7536a

24 files changed

+540
-69
lines changed

.idea/codeStyles/Project.xml

Lines changed: 109 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 42 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:dist="http://schemas.android.com/apk/distribution"
4-
package="source.open.akash.kotlinexample">
3+
xmlns:dist="http://schemas.android.com/apk/distribution"
4+
package="source.open.akash.kotlinexample">
55

6-
<dist:module dist:instant="true"/>
6+
<dist:module dist:instant="true" />
77

88
<application
99
android:allowBackup="true"
@@ -12,71 +12,48 @@
1212
android:roundIcon="@mipmap/ic_launcher_round"
1313
android:supportsRtl="true"
1414
android:theme="@style/AppTheme">
15-
<activity android:name=".Image.ImageSwitcher.ImageswitcherActivity">
16-
</activity>
17-
<activity android:name=".Image.ImageView.ImageViewActivity">
18-
</activity>
19-
<activity android:name=".Image.ImageActivity">
20-
</activity>
21-
<activity android:name=".Image.ImageButton.ImageButtonActivity">
22-
</activity>
23-
<activity android:name=".AlertDialog.EditTextInAlertDialog.EditTextAlertDialogActivity">
24-
</activity>
25-
<activity android:name=".AlertDialog.ListViewInAlertDialog.ListViewAlertDialogActivity">
26-
</activity>
27-
<activity android:name=".AlertDialog.AlertDialogActivity">
28-
</activity>
29-
<activity android:name=".AlertDialog.SimpleAlertDialog.SimpleAlertDialogActivity">
30-
</activity>
31-
<activity android:name=".Toast.ColoredToast.ColoredToastActivity">
32-
</activity>
33-
<activity android:name=".Toast.PositioningToast.PositioningToastActivity">
34-
</activity>
35-
<activity android:name=".Toast.CustomToast.CustomToastActivity">
36-
</activity>
37-
<activity android:name=".Toast.SimpleToast.SimpleToastActivity">
38-
</activity>
39-
<activity android:name=".Toast.ToastActivity">
40-
</activity>
41-
<activity android:name=".Widgets.Viewtag.ViewTag">
42-
</activity>
43-
<activity android:name=".Widgets.ScrollView.ScrollView">
44-
</activity>
45-
<activity android:name=".Widgets.ToggleButton.ToggleButton">
46-
</activity>
47-
<activity android:name=".Widgets.CheckedtextView.CheckedTextView">
48-
</activity>
49-
<activity android:name=".Widgets.TextSwitcher.TextSwitcher">
50-
</activity>
51-
<activity android:name=".Widgets.MultiAutoCompleteTextView.MultiAutoCompletetextView">
52-
</activity>
53-
<activity android:name=".Widgets.AutoCompletetextView.AutoCompleteTextView">
54-
</activity>
55-
<activity android:name=".Widgets.ProgressBar.ProgressActivity">
56-
</activity>
57-
<activity android:name=".Widgets.Switch.SwitchActivity">
58-
</activity>
59-
<activity android:name=".Widgets.Spinner.SpinnerActivity">
60-
</activity>
61-
<activity android:name=".Widgets.RatingBar.RatingBar">
62-
</activity>
63-
<activity android:name=".Widgets.CheckBox.CheckBox">
64-
</activity>
65-
<activity android:name=".Widgets.RadioButton.RadioButton">
66-
</activity>
67-
<activity android:name=".Widgets.Button.Button">
68-
</activity>
69-
<activity android:name=".Widgets.Widgets">
70-
</activity>
71-
<activity android:name=".Widgets.EditText.EditText">
72-
</activity>
73-
<activity android:name=".Widgets.TextView.TextView">
74-
</activity>
15+
<activity android:name=".Intent.ExplicitIntentActivity.ReturnresultActivity"></activity>
16+
<activity android:name=".Intent.ExplicitIntentActivity.SharedElementTransitionActivity" />
17+
<activity android:name=".Intent.ExplicitIntentActivity.SecondActivity" />
18+
<activity android:name=".Intent.ExplicitIntentActivity.ExplicitActivity" />
19+
<activity android:name=".Intent.ImlicitIntentActivity.ImplicitActivity" />
20+
<activity android:name=".Intent.IntentActivityDemo" />
21+
<activity android:name=".Image.ImageSlider.ImageSliderActivity" />
22+
<activity android:name=".Image.ImageSwitcher.ImageswitcherActivity" />
23+
<activity android:name=".Image.ImageView.ImageViewActivity" />
24+
<activity android:name=".Image.ImageActivity" />
25+
<activity android:name=".Image.ImageButton.ImageButtonActivity" />
26+
<activity android:name=".AlertDialog.EditTextInAlertDialog.EditTextAlertDialogActivity" />
27+
<activity android:name=".AlertDialog.ListViewInAlertDialog.ListViewAlertDialogActivity" />
28+
<activity android:name=".AlertDialog.AlertDialogActivity" />
29+
<activity android:name=".AlertDialog.SimpleAlertDialog.SimpleAlertDialogActivity" />
30+
<activity android:name=".Toast.ColoredToast.ColoredToastActivity" />
31+
<activity android:name=".Toast.PositioningToast.PositioningToastActivity" />
32+
<activity android:name=".Toast.CustomToast.CustomToastActivity" />
33+
<activity android:name=".Toast.SimpleToast.SimpleToastActivity" />
34+
<activity android:name=".Toast.ToastActivity" />
35+
<activity android:name=".Widgets.Viewtag.ViewTag" />
36+
<activity android:name=".Widgets.ScrollView.ScrollView" />
37+
<activity android:name=".Widgets.ToggleButton.ToggleButton" />
38+
<activity android:name=".Widgets.CheckedtextView.CheckedTextView" />
39+
<activity android:name=".Widgets.TextSwitcher.TextSwitcher" />
40+
<activity android:name=".Widgets.MultiAutoCompleteTextView.MultiAutoCompletetextView" />
41+
<activity android:name=".Widgets.AutoCompletetextView.AutoCompleteTextView" />
42+
<activity android:name=".Widgets.ProgressBar.ProgressActivity" />
43+
<activity android:name=".Widgets.Switch.SwitchActivity" />
44+
<activity android:name=".Widgets.Spinner.SpinnerActivity" />
45+
<activity android:name=".Widgets.RatingBar.RatingBar" />
46+
<activity android:name=".Widgets.CheckBox.CheckBox" />
47+
<activity android:name=".Widgets.RadioButton.RadioButton" />
48+
<activity android:name=".Widgets.Button.Button" />
49+
<activity android:name=".Widgets.Widgets" />
50+
<activity android:name=".Widgets.EditText.EditText" />
51+
<activity android:name=".Widgets.TextView.TextView" />
7552
<activity android:name=".MainActivity">
7653
<intent-filter>
77-
<action android:name="android.intent.action.MAIN"/>
54+
<action android:name="android.intent.action.MAIN" />
7855

79-
<category android:name="android.intent.category.LAUNCHER"/>
56+
<category android:name="android.intent.category.LAUNCHER" />
8057
</intent-filter>
8158
</activity>
8259
</application>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package source.open.akash.kotlinexample.Intent.ExplicitIntentActivity
2+
3+
import android.app.Activity
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import android.widget.ImageView
7+
import android.widget.Toast
8+
import androidx.appcompat.app.AppCompatActivity
9+
import androidx.core.app.ActivityOptionsCompat
10+
import androidx.core.view.ViewCompat
11+
import kotlinx.android.synthetic.main.activity_explicit.*
12+
import source.open.akash.kotlinexample.R
13+
14+
15+
class ExplicitActivity : AppCompatActivity() {
16+
val RequestCodeForResult = 101
17+
override fun onCreate(savedInstanceState: Bundle?) {
18+
super.onCreate(savedInstanceState)
19+
setContentView(R.layout.activity_explicit)
20+
21+
explicitOne.setOnClickListener {
22+
if (!edtText.text.isNullOrEmpty()) {
23+
val intent = Intent(
24+
this@ExplicitActivity,
25+
SecondActivity::class.java
26+
)
27+
intent.putExtra(
28+
"data",
29+
edtText.text.toString()
30+
) //sending data from this or current activity to second activity
31+
startActivity(intent)
32+
} else {
33+
Toast.makeText(
34+
this@ExplicitActivity,
35+
"Need Some Data to Proceed Second Activity",
36+
Toast.LENGTH_SHORT
37+
).show()
38+
}
39+
}
40+
explicitTwo.setOnClickListener {
41+
val intent = Intent(this@ExplicitActivity, SharedElementTransitionActivity::class.java)
42+
// Pass data object in the bundle and populate details activity.
43+
// Pass data object in the bundle and populate details activity.
44+
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(
45+
this,
46+
imgTransOne as ImageView,
47+
ViewCompat.getTransitionName(imgTransOne)!!
48+
49+
)
50+
startActivity(intent, options.toBundle())
51+
}
52+
53+
explicitThree.setOnClickListener {
54+
val intent = Intent(this@ExplicitActivity, ReturnresultActivity::class.java)
55+
startActivityForResult(intent, RequestCodeForResult)
56+
}
57+
58+
}
59+
60+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
61+
super.onActivityResult(requestCode, resultCode, data)
62+
if (requestCode == RequestCodeForResult && resultCode == Activity.RESULT_OK) {
63+
Toast.makeText(
64+
applicationContext,
65+
"Activity Return :${data!!.getStringExtra("returnData")}",
66+
Toast.LENGTH_SHORT
67+
).show()
68+
69+
} else {
70+
Toast.makeText(applicationContext, "Activity cancelled", Toast.LENGTH_SHORT).show()
71+
}
72+
}
73+
74+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package source.open.akash.kotlinexample.Intent.ExplicitIntentActivity
2+
3+
import android.app.Activity
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import android.widget.Toast
7+
import androidx.appcompat.app.AppCompatActivity
8+
import kotlinx.android.synthetic.main.activity_returnresult.*
9+
import source.open.akash.kotlinexample.R
10+
11+
class ReturnresultActivity : AppCompatActivity() {
12+
13+
override fun onCreate(savedInstanceState: Bundle?) {
14+
super.onCreate(savedInstanceState)
15+
setContentView(R.layout.activity_returnresult)
16+
17+
btnReturn.setOnClickListener {
18+
if (edtreturn.text.isNullOrEmpty()) {
19+
Toast.makeText(applicationContext, "Enter Some Dtat to return", Toast.LENGTH_SHORT)
20+
.show()
21+
} else {
22+
val returnIntent = Intent()
23+
returnIntent.putExtra("returnData", edtreturn.text.toString())
24+
setResult(Activity.RESULT_OK, returnIntent)
25+
finish()
26+
}
27+
}
28+
}
29+
30+
override fun onBackPressed() {
31+
super.onBackPressed()
32+
val returnIntent = Intent()
33+
setResult(Activity.RESULT_CANCELED, returnIntent)
34+
finish()
35+
}
36+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package source.open.akash.kotlinexample.Intent.ExplicitIntentActivity
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
import kotlinx.android.synthetic.main.activity_second.*
6+
import source.open.akash.kotlinexample.R
7+
8+
class SecondActivity : AppCompatActivity() {
9+
10+
override fun onCreate(savedInstanceState: Bundle?) {
11+
super.onCreate(savedInstanceState)
12+
setContentView(R.layout.activity_second)
13+
14+
//fetching data from Intent and show in textview of given activity
15+
secondActivityData.text = intent.getStringExtra("data")
16+
}
17+
}

0 commit comments

Comments
 (0)