├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── menu
│ │ │ └── menu_fragmented.xml
│ │ ├── layout
│ │ │ ├── content_fragmented.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── fragment_fragmented.xml
│ │ │ └── activity_fragmented.xml
│ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ └── drawable
│ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ └── ability
│ │ │ └── co
│ │ │ └── mz
│ │ │ └── nahuexample
│ │ │ ├── FragmentedActivity.kt
│ │ │ ├── MainActivity.kt
│ │ │ └── ActivityFragment.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── nahu
├── .gitignore
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ └── java
│ │ └── ability
│ │ └── co
│ │ └── mz
│ │ └── nahu
│ │ ├── exceptions
│ │ └── ComponentNotSetException.kt
│ │ ├── PermissionManager.kt
│ │ ├── ResultHandler.kt
│ │ └── PermissionHandler.kt
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── codeStyles
│ └── Project.xml
└── misc.xml
├── .gitignore
├── gradle.properties
├── LICENSE
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/nahu/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':nahu'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/nahu/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PauloEnoque/Nahu/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/nahu/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Nahu
3 | Some features have been disabled due to missing permissions
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 02 19:52:17 CAT 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NahuExample
3 | Open Dialer
4 | NahuFragment
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_fragmented.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_fragmented.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/nahu/src/main/java/ability/co/mz/nahu/exceptions/ComponentNotSetException.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahu.exceptions
2 |
3 | import java.lang.Exception
4 |
5 | /**
6 | * Created by Paulo Enoque on 3/24/2018.
7 | */
8 | class ComponentNotSetException(private val componentName: String): Exception() {
9 |
10 | override val message: String?
11 | get() = "No $componentName has been specified, " +
12 | "be sure to initialize the $componentName variable in the requestNahuPermissions" +
13 | " function"
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/ability/co/mz/nahuexample/FragmentedActivity.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahuexample
2 |
3 | import android.os.Bundle
4 | import android.support.design.widget.Snackbar
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import kotlinx.android.synthetic.main.activity_fragmented.*
8 |
9 | class FragmentedActivity : AppCompatActivity() {
10 |
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | super.onCreate(savedInstanceState)
13 | setContentView(R.layout.activity_fragmented)
14 | setSupportActionBar(toolbar)
15 |
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/nahu/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/nahu/src/main/java/ability/co/mz/nahu/PermissionManager.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahu
2 |
3 | import android.app.Activity
4 | import android.support.v4.app.Fragment
5 |
6 | private var handlerRequestCode: Int? = null
7 | const val DEFAULT_NAHU_REQUEST_CODE = 123
8 |
9 | fun Activity.requestNahuPermissions(block: PermissionHandler.() -> Unit) {
10 | val handler = PermissionHandler(this)
11 | handlerRequestCode = handler.requestCode
12 | handler.block()
13 | }
14 |
15 | fun Fragment.requestNahuPermissions(block: PermissionHandler.() -> Unit) {
16 | val handler = PermissionHandler(this)
17 | handlerRequestCode = handler.requestCode
18 | handler.block()
19 | }
20 |
21 | fun handlePermissionsResult(block: ResultHandler.() -> Unit) {
22 | val resultHandler = ResultHandler()
23 | if (handlerRequestCode == resultHandler.requestCode) {
24 | resultHandler.block()
25 | }
26 | }
--------------------------------------------------------------------------------
/nahu/src/main/java/ability/co/mz/nahu/ResultHandler.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahu
2 |
3 | import android.content.pm.PackageManager
4 |
5 | class ResultHandler {
6 | var requestCode: Int? = null
7 | var permissions: Array? = null
8 | var grantResults: IntArray? = null
9 |
10 | fun onPermissionDenied(block: ResultHandler.(deniedPermission: String) -> Unit) {
11 | for (i in 0 until grantResults!!.size) {
12 | if (!isPermissionGranted(grantResults!![i])) {
13 | block(permissions!![i])
14 | }
15 | }
16 | }
17 |
18 | fun onPermissionGranted(block: ResultHandler.(grantedPermission: String) -> Unit) {
19 | for (i in 0 until grantResults!!.size) {
20 | if (isPermissionGranted(grantResults!![i])) {
21 | block(permissions!![i])
22 | }
23 | }
24 | }
25 |
26 | private fun isPermissionGranted(result: Int): Boolean = result == PackageManager.PERMISSION_GRANTED
27 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
--------------------------------------------------------------------------------
/nahu/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdkVersion 27
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 27
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 |
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(dir: 'libs', include: ['*.jar'])
28 |
29 | implementation 'com.android.support:appcompat-v7:27.1.1'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
34 | }
35 | repositories {
36 | mavenCentral()
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_fragmented.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Paulo Enoque Safrao
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fragmented.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 27
7 | defaultConfig {
8 | applicationId "ability.co.mz.nahuexample"
9 | minSdkVersion 19
10 | targetSdkVersion 27
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | implementation fileTree(include: ['*.jar'], dir: 'libs')
25 | implementation 'com.android.support:appcompat-v7:27.1.1'
26 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
27 | implementation 'com.android.support:design:27.1.1'
28 | testImplementation 'junit:junit:4.12'
29 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
30 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
31 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
32 | implementation project(':nahu')
33 | }
34 | repositories {
35 | mavenCentral()
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/ability/co/mz/nahuexample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahuexample
2 |
3 | import ability.co.mz.nahu.handlePermissionsResult
4 | import ability.co.mz.nahu.requestNahuPermissions
5 | import android.Manifest
6 | import android.content.Intent
7 | import android.net.Uri
8 | import android.os.Bundle
9 | import android.support.v7.app.AppCompatActivity
10 | import android.widget.Toast
11 | import kotlinx.android.synthetic.main.activity_main.*
12 |
13 | class MainActivity : AppCompatActivity() {
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_main)
18 |
19 | openDialer.setOnClickListener {
20 | requestNahuPermissions {
21 | permissions = arrayOf(Manifest.permission.CALL_PHONE)
22 | then {
23 | openDialerApp()
24 | }
25 | }
26 | }
27 |
28 | }
29 |
30 | override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
31 |
32 | handlePermissionsResult {
33 | this.requestCode = requestCode
34 | this.permissions = permissions
35 | this.grantResults = grantResults
36 |
37 | onPermissionGranted { permission ->
38 | when (permission) {
39 | Manifest.permission.CALL_PHONE -> openDialerApp()
40 | }
41 | }
42 |
43 | onPermissionDenied { permission ->
44 | when (permission) {
45 | Manifest.permission.CALL_PHONE -> {
46 | Toast.makeText(applicationContext, "Cant open dialler without permission",
47 | Toast.LENGTH_SHORT).show()
48 | }
49 | }
50 | }
51 |
52 | }
53 |
54 | }
55 |
56 | private fun openDialerApp() {
57 | val intent = Intent(Intent.ACTION_DIAL)
58 | intent.data = Uri.parse("tel:823389250")
59 | startActivity(intent)
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/ability/co/mz/nahuexample/ActivityFragment.kt:
--------------------------------------------------------------------------------
1 | package ability.co.mz.nahuexample
2 |
3 | import ability.co.mz.nahu.handlePermissionsResult
4 | import ability.co.mz.nahu.requestNahuPermissions
5 | import android.Manifest
6 | import android.content.Intent
7 | import android.net.Uri
8 | import android.os.Bundle
9 | import android.support.v4.app.Fragment
10 | import android.view.LayoutInflater
11 | import android.view.View
12 | import android.view.ViewGroup
13 | import android.widget.Button
14 | import android.widget.Toast
15 |
16 | /**
17 | * A placeholder fragment containing a simple view.
18 | */
19 | class ActivityFragment : Fragment() {
20 |
21 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
22 | savedInstanceState: Bundle?): View? {
23 | val fragmentView = inflater.inflate(R.layout.fragment_fragmented, container, false)
24 | val openDialer = fragmentView.findViewById