Skip to content

Commit

Permalink
Removed the permissions for call_phone. Its not important for the dem…
Browse files Browse the repository at this point in the history
…o activity
  • Loading branch information
vansikrishna committed Sep 14, 2017
1 parent 4e95c81 commit 8086bd3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 67 deletions.
8 changes: 4 additions & 4 deletions example/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
applicationId "com.vlk.multimager.example"
minSdkVersion 15
targetSdkVersion 24
targetSdkVersion 26
versionCode 5
versionName "1.0.4"

Expand All @@ -34,7 +34,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:appcompat-v7:26.+'
compile('com.github.QuadFlask:colorpicker:0.0.10@aar') {
transitive = true;
}
Expand Down
@@ -1,13 +1,10 @@
package com.vlk.multimager.example;

import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
Expand All @@ -18,7 +15,6 @@
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.flask.colorpicker.ColorPickerView;
import com.flask.colorpicker.OnColorSelectedListener;
Expand Down Expand Up @@ -124,7 +120,7 @@ private void handleResponseIntent(Intent intent) {
recyclerView.setAdapter(imageAdapter);
}

@OnClick({R.id.multiCaptureButton, R.id.multiPickerButton, R.id.customThemeButton, R.id.call, R.id.message, R.id.github})
@OnClick({R.id.multiCaptureButton, R.id.multiPickerButton, R.id.customThemeButton, R.id.github})
public void onClick(View view) {
switch (view.getId()) {
case R.id.multiCaptureButton:
Expand All @@ -139,12 +135,6 @@ public void onClick(View view) {
case R.id.customThemeButton:
setCustomTheme();
break;
case R.id.call:
initiateCall();
break;
case R.id.message:
sendMessage();
break;
case R.id.github:
navigateToUrl();
break;
Expand All @@ -155,47 +145,6 @@ private void navigateToUrl() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/vansikrishna/Multimager.git")));
}

private void sendMessage() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", "+918106064137", "Hello, I am very much pleased with the Multimager sample app posted on Github. Thank you.")));
}

private void initiateCall() {
if (hasCallPermission(this)) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + "+918106064137"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
startActivity(intent);
}
else
requestCallPermissions(this, Constants.REQUEST_CALL_PERMS);
}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case Constants.REQUEST_CALL_PERMS:
if (validateGrantedPermissions(grantResults)) {
initiateCall();
} else {
Toast.makeText(this, "Permissions not granted.", Toast.LENGTH_LONG).show();
}
break;
default: {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}

private void setCustomTheme() {
ColorPickerDialogBuilder
.with(this)
Expand Down
3 changes: 2 additions & 1 deletion example/src/main/res/layout/activity_sample.xml
Expand Up @@ -82,7 +82,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_5"
android:orientation="horizontal"
android:gravity="center">
android:gravity="center"
android:visibility="gone">
<ImageView
android:id="@+id/call"
android:layout_width="wrap_content"
Expand Down
18 changes: 9 additions & 9 deletions lib/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 7
versionName "1.0.6"
targetSdkVersion 26
versionCode 8
versionName "1.0.7"
}
buildTypes {
release {
Expand All @@ -25,8 +25,8 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v13:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-annotations:24.2.1'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:support-v13:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-annotations:26.+'
}
1 change: 0 additions & 1 deletion lib/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vlk.multimager">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
Expand Down

0 comments on commit 8086bd3

Please sign in to comment.