madshellnpm 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/cli.js +44 -0
  2. package/generator.js +30 -0
  3. package/index.js +5 -0
  4. package/menu/context menu/MainActivity.kt +50 -0
  5. package/menu/context menu/activity_main.xml +18 -0
  6. package/menu/context menu/menu_main.xml +34 -0
  7. package/menu/options menu/MainActivity.kt +52 -0
  8. package/menu/options menu/activity_main.xml +9 -0
  9. package/menu/options menu/menu_main.xml +81 -0
  10. package/menu/popup menu/MainActivity.kt +58 -0
  11. package/menu/popup menu/activity_main.xml +20 -0
  12. package/menu/popup menu/menu_main.xml +39 -0
  13. package/package.json +27 -0
  14. package/templates/alertdialog/MainActivity.kt +47 -0
  15. package/templates/alertdialog/activity_main.xml +39 -0
  16. package/templates/animations/MainActivity.kt +70 -0
  17. package/templates/animations/activity_main.xml +125 -0
  18. package/templates/animations/bounce.xml +24 -0
  19. package/templates/animations/fade_in.xml +11 -0
  20. package/templates/animations/fade_out.xml +12 -0
  21. package/templates/animations/slide_down.xml +9 -0
  22. package/templates/animations/slide_up.xml +9 -0
  23. package/templates/animations/zoom_in.xml +15 -0
  24. package/templates/animations/zoom_out.xml +15 -0
  25. package/templates/autocomplete_textview/MainActivity.kt +40 -0
  26. package/templates/autocomplete_textview/activity_main.xml +34 -0
  27. package/templates/canvas/MainActivity.kt +54 -0
  28. package/templates/canvas/activity_main.xml +19 -0
  29. package/templates/canvas/example2.kt +13 -0
  30. package/templates/checkbox/MainActivity.kt +56 -0
  31. package/templates/checkbox/activity_main.xml +67 -0
  32. package/templates/custom_checkbox/MainActivity.kt +32 -0
  33. package/templates/custom_checkbox/activity_main.xml +43 -0
  34. package/templates/custom_toast/MainActivity.kt +23 -0
  35. package/templates/custom_toast/activity_main.xml +22 -0
  36. package/templates/custom_toast/customtoast.xml +20 -0
  37. package/templates/database/MainActivity.kt +64 -0
  38. package/templates/database/activity_main.xml +77 -0
  39. package/templates/database/dbController.kt +56 -0
  40. package/templates/datepicker_and_timepicker/datepicker/MainActivity.kt +34 -0
  41. package/templates/datepicker_and_timepicker/datepicker/activity_main.xml +24 -0
  42. package/templates/datepicker_and_timepicker/timepicker/MainActivity.kt +37 -0
  43. package/templates/datepicker_and_timepicker/timepicker/activity_main.xml +15 -0
  44. package/templates/explicit_and_implicit_intents/example 1/MainActivity.kt +36 -0
  45. package/templates/explicit_and_implicit_intents/example 1/SecondActivity.kt +12 -0
  46. package/templates/explicit_and_implicit_intents/example 1/activity_main.xml +33 -0
  47. package/templates/explicit_and_implicit_intents/example 1/activity_second.xml +20 -0
  48. package/templates/explicit_and_implicit_intents/example 2/MainActivity.kt +37 -0
  49. package/templates/explicit_and_implicit_intents/example 2/MainActivity2.kt +23 -0
  50. package/templates/explicit_and_implicit_intents/example 2/activity_main.xml +38 -0
  51. package/templates/explicit_and_implicit_intents/example 2/activity_second.xml +18 -0
  52. package/templates/image_view_listener/MainActivity.kt +38 -0
  53. package/templates/image_view_listener/activity_main.xml +89 -0
  54. package/templates/menu/context menu/MainActivity.kt +50 -0
  55. package/templates/menu/context menu/activity_main.xml +18 -0
  56. package/templates/menu/context menu/menu_main.xml +34 -0
  57. package/templates/menu/options menu/MainActivity.kt +52 -0
  58. package/templates/menu/options menu/activity_main.xml +9 -0
  59. package/templates/menu/options menu/menu_main.xml +81 -0
  60. package/templates/menu/popup menu/MainActivity.kt +58 -0
  61. package/templates/menu/popup menu/activity_main.xml +20 -0
  62. package/templates/menu/popup menu/menu_main.xml +39 -0
  63. package/templates/progressbar/MainActivity.kt +60 -0
  64. package/templates/progressbar/activity_main.xml +47 -0
  65. package/templates/radio_button/MainActivity.kt +46 -0
  66. package/templates/radio_button/activity_main.xml +86 -0
  67. package/templates/sharedpreferences/example1/MainActivity.kt +54 -0
  68. package/templates/sharedpreferences/example1/activity_main.xml +69 -0
  69. package/templates/sharedpreferences/example2/MainActivity.kt +45 -0
  70. package/templates/sharedpreferences/example2/activity_main.xml +48 -0
  71. package/templates/spinner/MainActivity.kt +54 -0
  72. package/templates/spinner/activity_main.xml +37 -0
  73. package/templates/spinner/strings.xml +13 -0
  74. package/templates/toggle_button/MainActivity.kt +39 -0
  75. package/templates/toggle_button/activity_main.xml +50 -0
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <android.support.constraint.ConstraintLayout
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ xmlns:app="http://schemas.android.com/apk/res-auto"
5
+ xmlns:tools="http://schemas.android.com/tools"
6
+ android:layout_width="match_parent"
7
+ android:layout_height="match_parent"
8
+ tools:context=".MainActivity">
9
+
10
+ <EditText
11
+ android:id="@+id/ed1"
12
+ android:layout_width="wrap_content"
13
+ android:layout_height="wrap_content"
14
+ android:layout_marginTop="56dp"
15
+ android:ems="10"
16
+ android:hint="Username"
17
+ android:inputType="textPersonName"
18
+ android:minHeight="48dp"
19
+ app:layout_constraintTop_toTopOf="parent"
20
+ app:layout_constraintStart_toStartOf="parent"
21
+ app:layout_constraintEnd_toEndOf="parent"
22
+ app:layout_constraintHorizontal_bias="0.497" />
23
+
24
+ <EditText
25
+ android:id="@+id/ed2"
26
+ android:layout_width="wrap_content"
27
+ android:layout_height="wrap_content"
28
+ android:layout_marginTop="36dp"
29
+ android:ems="10"
30
+ android:hint="Password"
31
+ android:inputType="textPersonName"
32
+ android:minHeight="48dp"
33
+ app:layout_constraintTop_toBottomOf="@+id/ed1"
34
+ app:layout_constraintStart_toStartOf="parent"
35
+ app:layout_constraintEnd_toEndOf="parent"
36
+ app:layout_constraintHorizontal_bias="0.497" />
37
+
38
+ <Button
39
+ android:id="@+id/b1"
40
+ android:layout_width="wrap_content"
41
+ android:layout_height="wrap_content"
42
+ android:layout_marginTop="95dp"
43
+ android:text="Save"
44
+ app:layout_constraintTop_toBottomOf="@+id/ed2"
45
+ app:layout_constraintStart_toStartOf="parent"
46
+ app:layout_constraintEnd_toEndOf="parent"
47
+ app:layout_constraintHorizontal_bias="0.235" />
48
+
49
+ <Button
50
+ android:id="@+id/b2"
51
+ android:layout_width="wrap_content"
52
+ android:layout_height="wrap_content"
53
+ android:layout_marginStart="96dp"
54
+ android:layout_marginTop="95dp"
55
+ android:text="Load"
56
+ app:layout_constraintTop_toBottomOf="@+id/ed2"
57
+ app:layout_constraintStart_toEndOf="@+id/b1" />
58
+
59
+ <Button
60
+ android:id="@+id/b4"
61
+ android:layout_width="wrap_content"
62
+ android:layout_height="wrap_content"
63
+ android:layout_marginTop="20dp"
64
+ android:layout_marginEnd="68dp"
65
+ android:text="DELETE"
66
+ app:layout_constraintTop_toBottomOf="@+id/b2"
67
+ app:layout_constraintEnd_toEndOf="parent" />
68
+
69
+ </android.support.constraint.ConstraintLayout>
@@ -0,0 +1,45 @@
1
+ package com.example.sharedpeferences1
2
+
3
+ import android.support.v7.app.AppCompatActivity
4
+ import android.os.Bundle
5
+ import android.widget.EditText
6
+
7
+ class MainActivity : AppCompatActivity() {
8
+
9
+ private lateinit var name: EditText
10
+ private lateinit var age: EditText
11
+
12
+ override fun onCreate(savedInstanceState: Bundle?) {
13
+ super.onCreate(savedInstanceState)
14
+ setContentView(R.layout.activity_main)
15
+
16
+ name = findViewById(R.id.edit1)
17
+ age = findViewById(R.id.edit2)
18
+ }
19
+
20
+ // Fetch stored data when app resumes
21
+ override fun onResume() {
22
+ super.onResume()
23
+
24
+ val sh = getSharedPreferences("MySharedPref", MODE_PRIVATE)
25
+
26
+ val s1 = sh.getString("name", "")
27
+ val a = sh.getInt("age", 0)
28
+
29
+ name.setText(s1)
30
+ age.setText(a.toString())
31
+ }
32
+
33
+ // Store data when app pauses
34
+ override fun onPause() {
35
+ super.onPause()
36
+
37
+ val sharedPreferences = getSharedPreferences("MySharedPref", MODE_PRIVATE)
38
+ val myEdit = sharedPreferences.edit()
39
+
40
+ myEdit.putString("name", name.text.toString())
41
+ myEdit.putInt("age", age.text.toString().toInt())
42
+
43
+ myEdit.apply()
44
+ }
45
+ }
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <RelativeLayout
4
+ xmlns:android="http://schemas.android.com/apk/res/android"
5
+ xmlns:tools="http://schemas.android.com/tools"
6
+ android:layout_width="match_parent"
7
+ android:layout_height="match_parent"
8
+ tools:context=".MainActivity"
9
+ tools:ignore="HardcodedText">
10
+
11
+ <TextView
12
+ android:id="@+id/textview"
13
+ android:layout_width="wrap_content"
14
+ android:layout_height="wrap_content"
15
+ android:layout_centerHorizontal="true"
16
+ android:layout_marginTop="32dp"
17
+ android:text="Shared Preferences"
18
+ android:textColor="@android:color/black"
19
+ android:textSize="24sp" />
20
+
21
+ <!-- EditText to take the data from the user and save the data in SharedPreferences -->
22
+
23
+ <EditText
24
+ android:id="@+id/edit1"
25
+ android:layout_width="match_parent"
26
+ android:layout_height="wrap_content"
27
+ android:layout_below="@id/textview"
28
+ android:layout_marginStart="16dp"
29
+ android:layout_marginTop="8dp"
30
+ android:layout_marginEnd="16dp"
31
+ android:hint="Enter your Name"
32
+ android:padding="10dp" />
33
+
34
+ <!-- EditText to take the data from the user and save the data in SharedPreferences -->
35
+
36
+ <EditText
37
+ android:id="@+id/edit2"
38
+ android:layout_width="match_parent"
39
+ android:layout_height="wrap_content"
40
+ android:layout_below="@id/edit1"
41
+ android:layout_marginStart="16dp"
42
+ android:layout_marginTop="8dp"
43
+ android:layout_marginEnd="16dp"
44
+ android:hint="Enter your Age"
45
+ android:inputType="number"
46
+ android:padding="10dp" />
47
+
48
+ </RelativeLayout>
@@ -0,0 +1,54 @@
1
+ package com.example.spinner
2
+
3
+ import androidx.appcompat.app.AppCompatActivity
4
+ import android.os.Bundle
5
+ import android.view.View
6
+ import android.widget.AdapterView
7
+ import android.widget.ArrayAdapter
8
+ import android.widget.Spinner
9
+ import android.widget.TextView
10
+
11
+ class MainActivity : AppCompatActivity(),
12
+ AdapterView.OnItemSelectedListener {
13
+
14
+ lateinit var spinner: Spinner
15
+ lateinit var result: TextView
16
+
17
+ override fun onCreate(savedInstanceState: Bundle?) {
18
+ super.onCreate(savedInstanceState)
19
+ setContentView(R.layout.activity_main)
20
+
21
+ spinner = findViewById(R.id.spinnerCountry)
22
+ result = findViewById(R.id.result)
23
+
24
+ spinner.onItemSelectedListener = this
25
+
26
+ val arrayAdapter = ArrayAdapter.createFromResource(
27
+ this,
28
+ R.array.countries,
29
+ android.R.layout.simple_spinner_item
30
+ )
31
+
32
+ arrayAdapter.setDropDownViewResource(
33
+ android.R.layout.simple_spinner_dropdown_item
34
+ )
35
+
36
+ spinner.adapter = arrayAdapter
37
+ }
38
+
39
+ override fun onItemSelected(
40
+ parent: AdapterView<*>?,
41
+ view: View?,
42
+ position: Int,
43
+ id: Long
44
+ ) {
45
+
46
+ if (parent != null) {
47
+ result.text = parent.getItemAtPosition(position).toString()
48
+ }
49
+ }
50
+
51
+ override fun onNothingSelected(parent: AdapterView<*>?) {
52
+
53
+ }
54
+ }
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <androidx.constraintlayout.widget.ConstraintLayout
4
+ xmlns:android="http://schemas.android.com/apk/res/android"
5
+ xmlns:app="http://schemas.android.com/apk/res-auto"
6
+ xmlns:tools="http://schemas.android.com/tools"
7
+ android:layout_width="match_parent"
8
+ android:layout_height="match_parent"
9
+ tools:context=".MainActivity">
10
+
11
+ <TextView
12
+ android:id="@+id/result"
13
+ android:layout_width="300dp"
14
+ android:layout_height="50dp"
15
+ android:layout_marginTop="100dp"
16
+ android:background="#E91E63"
17
+ android:gravity="center"
18
+ android:text="TextView"
19
+ android:textColor="#FFFFFF"
20
+ android:textSize="20sp"
21
+ app:layout_constraintEnd_toEndOf="parent"
22
+ app:layout_constraintHorizontal_bias="0.5"
23
+ app:layout_constraintStart_toStartOf="parent"
24
+ app:layout_constraintTop_toTopOf="parent" />
25
+
26
+ <Spinner
27
+ android:id="@+id/spinnerCountry"
28
+ android:layout_width="wrap_content"
29
+ android:layout_height="wrap_content"
30
+ android:layout_marginTop="20dp"
31
+ app:layout_constraintEnd_toEndOf="parent"
32
+ app:layout_constraintHorizontal_bias="0.5"
33
+ app:layout_constraintStart_toStartOf="parent"
34
+ app:layout_constraintTop_toBottomOf="@id/result"
35
+ tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
36
+
37
+ </androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,13 @@
1
+ <resources>
2
+
3
+ <string name="app_name">Spinner</string>
4
+
5
+ <string-array name="countries">
6
+ <item>England</item>
7
+ <item>Netherlands</item>
8
+ <item>Belgium</item>
9
+ <item>Germany</item>
10
+ <item>Finland</item>
11
+ </string-array>
12
+
13
+ </resources>
@@ -0,0 +1,39 @@
1
+ package com.example.toggle
2
+
3
+ import androidx.appcompat.app.AppCompatActivity
4
+ import android.os.Bundle
5
+ import android.view.View
6
+ import android.widget.ImageView
7
+ import android.widget.TextView
8
+ import android.widget.ToggleButton
9
+
10
+ class MainActivity : AppCompatActivity() {
11
+
12
+ lateinit var image: ImageView
13
+ lateinit var result: TextView
14
+ lateinit var toggleButton: ToggleButton
15
+
16
+ override fun onCreate(savedInstanceState: Bundle?) {
17
+ super.onCreate(savedInstanceState)
18
+ setContentView(R.layout.activity_main)
19
+
20
+ toggleButton = findViewById(R.id.toggleButton)
21
+ image = findViewById(R.id.image)
22
+ result = findViewById(R.id.result)
23
+
24
+ toggleButton.setOnCheckedChangeListener { compoundButton, isChecked ->
25
+
26
+ if (isChecked) {
27
+
28
+ image.visibility = View.INVISIBLE
29
+ result.text = "The image is invisible."
30
+
31
+ } else {
32
+
33
+ image.visibility = View.VISIBLE
34
+ result.text = "The image is visible."
35
+
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,50 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <androidx.constraintlayout.widget.ConstraintLayout
4
+ xmlns:android="http://schemas.android.com/apk/res/android"
5
+ xmlns:app="http://schemas.android.com/apk/res-auto"
6
+ xmlns:tools="http://schemas.android.com/tools"
7
+ android:layout_width="match_parent"
8
+ android:layout_height="match_parent"
9
+ android:background="@android:color/holo_blue_dark"
10
+ tools:context=".MainActivity">
11
+
12
+ <ImageView
13
+ android:id="@+id/image"
14
+ android:layout_width="300dp"
15
+ android:layout_height="200dp"
16
+ android:layout_marginTop="50dp"
17
+ app:layout_constraintEnd_toEndOf="parent"
18
+ app:layout_constraintHorizontal_bias="0.5"
19
+ app:layout_constraintStart_toStartOf="parent"
20
+ app:layout_constraintTop_toTopOf="parent"
21
+ app:srcCompat="@drawable/ic_launcher_background" />
22
+
23
+ <TextView
24
+ android:id="@+id/result"
25
+ android:layout_width="300dp"
26
+ android:layout_height="50dp"
27
+ android:layout_marginTop="20dp"
28
+ android:background="#FFFFFF"
29
+ android:gravity="center"
30
+ android:text="The image is visible"
31
+ android:textColor="#000000"
32
+ android:textSize="20sp"
33
+ app:layout_constraintEnd_toEndOf="parent"
34
+ app:layout_constraintHorizontal_bias="0.495"
35
+ app:layout_constraintStart_toStartOf="parent"
36
+ app:layout_constraintTop_toBottomOf="@id/image" />
37
+
38
+ <ToggleButton
39
+ android:id="@+id/toggleButton"
40
+ android:layout_width="wrap_content"
41
+ android:layout_height="wrap_content"
42
+ android:layout_marginTop="30dp"
43
+ android:text="ToggleButton"
44
+ android:textOff="Hide Image"
45
+ android:textOn="Show Image"
46
+ app:layout_constraintEnd_toEndOf="parent"
47
+ app:layout_constraintStart_toStartOf="parent"
48
+ app:layout_constraintTop_toBottomOf="@id/result" />
49
+
50
+ </androidx.constraintlayout.widget.ConstraintLayout>