Ver Fonte

完成基本UI,暂未完成交互,编写暂未实现功能效果的自定义水印控件

dengyujia há 2 anos atrás
pai
commit
767b043689
61 ficheiros alterados com 1693 adições e 0 exclusões
  1. 6 0
      .gitignore
  2. 3 0
      .idea/.gitignore
  3. 6 0
      .idea/compiler.xml
  4. 17 0
      .idea/deploymentTargetDropDown.xml
  5. 19 0
      .idea/gradle.xml
  6. 10 0
      .idea/misc.xml
  7. 1 0
      app/.gitignore
  8. 42 0
      app/build.gradle
  9. 21 0
      app/proguard-rules.pro
  10. 43 0
      app/src/main/AndroidManifest.xml
  11. 141 0
      app/src/main/java/com/compdfkit/pdfviewer/MainActivity.java
  12. 4 0
      app/src/main/java/com/compdfkit/pdfviewer/builder/WatermarkBuilder.java
  13. 69 0
      app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkView.java
  14. 94 0
      app/src/main/java/com/compdfkit/pdfviewer/fragments/WatermarkConsoleFragment.java
  15. 30 0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  16. 4 0
      app/src/main/res/drawable/circle.xml
  17. 5 0
      app/src/main/res/drawable/ic_baseline_circle1_24.xml
  18. 5 0
      app/src/main/res/drawable/ic_baseline_circle2_24.xml
  19. 5 0
      app/src/main/res/drawable/ic_baseline_circle3_24.xml
  20. 5 0
      app/src/main/res/drawable/ic_baseline_circle4_24.xml
  21. 5 0
      app/src/main/res/drawable/ic_baseline_circle5_24.xml
  22. 5 0
      app/src/main/res/drawable/ic_baseline_circle6_24.xml
  23. 5 0
      app/src/main/res/drawable/ic_baseline_circle7_24.xml
  24. 5 0
      app/src/main/res/drawable/ic_baseline_format_size_20.xml
  25. 5 0
      app/src/main/res/drawable/ic_baseline_opacity_20.xml
  26. 170 0
      app/src/main/res/drawable/ic_launcher_background.xml
  27. 5 0
      app/src/main/res/drawable/ic_white_roll_15.xml
  28. 21 0
      app/src/main/res/drawable/pdf.xml
  29. 6 0
      app/src/main/res/drawable/watermark_handle_shape.xml
  30. 9 0
      app/src/main/res/drawable/watermark_shape.xml
  31. 81 0
      app/src/main/res/layout/activity_main.xml
  32. 335 0
      app/src/main/res/layout/fragment_watermark_console.xml
  33. 33 0
      app/src/main/res/layout/watermark_image_view.xml
  34. 34 0
      app/src/main/res/layout/watermark_text_view.xml
  35. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  36. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  37. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.webp
  38. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
  39. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.webp
  40. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
  41. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.webp
  42. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
  43. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
  44. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
  45. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
  46. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
  47. 16 0
      app/src/main/res/values-night/themes.xml
  48. 10 0
      app/src/main/res/values/attrs.xml
  49. 10 0
      app/src/main/res/values/colors.xml
  50. 16 0
      app/src/main/res/values/strings.xml
  51. 11 0
      app/src/main/res/values/styles.xml
  52. 17 0
      app/src/main/res/values/themes.xml
  53. 13 0
      app/src/main/res/xml/backup_rules.xml
  54. 19 0
      app/src/main/res/xml/data_extraction_rules.xml
  55. 5 0
      build.gradle
  56. 21 0
      gradle.properties
  57. BIN
      gradle/wrapper/gradle-wrapper.jar
  58. 6 0
      gradle/wrapper/gradle-wrapper.properties
  59. 185 0
      gradlew
  60. 89 0
      gradlew.bat
  61. 16 0
      settings.gradle

+ 6 - 0
.gitignore

@@ -7,6 +7,12 @@
 /.idea/workspace.xml
 /.idea/navEditor.xml
 /.idea/assetWizardSettings.xml
+
+/app/libs
+
+/app/src/androidTest
+/app/src/test
+
 .DS_Store
 /build
 /captures

+ 3 - 0
.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

+ 6 - 0
.idea/compiler.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="11" />
+  </component>
+</project>

+ 17 - 0
.idea/deploymentTargetDropDown.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="deploymentTargetDropDown">
+    <targetSelectedWithDropDown>
+      <Target>
+        <type value="QUICK_BOOT_TARGET" />
+        <deviceKey>
+          <Key>
+            <type value="VIRTUAL_DEVICE_PATH" />
+            <value value="C:\Users\KAD\.android\avd\Pixel_6_Pro_API_33.avd" />
+          </Key>
+        </deviceKey>
+      </Target>
+    </targetSelectedWithDropDown>
+    <timeTargetWasSelectedWithDropDown value="2022-11-16T12:08:26.803971100Z" />
+  </component>
+</project>

