diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 40cd348..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - namespace 'com.example.convertor' - compileSdk 33 - - defaultConfig { - applicationId "com.example.convertor" - minSdk 19 - targetSdk 33 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - implementation 'com.itextpdf:itextpdf:5.5.13.2' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.9.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' -} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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/app/src/androidTest/java/com/example/convertor/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/convertor/ExampleInstrumentedTest.java deleted file mode 100644 index e718ac0..0000000 --- a/app/src/androidTest/java/com/example/convertor/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.convertor; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.example.convertor", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index ede5653..0000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/example/convertor/MainActivity.java b/app/src/main/java/com/example/convertor/MainActivity.java deleted file mode 100644 index b871e64..0000000 --- a/app/src/main/java/com/example/convertor/MainActivity.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.example.convertor; - -import android.Manifest; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.graphics.Bitmap; -import android.graphics.pdf.PdfDocument; -import android.net.Uri; -import android.os.Bundle; -import android.os.Environment; -import android.provider.MediaStore; -import android.util.Log; -import android.view.View; -import android.widget.Button; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public class MainActivity extends AppCompatActivity { - - private static final int REQUEST_CODE_PERMISSION = 100; - private static final int REQUEST_CODE_PICK_IMAGES = 101; - - private List selectedImages = new ArrayList<>(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - Button btnSelectImages = findViewById(R.id.btnSelectImages); - btnSelectImages.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - checkAndRequestPermission(); - } - }); - - Button btnConvertToPDF = findViewById(R.id.btnConvertAndDownload); - btnConvertToPDF.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - convertToPDF(); - } - }); - } - - private void checkAndRequestPermission() { - if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) - != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(this, - new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, - REQUEST_CODE_PERMISSION); - } else { - pickImages(); - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, - @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - if (requestCode == REQUEST_CODE_PERMISSION) { - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - pickImages(); - } else { - Log.e("Permission", "Permission denied"); - } - } - } - - private void pickImages() { - Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); - intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); - intent.setType("image/*"); - startActivityForResult(Intent.createChooser(intent, "Select Images"), REQUEST_CODE_PICK_IMAGES); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (requestCode == REQUEST_CODE_PICK_IMAGES && resultCode == RESULT_OK && data != null) { - selectedImages.clear(); - - if (data.getClipData() != null) { - int count = data.getClipData().getItemCount(); - for (int i = 0; i < count; i++) { - Uri imageUri = data.getClipData().getItemAt(i).getUri(); - selectedImages.add(imageUri); - } - } else if (data.getData() != null) { - Uri imageUri = data.getData(); - selectedImages.add(imageUri); - } - } - } - - private void convertToPDF() { - if (selectedImages.isEmpty()) { - Log.e("Conversion", "No images selected"); - return; - } - - PdfDocument pdfDocument = new PdfDocument(); - for (Uri imageUri : selectedImages) { - try { - Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri); - PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(bitmap.getWidth(), bitmap.getHeight(), 1).create(); - PdfDocument.Page page = pdfDocument.startPage(pageInfo); - page.getCanvas().drawBitmap(bitmap, 0, 0, null); - pdfDocument.finishPage(page); - } catch (IOException e) { - e.printStackTrace(); - } - } - - File pdfFile = new File(Environment.getExternalStorageDirectory(), "images.pdf"); - try { - pdfDocument.writeTo(new FileOutputStream(pdfFile)); - pdfDocument.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - // Open the PDF file using an intent - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(pdfFile), "application/pdf"); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); - startActivity(intent); - } -} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 24cf46e..0000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - -