diff --git a/QRWhatsAppContact/.gitignore b/QRWhatsAppContact/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/QRWhatsAppContact/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/QRWhatsAppContact/.idea/codeStyles/Project.xml b/QRWhatsAppContact/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..88ea3aa --- /dev/null +++ b/QRWhatsAppContact/.idea/codeStyles/Project.xml @@ -0,0 +1,122 @@ + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+ + +
+
\ No newline at end of file diff --git a/QRWhatsAppContact/.idea/codeStyles/codeStyleConfig.xml b/QRWhatsAppContact/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/QRWhatsAppContact/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/dictionaries/kandy.xml b/QRWhatsAppContact/.idea/dictionaries/kandy.xml new file mode 100644 index 0000000..b37922e --- /dev/null +++ b/QRWhatsAppContact/.idea/dictionaries/kandy.xml @@ -0,0 +1,7 @@ + + + + zxing + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/gradle.xml b/QRWhatsAppContact/.idea/gradle.xml new file mode 100644 index 0000000..ac6b0ae --- /dev/null +++ b/QRWhatsAppContact/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/jarRepositories.xml b/QRWhatsAppContact/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/QRWhatsAppContact/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/misc.xml b/QRWhatsAppContact/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/QRWhatsAppContact/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/render.experimental.xml b/QRWhatsAppContact/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/QRWhatsAppContact/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/.idea/runConfigurations.xml b/QRWhatsAppContact/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/QRWhatsAppContact/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/app/.gitignore b/QRWhatsAppContact/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/QRWhatsAppContact/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/QRWhatsAppContact/app/build.gradle b/QRWhatsAppContact/app/build.gradle new file mode 100644 index 0000000..df6c861 --- /dev/null +++ b/QRWhatsAppContact/app/build.gradle @@ -0,0 +1,42 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + + defaultConfig { + applicationId "com.kandy.qrwhatsappcontact" + minSdkVersion 19 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + multiDexEnabled true + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + + implementation 'com.journeyapps:zxing-android-embedded:3.6.0' + implementation 'com.google.zxing:core:3.4.0' + implementation 'com.google.zxing:javase:3.3.0' + implementation 'com.android.support:multidex:1.0.3' + +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/proguard-rules.pro b/QRWhatsAppContact/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/QRWhatsAppContact/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/androidTest/java/com/kandy/qrwhatsappcontact/ExampleInstrumentedTest.kt b/QRWhatsAppContact/app/src/androidTest/java/com/kandy/qrwhatsappcontact/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..6c4430d --- /dev/null +++ b/QRWhatsAppContact/app/src/androidTest/java/com/kandy/qrwhatsappcontact/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.kandy.qrwhatsappcontact + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.kandy.qrwhatsappcontact", appContext.packageName) + } +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/AndroidManifest.xml b/QRWhatsAppContact/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..de8faff --- /dev/null +++ b/QRWhatsAppContact/app/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/KtApplication.kt b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/KtApplication.kt new file mode 100644 index 0000000..81fc71e --- /dev/null +++ b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/KtApplication.kt @@ -0,0 +1,9 @@ +package com.kandy.qrwhatsappcontact + +import androidx.multidex.MultiDexApplication + +class KtApplication: MultiDexApplication() { + override fun onCreate() { + super.onCreate() + } +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/MainActivity.kt b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/MainActivity.kt new file mode 100644 index 0000000..91b943e --- /dev/null +++ b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/MainActivity.kt @@ -0,0 +1,133 @@ +package com.kandy.qrwhatsappcontact +import android.content.DialogInterface +import android.content.Intent +import android.content.pm.PackageManager +import android.net.Uri +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.provider.Settings +import android.widget.Button +import androidx.appcompat.app.AlertDialog +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat + +class MainActivity : AppCompatActivity() { + private val PERMISSIONS_REQUEST_CODE = 23 + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val scanContact: Button = findViewById(R.id.scan_contact_btn) + val selectContact: Button = findViewById(R.id.select_contact_btn) + val requestPermission: Button = findViewById(R.id.request_permissions_btn) + + scanContact.setOnClickListener { + val scanIntent = Intent(this, ScanContactDetails::class.java) + startActivity(scanIntent) + } + + requestPermission.setOnClickListener { + setupPermissions() + } + + selectContact.setOnClickListener { + val selectContactIntent = Intent(this, SelectContact::class.java) + startActivity(selectContactIntent) + } + } + + private fun setupPermissions() { + val neededPermissions = mutableListOf() + val permissionsToCheck = listOf(android.Manifest.permission.CAMERA,android.Manifest.permission.READ_CONTACTS,android.Manifest.permission.WRITE_CONTACTS,android.Manifest.permission.WRITE_EXTERNAL_STORAGE,android.Manifest.permission.READ_EXTERNAL_STORAGE) + + permissionsToCheck.forEach { + if(ContextCompat.checkSelfPermission(this,it) != PackageManager.PERMISSION_GRANTED) { + neededPermissions.add(it) + } + } + + if(neededPermissions.isNotEmpty()) { + ActivityCompat.requestPermissions(this, + neededPermissions.toTypedArray(),PERMISSIONS_REQUEST_CODE) + } + } + + + override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) + if(requestCode == PERMISSIONS_REQUEST_CODE) { + val permissionResults = HashMap() + var deniedCount = 0 + + for(i in grantResults.indices) { + if(grantResults[i] == PackageManager.PERMISSION_DENIED) { + permissionResults[permissions[i]] = grantResults[i] + deniedCount++ + } + } + + if(deniedCount==0) { + return + } + + else { + for(entry in permissionResults.entries) { + val permName = entry.key + val permResult = entry.value + + if(ActivityCompat.shouldShowRequestPermissionRationale(this,permName)) { + showPermissionDialog("","This app needs Camera, Contacts and External Storage permissions to work without problems","Yes, Grant Permissions", + DialogInterface.OnClickListener { + dialog, _ -> + dialog.dismiss() + setupPermissions() + },"No, Exit App", + DialogInterface.OnClickListener{ + dialog, _ -> + dialog.dismiss() + finish() + },false) + } + + else { + showPermissionDialog("", + "You have denied some permissions. Allow all permissions in Settings", + "Go to Settings", + DialogInterface.OnClickListener { + dialog, _ -> + dialog.dismiss() + + val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, + Uri.fromParts("package",packageName,null)) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + startActivity(intent) + finish() + }, + "No, Exit App", + DialogInterface.OnClickListener { + dialog, _ -> + dialog.dismiss() + finish() + }, + false + ) + break + } + } + } + } + } + + private fun showPermissionDialog(title:String, msg:String, positiveLabel:String, positiveOnClick:DialogInterface.OnClickListener, negativeLabel:String, negativeOnClick:DialogInterface.OnClickListener, isCancelAble:Boolean): AlertDialog{ + val builder = AlertDialog.Builder(this) + builder.setTitle(title) + builder.setCancelable(isCancelAble) + builder.setMessage(msg) + builder.setPositiveButton(positiveLabel, positiveOnClick) + builder.setNegativeButton(negativeLabel, negativeOnClick) + + val alert = builder.create() + alert.show() + return alert + } +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/ScanContactDetails.kt b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/ScanContactDetails.kt new file mode 100644 index 0000000..e2c5672 --- /dev/null +++ b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/ScanContactDetails.kt @@ -0,0 +1,138 @@ +package com.kandy.qrwhatsappcontact + +import android.app.Activity +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.provider.ContactsContract +import android.provider.MediaStore +import android.util.Log +import android.widget.Button +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import com.google.zxing.BinaryBitmap +import com.google.zxing.RGBLuminanceSource +import com.google.zxing.ResultPoint +import com.google.zxing.common.HybridBinarizer +import com.google.zxing.qrcode.QRCodeReader +import com.journeyapps.barcodescanner.BarcodeCallback +import com.journeyapps.barcodescanner.BarcodeResult +import com.journeyapps.barcodescanner.CaptureManager +import com.journeyapps.barcodescanner.DecoratedBarcodeView +import kotlinx.android.synthetic.main.scan_contact_details.* + +class ScanContactDetails: AppCompatActivity() { + lateinit var captureManager: CaptureManager + var torchState: Boolean = false + private val IMAGE_PICK_CODE = 2 + private val ADD_CONTACT_CODE = 11 + private var scannedData = "" + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.scan_contact_details) + + val scanButton: Button = findViewById(R.id.btnScan) + val textResult: TextView = findViewById(R.id.txtResult) + val barcodeView: DecoratedBarcodeView = findViewById(R.id.barcodeView) + val torchButton: Button = findViewById(R.id.btnTorch) + val scanImage:Button = findViewById(R.id.scan_image_btn) + + captureManager = CaptureManager(this,barcodeView) + captureManager.initializeFromIntent(intent, savedInstanceState) + + scanButton.setOnClickListener { + textResult.text = "Scanning..." + barcodeView.decodeSingle(object: BarcodeCallback{ + override fun barcodeResult(result: BarcodeResult?) { + result?.let { + scannedData = it.text + txtResult.text = it.text + saveContact() + } + } + + override fun possibleResultPoints(resultPoints: MutableList?) { + + } + }) + } + + torchButton.setOnClickListener { + if(torchState) { + torchState = false + barcodeView.setTorchOff() + } else { + torchState = true + barcodeView.setTorchOn() + } + } + + scanImage.setOnClickListener { + selectImage() + } + } + + override fun onPause() { + super.onPause() + captureManager.onPause() + } + + override fun onResume() { + super.onResume() + captureManager.onResume() + } + + override fun onDestroy() { + super.onDestroy() + captureManager.onDestroy() + } + + private fun selectImage() { + val intent = Intent(Intent.ACTION_PICK) + intent.type = "image/*" + startActivityForResult(intent,IMAGE_PICK_CODE) + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + if(requestCode == IMAGE_PICK_CODE && resultCode == Activity.RESULT_OK) { + data?.let { + decodeQRCodeImage(it.data) + } + } else if(requestCode == ADD_CONTACT_CODE) { + if(resultCode == Activity.RESULT_CANCELED) { + Toast.makeText(this,"Cancelled Added Contact",Toast.LENGTH_SHORT).show() + } + } + } + + private fun decodeQRCodeImage(imageUri: Uri?){ + val qrCodeReader = QRCodeReader() + + val bitmapImage = MediaStore.Images.Media.getBitmap(this.contentResolver,imageUri) + val pixels = IntArray(bitmapImage.width*bitmapImage.height) + bitmapImage.getPixels(pixels, 0, bitmapImage.width, 0, 0, bitmapImage.width,bitmapImage.height) + + val rawResult = qrCodeReader.decode(BinaryBitmap(HybridBinarizer(RGBLuminanceSource(bitmapImage.width,bitmapImage.height,pixels)))) + scannedData = rawResult.toString() + Log.d("Decoded Data", rawResult.toString()) + saveContact() + } + + fun saveContact() { + val data = scannedData.split(";") + val name = data[0] + val number = data[1] + val email = data[2] + + Log.d("Data in save contact:","$name;$number;$email") + + val saveContactIntent = Intent(ContactsContract.Intents.Insert.ACTION) + saveContactIntent.type = ContactsContract.RawContacts.CONTENT_TYPE + saveContactIntent.putExtra(ContactsContract.Intents.Insert.NAME,name) + saveContactIntent.putExtra(ContactsContract.Intents.Insert.PHONE,number) + saveContactIntent.putExtra(ContactsContract.Intents.Insert.EMAIL,email) + startActivityForResult(saveContactIntent,ADD_CONTACT_CODE) + } +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/SelectContact.kt b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/SelectContact.kt new file mode 100644 index 0000000..f26dcc5 --- /dev/null +++ b/QRWhatsAppContact/app/src/main/java/com/kandy/qrwhatsappcontact/SelectContact.kt @@ -0,0 +1,151 @@ +package com.kandy.qrwhatsappcontact + +import android.app.Activity +import android.content.Context +import android.content.Intent +import android.database.Cursor +import android.graphics.Bitmap +import android.graphics.Color +import android.net.Uri +import android.os.Bundle +import android.os.Environment +import android.os.PersistableBundle +import android.provider.ContactsContract +import android.util.Log +import android.widget.Button +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.FileProvider +import androidx.core.content.FileProvider.getUriForFile +import com.google.zxing.BarcodeFormat +import com.google.zxing.qrcode.QRCodeWriter +import java.io.File +import java.io.FileOutputStream +import java.nio.file.Files +import java.nio.file.Paths + +class SelectContact: AppCompatActivity() { + private val SELECT_PHONE_NUMBER = 1 + private lateinit var contactState:TextView + private lateinit var qrContact:ImageView + private lateinit var shareContact: Button + private lateinit var saveQrContact:Button + private var qrCreated = false + private var tempImagePath="" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.select_contact) + + contactState = findViewById(R.id.contactState_txt_view) + qrContact = findViewById(R.id.qr_contact_img_view) + shareContact = findViewById(R.id.share_qr_btn) + saveQrContact = findViewById(R.id.save_qr_contact_btn) + + val contactPickerIntent = Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI) + contactPickerIntent.type = ContactsContract.Contacts.CONTENT_TYPE + startActivityForResult(contactPickerIntent,SELECT_PHONE_NUMBER) + + shareContact.setOnClickListener { + if(!qrCreated) { + Toast.makeText(this,"No QR Contact has been created",Toast.LENGTH_LONG).show() + } else { + val imageFile = File(tempImagePath) + val imageUri = getUriForFile(this,"com.kandy.qrwhatsappcontact.fileprovider",imageFile) + val sendContactIntent = Intent().apply { + this.action = Intent.ACTION_SEND + this.putExtra(Intent.EXTRA_STREAM, imageUri) + this.type = "image/png" + } + val shareIntent = Intent.createChooser(sendContactIntent,null) + startActivity(shareIntent) + } + } + + saveQrContact.setOnClickListener{ + val qrImage = File(tempImagePath) + val imageBytes = qrImage.readBytes() + + val filePath = "${Environment.getExternalStorageDirectory().path}/Download" + val externalImageFile = File(filePath ,"temp.png") + + Log.d("External File Path:",externalImageFile.absolutePath) + FileOutputStream(externalImageFile).use { + it.write(imageBytes) + } + Toast.makeText(this,"Qr Contact has been saved in Downloads",Toast.LENGTH_LONG).show() + } + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + contactState.text = "Reading Contact Details" + var number = ""; + var name = ""; + var email = ""; + qrCreated = false; + if(requestCode == SELECT_PHONE_NUMBER && resultCode == Activity.RESULT_OK) { + val contactUri: Uri = data?.data ?: return + val c: Cursor? = contentResolver.query(contactUri,null,null,null,null) + c.let { it -> + if(it != null) { + it.moveToFirst() + val contactId = it.getString(it.getColumnIndex(ContactsContract.Contacts._ID)) + + val phoneDataCursor: Cursor? = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null) + val emailDataCursor: Cursor? = contentResolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null) + + phoneDataCursor.let { + if(it != null) { + it.moveToFirst() + number = it.getString(it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)) + name = it.getString(it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)) + it.close() + } + } + + phoneDataCursor?.close() + + emailDataCursor.let { + if(it != null) { + it.moveToFirst() + email = it.getString(it.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS)) + } + } + emailDataCursor?.close() + } + } + c?.close() + } + + if(number.isEmpty()) { + contactState.text = "No Contacts Found" + } else { + val content = "$name;$number;$email" + val writer = QRCodeWriter() + val bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, 256, 256) + + val width = bitMatrix.width + val height = bitMatrix.height + val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565) + for (x in 0 until width) { + for (y in 0 until height) { + bitmap.setPixel(x, y, if (bitMatrix.get(x, y)) Color.BLACK else Color.WHITE) + } + } + + qrContact.setImageBitmap(bitmap) + qrCreated = true + + tempImagePath = filesDir.absolutePath + "/temp.png" + Log.d("Image Path:",tempImagePath) + val qrImage = File(tempImagePath) + val fOut = FileOutputStream(qrImage) + bitmap.compress(Bitmap.CompressFormat.PNG, 85, fOut) + fOut.flush() + fOut.close() + } + } +} \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/QRWhatsAppContact/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/QRWhatsAppContact/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/QRWhatsAppContact/app/src/main/res/drawable/ic_launcher_background.xml b/QRWhatsAppContact/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/QRWhatsAppContact/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QRWhatsAppContact/app/src/main/res/layout/activity_main.xml b/QRWhatsAppContact/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..b21db6e --- /dev/null +++ b/QRWhatsAppContact/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,41 @@ + + + +