+ 19 - 0
.idea/gradle.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleMigrationSettings" migrationVersion="1" />
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <option name="testRunner" value="GRADLE" />
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="modules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/app" />
+          </set>
+        </option>
+      </GradleProjectSettings>
+    </option>
+  </component>
+</project>

+ 10 - 0
.idea/misc.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+  <component name="ProjectType">
+    <option name="id" value="Android" />
+  </component>
+</project>

+ 1 - 0
app/.gitignore

@@ -0,0 +1 @@
+/build

+ 42 - 0
app/build.gradle

@@ -0,0 +1,42 @@
+plugins {
+    id 'com.android.application'
+}
+
+android {
+    namespace 'com.compdfkit.pdfviewer'
+    compileSdk 32
+
+    defaultConfig {
+        applicationId "com.compdfkit.pdfviewer"
+        minSdk 21
+        targetSdk 32
+        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(fileTree('libs'))
+
+    implementation 'com.github.bumptech.glide:glide:4.12.0'
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
+    implementation 'androidx.appcompat:appcompat:1.5.1'
+    implementation 'com.google.android.material:material:1.7.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+    testImplementation 'junit:junit:4.13.2'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+}

+ 21 - 0
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

+ 43 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
+        tools:ignore="ScopedStorage" />
+
+    <application
+        android:allowBackup="true"
+        android:dataExtractionRules="@xml/data_extraction_rules"
+        android:fullBackupContent="@xml/backup_rules"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/Theme.PDFViewer"
+        tools:targetApi="31">
+        <activity
+            android:name=".MainActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+
+            <meta-data
+                android:name="android.app.lib_name"
+                android:value="" />
+        </activity>
+
+        <meta-data
+            android:name="compdfkit_license"
+            android:value="MHUXhZDGz8kJqmOW74zJ6swRHk6hZgRFj+c8srJgMrVcAd1zhn7Idg4HlQ/aZtFemhq/UOJMXOoOoBGQaGWls0f1kmBaUvD4bEIe6MXAzTujHtN/cN40FYvJJIo6iOko3YdV3LGdfEfpFKl98UOC+uRM27bnknWlplNR4BS2XOk=" />
+
+        <meta-data
+            android:name="compdfkit_message"
+            android:value="mG0c3O3Mzeu5dkZJW3gpqotjgd+APU/4fMqIHQR4gdwQurxTxGuBlGAhs0P1mD3XKqvsLa4npVLfI/mo45dkJ5QFcNndGDskT70Jc2iwVo5hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6ccsvUiEnSpVC16x66CLYBR9nL4G5ayY1Yw9IbVniEuzaCCVg1bqAdLSXAjS4mxI/QshmpPEP0qS8yPf877NfXnm6gW/UFOMJ5eWQQ5IO+aCVQ==" />
+    </application>
+
+</manifest>

+ 141 - 0
app/src/main/java/com/compdfkit/pdfviewer/MainActivity.java

@@ -0,0 +1,141 @@
+package com.compdfkit.pdfviewer;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.core.graphics.drawable.DrawableCompat;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.Settings;
+import android.widget.Toast;
+
+import com.compdfkit.core.document.CPDFDocument;
+import com.compdfkit.core.utils.ColorUtils;
+import com.compdfkit.core.watermark.CPDFImageWatermark;
+import com.compdfkit.core.watermark.CPDFTextWatermark;
+import com.compdfkit.core.watermark.CPDFWatermark;
+import com.compdfkit.ui.reader.CPDFReaderView;
+
+import java.io.File;
+
+public class MainActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+//        if (!(Build.VERSION.SDK_INT < Build.VERSION_CODES.R || Environment.isExternalStorageManager())) {
+//            Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
+//            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+//            startActivity(intent);
+//        }
+
+        File PDFFile = new File("/storage/emulated/0/TestPDFs/01.pdf");
+        Uri PDFUri = Uri.fromFile(PDFFile);
+
+        CPDFDocument document = new CPDFDocument(this);
+        CPDFDocument.PDFDocumentError error = document.open(PDFFile.getAbsolutePath());
+
+        CPDFReaderView readerView;
+        readerView = (CPDFReaderView) findViewById(R.id.pdf_view);
+
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            error = document.open(PDFUri, "password");
+        } else if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
+            Toast.makeText(this, "File:" + document.getFileName() + " open success.", Toast.LENGTH_SHORT).show();
+        } else {
+            Toast.makeText(this, "File failed.", Toast.LENGTH_SHORT).show();
+        }
+
+        readerView.setPDFDocument(document);
+        readerView.setVerticalMode(true);
+        readerView.setDoublePageMode(false);
+
+        int watermarkIndex = 0;
+        CPDFWatermark watermark = null;
+
+        try {
+            watermark = document.getWatermark(watermarkIndex);
+            if (watermark != null)
+                watermark.clear();
+        } finally {
+            if (watermark != null && watermark.isValid()) {
+                watermark.release();
+            }
+        }
+
+        Drawable drawable = ContextCompat.getDrawable(this, R.drawable.pdf);
+
+        CPDFImageWatermark imgWatermark = (CPDFImageWatermark)
+                document.createWatermark(CPDFWatermark.Type.WATERMARK_TYPE_IMG);
+
+        assert drawable != null;
+        Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(bitmap);
+        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+        drawable.draw(canvas);
+
+        try {
+            if (imgWatermark != null && imgWatermark.isValid()) {
+                imgWatermark.setText("RA"); //设置文本
+                imgWatermark.setFontName("Helvetica"); //设置字体
+                imgWatermark.setImage(bitmap, 100, 100);
+                imgWatermark.setTextRGBColor(ColorUtils.parseColor(new int[] { 102, 204, 255 }));
+                imgWatermark.setOpacity(0.5f);
+                imgWatermark.setRotation(0.785f);
+                imgWatermark.setFontSize(100);
+                imgWatermark.setFront(false);
+                imgWatermark.setVertalign(CPDFWatermark.Vertalign.WATERMARK_VERTALIGN_CENTER);
+                imgWatermark.setHorizalign(CPDFWatermark.Horizalign.WATERMARK_HORIZALIGN_CENTER);
+                imgWatermark.setVertOffset(0);
+                imgWatermark.setHorizOffset(0);
+                imgWatermark.setScale(0.2f);
+                imgWatermark.setPages("1,3-5");
+                imgWatermark.setFullScreen(true);
+                imgWatermark.setHorizontalSpacing(100);
+                imgWatermark.setVerticalSpacing(100);
+                imgWatermark.update();
+            }
+        } finally {
+            if (imgWatermark != null && imgWatermark.isValid()) {
+                imgWatermark.release();
+            }
+        }
+
+//        CPDFTextWatermark textWatermark = (CPDFTextWatermark)
+//                document.createWatermark(CPDFWatermark.Type.WATERMARK_TYPE_TEXT);
+//        try {
+//            if (textWatermark != null && textWatermark.isValid()) {
+//                textWatermark.setText("RA"); //设置文本
+//                textWatermark.setFontName("Helvetica"); //设置字体
+//                textWatermark.setTextRGBColor(ColorUtils.parseColor(new int[] { 102, 204, 255 }));
+//                textWatermark.setOpacity(1f);
+//                textWatermark.setFontSize(100);
+//                textWatermark.setFront(false);
+//                textWatermark.setVertalign(CPDFWatermark.Vertalign.WATERMARK_VERTALIGN_CENTER);
+//                textWatermark.setHorizalign(CPDFWatermark.Horizalign.WATERMARK_HORIZALIGN_CENTER);
+//                textWatermark.setVertOffset(0);
+//                textWatermark.setHorizOffset(0);
+//                textWatermark.setScale(1.0f);
+//                textWatermark.setPages("1,3-5");
+//                textWatermark.setFullScreen(true);
+//                textWatermark.setHorizontalSpacing(10);
+//                textWatermark.setVerticalSpacing(10);
+//                textWatermark.update();
+//            }
+//        } finally {
+//            if (textWatermark != null && textWatermark.isValid()) {
+//                textWatermark.release();
+//            }
+//        }
+    }
+}

+ 4 - 0
app/src/main/java/com/compdfkit/pdfviewer/builder/WatermarkBuilder.java

@@ -0,0 +1,4 @@
+package com.compdfkit.pdfviewer.builder;
+
+public class WatermarkBuilder {
+}

+ 69 - 0
app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkView.java

@@ -0,0 +1,69 @@
+package com.compdfkit.pdfviewer.customview;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageButton;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+import com.compdfkit.pdfviewer.R;
+
+public class WatermarkView extends ConstraintLayout {
+    private Context currentContext;
+    private LayoutInflater inflater;
+    private View currentView;
+
+    private ImageButton rollingHandle;
+
+    private boolean imageMode = false;
+
+    public WatermarkView(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public WatermarkView(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public WatermarkView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public WatermarkView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        init(context, attrs);
+    }
+
+    private void init(Context context, AttributeSet attrs) {
+        currentContext = context;
+        inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        TypedArray attribute = currentContext.obtainStyledAttributes(attrs, R.styleable.WatermarkView);
+        imageMode = attribute.getBoolean(R.styleable.WatermarkView_image_mode, false);
+
+        setImageMode(imageMode);
+    }
+
+    public void setImageMode(@NonNull Boolean isImageMode) {
+        if (isImageMode) {
+            currentView = inflater.inflate(R.layout.watermark_image_view, this, true);
+        } else {
+            currentView = inflater.inflate(R.layout.watermark_text_view, this, true);
+        }
+        Log.d("WatermarkView", "Current watermark mode: " + imageMode);
+        rollingHandle = currentView.findViewById(R.id.watermark_handle);
+
+        rollingHandle.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+            }
+        });
+    }
+}

+ 94 - 0
app/src/main/java/com/compdfkit/pdfviewer/fragments/WatermarkConsoleFragment.java

@@ -0,0 +1,94 @@
+package com.compdfkit.pdfviewer.fragments;
+
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.SeekBar;
+import android.widget.Spinner;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import com.compdfkit.pdfviewer.R;
+import com.google.android.material.textfield.TextInputEditText;
+
+public class WatermarkConsoleFragment extends Fragment {
+
+    private View colorPicker;
+    private View imagePicker;
+
+    private SeekBar opacitySlider;
+    private SeekBar sizeSlider;
+
+    private TextView opacityText;
+    private TextView sizeText;
+
+    private Spinner rangeSpinner;
+
+    private CheckBox fullScreenCheck;
+
+    private TextInputEditText hSpaceEdit;
+    private TextInputEditText vSpaceEdit;
+
+    private static final String ARG_PARAM1 = "param1";
+    private static final String ARG_PARAM2 = "param2";
+
+    private String mParam1;
+    private String mParam2;
+
+    public WatermarkConsoleFragment() {
+        // Required empty public constructor
+    }
+
+    public static WatermarkConsoleFragment newInstance(String param1, String param2) {
+        WatermarkConsoleFragment fragment = new WatermarkConsoleFragment();
+        Bundle args = new Bundle();
+        args.putString(ARG_PARAM1, param1);
+        args.putString(ARG_PARAM2, param2);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (getArguments() != null) {
+            mParam1 = getArguments().getString(ARG_PARAM1);
+            mParam2 = getArguments().getString(ARG_PARAM2);
+        }
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
+        View returnView = inflater.inflate(R.layout.fragment_watermark_console, container, false);
+        InitViews(returnView);
+        return returnView;
+    }
+
+    private void InitViews(View returnView) {
+        colorPicker = returnView.findViewById(R.id.color_picker);
+        imagePicker = returnView.findViewById(R.id.image_picker);
+
+        opacitySlider = returnView.findViewById(R.id.opacity_slider);
+        sizeSlider = returnView.findViewById(R.id.size_slider);
+
+        opacityText = returnView.findViewById(R.id.opacity_text);
+        sizeText = returnView.findViewById(R.id.size_text);
+
+        rangeSpinner = returnView.findViewById(R.id.page_range_spinner);
+
+        fullScreenCheck = returnView.findViewById(R.id.full_screen_checkbox);
+
+        hSpaceEdit = returnView.findViewById(R.id.horizontal_space);
+        vSpaceEdit = returnView.findViewById(R.id.vertical_space);
+    }
+
+    public void ChangePicker(int mode) {
+        colorPicker.setVisibility(mode == 0 ? View.VISIBLE : View.INVISIBLE);
+        imagePicker.setVisibility(mode == 0 ? View.INVISIBLE : View.VISIBLE);
+    }
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 30 - 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml


+ 4 - 0
app/src/main/res/drawable/circle.xml

@@ -0,0 +1,4 @@
+<vector android:height="35dp" android:viewportHeight="1024"
+    android:viewportWidth="1024" android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="#bfbfbf" android:pathData="M512,928c229.8,0 416,-186.2 416,-416S741.8,96 512,96 96,282.2 96,512s186.2,416 416,416zM512,896C299.9,896 128,724.1 128,512S299.9,128 512,128s384,171.9 384,384 -171.9,384 -384,384z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle1_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FF0000"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle2_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FF6600"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle3_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FFDD00"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle4_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#00FF33"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle5_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#00FFFF"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle6_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#0022FF"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_circle7_24.xml

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#8800FF"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_format_size_20.xml

@@ -0,0 +1,5 @@
+<vector android:height="20dp" android:tint="#3C4045"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M9,4v3h5v12h3L17,7h5L22,4L9,4zM3,12h3v7h3v-7h3L12,9L3,9v3z"/>
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_baseline_opacity_20.xml

@@ -0,0 +1,5 @@
+<vector android:height="20dp" android:tint="#3C4045"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M17.66,8L12,2.35 6.34,8C4.78,9.56 4,11.64 4,13.64s0.78,4.11 2.34,5.67 3.61,2.35 5.66,2.35 4.1,-0.79 5.66,-2.35S20,15.64 20,13.64 19.22,9.56 17.66,8zM6,14c0.01,-2 0.62,-3.27 1.76,-4.4L12,5.27l4.24,4.38C17.38,10.77 17.99,12 18,14H6z"/>
+</vector>

+ 170 - 0
app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#3DDC84"
+        android:pathData="M0,0h108v108h-108z" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M9,0L9,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,0L19,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,0L29,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,0L39,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,0L49,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,0L59,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,0L69,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,0L79,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M89,0L89,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M99,0L99,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,9L108,9"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,19L108,19"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,29L108,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,39L108,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,49L108,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,59L108,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,69L108,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,79L108,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,89L108,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,99L108,99"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,29L89,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,39L89,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,49L89,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,59L89,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,69L89,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,79L89,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,19L29,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,19L39,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,19L49,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,19L59,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,19L69,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,19L79,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+</vector>

+ 5 - 0
app/src/main/res/drawable/ic_white_roll_15.xml

@@ -0,0 +1,5 @@
+<vector android:height="15dp" android:tint="#FFFFFF"
+    android:viewportHeight="24" android:viewportWidth="24"
+    android:width="15dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@android:color/white" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
+</vector>

Diff do ficheiro suprimidas por serem muito extensas
+ 21 - 0
app/src/main/res/drawable/pdf.xml


+ 6 - 0
app/src/main/res/drawable/watermark_handle_shape.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+
+    <solid android:color="#66ccff" />
+</shape>

+ 9 - 0
app/src/main/res/drawable/watermark_shape.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <stroke
+        android:width="1dp"
+        android:color="#66ccff" />
+
+</shape>

+ 81 - 0
app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".MainActivity">
+
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="?attr/colorPrimary"
+        android:minHeight="?actionBarSize"
+        android:elevation="4dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:title="Add Watermark"
+        app:titleTextColor="@color/white" />
+
+    <com.google.android.material.tabs.TabLayout
+        android:id="@+id/tab_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:elevation="4dp"
+        android:background="?attr/colorPrimary"
+        app:tabTextAppearance="@style/TabLayoutTextStyle"
+        app:tabIndicatorColor="@color/white"
+        app:tabSelectedTextColor="@color/white"
+        app:tabTextColor="@color/purple_200"
+        app:layout_constraintTop_toBottomOf="@+id/toolbar"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent">
+
+        <com.google.android.material.tabs.TabItem
+            android:id="@+id/text_item"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/text"
+            tools:layout_editor_absoluteX="164dp"
+            tools:layout_editor_absoluteY="52dp" />
+
+        <com.google.android.material.tabs.TabItem
+            android:id="@+id/image_item"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/image"
+            tools:layout_editor_absoluteX="164dp"
+            tools:layout_editor_absoluteY="52dp" />
+
+    </com.google.android.material.tabs.TabLayout>
+
+    <com.compdfkit.ui.reader.CPDFReaderView
+        android:id="@+id/pdf_view"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <com.compdfkit.pdfviewer.customview.WatermarkView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tab_layout"
+        app:image_mode="true" />
+
+    <androidx.fragment.app.FragmentContainerView
+        android:name="com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment"
+        android:id="@+id/console_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 335 - 0
app/src/main/res/layout/fragment_watermark_console.xml

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="10dp"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    tools:context=".fragments.WatermarkConsoleFragment">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/picker"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toTopOf="@+id/opacity_icon"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent" >
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/color_picker"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="8dp"
+            android:visibility="visible"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent" >
+
+            <ImageView
+                android:id="@+id/color_selected"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/circle"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_1"
+                app:layout_constraintStart_toStartOf="parent" />
+
+            <ImageView
+                android:id="@+id/color_1"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle1_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_2"
+                app:layout_constraintStart_toEndOf="@id/color_selected" />
+
+            <ImageView
+                android:id="@+id/color_2"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle2_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_3"
+                app:layout_constraintStart_toEndOf="@id/color_1" />
+
+            <ImageView
+                android:id="@+id/color_3"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle3_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_4"
+                app:layout_constraintStart_toEndOf="@id/color_2" />
+
+            <ImageView
+                android:id="@+id/color_4"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle4_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_5"
+                app:layout_constraintStart_toEndOf="@id/color_3" />
+
+            <ImageView
+                android:id="@+id/color_5"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle5_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_6"
+                app:layout_constraintStart_toEndOf="@id/color_4" />
+
+            <ImageView
+                android:id="@+id/color_6"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle6_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toStartOf="@id/color_7"
+                app:layout_constraintStart_toEndOf="@id/color_5" />
+
+            <ImageView
+                android:id="@+id/color_7"
+                android:layout_width="35dp"
+                android:layout_height="35dp"
+                android:contentDescription="@string/opacity_icon"
+                android:src="@drawable/ic_baseline_circle7_24"
+                app:layout_constraintHorizontal_chainStyle="spread_inside"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toEndOf="@id/color_6" />
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/image_picker"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="5dp"
+            android:visibility="invisible"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent" >
+
+            <TextView
+                android:id="@+id/image_select_text"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/image"
+                android:textSize="20sp"
+                android:textColor="#3C4045"
+                android:padding="7dp"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintStart_toStartOf="parent" />
+
+            <TextView
+                android:id="@+id/image_select_path"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:padding="3dp"
+                android:text="/storage/emulated/0/tutu.png"
+                app:layout_constraintTop_toTopOf="@id/image_select_text"
+                app:layout_constraintBottom_toBottomOf="@id/image_select_text"
+                app:layout_constraintStart_toEndOf="@id/image_select_text"
+                app:layout_constraintEnd_toStartOf="@id/image_select_btn" />
+
+            <Button
+                android:id="@+id/image_select_btn"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Select"
+                android:textColor="@color/white"
+                android:backgroundTint="@color/purple_500"
+                app:layout_constraintTop_toTopOf="@+id/image_select_text"
+                app:layout_constraintBottom_toBottomOf="@id/image_select_text"
+                app:layout_constraintEnd_toEndOf="parent"
+                tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+    <ImageView
+        android:id="@+id/opacity_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:contentDescription="@string/opacity_icon"
+        android:src="@drawable/ic_baseline_opacity_20"
+        android:padding="10dp"
+        app:layout_constraintHorizontal_chainStyle="spread_inside"
+        app:layout_constraintEnd_toStartOf="@+id/opacity_slider"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/picker"
+        app:layout_constraintBottom_toTopOf="@+id/size_icon"/>
+
+    <androidx.appcompat.widget.AppCompatSeekBar
+        android:id="@+id/opacity_slider"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:progress="50"
+        android:theme="@style/SeekBarColor"
+        app:layout_constraintTop_toTopOf="@id/opacity_icon"
+        app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
+        app:layout_constraintStart_toEndOf="@+id/opacity_icon"
+        app:layout_constraintEnd_toStartOf="@id/opacity_text"/>
+
+    <TextView
+        android:id="@+id/opacity_text"
+        android:layout_width="40dp"
+        android:layout_height="wrap_content"
+        android:text="@string/default_opacity"
+        app:layout_constraintTop_toTopOf="@id/opacity_icon"
+        app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/opacity_slider" />
+
+
+    <ImageView
+        android:id="@+id/size_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:contentDescription="@string/opacity_icon"
+        android:src="@drawable/ic_baseline_format_size_20"
+        android:padding="10dp"
+        app:layout_constraintHorizontal_chainStyle="spread_inside"
+        app:layout_constraintEnd_toStartOf="@+id/size_slider"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/opacity_icon"
+        app:layout_constraintBottom_toTopOf="@+id/page_range_text"/>
+
+    <androidx.appcompat.widget.AppCompatSeekBar
+        android:id="@+id/size_slider"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:progress="50"
+        android:theme="@style/SeekBarColor"
+        app:layout_constraintTop_toTopOf="@id/size_icon"
+        app:layout_constraintBottom_toBottomOf="@id/size_icon"
+        app:layout_constraintStart_toEndOf="@+id/size_icon"
+        app:layout_constraintEnd_toStartOf="@id/size_text"/>
+
+    <TextView
+        android:id="@+id/size_text"
+        android:layout_width="40dp"
+        android:layout_height="wrap_content"
+        android:text="@string/default_opacity"
+        app:layout_constraintTop_toTopOf="@id/size_icon"
+        app:layout_constraintBottom_toBottomOf="@id/size_icon"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/size_slider" />
+
+
+    <TextView
+        android:id="@+id/page_range_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/page_range"
+        android:textSize="20sp"
+        android:textColor="#3C4045"
+        android:padding="12dp"
+        app:layout_constraintTop_toBottomOf="@+id/size_icon"
+        app:layout_constraintBottom_toTopOf="@id/full_screen_checkbox"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <Spinner
+        android:id="@+id/page_range_spinner"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintBottom_toBottomOf="@id/page_range_text"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@id/page_range_text"
+        tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
+
+
+    <CheckBox
+        android:id="@+id/full_screen_checkbox"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="10dp"
+        android:text="@string/full_screen"
+        app:layout_constraintHorizontal_chainStyle="spread_inside"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/page_range_text"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/full_screen_space"
+        tools:ignore="TouchTargetSizeCheck" />
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/full_screen_space"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toTopOf="@id/full_screen_checkbox"
+        app:layout_constraintBottom_toBottomOf="@id/full_screen_checkbox"
+        app:layout_constraintStart_toEndOf="@id/full_screen_checkbox"
+        app:layout_constraintEnd_toEndOf="parent">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:id="@+id/horizontal_space"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:hint="@string/default_space"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@id/horizontal_space_mm"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
+
+        <TextView
+            android:id="@+id/horizontal_space_mm"
+            android:layout_width="40dp"
+            android:layout_height="wrap_content"
+            android:text="@string/mm"
+            app:layout_constraintTop_toTopOf="@id/horizontal_space"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
+            app:layout_constraintStart_toEndOf="@+id/horizontal_space"
+            app:layout_constraintEnd_toStartOf="@id/vertical_space"/>
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:id="@+id/vertical_space"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:hint="@string/default_space"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
+            app:layout_constraintEnd_toStartOf="@id/vertical_space_mm"
+            app:layout_constraintStart_toEndOf="@id/horizontal_space_mm"
+            app:layout_constraintTop_toTopOf="@id/horizontal_space"
+            tools:ignore="TouchTargetSizeCheck" />
+
+        <TextView
+            android:id="@+id/vertical_space_mm"
+            android:layout_width="40dp"
+            android:layout_height="wrap_content"
+            android:text="@string/mm"
+            app:layout_constraintTop_toTopOf="@id/horizontal_space"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
+            app:layout_constraintStart_toEndOf="@+id/vertical_space"
+            app:layout_constraintEnd_toEndOf="parent" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 33 - 0
app/src/main/res/layout/watermark_image_view.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <ImageView
+        android:id="@+id/image_watermark"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="15dp"
+        android:background="@drawable/watermark_shape"
+        android:src="@drawable/pdf"
+        android:visibility="visible"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        android:contentDescription="@string/watermark_image" />
+
+    <ImageButton
+        android:id="@+id/watermark_handle"
+        android:layout_width="20dp"
+        android:layout_height="20dp"
+        app:srcCompat="@drawable/ic_white_roll_15"
+        android:background="@drawable/watermark_handle_shape"
+        app:layout_constraintTop_toBottomOf="@id/image_watermark"
+        app:layout_constraintBottom_toBottomOf="@+id/image_watermark"
+        app:layout_constraintStart_toEndOf="@+id/image_watermark"
+        app:layout_constraintEnd_toEndOf="@id/image_watermark"
+        android:contentDescription="@string/watermark_handle" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 34 - 0
app/src/main/res/layout/watermark_text_view.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <TextView
+        android:id="@+id/text_watermark"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="15dp"
+        android:text="@string/watermark"
+        android:background="@drawable/watermark_shape"
+        android:textColor="#88FF0000"
+        android:textSize="35sp"
+        android:visibility="visible"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageButton
+        android:id="@+id/watermark_handle"
+        android:layout_width="20dp"
+        android:layout_height="20dp"
+        app:srcCompat="@drawable/ic_white_roll_15"
+        android:background="@drawable/watermark_handle_shape"
+        app:layout_constraintTop_toBottomOf="@id/text_watermark"
+        app:layout_constraintBottom_toBottomOf="@+id/text_watermark"
+        app:layout_constraintStart_toEndOf="@+id/text_watermark"
+        app:layout_constraintEnd_toEndOf="@id/text_watermark"
+        android:contentDescription="@string/watermark_handle" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp


+ 16 - 0
app/src/main/res/values-night/themes.xml

@@ -0,0 +1,16 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+    <!-- Base application theme. -->
+    <style name="Theme.PDFViewer" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
+        <!-- Primary brand color. -->
+        <item name="colorPrimary">@color/purple_200</item>
+        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <item name="colorOnPrimary">@color/black</item>
+        <!-- Secondary brand color. -->
+        <item name="colorSecondary">@color/teal_200</item>
+        <item name="colorSecondaryVariant">@color/teal_200</item>
+        <item name="colorOnSecondary">@color/black</item>
+        <!-- Status bar color. -->
+        <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
+        <!-- Customize your theme here. -->
+    </style>
+</resources>

+ 10 - 0
app/src/main/res/values/attrs.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <declare-styleable name="WatermarkView">
+        <attr name="image_mode" format="boolean" />
+        <attr name="content_text" format="string" />
+        <attr name="content_image_path" format="string" />
+        <attr name="content_color" format="color" />
+        <attr name="content_opacity" format="float" />
+    </declare-styleable>
+</resources>

+ 10 - 0
app/src/main/res/values/colors.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="purple_200">#FFBB86FC</color>
+    <color name="purple_500">#FF6200EE</color>
+    <color name="purple_700">#FF3700B3</color>
+    <color name="teal_200">#FF03DAC5</color>
+    <color name="teal_700">#FF018786</color>
+    <color name="black">#FF000000</color>
+    <color name="white">#FFFFFFFF</color>
+</resources>

+ 16 - 0
app/src/main/res/values/strings.xml

@@ -0,0 +1,16 @@
+<resources>
+    <string name="app_name">PDFViewer</string>
+    <string name="text">Text</string>
+    <string name="image">Image</string>
+    <!-- TODO: Remove or change this placeholder text -->
+    <string name="hello_blank_fragment">Hello blank fragment</string>
+    <string name="opacity_icon">Opacity icon</string>
+    <string name="full_screen">Full screen</string>
+    <string name="default_opacity">50%</string>
+    <string name="page_range">Page Range</string>
+    <string name="mm">mm</string>
+    <string name="default_space">100</string>
+    <string name="watermark_image">watermark image</string>
+    <string name="watermark">Watermark</string>
+    <string name="watermark_handle">Watermark Handle</string>
+</resources>

+ 11 - 0
app/src/main/res/values/styles.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
+        <item name="textAllCaps">false</item>
+        <item name="android:textAllCaps">false</item>
+    </style>
+    <style name="SeekBarColor"
+        parent="Widget.AppCompat.SeekBar">
+        <item name="colorAccent">@color/purple_500</item>
+    </style>
+</resources>

+ 17 - 0
app/src/main/res/values/themes.xml

@@ -0,0 +1,17 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+    <!-- Base application theme. -->
+    <style name="Theme.PDFViewer" parent="Theme.AppCompat.Light.NoActionBar">
+        <!-- Primary brand color. -->
+        <item name="colorPrimary">@color/purple_500</item>
+        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <item name="colorOnPrimary">@color/white</item>
+        <!-- Secondary brand color. -->
+        <item name="colorSecondary">@color/teal_200</item>
+        <item name="colorSecondaryVariant">@color/teal_700</item>
+        <item name="colorOnSecondary">@color/black</item>
+        <!-- Status bar color. -->
+        <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
+        <!-- Customize your theme here. -->
+    </style>
+
+</resources>

+ 13 - 0
app/src/main/res/xml/backup_rules.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+   Sample backup rules file; uncomment and customize as necessary.
+   See https://developer.android.com/guide/topics/data/autobackup
+   for details.
+   Note: This file is ignored for devices older that API 31
+   See https://developer.android.com/about/versions/12/backup-restore
+-->
+<full-backup-content>
+    <!--
+   <include domain="sharedpref" path="."/>
+   <exclude domain="sharedpref" path="device.xml"/>
+-->
+</full-backup-content>

+ 19 - 0
app/src/main/res/xml/data_extraction_rules.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+   Sample data extraction rules file; uncomment and customize as necessary.
+   See https://developer.android.com/about/versions/12/backup-restore#xml-changes
+   for details.
+-->
+<data-extraction-rules>
+    <cloud-backup>
+        <!-- TODO: Use <include> and <exclude> to control what is backed up.
+        <include .../>
+        <exclude .../>
+        -->
+    </cloud-backup>
+    <!--
+    <device-transfer>
+        <include .../>
+        <exclude .../>
+    </device-transfer>
+    -->
+</data-extraction-rules>

+ 5 - 0
build.gradle

@@ -0,0 +1,5 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+    id 'com.android.application' version '7.3.1' apply false
+    id 'com.android.library' version '7.3.1' apply false
+}

+ 21 - 0
gradle.properties

@@ -0,0 +1,21 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
+#Tue Nov 15 15:02:50 CST 2022
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME

+ 185 - 0
gradlew

@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=`expr $i + 1`
+    done
+    case $i in
+        0) set -- ;;
+        1) set -- "$args0" ;;
+        2) set -- "$args0" "$args1" ;;
+        3) set -- "$args0" "$args1" "$args2" ;;
+        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"

+ 89 - 0
gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 16 - 0
settings.gradle

@@ -0,0 +1,16 @@
+pluginManagement {
+    repositories {
+        gradlePluginPortal()
+        google()
+        mavenCentral()
+    }
+}
+dependencyResolutionManagement {
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        google()
+        mavenCentral()
+    }
+}
+rootProject.name = "PDFViewer"
+include ':app'