Pārlūkot izejas kodu

完成demo水印模块

dengyujia 1 gadu atpakaļ
vecāks
revīzija
b704dfd8d2
42 mainītis faili ar 2217 papildinājumiem un 1395 dzēšanām
  1. 7 4
      app/build.gradle
  2. 8 8
      app/src/main/AndroidManifest.xml
  3. 230 200
      app/src/main/java/com/compdfkit/pdfviewer/MainActivity.java
  4. 14 26
      app/src/main/java/com/compdfkit/pdfviewer/adapter/WatermarkListAdapter.java
  5. 0 99
      app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkListItem.java
  6. 0 18
      app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkListView.java
  7. 234 0
      app/src/main/java/com/compdfkit/pdfviewer/customview/listview/WatermarkListView.java
  8. 98 0
      app/src/main/java/com/compdfkit/pdfviewer/customview/picker/ColorPicker.java
  9. 88 0
      app/src/main/java/com/compdfkit/pdfviewer/customview/picker/ImagePicker.java
  10. 11 12
      app/src/main/java/com/compdfkit/pdfviewer/customview/watermarkview/ImageWatermarkView.java
  11. 18 17
      app/src/main/java/com/compdfkit/pdfviewer/customview/watermarkview/TextWatermarkView.java
  12. 0 1
      app/src/main/java/com/compdfkit/pdfviewer/customview/watermarkview/WatermarkView.java
  13. 112 80
      app/src/main/java/com/compdfkit/pdfviewer/fragments/WatermarkConsoleFragment.java
  14. 9 0
      app/src/main/java/com/compdfkit/pdfviewer/tools/WatermarkHandle.java
  15. 5 0
      app/src/main/res/drawable-v31/ic_baseline_image_type_24.xml
  16. 5 0
      app/src/main/res/drawable-v31/ic_baseline_text_type_24.xml
  17. 70 57
      app/src/main/res/layout-land-v31/activity_main.xml
  18. 20 146
      app/src/main/res/layout-land-v31/fragment_watermark_console.xml
  19. 37 24
      app/src/main/res/layout-land/activity_main.xml
  20. 20 162
      app/src/main/res/layout-land/fragment_watermark_console.xml
  21. 50 55
      app/src/main/res/layout-v31/activity_main.xml
  22. 75 180
      app/src/main/res/layout-v31/fragment_watermark_console.xml
  23. 73 0
      app/src/main/res/layout-v31/watermark_item_layout.xml
  24. 31 0
      app/src/main/res/layout-v31/watermark_list_view.xml
  25. 55 59
      app/src/main/res/layout/activity_main.xml
  26. 104 0
      app/src/main/res/layout/color_picker.xml
  27. 24 152
      app/src/main/res/layout/fragment_watermark_console.xml
  28. 40 0
      app/src/main/res/layout/image_picker.xml
  29. 16 7
      app/src/main/res/layout/range_selector.xml
  30. 12 4
      app/src/main/res/layout/text_editor.xml
  31. 0 41
      app/src/main/res/layout/watermark_item.xml
  32. 39 3
      app/src/main/res/layout/watermark_item_layout.xml
  33. 31 0
      app/src/main/res/layout/watermark_list_view.xml
  34. 27 0
      app/src/main/res/values-ja-rJP/strings.xml
  35. 151 12
      app/src/main/res/values-night-v31/themes.xml
  36. 1 1
      app/src/main/res/values-night/themes.xml
  37. 151 13
      app/src/main/res/values-notnight-v31/themes.xml
  38. 3 6
      app/src/main/res/values-zh/strings.xml
  39. 310 0
      app/src/main/res/values/colors.xml
  40. 33 5
      app/src/main/res/values/strings.xml
  41. 2 2
      app/src/main/res/values/themes.xml
  42. 3 1
      gradle.properties

+ 7 - 4
app/build.gradle

@@ -4,12 +4,12 @@ plugins {
 
 android {
     namespace 'com.compdfkit.pdfviewer'
-    compileSdk 32
+    compileSdk 33
 
     defaultConfig {
         applicationId "com.compdfkit.pdfviewer"
         minSdk 21
-        targetSdk 32
+        targetSdk 33
         versionCode 1
         versionName "1.0"
 
@@ -26,6 +26,9 @@ android {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
+    buildFeatures {
+        viewBinding true
+    }
 }
 
 dependencies {
@@ -37,6 +40,6 @@ dependencies {
     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'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
 }

+ 8 - 8
app/src/main/AndroidManifest.xml

@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools">
+    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"
+    <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
@@ -15,11 +16,11 @@
         android:label="@string/app_name"
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
-        android:theme="@style/Theme.PDFViewer"
-        tools:targetApi="31">
+        android:theme="@style/AppTheme"
+        tools:targetApi="31" >
         <activity
             android:name=".MainActivity"
-            android:exported="true">
+            android:exported="true" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
@@ -34,7 +35,6 @@
         <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==" />

+ 230 - 200
app/src/main/java/com/compdfkit/pdfviewer/MainActivity.java

@@ -4,18 +4,13 @@ import static android.content.ContentValues.TAG;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.AppCompatImageButton;
 import androidx.appcompat.widget.Toolbar;
 import androidx.core.view.MenuProvider;
 import androidx.core.view.ViewCompat;
 import androidx.core.view.WindowInsetsControllerCompat;
-import androidx.recyclerview.widget.DividerItemDecoration;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
 
 import android.content.Intent;
 import android.graphics.Bitmap;
-import android.graphics.Color;
 import android.graphics.RectF;
 import android.net.Uri;
 import android.os.Build;
@@ -28,6 +23,7 @@ import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.Toast;
@@ -37,7 +33,7 @@ import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.core.page.CPDFPage;
 import com.compdfkit.core.watermark.CPDFImageWatermark;
 import com.compdfkit.core.watermark.CPDFWatermark;
-import com.compdfkit.pdfviewer.adapter.WatermarkListAdapter;
+import com.compdfkit.pdfviewer.customview.listview.WatermarkListView;
 import com.compdfkit.pdfviewer.customview.watermarkview.ImageWatermarkView;
 import com.compdfkit.pdfviewer.customview.watermarkview.TextWatermarkView;
 import com.compdfkit.pdfviewer.customview.watermarkview.WatermarkView;
@@ -49,19 +45,23 @@ import com.google.android.material.tabs.TabLayout;
 
 import java.io.File;
 import java.util.Objects;
+import java.util.Random;
 
 public class MainActivity extends AppCompatActivity implements MenuProvider {
+    private TabLayout tabLayout;
+    private View pageContainer;
+
     private ImageView pageImage;
     private ImageView fullScreenMask;
 
-    private AppCompatImageButton expandListBtn;
-    private RecyclerView watermarkList;
-    private WatermarkListAdapter adapter;
+    private WatermarkListView watermarkListView;
 
     private CPDFDocument document = new CPDFDocument(this);
     private WatermarkView watermark;
     private WatermarkConsoleFragment consoleFragment;
 
+    private MenuItem doneItem;
+
     private int currentPageHeight = 0;
     private int currentPageWidth = 0;
 
@@ -78,39 +78,88 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        int[] themes = new int[] {R.style.AppTheme, R.style.AppRedTheme, R.style.AppOrangeTheme, R.style.AppGreenTheme, R.style.AppCyanBlueTheme};
+        int randomTheme = new Random().nextInt(5);
+        setTheme(themes[randomTheme]);
+
         super.onCreate(savedInstanceState);
+
+        WindowManager.LayoutParams windowAttributes = getWindow().getAttributes();
+        windowAttributes.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_CROSSFADE;
+        getWindow().setAttributes(windowAttributes);
+
         setContentView(R.layout.activity_main);
         addMenuProvider(this);
 
         if (this.getResources().getConfiguration().uiMode == 0x11) {
             WindowInsetsControllerCompat wic = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
-            wic.setAppearanceLightStatusBars(true);
+//            assert wic != null;
+            if (wic != null)
+                wic.setAppearanceLightStatusBars(true);
         }
 
         Toolbar toolbar = findViewById(R.id.toolbar);
         setSupportActionBar(toolbar);
 
+        pageContainer = findViewById(R.id.page_container);
+
         watermark = findViewById(R.id.watermark_text);
-        consoleFragment = (WatermarkConsoleFragment) getSupportFragmentManager().findFragmentByTag("console_fragment");
 
+        consoleFragment = (WatermarkConsoleFragment) getSupportFragmentManager().findFragmentByTag("console_fragment");
         assert consoleFragment != null;
         consoleFragment.setAssociatedWatermark(watermark);
 
         pageImage = findViewById(R.id.page_image);
         fullScreenMask = findViewById(R.id.full_screen_mask);
 
-        expandListBtn = findViewById(R.id.expand_list_btn);
-        expandListBtn.setOnClickListener(view -> {
-            try {
-                expandWatermarkList();
-            } catch (CPDFDocumentException e) {
-                e.printStackTrace();
-            }
+        watermarkListView = findViewById(R.id.watermark_list_view);
+
+        tabLayout = findViewById(R.id.tab_layout);
+        initTabLayout();
+
+        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/test.pdf");
+        String rootpath = Environment.getExternalStorageDirectory().getPath();
+
+        File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
+        Uri PDFUri = Uri.fromFile(PDFFile);
+
+        reloadDocument(PDFFile, PDFUri);
+
+        consoleFragment.setDocumentPageCount(document.getPageCount());
+
+        pageImage.post(() -> {
+            initPageImageContent();
+            initPageImageListener();
+        });
+
+        watermarkListView.post(() -> {
+            watermarkListView.scrollTo(watermarkListView.getWidth(), 0);
+            watermarkListView.initList(document, consoleFragment);
         });
 
-        watermarkList = findViewById(R.id.watermark_list);
+        Log.d("Render. Watermark Count", "current watermark count:" + document.getWatermarkCount());
+    }
+
+    @Override
+    public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
+        menuInflater.inflate(R.menu.menu_prime, menu);
+
+        doneItem = menu.findItem(R.id.done);
+    }
+
+    @Override
+    public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
+        return false;
+    }
+
+    public void initTabLayout() {
 
-        TabLayout tabLayout = findViewById(R.id.tab_layout);
         tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
@@ -123,150 +172,120 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
             @Override
             public void onTabReselected(TabLayout.Tab tab) {}
         });
+    }
 
-        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/test.pdf");
-        Uri PDFUri = Uri.fromFile(PDFFile);
-
-        reloadDocument(PDFFile, PDFUri);
-
-        consoleFragment.setDocumentPageCount(document.getPageCount());
+    public void initPageImageContent() {
         CPDFPage currentPage = document.pageAtIndex(0);
 
         RectF pageSize = document.getPageSize(0);
         float pageW = pageSize.right - pageSize.left;
         float pageH = pageSize.bottom - pageSize.top;
 
-        pageImage.post(() -> {
-            imageHeight = pageImage.getHeight();
-            sizeConvertRate = pageImage.getHeight() / pageH;
-            imageWidth = (int) (sizeConvertRate * pageW);
+        if (pageW / pageH >  ((float) pageContainer.getWidth() / (float) pageContainer.getHeight())) {
+            sizeConvertRate = pageContainer.getWidth() / pageW;
+
+            imageHeight = (int) (sizeConvertRate * pageH);
+            imageWidth = pageContainer.getWidth();
 
+            pageImage.setMaxHeight(imageHeight);
             pageImage.setMaxWidth(imageWidth);
+        } else {
+            sizeConvertRate = pageContainer.getHeight() / pageH;
 
-            TextWatermarkView tempT = (TextWatermarkView) watermark;
-            tempT.setSizeConvertRate(sizeConvertRate);
-            ImageWatermarkView tempI = findViewById(R.id.watermark_image);
-            tempI.setSizeConvertRate(sizeConvertRate);
-
-            currentPageHeight = pageImage.getHeight();
-            currentPageWidth = imageWidth;
-            Bitmap pageBitmap = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_4444);
-
-            currentPage.renderPage(pageBitmap, 0, 0, imageWidth, pageImage.getHeight(), 0xFFFFFFFF, 255, 0, true, true);
-            refreshPageImage(pageBitmap);
-            fullScreenMask.setImageBitmap(pageBitmap);
-
-            pageImage.setOnDragListener(new View.OnDragListener() {
-                float currentSlope;
-
-                double currentRotation = 0;
-                double resultRotation = 0;
-
-                int[] location = new int[2];
-
-                @Override
-                public boolean onDrag(View view, DragEvent dragEvent) {
-
-                    if (watermark.getCurrentEvent() == WatermarkView.DRAG_EVENT) {
-                        float xOffset = 1.0f * watermark.getWidth() / 2;
-                        float yOffset = 1.0f * watermark.getHeight() / 2;
-
-                        int xOutline = pageImage.getLeft();
-                        int yOutline = pageImage.getTop();
-                        watermark.getLocationOnScreen(location);
-
-                        //TODO:需要优化控件越界行为
-                        switch (dragEvent.getAction()) {
-                            case DragEvent.ACTION_DRAG_LOCATION:
-                                watermark.setX(dragEvent.getX() + xOutline - xOffset);
-                                watermark.setY(dragEvent.getY() + yOutline - yOffset);
-
-                                watermark.setPDFXOffset(ConvertMapper.convertViewXToPDFXOffset(watermark.getX() - pageImage.getLeft(), xOffset, imageWidth / 2f, sizeConvertRate));
-                                watermark.setPDFYOffset(ConvertMapper.convertViewYToPDFYOffset(watermark.getY() - pageImage.getTop(), yOffset, imageHeight / 2f, sizeConvertRate));
-
-                                watermark.setViewXOffset(watermark.getPDFXOffset() * sizeConvertRate);
-                                watermark.setViewYOffset(watermark.getPDFYOffset() * sizeConvertRate);
-
-//                                Log.d("DragTest", "Drag Location: (" + dragEvent.getX() + "," + dragEvent.getY() + ")");
-//                                Log.d("DragTest", "Watermark Location: (" + location[0] + "," + location[1] + ")");
-//                                Log.d("DragTest", "Watermark get xy: (" + watermark.getX() + "," + watermark.getY() + ")");
-//                                Log.d("DragTest", "pdf page w h: (" + pageW + "," + pageH + ")");
-//                                Log.d("DragTest", "Watermark get PDF xy: (" + ConvertMapper.convertViewXtoPDFXOffset(watermark.getX() - pageImage.getLeft(), xOffset, imageWidth / 2, sizeConvertRate)
-//                                        + "," + ConvertMapper.convertViewYtoPDFYOffset(watermark.getY() - pageImage.getTop(), yOffset, imageHeight / 2, sizeConvertRate) + ")");
-                                return true;
-                            case DragEvent.ACTION_DRAG_ENDED:
-                                watermark.setVisibility(View.VISIBLE);
-                                return false;
-                            default:
-                                return true;
-                        }
-                    } else {
-                        float xOffset = 1.0f * watermark.getWidth() / 2; /* 控件一半宽度 */
-                        float yOffset = 1.0f * watermark.getHeight() / 2; /* 控件一半高度 */
-
-                        float baseSlope = yOffset / xOffset * -1;
-
-                        watermark.getLocationOnScreen(location);
-
-                        float centerPointX = watermark.getX() + 1.0f * watermark.getWidth() / 2; /* 控件中心点x = 当前控件位置x + 控件一半宽度 */
-                        float centerPointY = watermark.getY() + 1.0f * watermark.getHeight() / 2; /* 控件中心点y = 当前控件位置y + 控件一半高度 */
-
-                        if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {
-                            currentSlope = (dragEvent.getY() + pageImage.getTop() - centerPointY) / (dragEvent.getX() + pageImage.getLeft() - centerPointX) * -1;
-                            currentRotation = Math.toDegrees(Math.atan(currentSlope));
-
-                            if ((dragEvent.getY() + pageImage.getTop() < centerPointY && dragEvent.getX() + pageImage.getLeft() < centerPointX) || (dragEvent.getY() + pageImage.getTop() > centerPointY && dragEvent.getX() + pageImage.getLeft() < centerPointX)) {
-                                currentRotation += 180;
-                                currentSlope += Math.PI;
-                            }
-
-                            resultRotation = currentRotation - Math.toDegrees(Math.atan(baseSlope));
-
-                            watermark.setRotation((float) resultRotation * -1);
-                            watermark.setRotationRadian((float) Math.toRadians(resultRotation));
-//                                Log.d("RollTest", "Current slope: " + currentSlope + ", Result rotation: " + resultRotation + ", Current rotation: " + currentRotation);
-                            return true;
-                        }
-                        return true;
-                    }
-                }
-            });
-        });
+            imageHeight = pageContainer.getHeight();
+            imageWidth = (int) (sizeConvertRate * pageW);
 
-        watermarkList.post(() -> {
-            int watermarkCount = document.getWatermarkCount();
+            pageImage.setMaxWidth(imageWidth);
+        }
 
-            for (int i = 0; i < watermarkCount; i++) {
-                CPDFWatermark tempWatermark = document.getWatermark(i);
-                WatermarkHandle.addSettingIntoList(tempWatermark);
-            }
+        TextWatermarkView tempT = (TextWatermarkView) watermark;
+        tempT.setSizeConvertRate(sizeConvertRate);
+        ImageWatermarkView tempI = findViewById(R.id.watermark_image);
+        tempI.setSizeConvertRate(sizeConvertRate);
 
-            adapter = new WatermarkListAdapter(MainActivity.this, consoleFragment, WatermarkHandle.getSettingList());
-            watermarkList.setAdapter(adapter);
+        currentPageHeight = imageHeight;
+        currentPageWidth = imageWidth;
+        Bitmap pageBitmap = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_4444);
 
-            LinearLayoutManager manager = new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false);
-            watermarkList.setLayoutManager(manager);
+        currentPage.renderPage(pageBitmap, 0, 0, imageWidth, imageHeight, 0xFFFFFFFF, 255, 0, true, true);
+        refreshPageImage(pageBitmap);
+        fullScreenMask.setImageBitmap(pageBitmap);
+    }
+
+    public void initPageImageListener() {
+        pageImage.setOnDragListener((view, dragEvent) -> {
+            float xOffset = 1.0f * watermark.getWidth() / 2;
+            float yOffset = 1.0f * watermark.getHeight() / 2;
 
-            watermarkList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
+            if (watermark.getCurrentEvent() == WatermarkView.DRAG_EVENT) {
+                return handleDragEvent(dragEvent, xOffset, yOffset);
+            } else {
+                return handleRollEvent(dragEvent, xOffset, yOffset);
+            }
         });
+    }
 
-        Log.d("Render. Watermark Count", "current watermark count:" + document.getWatermarkCount());
+    public void setTabLayoutEnable(boolean enable) {
+        ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);;
+        if (viewGroup != null) {
+            for (int childIndex = 0; childIndex < viewGroup.getChildCount(); childIndex++) {
+                View tabView = viewGroup.getChildAt(childIndex);
+                if (tabView != null)
+                    tabView.setEnabled(enable);
+            }
+        }
     }
 
-    @Override
-    public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
-        menuInflater.inflate(R.menu.menu_prime, menu);
+    public boolean handleDragEvent(@NonNull DragEvent dragEvent, float xOffset, float yOffset) {
+        int xOutline = pageImage.getLeft();
+        int yOutline = pageImage.getTop();
+
+        switch (dragEvent.getAction()) {
+            case DragEvent.ACTION_DRAG_LOCATION:
+                watermark.setX(dragEvent.getX() + xOutline - xOffset);
+                watermark.setY(dragEvent.getY() + yOutline - yOffset);
+
+                watermark.setPDFXOffset(ConvertMapper.convertViewXToPDFXOffset(watermark.getX() - pageImage.getLeft(), xOffset, imageWidth / 2f, sizeConvertRate));
+                watermark.setPDFYOffset(ConvertMapper.convertViewYToPDFYOffset(watermark.getY() - pageImage.getTop(), yOffset, imageHeight / 2f, sizeConvertRate));
+
+                watermark.setViewXOffset(watermark.getPDFXOffset() * sizeConvertRate);
+                watermark.setViewYOffset(watermark.getPDFYOffset() * sizeConvertRate);
+
+                return true;
+            case DragEvent.ACTION_DRAG_ENDED:
+                watermark.setVisibility(View.VISIBLE);
+                return false;
+            default:
+                return true;
+        }
     }
 
-    @Override
-    public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
-        return false;
+    public boolean handleRollEvent(@NonNull DragEvent dragEvent, float xOffset, float yOffset) {
+        float currentSlope;
+
+        double currentRotation = 0;
+        double resultRotation = 0;
+
+        float baseSlope = yOffset / xOffset * -1;
+
+        float centerPointX = watermark.getX() + 1.0f * watermark.getWidth() / 2; /* 控件中心点x = 当前控件位置x + 控件一半宽度 */
+        float centerPointY = watermark.getY() + 1.0f * watermark.getHeight() / 2; /* 控件中心点y = 当前控件位置y + 控件一半高度 */
+
+        if (dragEvent.getAction() == DragEvent.ACTION_DRAG_LOCATION) {
+            currentSlope = (dragEvent.getY() + pageImage.getTop() - centerPointY) / (dragEvent.getX() + pageImage.getLeft() - centerPointX) * -1;
+            currentRotation = Math.toDegrees(Math.atan(currentSlope));
+
+            if ((dragEvent.getY() + pageImage.getTop() < centerPointY && dragEvent.getX() + pageImage.getLeft() < centerPointX) || (dragEvent.getY() + pageImage.getTop() > centerPointY && dragEvent.getX() + pageImage.getLeft() < centerPointX))
+                currentRotation += 180;
+
+            resultRotation = currentRotation - Math.toDegrees(Math.atan(baseSlope));
+
+            watermark.setRotation((float) resultRotation * -1);
+            watermark.setRotationRadian((float) Math.toRadians(resultRotation));
+
+            return true;
+        }
+        return true;
     }
 
     public void changeWatermarkLocation(float x, float y) {
@@ -300,14 +319,30 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
         pageImage.setImageBitmap(updatePageBitmap);
     }
 
-    public void reloadDocument(File PDFFile, Uri PDFUri) {
+    public void reloadDocument() throws CPDFDocumentException {
+        if (document.hasChanges()) {
+            boolean res;
+            res = document.save();
+        }
+        document.close();
+
+        File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
+        Uri PDFUri = Uri.fromFile(PDFFile);
+
+        reloadDocument(PDFFile, PDFUri);
+        CPDFPage currentPage = document.pageAtIndex(0);
+
+        Bitmap pageBitmap = Bitmap.createBitmap(currentPageWidth, currentPageHeight, Bitmap.Config.ARGB_4444);
+        currentPage.renderPage(pageBitmap, 0, 0, currentPageWidth, currentPageHeight, 0xFFFFFFFF, 255, 0, true, true);
+        refreshPageImage(pageBitmap);
+    }
+
+    public void reloadDocument(@NonNull File PDFFile, Uri PDFUri) {
         CPDFDocument.PDFDocumentError error = document.open(PDFFile.getAbsolutePath());
 
         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 {
+        } else if (error != CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
             Toast.makeText(this, "File failed.", Toast.LENGTH_SHORT).show();
         }
     }
@@ -317,47 +352,23 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
         CPDFWatermark currentWatermark = document.createWatermark(types[consoleFragment.getMode()]);
 
         WatermarkHandle.updateWatermark(currentWatermark, setting, sizeConvertRate);
-        adapter.addSettingIntoList(setting);
+        watermarkListView.addSettingIntoList(setting);
     }
 
     public void changeWatermark(CPDFWatermark watermark, WatermarkSetting setting) {
         WatermarkHandle.updateWatermark(watermark, setting, sizeConvertRate);
-        adapter.updateSettingList(cacheIndex, setting);
+//        adapter.updateSettingList(cacheIndex, setting);
     }
 
     public void deleteWatermark(int deleteIndex) throws CPDFDocumentException {
         CPDFWatermark targetWatermark = document.getWatermark(deleteIndex);
         targetWatermark.clear();
 
-        adapter.deleteSettingFromList(deleteIndex);
         reloadDocument();
     }
 
-    public void showFullScreenMask(boolean isFullScreen) {
-        if (isFullScreen) {
-            int imageHeight = pageImage.getHeight();
-            int imageWidth = pageImage.getWidth();
-
-            WatermarkView temp = watermark;
-
-            Bitmap fullScreenBitmap = temp.getFullScreenBitmap(imageWidth, imageHeight,
-                    (int) ConvertMapper.convertMMtoViewUnit(consoleFragment.gethSpace(), sizeConvertRate),
-                    (int) ConvertMapper.convertMMtoViewUnit(consoleFragment.getvSpace(), sizeConvertRate),
-                    (int) watermark.getViewXOffset(),
-                    (int) watermark.getViewYOffset(),
-                    watermark.getRotation());
-            fullScreenMask.setImageBitmap(fullScreenBitmap);
-            fullScreenMask.setAlpha(consoleFragment.getCurrentOpacity());
-            fullScreenMask.setVisibility(View.VISIBLE);
-            watermark.setVisibility(View.INVISIBLE);
-        } else {
-            fullScreenMask.setVisibility(View.INVISIBLE);
-            watermark.setVisibility(View.VISIBLE);
-        }
-    }
-
     public void resetWatermark(int index) {
-        if (index == -1 || index == cacheIndex)
+        if (index == -1)
             return;
 
         CPDFWatermark tempWatermark = document.getWatermark(index);
@@ -384,25 +395,9 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
 
         Log.d(TAG, "hideWatermark: current watermark count:" + document.getWatermarkCount());
 
-        reloadDocument();
-    }
+        doneItem.setEnabled(true);
 
-    public void reloadDocument() throws CPDFDocumentException {
-        if (document.hasChanges()) {
-            boolean res;
-            res = document.save();
-        }
-        document.close();
-
-        File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
-        Uri PDFUri = Uri.fromFile(PDFFile);
-
-        reloadDocument(PDFFile, PDFUri);
-        CPDFPage currentPage = document.pageAtIndex(0);
-
-        Bitmap pageBitmap = Bitmap.createBitmap(currentPageWidth, currentPageHeight, Bitmap.Config.ARGB_4444);
-        currentPage.renderPage(pageBitmap, 0, 0, currentPageWidth, currentPageHeight, 0xFFFFFFFF, 255, 0, true, true);
-        refreshPageImage(pageBitmap);
+        reloadDocument();
     }
 
     public void finishEditWatermark(MenuItem menuItem) throws CPDFDocumentException {
@@ -412,15 +407,40 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
         if (!editMode) {
             createNewWatermark(setting);
             Toast.makeText(this, "Add new watermark", Toast.LENGTH_SHORT).show();
+
+            reloadDocument();
         } else {
             changeWatermark(document.getWatermark(cacheIndex), setting);
             Toast.makeText(this, "Change a watermark, index:" + cacheIndex, Toast.LENGTH_SHORT).show();
 
             cacheIndex = -1;
+
+            expandWatermarkList();
         }
         Log.d("Finish. Watermark Count", "current watermark count:" + document.getWatermarkCount());
+    }
 
-        reloadDocument();
+    public void showFullScreenMask(boolean isFullScreen) {
+        if (isFullScreen) {
+            int imageHeight = pageImage.getHeight();
+            int imageWidth = pageImage.getWidth();
+
+            WatermarkView temp = watermark;
+
+            Bitmap fullScreenBitmap = temp.getFullScreenBitmap(imageWidth, imageHeight,
+                    (int) ConvertMapper.convertMMtoViewUnit(consoleFragment.gethSpace(), sizeConvertRate),
+                    (int) ConvertMapper.convertMMtoViewUnit(consoleFragment.getvSpace(), sizeConvertRate),
+                    (int) watermark.getViewXOffset(),
+                    (int) watermark.getViewYOffset(),
+                    watermark.getRotation());
+            fullScreenMask.setImageBitmap(fullScreenBitmap);
+            fullScreenMask.setAlpha(consoleFragment.getCurrentOpacity());
+            fullScreenMask.setVisibility(View.VISIBLE);
+            watermark.setVisibility(View.INVISIBLE);
+        } else {
+            fullScreenMask.setVisibility(View.INVISIBLE);
+            watermark.setVisibility(View.VISIBLE);
+        }
     }
 
     public void changeEditMode(MenuItem menuItem) {
@@ -430,22 +450,32 @@ public class MainActivity extends AppCompatActivity implements MenuProvider {
         menuItem.setIcon(editMode ? R.drawable.ic_baseline_watermark_add_24 : R.drawable.ic_baseline_edit_note_24);
 
         watermark.setVisibility(editMode ? View.INVISIBLE : View.VISIBLE);
-        watermarkList.setVisibility(editMode ? View.VISIBLE : View.INVISIBLE);
-        if (!editMode) {
-            expandListBtn.setVisibility(View.INVISIBLE);
+        if (editMode) {
+            watermarkListView.showView();
+
+            setTabLayoutEnable(false);
+            doneItem.setEnabled(false);
+        } else {
+            resetWatermark(cacheIndex);
+            watermarkListView.hintView();
+
+            setTabLayoutEnable(true);
+            doneItem.setEnabled(true);
         }
     }
 
     public void expandWatermarkList() throws CPDFDocumentException {
+        watermarkListView.showView();
+
         resetWatermark(cacheIndex);
         watermark.setVisibility(View.INVISIBLE);
-        watermarkList.setVisibility(View.VISIBLE);
         reloadDocument();
+
+        doneItem.setEnabled(false);
     }
 
     public void closeWatermarkList() {
-        expandListBtn.setVisibility(View.VISIBLE);
-        watermarkList.setVisibility(View.INVISIBLE);
+        watermarkListView.hintList();
+        watermark.setVisibility(View.VISIBLE);
     }
-
 }

+ 14 - 26
app/src/main/java/com/compdfkit/pdfviewer/adapter/WatermarkListAdapter.java

@@ -3,12 +3,10 @@ package com.compdfkit.pdfviewer.adapter;
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.view.LayoutInflater;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.RecyclerView;
@@ -16,21 +14,17 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.compdfkit.core.common.CPDFDocumentException;
 import com.compdfkit.pdfviewer.MainActivity;
 import com.compdfkit.pdfviewer.R;
-import com.compdfkit.pdfviewer.customview.WatermarkListItem;
 import com.compdfkit.pdfviewer.entity.WatermarkSetting;
 import com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment;
-import com.compdfkit.pdfviewer.tools.WatermarkHandle;
 
 import java.util.ArrayList;
 
-public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdapter.WatermarkItemHolder>{
+public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdapter.WatermarkItemHolder> {
     private final WatermarkConsoleFragment console;
 
     private final Context context;
     private View watermarkListView;
 
-    private int itemViewState = 0;
-
     private final ArrayList<WatermarkSetting> settings;
 
     public WatermarkListAdapter(Context context, WatermarkConsoleFragment console, ArrayList<WatermarkSetting> settings) {
@@ -53,8 +47,8 @@ public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdap
 
         WatermarkSetting currentSetting = settings.get(position);
 
-        holder.item.setWatermarkTypeIcon(context.getResources().getDrawable(currentSetting.getType() == 0 ? R.drawable.ic_baseline_text_type_24 : R.drawable.ic_baseline_image_type_24));
-        holder.item.setWatermarkContentText(currentSetting.getType() == 0 ? currentSetting.getText() : "Image\nwatermark");
+        holder.hintIcon.setImageDrawable(context.getResources().getDrawable(currentSetting.getType() == 0 ? R.drawable.ic_baseline_text_type_24 : R.drawable.ic_baseline_image_type_24, context.getTheme()));
+        holder.hintText.setText(currentSetting.getType() == 0 ? currentSetting.getText() : "Image\nwatermark");
 
         holder.itemView.setOnClickListener(view -> {
             WatermarkSetting setting = settings.get(holder.getAdapterPosition());
@@ -65,14 +59,7 @@ public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdap
             }
         });
 
-        holder.hintIcon.setOnClickListener(view -> {
-            holder.deleteView.setVisibility(View.VISIBLE);
-            holder.item.smoothScrollX(holder.deleteViewOffset);
-        });
-
         holder.deleteView.setOnClickListener(view -> {
-            holder.item.smoothScrollX(0);
-            holder.deleteView.setVisibility(View.INVISIBLE);
 
             MainActivity activity = (MainActivity) console.getActivity();
             assert activity != null;
@@ -82,6 +69,8 @@ public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdap
             } catch (CPDFDocumentException e) {
                 e.printStackTrace();
             }
+
+            deleteSettingFromList(holder.getAdapterPosition());
         });
     }
 
@@ -108,24 +97,23 @@ public class WatermarkListAdapter extends RecyclerView.Adapter<WatermarkListAdap
     public static class WatermarkItemHolder extends RecyclerView.ViewHolder {
         int deleteViewOffset;
 
-        WatermarkListItem item;
         ImageView hintIcon;
+        TextView hintText;
+        View itemView;
         View deleteView;
 
         public WatermarkItemHolder(@NonNull View itemView) {
             super(itemView);
-            item = itemView.findViewById(R.id.item_view);
-            hintIcon = item.findViewById(R.id.hint_icon);
+            hintIcon = itemView.findViewById(R.id.watermark_type_icon);
+            hintText = itemView.findViewById(R.id.watermark_content);
+            this.itemView = itemView.findViewById(R.id.item_view);
             deleteView = itemView.findViewById(R.id.delete_view);
 
-//            self = itemView;
-//            this.itemView = itemView.findViewById(R.id.item_view);
-//            deleteView = itemView.findViewById(R.id.delete_view);
             deleteView.post(() -> deleteViewOffset = deleteView.getWidth());
-            deleteView.setVisibility(View.INVISIBLE);
-//
-//            watermarkType = itemView.findViewById(R.id.watermark_type_icon);
-//            watermarkContent = itemView.findViewById(R.id.watermark_content);
+        }
+
+        public int getDeleteViewOffset() {
+            return deleteViewOffset;
         }
     }
 }

+ 0 - 99
app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkListItem.java

@@ -1,99 +0,0 @@
-package com.compdfkit.pdfviewer.customview;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.Scroller;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-import com.compdfkit.pdfviewer.R;
-
-public class WatermarkListItem extends ConstraintLayout {
-    private Context currentContext;
-    private LayoutInflater inflater;
-    private View currentView;
-
-    private ImageView watermarkType;
-    private TextView watermarkContent;
-
-    private Scroller mScroller;
-
-    private int deleteOffset = 0;
-
-    public WatermarkListItem(@NonNull Context context) {
-        this(context, null);
-    }
-
-    public WatermarkListItem(@NonNull Context context, @Nullable AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public WatermarkListItem(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        this(context, attrs, defStyleAttr, 0);
-    }
-
-    public WatermarkListItem(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-        init(context, attrs);
-    }
-
-//    public WatermarkListItem(@NonNull Context context, ) {
-//
-//    }
-
-    @Override
-    public void computeScroll() {
-        super.computeScroll();
-        if (mScroller.computeScrollOffset()) {
-            scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
-            invalidate();
-        }
-    }
-
-    private void init(Context context, AttributeSet attrs) {
-        mScroller = new Scroller(context);
-
-        currentContext = context;
-        inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-        currentView = inflater.inflate(R.layout.watermark_item, this, true);
-
-        watermarkType = currentView.findViewById(R.id.watermark_type_icon);
-        watermarkContent = currentView.findViewById(R.id.watermark_content);
-    }
-
-    public void smoothScrollX(int destX) {
-        int scrollX = getScrollX();
-        int deltaX = destX - scrollX;
-        mScroller.startScroll(scrollX, 0, deltaX, 0, 500);
-        invalidate();
-    }
-
-//    public void showDeleteView() {
-//        smoothScrollX(deleteOffset);
-//    }
-//
-//    public void closeDeleteView() {
-//        smoothScrollX(-deleteOffset);
-//    }
-
-    public void setWatermarkTypeIcon(Drawable drawable) {
-        watermarkType.setImageDrawable(drawable);
-    }
-
-    public void setWatermarkContentText(String text) {
-        watermarkContent.setText(text);
-    }
-
-    @Override
-    public boolean performClick() {
-        return super.performClick();
-    }
-}

+ 0 - 18
app/src/main/java/com/compdfkit/pdfviewer/customview/WatermarkListView.java

@@ -1,18 +0,0 @@
-package com.compdfkit.pdfviewer.customview;
-
-import android.content.Context;
-import android.view.MotionEvent;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class WatermarkListView extends RecyclerView {
-    int lastX = 0;
-    int lastY = 0;
-
-    public WatermarkListView(@NonNull Context context) {
-        super(context);
-    }
-}
-

+ 234 - 0
app/src/main/java/com/compdfkit/pdfviewer/customview/listview/WatermarkListView.java

@@ -0,0 +1,234 @@
+package com.compdfkit.pdfviewer.customview.listview;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Scroller;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatImageButton;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.recyclerview.widget.DividerItemDecoration;
+import androidx.recyclerview.widget.ItemTouchHelper;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.compdfkit.core.common.CPDFDocumentException;
+import com.compdfkit.core.document.CPDFDocument;
+import com.compdfkit.core.watermark.CPDFWatermark;
+import com.compdfkit.pdfviewer.MainActivity;
+import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.adapter.WatermarkListAdapter;
+import com.compdfkit.pdfviewer.entity.WatermarkSetting;
+import com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment;
+import com.compdfkit.pdfviewer.tools.WatermarkHandle;
+
+public class WatermarkListView extends ConstraintLayout {
+    private boolean isExpand = true;
+    private int listWidth;
+
+    private Context context;
+
+    private final RecyclerView watermarkList;
+    private WatermarkListAdapter adapter;
+    private WatermarkConsoleFragment consoleFragment;
+
+    private final AppCompatImageButton expandBtn;
+
+    private Scroller mScroller;
+
+    @Override
+    public void computeScroll() {
+        super.computeScroll();
+        if (mScroller.computeScrollOffset()) {
+            scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
+            invalidate();
+        }
+    }
+
+    public void smoothScrollX(int destX) {
+        int scrollX = getScrollX();
+        int deltaX = destX - scrollX;
+        mScroller.startScroll(scrollX, 0, deltaX, 0, 500);
+        invalidate();
+    }
+
+    public WatermarkListView(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public WatermarkListView(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public WatermarkListView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public WatermarkListView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+
+        this.context = context;
+        this.mScroller = new Scroller(context);
+
+        mScroller = new Scroller(context);
+        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        View currentView = inflater.inflate(R.layout.watermark_list_view, this, true);
+
+        watermarkList = currentView.findViewById(R.id.watermark_list);
+        watermarkList.post(() -> listWidth = watermarkList.getWidth());
+
+        expandBtn = currentView.findViewById(R.id.expand_list_btn);
+
+        expandBtn.setOnClickListener(v -> {
+            if (isExpand) {
+                hintList();
+            } else {
+                expandWatermarkList();
+            }
+        });
+    }
+
+    public void expandWatermarkList() {
+        showView();
+
+        MainActivity activity = (MainActivity) consoleFragment.getActivity();
+        assert activity != null;
+
+        try {
+            activity.expandWatermarkList();
+        } catch (CPDFDocumentException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void initList(CPDFDocument document, WatermarkConsoleFragment consoleFragment) {
+        int watermarkCount = document.getWatermarkCount();
+
+        if (!WatermarkHandle.getEnable()) {
+            for (int i = 0; i < watermarkCount; i++) {
+                CPDFWatermark tempWatermark = document.getWatermark(i);
+                WatermarkHandle.addSettingIntoList(tempWatermark);
+            }
+        }
+
+        this.consoleFragment = consoleFragment;
+        adapter = new WatermarkListAdapter(context, consoleFragment, WatermarkHandle.getSettingList());
+        watermarkList.setAdapter(adapter);
+
+        LinearLayoutManager manager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
+        watermarkList.setLayoutManager(manager);
+        watermarkList.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
+
+        setItemTouchHelper();
+    }
+
+    private void setItemTouchHelper() {
+        ItemTouchHelper.Callback callback = new ItemTouchHelper.Callback() {
+            int offset = 0;
+            float maxDX = 0;
+            boolean isExpand = false;
+            boolean isFirstSwipe = false;
+
+            @Override
+            public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
+                WatermarkListAdapter.WatermarkItemHolder holder = (WatermarkListAdapter.WatermarkItemHolder) viewHolder;
+
+                if (dX == 0.0f) {
+                    offset = viewHolder.itemView.getScrollX();
+                    isFirstSwipe = true;
+                }
+
+                if (isCurrentlyActive) {
+                    viewHolder.itemView.scrollTo(offset - (int) dX, 0);
+                    isExpand = viewHolder.itemView.getScrollX() > holder.getDeleteViewOffset();
+                } else {
+                    if (isFirstSwipe) {
+                        maxDX = dX;
+                        isFirstSwipe = false;
+                    }
+
+                    if (isExpand)
+                        viewHolder.itemView.scrollTo(Math.max(offset - (int) dX - 5, holder.getDeleteViewOffset()), 0);
+                    else {
+                        if (maxDX > offset) {
+                            viewHolder.itemView.scrollTo(-(int) dX, 0);
+                            return;
+                        }
+
+                        if (offset >= holder.getDeleteViewOffset())
+                            viewHolder.itemView.scrollTo((int) ((offset - (int) maxDX) * (dX / maxDX)), 0);
+                        else
+                            viewHolder.itemView.scrollTo(offset - (int) dX - 2, 0);
+                    }
+                }
+            }
+
+            @Override
+            public float getSwipeThreshold(@NonNull RecyclerView.ViewHolder viewHolder) {
+                return Integer.MAX_VALUE;
+            }
+
+            @Override
+            public float getSwipeEscapeVelocity(float defaultValue) {
+                return Integer.MAX_VALUE;
+            }
+
+            @Override
+            public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
+                int dragFlags = 0;
+
+                int swipeFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
+                return makeMovementFlags(dragFlags, swipeFlags);
+            }
+
+            @Override
+            public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
+                return true;
+            }
+
+            @Override
+            public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
+                MainActivity activity = (MainActivity) consoleFragment.getActivity();
+                assert activity != null;
+
+                try {
+                    activity.deleteWatermark(viewHolder.getAdapterPosition());
+                } catch (CPDFDocumentException e) {
+                    e.printStackTrace();
+                }
+
+                adapter.deleteSettingFromList(viewHolder.getAdapterPosition());
+            }
+        };
+        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
+        itemTouchHelper.attachToRecyclerView(watermarkList);
+    }
+
+    public void addSettingIntoList(WatermarkSetting setting) {
+        adapter.addSettingIntoList(setting);
+    }
+
+    public void showView() {
+        smoothScrollX(0);
+        expandBtn.setRotation(180);
+        isExpand = true;
+    }
+
+    public void hintView() {
+        smoothScrollX(getWidth());
+    }
+
+    public void hintList() {
+        smoothScrollX(listWidth);
+        expandBtn.setRotation(0);
+        isExpand = false;
+    }
+}
+

+ 98 - 0
app/src/main/java/com/compdfkit/pdfviewer/customview/picker/ColorPicker.java

@@ -0,0 +1,98 @@
+package com.compdfkit.pdfviewer.customview.picker;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.Scroller;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.customview.watermarkview.TextWatermarkView;
+
+public class ColorPicker extends ConstraintLayout {
+    private View currentView;
+    private LayoutInflater inflater;
+    private Context currentContext;
+
+    private Scroller mScroller;
+
+    private TextWatermarkView textWatermark;
+
+    private final int[] colorPickers = { R.id.color_1, R.id.color_2, R.id.color_3, R.id.color_4, R.id.color_5, R.id.color_6, R.id.color_7 };
+    private final int[] colors = { 0xFFFF0000, 0xFFFF6600, 0xFFFFDD00, 0xFF00FF33, 0xFF00FFFF, 0xFF0022FF, 0xFF8800FF };
+
+    public ColorPicker(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public ColorPicker(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ColorPicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs,defStyleAttr, 0);
+    }
+
+    public ColorPicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        this.mScroller = new Scroller(context);
+        init(context);
+    }
+
+    @Override
+    public void computeScroll() {
+        super.computeScroll();
+        if (mScroller.computeScrollOffset()) {
+            scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
+            invalidate();
+        }
+    }
+
+    public void smoothScrollX(int destX) {
+        int scrollX = getScrollX();
+        int deltaX = destX - scrollX;
+        mScroller.startScroll(scrollX, 0, deltaX, 0, 500);
+        invalidate();
+    }
+
+    private void init(Context context) {
+        mScroller = new Scroller(context);
+
+        currentContext = context;
+        inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        currentView = inflater.inflate(R.layout.color_picker, this, true);
+
+        initColorPicker(currentView);
+    }
+
+    private void initColorPicker(View currentView) {
+        for (int i = 0; i < 7; i++) {
+            ImageView tempColor = currentView.findViewById(colorPickers[i]);
+
+            int tempI = i;
+            tempColor.setOnClickListener(view -> setColorForWatermark(colors[tempI]));
+        }
+    }
+
+    private void setColorForWatermark(int color) {
+        textWatermark.setTextWatermarkColor(color);
+    }
+
+    public void setTextWatermark(TextWatermarkView textWatermark) {
+        this.textWatermark = textWatermark;
+    }
+
+    public void show() {
+        smoothScrollX(0);
+    }
+
+    public void hide() {
+        smoothScrollX(getWidth());
+    }
+}

+ 88 - 0
app/src/main/java/com/compdfkit/pdfviewer/customview/picker/ImagePicker.java

@@ -0,0 +1,88 @@
+package com.compdfkit.pdfviewer.customview.picker;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Scroller;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+import com.compdfkit.pdfviewer.R;
+
+public class ImagePicker extends ConstraintLayout {
+    private View currentView;
+    private LayoutInflater inflater;
+    private Context currentContext;
+
+    private TextView imageSelectPathView;
+    private Button imageSelectBtn;
+
+    private Scroller mScroller;
+
+    public ImagePicker(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public ImagePicker(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ImagePicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public ImagePicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        this.mScroller = new Scroller(context);
+        init(context);
+    }
+
+    @Override
+    public void computeScroll() {
+        super.computeScroll();
+        if (mScroller.computeScrollOffset()) {
+            scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
+            invalidate();
+        }
+    }
+
+    public void smoothScrollX(int destX) {
+        int scrollX = getScrollX();
+        int deltaX = destX - scrollX;
+        mScroller.startScroll(scrollX, 0, deltaX, 0, 500);
+        invalidate();
+    }
+
+    private void init(Context context) {
+        mScroller = new Scroller(context);
+
+        currentContext = context;
+        inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        currentView = inflater.inflate(R.layout.image_picker, this, true);
+
+        imageSelectPathView = currentView.findViewById(R.id.image_select_path);
+        imageSelectBtn = currentView.findViewById(R.id.image_select_btn);
+    }
+
+    public TextView getImageSelectPathView() {
+        return imageSelectPathView;
+    }
+
+    public Button getImageSelectBtn() {
+        return imageSelectBtn;
+    }
+
+    public void show() {
+        smoothScrollX(0);
+    }
+
+    public void hide() {
+        smoothScrollX(getWidth());
+    }
+}

+ 11 - 12
app/src/main/java/com/compdfkit/pdfviewer/customview/watermarkview/ImageWatermarkView.java

@@ -44,10 +44,10 @@ public class ImageWatermarkView extends WatermarkView {
 
     public ImageWatermarkView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
-        init(context, attrs);
+        init(context);
     }
 
-    private void init(Context context, AttributeSet attrs) {
+    private void init(Context context) {
         currentContext = context;
         inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
@@ -148,9 +148,17 @@ public class ImageWatermarkView extends WatermarkView {
         super.setSizeConvertRate(sizeConvertRate);
     }
 
+    @Override
+    public Bitmap getFullScreenBitmap(int width, int height, int hSpace, int vSpace, int xOffset, int yOffset, float rotation) {
+        Matrix matrix = new Matrix();
+        matrix.setScale(getScale(), getScale());
+
+        Bitmap tempBitmap = Bitmap.createBitmap(initBitmap, 0, 0, initBitmap.getWidth(), initBitmap.getHeight(), matrix, true);
+        return generateFullScreenBitmap(tempBitmap, width, height, hSpace, vSpace, xOffset, yOffset, rotation);
+    }
+
     public void setWatermarkImageContent(Bitmap content) {
         watermarkImage.setImageBitmap(content);
-//        initBitmap = content;
     }
 
     public void setWatermarkImageFromPath(String imagePath) {
@@ -161,13 +169,4 @@ public class ImageWatermarkView extends WatermarkView {
             Toast.makeText(currentContext, "获取图片失败", Toast.LENGTH_SHORT).show();
         }
     }
-
-    @Override
-    public Bitmap getFullScreenBitmap(int width, int height, int hSpace, int vSpace, int xOffset, int yOffset, float rotation) {
-        Matrix matrix = new Matrix();
-        matrix.setScale(getScale(), getScale());
-
-        Bitmap tempBitmap = Bitmap.createBitmap(initBitmap, 0, 0, initBitmap.getWidth(), initBitmap.getHeight(), matrix, true);
-        return generateFullScreenBitmap(tempBitmap, width, height, hSpace, vSpace, xOffset, yOffset, rotation);
-    }
 }

+ 18 - 17
app/src/main/java/com/compdfkit/pdfviewer/customview/watermarkview/TextWatermarkView.java

@@ -27,6 +27,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
 
 import com.compdfkit.pdfviewer.R;
 import com.compdfkit.pdfviewer.entity.WatermarkSetting;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
 
 public class TextWatermarkView extends WatermarkView{
     private TextView watermarkText;
@@ -49,10 +50,10 @@ public class TextWatermarkView extends WatermarkView{
 
     public TextWatermarkView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
-        init(context, attrs);
+        init(context);
     }
 
-    private void init(Context context, AttributeSet attrs) {
+    private void init(Context context) {
         currentContext = context;
         inflater = (LayoutInflater) currentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
@@ -105,7 +106,7 @@ public class TextWatermarkView extends WatermarkView{
         final Button[] positiveButton = new Button[1];
 
         editText.setText(watermarkText.getText());
-        AlertDialog.Builder inputDialog = new AlertDialog.Builder(currentContext);
+        MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(currentContext);
         inputDialog.setTitle(R.string.text_watermark).setView(textEditorLayout);
         inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> setWatermarkTextContent(editText.getText().toString()));
 
@@ -163,20 +164,6 @@ public class TextWatermarkView extends WatermarkView{
         watermarkText.setTextColor(color);
     }
 
-    public void setWatermarkTextContent(String content) {
-        watermarkText.setText(content);
-    }
-
-    public void setWatermarkTextFontSize(float textFontSize) {
-        watermarkText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textFontSize * sizeConvertRate);
-    }
-
-    public void setTextDefaultSize(float textDefaultSize) {
-        this.textDefaultSize = textDefaultSize;
-        watermarkText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textDefaultSize);
-        Log.d("Watermark attribute", "Text Watermark: " + watermarkText.getTextSize());
-    }
-
     @Override
     public WatermarkSetting completeSetting(WatermarkSetting setting) {
         setting.setType(0);
@@ -218,4 +205,18 @@ public class TextWatermarkView extends WatermarkView{
 
         return generateFullScreenBitmap(bitmap, width, height, hSpace, vSpace, xOffset, yOffset, rotation);
     }
+
+    public void setWatermarkTextContent(String content) {
+        watermarkText.setText(content);
+    }
+
+    public void setWatermarkTextFontSize(float textFontSize) {
+        watermarkText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textFontSize * sizeConvertRate);
+    }
+
+    public void setTextDefaultSize(float textDefaultSize) {
+        this.textDefaultSize = textDefaultSize;
+        watermarkText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textDefaultSize);
+        Log.d("Watermark attribute", "Text Watermark: " + watermarkText.getTextSize());
+    }
 }

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

@@ -126,7 +126,6 @@ public class WatermarkView extends ConstraintLayout {
         this.sizeConvertRate = sizeConvertRate;
     }
 
-    //TODO:有待优化
     public Bitmap generateFullScreenBitmap(Bitmap srcBitmap, int width, int height, int hSpace, int vSpace, int xOffset, int yOffset, float rotation) {
         int srcWidth = srcBitmap.getWidth();
         int srcHeight = srcBitmap.getHeight();

+ 112 - 80
app/src/main/java/com/compdfkit/pdfviewer/fragments/WatermarkConsoleFragment.java

@@ -11,9 +11,12 @@ import android.content.pm.PackageManager;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.Matrix;
+import android.media.Image;
 import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
 
+import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
 import androidx.appcompat.widget.AppCompatEditText;
@@ -29,6 +32,8 @@ import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
 import android.widget.Button;
 import android.widget.ImageButton;
 import android.widget.ImageView;
@@ -40,10 +45,15 @@ import android.widget.TextView;
 import com.compdfkit.core.common.CPDFDocumentException;
 import com.compdfkit.pdfviewer.MainActivity;
 import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.customview.picker.ColorPicker;
+import com.compdfkit.pdfviewer.customview.picker.ImagePicker;
 import com.compdfkit.pdfviewer.customview.watermarkview.ImageWatermarkView;
 import com.compdfkit.pdfviewer.customview.watermarkview.TextWatermarkView;
 import com.compdfkit.pdfviewer.customview.watermarkview.WatermarkView;
 import com.compdfkit.pdfviewer.entity.WatermarkSetting;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.google.android.material.dialog.MaterialDialogs;
+import com.google.android.material.slider.Slider;
 import com.google.android.material.textfield.TextInputEditText;
 
 import java.util.Objects;
@@ -52,11 +62,11 @@ public class WatermarkConsoleFragment extends Fragment {
     private int mode;
     private boolean isCustomRange = false;
 
-    private int tWatermarkOpacity = 50;
-    private int tWatermarkSize = 50;
+    private float tWatermarkOpacity = 50;
+    private float tWatermarkSize = 100;
 
-    private int iWatermarkOpacity = 50;
-    private int iWatermarkSize = 50;
+    private float iWatermarkOpacity = 50;
+    private float iWatermarkSize = 100;
 
     private int documentPageCount = 0;
 
@@ -69,14 +79,14 @@ public class WatermarkConsoleFragment extends Fragment {
 
     private WatermarkView associatedWatermark = null;
 
-    private View colorPicker;
-    private View imagePicker;
+    private ColorPicker colorPicker;
+    private ImagePicker imagePicker;
 
     private TextView imageSelectPathView;
     private Button imageSelectBtn;
 
-    private SeekBar opacitySlider;
-    private SeekBar sizeSlider;
+    private Slider opacitySlider;
+    private Slider sizeSlider;
 
     private TextView opacityText;
     private TextView sizeText;
@@ -89,9 +99,6 @@ public class WatermarkConsoleFragment extends Fragment {
     private TextInputEditText hSpaceEdit;
     private TextInputEditText vSpaceEdit;
 
-    private final int[] colorPickers = { R.id.color_1, R.id.color_2, R.id.color_3, R.id.color_4, R.id.color_5, R.id.color_6, R.id.color_7 };
-    private final int[] colors = { 0xFFFF0000, 0xFFFF6600, 0xFFFFDD00, 0xFF00FF33, 0xFF00FFFF, 0xFF0022FF, 0xFF8800FF };
-
     private String pageRange = "0";
 
     public WatermarkConsoleFragment() {
@@ -122,8 +129,10 @@ public class WatermarkConsoleFragment extends Fragment {
         colorPicker = returnView.findViewById(R.id.color_picker);
         imagePicker = returnView.findViewById(R.id.image_picker);
 
-        imageSelectPathView = returnView.findViewById(R.id.image_select_path);
-        imageSelectBtn = returnView.findViewById(R.id.image_select_btn);
+        colorPicker.setTextWatermark((TextWatermarkView) associatedWatermark);
+
+        imageSelectPathView = imagePicker.getImageSelectPathView();
+        imageSelectBtn = imagePicker.getImageSelectBtn();
         initImageSelectBtn();
 
         opacityText = returnView.findViewById(R.id.opacity_text);
@@ -141,22 +150,11 @@ public class WatermarkConsoleFragment extends Fragment {
         fullScreenCheck = returnView.findViewById(R.id.full_screen_checkbox);
         initFullScreenCheck();
 
-        initColorPicker(returnView);
-
         hSpaceEdit = returnView.findViewById(R.id.horizontal_space);
         vSpaceEdit = returnView.findViewById(R.id.vertical_space);
         initSpaceEdits();
     }
 
-    private void initColorPicker(View returnView) {
-        for (int i = 0; i < 7; i++) {
-            ImageView tempColor = returnView.findViewById(colorPickers[i]);
-
-            int tempI = i;
-            tempColor.setOnClickListener(view -> associatedWatermark.setTextWatermarkColor(colors[tempI]));
-        }
-    }
-
     private void initImageSelectBtn() {
         imageSelectBtn.setOnClickListener(v -> {
             //动态申请获取访问 读写磁盘的权限
@@ -165,10 +163,15 @@ public class WatermarkConsoleFragment extends Fragment {
                 ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 101);
             } else {
                 //打开相册
-                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
-                //Intent.ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"
-                intent.setType("image/*");
-                startActivityForResult(intent, 102); // 打开相册
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+                    Intent intent = new Intent(MediaStore.ACTION_PICK_IMAGES);
+                    startActivityForResult(intent, 102);
+                } else {
+                    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                    //Intent.ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"
+                    intent.setType("image/*");
+                    startActivityForResult(intent, 102); // 打开相册
+                }
             }
         });
     }
@@ -220,46 +223,31 @@ public class WatermarkConsoleFragment extends Fragment {
         return path;
     }
 
+    @SuppressLint("SetTextI18n")
     private void initOpacitySlider() {
-        opacitySlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
-                currentOpacity = i / 100f;
-                if (mode == 0)
-                    tWatermarkOpacity = i;
-                else
-                    iWatermarkOpacity = i;
-
-                opacityText.setText(i + "%");
-                setting.setOpacity(1.0f * i / 100);
-                associatedWatermark.setWatermarkOpacity(1.0f * i / 100);
-            }
-            @Override
-            public void onStartTrackingTouch(SeekBar seekBar) {}
-            @Override
-            public void onStopTrackingTouch(SeekBar seekBar) {}
+        opacitySlider.addOnChangeListener((slider, value, fromUser) -> {
+            currentOpacity = value / 100f;
+            if (mode == 0)
+                tWatermarkOpacity = value;
+            else
+                iWatermarkOpacity = value;
+
+            opacityText.setText((int) value + "%");
+            setting.setOpacity(value / 100);
+            associatedWatermark.setWatermarkOpacity(value / 100);
         });
     }
 
+    @SuppressLint("SetTextI18n")
     private void initSizeSlider() {
-        sizeSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            @SuppressLint("SetTextI18n")
-            @Override
-            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
-                if (mode == 0)
-                    tWatermarkSize = i;
-                else
-                    iWatermarkSize = i;
-
-                i = i + 50;
-                sizeText.setText(i + "%");
-                associatedWatermark.setWatermarkScale(1.0f * i / 100);
-            }
-            @Override
-            public void onStartTrackingTouch(SeekBar seekBar) {}
-            @Override
-            public void onStopTrackingTouch(SeekBar seekBar) {}
+        sizeSlider.addOnChangeListener((slider, value, fromUser) -> {
+            if (mode == 0)
+                tWatermarkSize = value;
+            else
+                iWatermarkSize = value;
+
+            sizeText.setText((int) value + "%");
+            associatedWatermark.setWatermarkScale(value / 100);
         });
     }
 
@@ -277,7 +265,8 @@ public class WatermarkConsoleFragment extends Fragment {
             if (isCustomRange)
                 rangeEditText.setText(pageRange);
 
-            AlertDialog.Builder inputDialog = new AlertDialog.Builder(getActivity());
+
+            MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(getActivity());
             inputDialog.setTitle(R.string.setting_range).setView(rangeSelectLayout);
             inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
                 if (customRadioBtn.isChecked()) {
@@ -295,7 +284,7 @@ public class WatermarkConsoleFragment extends Fragment {
 
             customRadioBtn.setOnCheckedChangeListener((compoundButton, b) -> {
                 rangeEditText.setEnabled(b);
-                if (b && rangeEditText.getText().toString().equals(""))
+                if (b && Objects.requireNonNull(rangeEditText.getText()).toString().equals(""))
                     positiveButton[0].setEnabled(false);
             });
 
@@ -350,15 +339,12 @@ public class WatermarkConsoleFragment extends Fragment {
             }
         });
 
-        vSpaceEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
-            @Override
-            public void onFocusChange(View view, boolean b) {
-                if (!b) {
-                    setvSpace(Float.parseFloat(Objects.requireNonNull(vSpaceEdit.getText()).toString()));
-                    MainActivity activity = (MainActivity) getActivity();
-                    assert activity != null;
-                    activity.showFullScreenMask(true);
-                }
+        vSpaceEdit.setOnFocusChangeListener((view, b) -> {
+            if (!b) {
+                setvSpace(Float.parseFloat(Objects.requireNonNull(vSpaceEdit.getText()).toString()));
+                MainActivity activity = (MainActivity) getActivity();
+                assert activity != null;
+                activity.showFullScreenMask(true);
             }
         });
     }
@@ -369,12 +355,58 @@ public class WatermarkConsoleFragment extends Fragment {
 
     public void changePicker(int mode) {
         this.mode = mode;
-        colorPicker.setVisibility(this.mode == 0 ? View.VISIBLE : View.INVISIBLE);
-        imagePicker.setVisibility(this.mode == 0 ? View.INVISIBLE : View.VISIBLE);
+
+        AlphaAnimation appearAnimation = new AlphaAnimation(0, 1);
+        appearAnimation.setDuration(250);
+
+        AlphaAnimation disappearAnimation = new AlphaAnimation(1, 0);
+        disappearAnimation.setDuration(250);
+
+        if (mode == 0) {
+            disappearAnimation.setAnimationListener(new Animation.AnimationListener() {
+                @Override
+                public void onAnimationStart(Animation animation) {
+                    colorPicker.setVisibility(View.VISIBLE);
+                }
+
+                @Override
+                public void onAnimationEnd(Animation animation) {
+                    imagePicker.setVisibility(View.INVISIBLE);
+                }
+
+                @Override
+                public void onAnimationRepeat(Animation animation) {
+
+                }
+            });
+
+            colorPicker.startAnimation(appearAnimation);
+            imagePicker.startAnimation(disappearAnimation);
+        } else {
+            disappearAnimation.setAnimationListener(new Animation.AnimationListener() {
+                @Override
+                public void onAnimationStart(Animation animation) {
+                    imagePicker.setVisibility(View.VISIBLE);
+                }
+
+                @Override
+                public void onAnimationEnd(Animation animation) {
+                    colorPicker.setVisibility(View.INVISIBLE);
+                }
+
+                @Override
+                public void onAnimationRepeat(Animation animation) {
+
+                }
+            });
+
+            colorPicker.startAnimation(disappearAnimation);
+            imagePicker.startAnimation(appearAnimation);
+        }
 
         currentOpacity = (this.mode == 0 ? tWatermarkOpacity : iWatermarkOpacity) / 100.0f;
-        opacitySlider.setProgress(this.mode == 0 ? tWatermarkOpacity : iWatermarkOpacity);
-        sizeSlider.setProgress(this.mode == 0 ? tWatermarkSize : iWatermarkSize);
+        opacitySlider.setValue(this.mode == 0 ? tWatermarkOpacity : iWatermarkOpacity);
+        sizeSlider.setValue(this.mode == 0 ? tWatermarkSize : iWatermarkSize);
         if (fullScreenCheck.isChecked()) {
             MainActivity activity = (MainActivity) getActivity();
             assert activity != null;
@@ -383,7 +415,7 @@ public class WatermarkConsoleFragment extends Fragment {
     }
 
     public WatermarkSetting getWatermarkSetting() {
-        setting.setOpacity(opacitySlider.getProgress() * 1.0f / 100);
+        setting.setOpacity(opacitySlider.getValue() / 100);
         setting.setFullScreen(fullScreenCheck.isChecked());
         setting.setPages(pageRange);
         if (fullScreenCheck.isChecked()) {
@@ -448,7 +480,7 @@ public class WatermarkConsoleFragment extends Fragment {
         }
 
         associatedWatermark.setWatermarkOpacity(setting.getOpacity());
-        opacitySlider.setProgress((int) (setting.getOpacity() * 100));
+        opacitySlider.setValue((int) (setting.getOpacity() * 100));
 
         associatedWatermark.setRotationRadian(setting.getRotation());
         associatedWatermark.setRotation((float) -Math.toDegrees(setting.getRotation()));

+ 9 - 0
app/src/main/java/com/compdfkit/pdfviewer/tools/WatermarkHandle.java

@@ -6,6 +6,8 @@ import com.compdfkit.pdfviewer.entity.WatermarkSetting;
 import java.util.ArrayList;
 
 public class WatermarkHandle {
+    private static boolean enabled = false;
+
     private static final ArrayList<WatermarkSetting> settingList = new ArrayList<>();
 
     public static void updateWatermark(CPDFWatermark watermark, WatermarkSetting setting, float sizeConvertRate) {
@@ -61,7 +63,14 @@ public class WatermarkHandle {
         return setting;
     }
 
+    public static boolean getEnable() {
+        return enabled;
+    }
+
     public static void addSettingIntoList(CPDFWatermark watermark) {
+        if (!enabled)
+            enabled = true;
+
         settingList.add(getSettingFromWatermark(watermark));
     }
 

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

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="?android:attr/textColorSecondary"
+    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="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
+</vector>

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

@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="?android:attr/textColorSecondary"
+    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="M5,17v2h14v-2L5,17zM9.5,12.8h5l0.9,2.2h2.1L12.75,4h-1.5L6.5,15h2.1l0.9,-2.2zM12,5.98L13.87,11h-3.74L12,5.98z"/>
+</vector>

+ 70 - 57
app/src/main/res/layout-land-v31/activity_main.xml

@@ -6,49 +6,21 @@
     android:layout_height="match_parent"
     tools:context=".MainActivity">
 
-    <androidx.appcompat.widget.Toolbar
-        android:id="@+id/toolbar"
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
-        android:minHeight="?actionBarSize"
-        android:elevation="4dp"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:title="@string/add_watermark"/>
-
-    <com.google.android.material.tabs.TabLayout
-        android:id="@+id/tab_layout"
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
-        app:tabTextAppearance="@style/TabLayoutTextStyle"
-        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>
+    <View
+        android:id="@+id/page_container"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="?attr/colorSecondaryContainer"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"
+        app:layout_constraintStart_toStartOf="parent" />
 
     <androidx.appcompat.widget.AppCompatImageView
         android:id="@+id/page_image"
         android:layout_width="wrap_content"
         android:layout_height="0dp"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toStartOf="@id/console_view"
@@ -59,7 +31,7 @@
         android:layout_width="wrap_content"
         android:layout_height="0dp"
         android:visibility="invisible"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toStartOf="@id/console_view"
@@ -86,27 +58,50 @@
         app:layout_constraintStart_toStartOf="@id/page_image"
         app:image_mode="false" />
 
-    <androidx.appcompat.widget.AppCompatImageButton
-        android:layout_margin="10dp"
-        android:id="@+id/expand_list_btn"
-        android:backgroundTint="@color/white"
-        android:layout_width="wrap_content"
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:visibility="invisible"
-        android:elevation="4dp"
-        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintStart_toStartOf="parent" />
+        android:minHeight="?actionBarSize"
+        android:background="?attr/colorSurface"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:title="@string/add_watermark"/>
+
+    <com.google.android.material.tabs.TabLayout
+        android:id="@+id/tab_layout"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        app:tabTextAppearance="@style/TabLayoutTextStyle"
+        app:layout_constraintTop_toBottomOf="@+id/toolbar"
+        app:layout_constraintStart_toStartOf="@id/console_view"
+        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>
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/watermark_list"
-        android:layout_width="160dp"
+    <com.compdfkit.pdfviewer.customview.listview.WatermarkListView
+        android:id="@+id/watermark_list_view"
+        android:layout_width="wrap_content"
         android:layout_height="0dp"
-        android:background="@color/gray"
         android:elevation="4dp"
-        android:visibility="invisible"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent" />
 
@@ -115,7 +110,7 @@
         android:layout_width="1dp"
         android:layout_height="0dp"
         android:background="?android:attr/listDivider"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toStartOf="@id/console_view"/>
 
@@ -131,4 +126,22 @@
         app:layout_constraintEnd_toEndOf="parent"
         tools:layout="@layout/fragment_watermark_console" />
 
+    <View
+        android:id="@+id/divider4"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"/>
+
+    <View
+        android:id="@+id/divider3"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"/>
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 20 - 146
app/src/main/res/layout-land-v31/fragment_watermark_console.xml

@@ -3,8 +3,9 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="350dp"
     android:layout_height="match_parent"
-    android:padding="10dp"
+    android:padding="8dp"
     android:elevation="4dp"
+    android:background="?attr/colorSurface"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     tools:context=".fragments.WatermarkConsoleFragment">
 
@@ -17,7 +18,7 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent" >
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ColorPicker
             android:id="@+id/color_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -26,107 +27,9 @@
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent" >
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ImagePicker
             android:id="@+id/image_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -135,41 +38,8 @@
             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: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="@string/default_image"
-                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="@string/select_image"
-                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" />
+            app:layout_constraintEnd_toEndOf="parent" />
 
-        </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <ImageView
@@ -178,19 +48,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_opacity_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/opacity_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/opacity"
+        android:value="50.0"
+        android:valueFrom="0.0"
+        android:valueTo="100.0"
         app:layout_constraintTop_toTopOf="@id/opacity_icon"
         app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
         app:layout_constraintStart_toEndOf="@+id/opacity_icon"
@@ -213,19 +85,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_format_size_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/size_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/size"
+        android:value="100.0"
+        android:valueFrom="50.0"
+        android:valueTo="150.0"
         app:layout_constraintTop_toTopOf="@id/size_icon"
         app:layout_constraintBottom_toBottomOf="@id/size_icon"
         app:layout_constraintStart_toEndOf="@+id/size_icon"
@@ -262,7 +136,7 @@
         app:layout_constraintEnd_toStartOf="@id/page_range_button" />
 
     <ImageButton
-        android:padding="10dp"
+        android:padding="8dp"
         android:id="@+id/page_range_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -277,7 +151,7 @@
         android:id="@+id/full_screen_checkbox"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:padding="10dp"
+        android:padding="8dp"
         android:text="@string/full_screen"
         app:layout_constraintHorizontal_chainStyle="spread_inside"
         app:layout_constraintBottom_toBottomOf="parent"

+ 37 - 24
app/src/main/res/layout-land/activity_main.xml

@@ -6,10 +6,20 @@
     android:layout_height="match_parent"
     tools:context=".MainActivity">
 
+    <View
+        android:id="@+id/page_container"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="#eeeeee"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"
+        app:layout_constraintStart_toStartOf="parent" />
+
     <androidx.appcompat.widget.Toolbar
         android:id="@+id/toolbar"
         android:layout_width="match_parent"
-        android:layout_height="30dp"
+        android:layout_height="wrap_content"
         android:background="?attr/colorPrimary"
         android:minHeight="?actionBarSize"
         android:elevation="4dp"
@@ -21,8 +31,8 @@
 
     <com.google.android.material.tabs.TabLayout
         android:id="@+id/tab_layout"
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
         android:elevation="4dp"
         android:background="?attr/colorPrimary"
         app:tabTextAppearance="@style/TabLayoutTextStyle"
@@ -30,7 +40,7 @@
         app:tabSelectedTextColor="@color/white"
         app:tabTextColor="@color/purple_200"
         app:layout_constraintTop_toBottomOf="@+id/toolbar"
-        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintStart_toStartOf="@id/console_view"
         app:layout_constraintEnd_toEndOf="parent">
 
         <com.google.android.material.tabs.TabItem
@@ -55,7 +65,7 @@
         android:id="@+id/page_image"
         android:layout_width="wrap_content"
         android:layout_height="0dp"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toStartOf="@id/console_view"
@@ -66,7 +76,7 @@
         android:layout_width="wrap_content"
         android:layout_height="0dp"
         android:visibility="invisible"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toStartOf="@id/console_view"
@@ -93,27 +103,12 @@
         app:layout_constraintStart_toStartOf="@id/page_image"
         app:image_mode="false" />
 
-    <androidx.appcompat.widget.AppCompatImageButton
-        android:layout_margin="10dp"
-        android:id="@+id/expand_list_btn"
-        android:backgroundTint="@color/white"
+    <com.compdfkit.pdfviewer.customview.listview.WatermarkListView
+        android:id="@+id/watermark_list_view"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="invisible"
-        android:elevation="4dp"
-        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintStart_toStartOf="parent" />
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/watermark_list"
-        android:layout_width="160dp"
         android:layout_height="0dp"
-        android:background="@color/gray"
         android:elevation="4dp"
-        android:visibility="invisible"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent" />
 
@@ -129,4 +124,22 @@
         app:layout_constraintEnd_toEndOf="parent"
         tools:layout="@layout/fragment_watermark_console" />
 
+    <View
+        android:id="@+id/divider4"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"/>
+
+    <View
+        android:id="@+id/divider3"
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:background="?android:attr/listDivider"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toStartOf="@id/console_view"/>
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 20 - 162
app/src/main/res/layout-land/fragment_watermark_console.xml

@@ -3,8 +3,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="350dp"
     android:layout_height="match_parent"
-    android:background="@color/white"
-    android:padding="10dp"
+    android:background="@color/gray"
+    android:padding="8dp"
     android:elevation="4dp"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     tools:context=".fragments.WatermarkConsoleFragment">
@@ -18,7 +18,7 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent" >
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ColorPicker
             android:id="@+id/color_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -27,107 +27,9 @@
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent" >
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ImagePicker
             android:id="@+id/image_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -136,44 +38,7 @@
             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="@string/default_image"
-                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="@string/select_image"
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <ImageView
@@ -182,19 +47,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_opacity_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/opacity_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/opacity"
+        android:value="50.0"
+        android:valueFrom="0.0"
+        android:valueTo="100.0"
         app:layout_constraintTop_toTopOf="@id/opacity_icon"
         app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
         app:layout_constraintStart_toEndOf="@+id/opacity_icon"
@@ -217,19 +84,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_format_size_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/size_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/size"
+        android:value="100.0"
+        android:valueFrom="50.0"
+        android:valueTo="150.0"
         app:layout_constraintTop_toTopOf="@id/size_icon"
         app:layout_constraintBottom_toBottomOf="@id/size_icon"
         app:layout_constraintStart_toEndOf="@+id/size_icon"
@@ -245,7 +114,6 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toEndOf="@+id/size_slider" />
 
-
     <TextView
         android:id="@+id/page_range_text"
         android:layout_width="wrap_content"
@@ -258,16 +126,6 @@
         app:layout_constraintBottom_toTopOf="@id/full_screen_checkbox"
         app:layout_constraintStart_toStartOf="parent" />
 
-<!--    <androidx.appcompat.widget.AppCompatSpinner-->
-<!--        android:id="@+id/page_range_spinner"-->
-<!--        android:layout_width="wrap_content"-->
-<!--        android:layout_height="wrap_content"-->
-<!--        android:spinnerMode="dialog"-->
-<!--        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" />-->
-
     <TextView
         android:id="@+id/page_range_msg"
         android:layout_width="wrap_content"
@@ -279,7 +137,7 @@
         app:layout_constraintEnd_toStartOf="@id/page_range_button" />
 
     <ImageButton
-        android:padding="10dp"
+        android:padding="8dp"
         android:id="@+id/page_range_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -294,7 +152,7 @@
         android:id="@+id/full_screen_checkbox"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:padding="10dp"
+        android:padding="8dp"
         android:text="@string/full_screen"
         app:layout_constraintHorizontal_chainStyle="spread_inside"
         app:layout_constraintBottom_toBottomOf="parent"

+ 50 - 55
app/src/main/res/layout-v31/activity_main.xml

@@ -6,48 +6,20 @@
     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:minHeight="?actionBarSize"
-        android:elevation="4dp"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
+    <View
+        android:id="@+id/page_container"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="?attr/colorSecondaryContainer"
+        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintEnd_toEndOf="parent"
-        app:title="@string/add_watermark" />
-
-    <com.google.android.material.tabs.TabLayout
-        android:id="@+id/tab_layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        app:tabTextAppearance="@style/TabLayoutTextStyle"
-        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>
+        app:layout_constraintStart_toStartOf="parent" />
 
     <androidx.appcompat.widget.AppCompatImageView
         android:id="@+id/page_image"
         android:layout_width="wrap_content"
-        android:layout_height="0dp"
+        android:layout_height="wrap_content"
         app:layout_constraintTop_toBottomOf="@id/tab_layout"
         app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintEnd_toEndOf="parent"
@@ -86,26 +58,49 @@
         app:layout_constraintStart_toStartOf="@id/page_image"
         app:image_mode="false" />
 
-    <androidx.appcompat.widget.AppCompatImageButton
-        android:layout_margin="10dp"
-        android:id="@+id/expand_list_btn"
-        android:backgroundTint="@color/white"
-        android:layout_width="wrap_content"
+    <com.google.android.material.appbar.MaterialToolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:visibility="invisible"
-        android:elevation="4dp"
-        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
-        app:layout_constraintBottom_toTopOf="@id/console_view"
-        app:layout_constraintStart_toStartOf="parent"/>
+        android:minHeight="?actionBarSize"
+        android:background="?attr/colorSurface"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:title="@string/add_watermark" />
+
+    <com.google.android.material.tabs.TabLayout
+        android:id="@+id/tab_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@+id/toolbar"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent">
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/watermark_list"
-        android:layout_width="160dp"
+        <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.pdfviewer.customview.listview.WatermarkListView
+        android:id="@+id/watermark_list_view"
+        android:layout_width="wrap_content"
         android:layout_height="0dp"
-        android:background="@color/gray"
-        android:elevation="4dp"
-        android:visibility="invisible"
+        android:elevation="1dp"
+        android:visibility="visible"
         app:layout_constraintTop_toBottomOf="@id/tab_layout"
         app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintStart_toStartOf="parent"/>
@@ -114,7 +109,7 @@
         android:id="@+id/divider"
         android:layout_width="409dp"
         android:layout_height="1dp"
-        android:background="?android:attr/listDivider"
+        android:background="?attr/colorSecondaryContainer"
         app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent"/>

+ 75 - 180
app/src/main/res/layout-v31/fragment_watermark_console.xml

@@ -3,8 +3,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:padding="10dp"
-    android:elevation="4dp"
+    android:padding="8dp"
+    android:background="?attr/colorSurface"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     tools:context=".fragments.WatermarkConsoleFragment">
 
@@ -17,7 +17,7 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent" >
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ColorPicker
             android:id="@+id/color_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -26,150 +26,18 @@
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent" >
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ImagePicker
             android:id="@+id/image_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:padding="5dp"
+            android:padding="7dp"
             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: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="@string/default_image"
-                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="@string/select_image"
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <ImageView
@@ -178,19 +46,23 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_opacity_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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:stepSize="10.0"-->
+    <com.google.android.material.slider.Slider
         android:id="@+id/opacity_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/opacity"
+        android:value="50.0"
+        android:valueFrom="0.0"
+        android:valueTo="100.0"
         app:layout_constraintTop_toTopOf="@id/opacity_icon"
         app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
         app:layout_constraintStart_toEndOf="@+id/opacity_icon"
@@ -213,23 +85,26 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_format_size_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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:stepSize="10.0"-->
+    <com.google.android.material.slider.Slider
         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"
+        android:contentDescription="@string/size"
+        android:value="100.0"
+        android:valueFrom="50.0"
+        android:valueTo="150.0"
         app:layout_constraintBottom_toBottomOf="@id/size_icon"
+        app:layout_constraintEnd_toStartOf="@id/size_text"
         app:layout_constraintStart_toEndOf="@+id/size_icon"
-        app:layout_constraintEnd_toStartOf="@id/size_text"/>
+        app:layout_constraintTop_toTopOf="@id/size_icon" />
 
     <TextView
         android:id="@+id/size_text"
@@ -247,8 +122,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/page_range"
-        android:textSize="20sp"
-        android:padding="12dp"
+        android:textSize="16sp"
+        android:padding="8dp"
         app:layout_constraintTop_toBottomOf="@+id/size_icon"
         app:layout_constraintBottom_toTopOf="@id/full_screen_checkbox"
         app:layout_constraintStart_toStartOf="parent" />
@@ -263,22 +138,24 @@
         app:layout_constraintEnd_toStartOf="@id/page_range_button" />
 
     <ImageButton
-        android:padding="10dp"
         android:id="@+id/page_range_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:background="#00000000"
+        android:contentDescription="@string/custom_range"
+        android:minWidth="48dp"
+        android:minHeight="48dp"
+        android:padding="8dp"
         android:src="@drawable/ic_baseline_expand_more_24"
         app:layout_constraintBottom_toBottomOf="@id/page_range_text"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@id/page_range_text"/>
+        app:layout_constraintTop_toTopOf="@id/page_range_text" />
 
-
-    <CheckBox
+    <com.google.android.material.checkbox.MaterialCheckBox
         android:id="@+id/full_screen_checkbox"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:padding="10dp"
+        android:padding="8dp"
         android:text="@string/full_screen"
         app:layout_constraintHorizontal_chainStyle="spread_inside"
         app:layout_constraintBottom_toBottomOf="parent"
@@ -296,50 +173,68 @@
         app:layout_constraintStart_toEndOf="@id/full_screen_checkbox"
         app:layout_constraintEnd_toEndOf="parent">
 
-        <com.google.android.material.textfield.TextInputEditText
-            android:id="@+id/horizontal_space"
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/horizontal_space_field"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:hint="@string/default_space"
-            android:text="@string/default_space"
-            android:enabled="false"
+            android:hint="@string/horizontal_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" />
+            app:layout_constraintTop_toTopOf="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"
+                android:text="@string/default_space"
+                android:enabled="false"
+                tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
+
+        </com.google.android.material.textfield.TextInputLayout>
 
         <TextView
             android:id="@+id/horizontal_space_mm"
-            android:layout_width="40dp"
+            android:layout_width="wrap_content"
             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"/>
+            android:padding="8dp"
+            app:layout_constraintTop_toTopOf="@id/horizontal_space_field"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space_field"
+            app:layout_constraintStart_toEndOf="@+id/horizontal_space_field"
+            app:layout_constraintEnd_toStartOf="@id/vertical_space_field"/>
 
-        <com.google.android.material.textfield.TextInputEditText
-            android:id="@+id/vertical_space"
+        <com.google.android.material.textfield.TextInputLayout
+            android:id="@+id/vertical_space_field"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:hint="@string/default_space"
-            android:text="@string/default_space"
-            android:enabled="false"
-            app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
+            android:hint="@string/v"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space_field"
             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" />
+            app:layout_constraintTop_toTopOf="@id/horizontal_space_field" >
+
+            <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"
+                android:text="@string/default_space"
+                android:enabled="false"
+                tools:ignore="TouchTargetSizeCheck" />
+
+        </com.google.android.material.textfield.TextInputLayout>
 
         <TextView
             android:id="@+id/vertical_space_mm"
-            android:layout_width="40dp"
+            android:layout_width="wrap_content"
             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"
+            android:padding="8dp"
+            app:layout_constraintTop_toTopOf="@id/horizontal_space_field"
+            app:layout_constraintBottom_toBottomOf="@id/horizontal_space_field"
+            app:layout_constraintStart_toEndOf="@id/vertical_space_field"
             app:layout_constraintEnd_toEndOf="parent" />
 
     </androidx.constraintlayout.widget.ConstraintLayout>

+ 73 - 0
app/src/main/res/layout-v31/watermark_item_layout.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@color/white">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/delete_view"
+        android:layout_width="80dp"
+        android:layout_height="0dp"
+        android:background="#e06666"
+        app:layout_constraintStart_toEndOf="@id/item_view"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent">
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:srcCompat="@drawable/ic_baseline_delete_forever_24"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/item_view"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:background="?attr/colorOnTertiary"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent">
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/watermark_type_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:padding="8dp"
+            android:src="@drawable/ic_baseline_text_type_24"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@id/watermark_content"/>
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/watermark_content"
+            android:layout_width="80dp"
+            android:layout_height="wrap_content"
+            android:maxEms="5"
+            android:ellipsize="end"
+            android:text="test"
+            android:textColor="?attr/colorOnTertiaryContainer"
+            app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
+            app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
+            app:layout_constraintStart_toEndOf="@id/watermark_type_icon"
+            app:layout_constraintEnd_toStartOf="@id/hint_icon"/>
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/hint_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
+            app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
+            app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
+            app:layout_constraintStart_toEndOf="@id/watermark_content" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 31 - 0
app/src/main/res/layout-v31/watermark_list_view.xml

@@ -0,0 +1,31 @@
+<?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">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/watermark_list"
+        android:layout_width="160dp"
+        android:layout_height="0dp"
+        android:background="?attr/colorTertiaryContainer"
+        android:elevation="1dp"
+        android:visibility="visible"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageButton
+        android:layout_margin="8dp"
+        android:id="@+id/expand_list_btn"
+        android:background="#00000000"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:visibility="visible"
+        android:elevation="4dp"
+        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
+        app:layout_constraintTop_toTopOf="@id/watermark_list"
+        app:layout_constraintBottom_toBottomOf="@id/watermark_list"
+        app:layout_constraintStart_toEndOf="@id/watermark_list"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 55 - 59
app/src/main/res/layout/activity_main.xml

@@ -6,50 +6,15 @@
     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"
+    <View
+        android:id="@+id/page_container"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:background="#eeeeee"
+        app:layout_constraintTop_toBottomOf="@id/tab_layout"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintEnd_toEndOf="parent"
-        app:title="@string/add_watermark"
-        app:titleTextColor="?attr/colorOnPrimary" />
-
-    <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="?attr/colorOnPrimary"
-        app:tabSelectedTextColor="?attr/colorOnPrimary"
-        app:tabTextColor="?attr/colorSecondary"
-        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>
+        app:layout_constraintStart_toStartOf="parent" />
 
     <androidx.appcompat.widget.AppCompatImageView
         android:id="@+id/page_image"
@@ -93,29 +58,60 @@
         app:layout_constraintStart_toStartOf="@id/page_image"
         app:image_mode="false" />
 
-    <androidx.appcompat.widget.AppCompatImageButton
-        android:layout_margin="10dp"
-        android:id="@+id/expand_list_btn"
-        android:backgroundTint="@color/white"
+    <com.compdfkit.pdfviewer.customview.listview.WatermarkListView
+        android:id="@+id/watermark_list_view"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="invisible"
+        android:layout_height="0dp"
         android:elevation="4dp"
-        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
+        android:visibility="visible"
         app:layout_constraintTop_toBottomOf="@id/tab_layout"
         app:layout_constraintBottom_toTopOf="@id/console_view"
         app:layout_constraintStart_toStartOf="parent"/>
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/watermark_list"
-        android:layout_width="160dp"
-        android:layout_height="0dp"
-        android:background="@color/gray"
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="?actionBarSize"
         android:elevation="4dp"
-        android:visibility="invisible"
-        app:layout_constraintTop_toBottomOf="@id/tab_layout"
-        app:layout_constraintBottom_toTopOf="@id/console_view"
-        app:layout_constraintStart_toStartOf="parent"/>
+        android:background="?attr/colorPrimary"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:title="@string/add_watermark"
+        app:titleTextColor="?attr/colorOnPrimary"/>
+
+    <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="?attr/colorOnPrimary"
+        app:tabSelectedTextColor="?attr/colorOnPrimary"
+        app:tabTextColor="?attr/colorSecondary"
+        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>
 
     <androidx.fragment.app.FragmentContainerView
         android:name="com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment"

+ 104 - 0
app/src/main/res/layout/color_picker.xml

@@ -0,0 +1,104 @@
+<?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="wrap_content"
+    android:padding="8dp"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        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>

+ 24 - 152
app/src/main/res/layout/fragment_watermark_console.xml

@@ -3,9 +3,9 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="?attr/colorOnPrimary"
-    android:padding="10dp"
+    android:padding="8dp"
     android:elevation="4dp"
+    android:background="@color/gray"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     tools:context=".fragments.WatermarkConsoleFragment">
 
@@ -18,7 +18,7 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent" >
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ColorPicker
             android:id="@+id/color_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -27,107 +27,9 @@
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent" >
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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" />
-
-            <androidx.appcompat.widget.AppCompatImageView
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
 
-        <androidx.constraintlayout.widget.ConstraintLayout
+        <com.compdfkit.pdfviewer.customview.picker.ImagePicker
             android:id="@+id/image_picker"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -136,44 +38,7 @@
             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="@string/default_image"
-                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="@string/select_image"
-                android:textColor="@color/white"
-                android:backgroundTint="?attr/colorPrimary"
-                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>
+            app:layout_constraintEnd_toEndOf="parent" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <ImageView
@@ -182,19 +47,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_opacity_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/opacity_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/opacity"
+        android:value="50.0"
+        android:valueFrom="0.0"
+        android:valueTo="100.0"
         app:layout_constraintTop_toTopOf="@id/opacity_icon"
         app:layout_constraintBottom_toBottomOf="@id/opacity_icon"
         app:layout_constraintStart_toEndOf="@+id/opacity_icon"
@@ -217,19 +84,21 @@
         android:layout_height="wrap_content"
         android:contentDescription="@string/opacity_icon"
         android:src="@drawable/ic_baseline_format_size_20"
-        android:padding="10dp"
+        android:padding="8dp"
         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
+    <com.google.android.material.slider.Slider
         android:id="@+id/size_slider"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:progress="50"
-        android:theme="@style/SeekBarColor"
+        android:contentDescription="@string/size"
+        android:value="100.0"
+        android:valueFrom="50.0"
+        android:valueTo="150.0"
         app:layout_constraintTop_toTopOf="@id/size_icon"
         app:layout_constraintBottom_toBottomOf="@id/size_icon"
         app:layout_constraintStart_toEndOf="@+id/size_icon"
@@ -269,22 +138,25 @@
         app:layout_constraintEnd_toStartOf="@id/page_range_button" />
 
     <ImageButton
-        android:padding="10dp"
         android:id="@+id/page_range_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:background="#00000000"
+        android:contentDescription="@string/custom_range"
+        android:minWidth="48dp"
+        android:minHeight="48dp"
+        android:padding="8dp"
         android:src="@drawable/ic_baseline_expand_more_24"
         app:layout_constraintBottom_toBottomOf="@id/page_range_text"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@id/page_range_text"/>
+        app:layout_constraintTop_toTopOf="@id/page_range_text" />
 
 
     <CheckBox
         android:id="@+id/full_screen_checkbox"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:padding="10dp"
+        android:padding="8dp"
         android:text="@string/full_screen"
         app:layout_constraintHorizontal_chainStyle="spread_inside"
         app:layout_constraintBottom_toBottomOf="parent"

+ 40 - 0
app/src/main/res/layout/image_picker.xml

@@ -0,0 +1,40 @@
+<?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="wrap_content"
+    android:padding="1dp"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <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: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="8dp"
+        android:maxLines="2"
+        android:text="@string/default_image"
+        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="@string/select_image"
+        app:layout_constraintTop_toTopOf="@+id/image_select_text"
+        app:layout_constraintBottom_toBottomOf="@id/image_select_text"
+        app:layout_constraintEnd_toEndOf="parent"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 16 - 7
app/src/main/res/layout/range_selector.xml

@@ -12,14 +12,14 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintStart_toStartOf="parent">
 
-        <androidx.appcompat.widget.AppCompatRadioButton
+        <com.google.android.material.radiobutton.MaterialRadioButton
             android:id="@+id/all_pages"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/all_pages"
             android:checked="true"/>
 
-        <androidx.appcompat.widget.AppCompatRadioButton
+        <com.google.android.material.radiobutton.MaterialRadioButton
             android:id="@+id/custom_range"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -27,14 +27,23 @@
 
     </RadioGroup>
 
-    <androidx.appcompat.widget.AppCompatEditText
-        android:id="@+id/range_edit"
-        android:layout_width="200dp"
+    <com.google.android.material.textfield.TextInputLayout
+        android:id="@+id/textField"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:hint="@string/range_hint"
-        app:layout_constraintTop_toBottomOf="@id/select_group"
+        app:endIconMode="clear_text"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        android:enabled="false"/>
+        app:layout_constraintTop_toBottomOf="@id/select_group">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:id="@+id/range_edit"
+            android:layout_width="200dp"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:minHeight="48dp" />
+
+    </com.google.android.material.textfield.TextInputLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 12 - 4
app/src/main/res/layout/text_editor.xml

@@ -5,14 +5,22 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
-    <androidx.appcompat.widget.AppCompatEditText
-        android:id="@+id/text_editor"
+    <com.google.android.material.textfield.TextInputLayout
+        android:id="@+id/textField"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:enabled="true"
         android:hint="@string/watermark_context"
+        app:endIconMode="clear_text"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent" >
+
+        <androidx.appcompat.widget.AppCompatEditText
+            android:id="@+id/text_editor"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:enabled="true" />
+
+    </com.google.android.material.textfield.TextInputLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 41
app/src/main/res/layout/watermark_item.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:padding="6dp"
-    android:background="@color/white"
-    xmlns:app="http://schemas.android.com/apk/res-auto">
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/watermark_type_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:padding="10dp"
-        android:src="@drawable/ic_baseline_text_type_24"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toStartOf="@id/watermark_content"/>
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/watermark_content"
-        android:layout_width="80dp"
-        android:layout_height="wrap_content"
-        android:maxEms="5"
-        android:ellipsize="end"
-        android:text="test"
-        app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
-        app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
-        app:layout_constraintStart_toEndOf="@id/watermark_type_icon"
-        app:layout_constraintEnd_toStartOf="@id/hint_icon"/>
-
-    <androidx.appcompat.widget.AppCompatImageView
-        android:id="@+id/hint_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
-        app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
-        app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
-        app:layout_constraintStart_toEndOf="@id/watermark_content" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 39 - 3
app/src/main/res/layout/watermark_item_layout.xml

@@ -10,7 +10,7 @@
         android:layout_width="80dp"
         android:layout_height="0dp"
         android:background="#e06666"
-        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@id/item_view"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent">
 
@@ -25,12 +25,48 @@
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
-    <com.compdfkit.pdfviewer.customview.WatermarkListItem
+    <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/item_view"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:background="@color/white"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"/>
+        app:layout_constraintBottom_toBottomOf="parent">
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/watermark_type_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:padding="8dp"
+            android:src="@drawable/ic_baseline_text_type_24"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@id/watermark_content"/>
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/watermark_content"
+            android:layout_width="80dp"
+            android:layout_height="wrap_content"
+            android:maxEms="5"
+            android:ellipsize="end"
+            android:text="test"
+            app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
+            app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
+            app:layout_constraintStart_toEndOf="@id/watermark_type_icon"
+            app:layout_constraintEnd_toStartOf="@id/hint_icon"/>
+
+        <androidx.appcompat.widget.AppCompatImageView
+            android:id="@+id/hint_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
+            app:layout_constraintTop_toTopOf="@id/watermark_type_icon"
+            app:layout_constraintBottom_toBottomOf="@id/watermark_type_icon"
+            app:layout_constraintStart_toEndOf="@id/watermark_content" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 31 - 0
app/src/main/res/layout/watermark_list_view.xml

@@ -0,0 +1,31 @@
+<?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">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/watermark_list"
+        android:layout_width="160dp"
+        android:layout_height="0dp"
+        android:elevation="1dp"
+        android:background="#aaaaaa"
+        android:visibility="visible"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageButton
+        android:layout_margin="8dp"
+        android:id="@+id/expand_list_btn"
+        android:background="#00000000"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:visibility="visible"
+        android:elevation="4dp"
+        app:srcCompat="@drawable/ic_baseline_keyboard_arrow_right_24"
+        app:layout_constraintTop_toTopOf="@id/watermark_list"
+        app:layout_constraintBottom_toBottomOf="@id/watermark_list"
+        app:layout_constraintStart_toEndOf="@id/watermark_list"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 27 - 0
app/src/main/res/values-ja-rJP/strings.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">PDFViewer</string>
+    <string name="add_watermark">透かしを追加</string>
+    <string name="edit_watermark">透かしを編集</string>
+    <string name="text">文章</string>
+    <string name="image">写真</string>
+    <string name="opacity_icon">透過アイコン</string>
+    <string name="full_screen">タイリング</string>
+    <string name="page_range">ページ範囲</string>
+    <string name="watermark_image">透かし画像</string>
+    <string name="text_watermark">テキスト透かし</string>
+    <string name="watermark">Watermark</string>
+    <string name="watermark_handle">透かしの回転</string>
+    <string name="default_image">デフォルトの画像</string>
+    <string name="select_image">画像を選択</string>
+    <string name="done">終了</string>
+    <string name="page_image">ページ画像</string>
+    <string name="range_hint">例: 1,3–5,10</string>
+    <string name="watermark_context">透かしコンテンツ</string>
+    <string name="all_pages">すべてのページ</string>
+    <string name="setting_range">ページ範囲の設定</string>
+    <string name="custom_range">カスタム ページ範囲</string>
+    <string name="cancel">キャンセル</string>
+    <string name="opacity">透明度</string>
+    <string name="size">サイズ</string>
+</resources>

+ 151 - 12
app/src/main/res/values-night-v31/themes.xml

@@ -1,18 +1,157 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources xmlns:tools="http://schemas.android.com/tools">
-<!-- Base application theme. -->
-    <style name="Theme.PDFViewer" parent="Theme.Material3.DayNight.NoActionBar">
-        <!-- 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. -->
+    <style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="colorPrimary">@color/md_theme_dark_primary</item>
+        <item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme_dark_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme_dark_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme_dark_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme_dark_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme_dark_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme_dark_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme_dark_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme_dark_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme_dark_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme_dark_error</item>
+        <item name="colorOnError">@color/md_theme_dark_onError</item>
+        <item name="colorErrorContainer">@color/md_theme_dark_errorContainer</item>
+        <item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
+        <item name="colorOutline">@color/md_theme_dark_outline</item>
+        <item name="android:colorBackground">@color/md_theme_dark_background</item>
+        <item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
+        <item name="colorSurface">@color/md_theme_dark_surface</item>
+        <item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme_dark_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme_dark_onSurfaceVariant</item>
+        <item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme_dark_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppRedTheme" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="colorPrimary">@color/md_theme1_dark_primary</item>
+        <item name="colorOnPrimary">@color/md_theme1_dark_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme1_dark_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme1_dark_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme1_dark_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme1_dark_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme1_dark_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme1_dark_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme1_dark_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme1_dark_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme1_dark_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme1_dark_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme1_dark_error</item>
+        <item name="colorErrorContainer">@color/md_theme1_dark_errorContainer</item>
+        <item name="colorOnError">@color/md_theme1_dark_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme1_dark_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme1_dark_background</item>
+        <item name="colorOnBackground">@color/md_theme1_dark_onBackground</item>
+        <item name="colorSurface">@color/md_theme1_dark_surface</item>
+        <item name="colorOnSurface">@color/md_theme1_dark_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme1_dark_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme1_dark_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme1_dark_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme1_dark_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme1_dark_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme1_dark_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppOrangeTheme" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="colorPrimary">@color/md_theme2_dark_primary</item>
+        <item name="colorOnPrimary">@color/md_theme2_dark_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme2_dark_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme2_dark_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme2_dark_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme2_dark_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme2_dark_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme2_dark_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme2_dark_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme2_dark_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme2_dark_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme2_dark_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme2_dark_error</item>
+        <item name="colorErrorContainer">@color/md_theme2_dark_errorContainer</item>
+        <item name="colorOnError">@color/md_theme2_dark_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme2_dark_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme2_dark_background</item>
+        <item name="colorOnBackground">@color/md_theme2_dark_onBackground</item>
+        <item name="colorSurface">@color/md_theme2_dark_surface</item>
+        <item name="colorOnSurface">@color/md_theme2_dark_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme2_dark_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme2_dark_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme2_dark_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme2_dark_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme2_dark_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme2_dark_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppGreenTheme" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="colorPrimary">@color/md_theme3_dark_primary</item>
+        <item name="colorOnPrimary">@color/md_theme3_dark_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme3_dark_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme3_dark_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme3_dark_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme3_dark_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme3_dark_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme3_dark_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme3_dark_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme3_dark_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme3_dark_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme3_dark_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme3_dark_error</item>
+        <item name="colorErrorContainer">@color/md_theme3_dark_errorContainer</item>
+        <item name="colorOnError">@color/md_theme3_dark_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme3_dark_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme3_dark_background</item>
+        <item name="colorOnBackground">@color/md_theme3_dark_onBackground</item>
+        <item name="colorSurface">@color/md_theme3_dark_surface</item>
+        <item name="colorOnSurface">@color/md_theme3_dark_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme3_dark_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme3_dark_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme3_dark_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme3_dark_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme3_dark_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme3_dark_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppCyanBlueTheme" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="colorPrimary">@color/md_theme4_dark_primary</item>
+        <item name="colorOnPrimary">@color/md_theme4_dark_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme4_dark_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme4_dark_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme4_dark_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme4_dark_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme4_dark_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme4_dark_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme4_dark_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme4_dark_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme4_dark_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme4_dark_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme4_dark_error</item>
+        <item name="colorErrorContainer">@color/md_theme4_dark_errorContainer</item>
+        <item name="colorOnError">@color/md_theme4_dark_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme4_dark_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme4_dark_background</item>
+        <item name="colorOnBackground">@color/md_theme4_dark_onBackground</item>
+        <item name="colorSurface">@color/md_theme4_dark_surface</item>
+        <item name="colorOnSurface">@color/md_theme4_dark_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme4_dark_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme4_dark_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme4_dark_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme4_dark_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme4_dark_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme4_dark_inversePrimary</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:navigationBarColor">@android:color/transparent</item>
-        <!-- Customize your theme here. -->
     </style>
 </resources>

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

@@ -1,6 +1,6 @@
 <resources xmlns:tools="http://schemas.android.com/tools">
     <!-- Base application theme. -->
-    <style name="Theme.PDFViewer" parent="Theme.MaterialComponents.DayNight.NoActionBar">
+    <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
         <!-- Primary brand color. -->
         <item name="colorPrimary">@color/purple_200</item>
         <item name="colorPrimaryVariant">@color/purple_700</item>

+ 151 - 13
app/src/main/res/values-notnight-v31/themes.xml

@@ -1,19 +1,157 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources xmlns:tools="http://schemas.android.com/tools">
-    <!-- Base application theme. -->
-    <style name="Theme.PDFViewer" parent="Theme.Material3.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/purple_200</item>
-        <item name="colorSecondaryVariant">@color/teal_700</item>
-        <item name="colorOnSecondary">@color/black</item>
-        <!-- Status bar color. -->
+    <style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">
+        <item name="colorPrimary">@color/md_theme_light_primary</item>
+        <item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme_light_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme_light_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme_light_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme_light_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme_light_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme_light_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme_light_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme_light_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme_light_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme_light_error</item>
+        <item name="colorOnError">@color/md_theme_light_onError</item>
+        <item name="colorErrorContainer">@color/md_theme_light_errorContainer</item>
+        <item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
+        <item name="colorOutline">@color/md_theme_light_outline</item>
+        <item name="android:colorBackground">@color/md_theme_light_background</item>
+        <item name="colorOnBackground">@color/md_theme_light_onBackground</item>
+        <item name="colorSurface">@color/md_theme_light_surface</item>
+        <item name="colorOnSurface">@color/md_theme_light_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme_light_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme_light_onSurfaceVariant</item>
+        <item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppRedTheme" parent="Theme.Material3.Light.NoActionBar">
+        <item name="colorPrimary">@color/md_theme1_light_primary</item>
+        <item name="colorOnPrimary">@color/md_theme1_light_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme1_light_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme1_light_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme1_light_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme1_light_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme1_light_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme1_light_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme1_light_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme1_light_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme1_light_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme1_light_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme1_light_error</item>
+        <item name="colorOnError">@color/md_theme1_light_onError</item>
+        <item name="colorErrorContainer">@color/md_theme1_light_errorContainer</item>
+        <item name="colorOnErrorContainer">@color/md_theme1_light_onErrorContainer</item>
+        <item name="colorOutline">@color/md_theme1_light_outline</item>
+        <item name="android:colorBackground">@color/md_theme1_light_background</item>
+        <item name="colorOnBackground">@color/md_theme1_light_onBackground</item>
+        <item name="colorSurface">@color/md_theme1_light_surface</item>
+        <item name="colorOnSurface">@color/md_theme1_light_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme1_light_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme1_light_onSurfaceVariant</item>
+        <item name="colorSurfaceInverse">@color/md_theme1_light_inverseSurface</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme1_light_inverseOnSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme1_light_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppOrangeTheme" parent="Theme.Material3.Light.NoActionBar">
+        <item name="colorPrimary">@color/md_theme2_light_primary</item>
+        <item name="colorOnPrimary">@color/md_theme2_light_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme2_light_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme2_light_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme2_light_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme2_light_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme2_light_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme2_light_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme2_light_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme2_light_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme2_light_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme2_light_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme2_light_error</item>
+        <item name="colorErrorContainer">@color/md_theme2_light_errorContainer</item>
+        <item name="colorOnError">@color/md_theme2_light_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme2_light_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme2_light_background</item>
+        <item name="colorOnBackground">@color/md_theme2_light_onBackground</item>
+        <item name="colorSurface">@color/md_theme2_light_surface</item>
+        <item name="colorOnSurface">@color/md_theme2_light_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme2_light_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme2_light_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme2_light_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme2_light_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme2_light_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme2_light_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppGreenTheme" parent="Theme.Material3.Light.NoActionBar">
+        <item name="colorPrimary">@color/md_theme3_light_primary</item>
+        <item name="colorOnPrimary">@color/md_theme3_light_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme3_light_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme3_light_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme3_light_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme3_light_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme3_light_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme3_light_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme3_light_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme3_light_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme3_light_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme3_light_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme3_light_error</item>
+        <item name="colorErrorContainer">@color/md_theme3_light_errorContainer</item>
+        <item name="colorOnError">@color/md_theme3_light_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme3_light_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme3_light_background</item>
+        <item name="colorOnBackground">@color/md_theme3_light_onBackground</item>
+        <item name="colorSurface">@color/md_theme3_light_surface</item>
+        <item name="colorOnSurface">@color/md_theme3_light_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme3_light_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme3_light_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme3_light_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme3_light_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme3_light_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme3_light_inversePrimary</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
+    </style>
+
+    <style name="AppCyanBlueTheme" parent="Theme.Material3.Light.NoActionBar">
+        <item name="colorPrimary">@color/md_theme4_light_primary</item>
+        <item name="colorOnPrimary">@color/md_theme4_light_onPrimary</item>
+        <item name="colorPrimaryContainer">@color/md_theme4_light_primaryContainer</item>
+        <item name="colorOnPrimaryContainer">@color/md_theme4_light_onPrimaryContainer</item>
+        <item name="colorSecondary">@color/md_theme4_light_secondary</item>
+        <item name="colorOnSecondary">@color/md_theme4_light_onSecondary</item>
+        <item name="colorSecondaryContainer">@color/md_theme4_light_secondaryContainer</item>
+        <item name="colorOnSecondaryContainer">@color/md_theme4_light_onSecondaryContainer</item>
+        <item name="colorTertiary">@color/md_theme4_light_tertiary</item>
+        <item name="colorOnTertiary">@color/md_theme4_light_onTertiary</item>
+        <item name="colorTertiaryContainer">@color/md_theme4_light_tertiaryContainer</item>
+        <item name="colorOnTertiaryContainer">@color/md_theme4_light_onTertiaryContainer</item>
+        <item name="colorError">@color/md_theme4_light_error</item>
+        <item name="colorErrorContainer">@color/md_theme4_light_errorContainer</item>
+        <item name="colorOnError">@color/md_theme4_light_onError</item>
+        <item name="colorOnErrorContainer">@color/md_theme4_light_onErrorContainer</item>
+        <item name="android:colorBackground">@color/md_theme4_light_background</item>
+        <item name="colorOnBackground">@color/md_theme4_light_onBackground</item>
+        <item name="colorSurface">@color/md_theme4_light_surface</item>
+        <item name="colorOnSurface">@color/md_theme4_light_onSurface</item>
+        <item name="colorSurfaceVariant">@color/md_theme4_light_surfaceVariant</item>
+        <item name="colorOnSurfaceVariant">@color/md_theme4_light_onSurfaceVariant</item>
+        <item name="colorOutline">@color/md_theme4_light_outline</item>
+        <item name="colorOnSurfaceInverse">@color/md_theme4_light_inverseOnSurface</item>
+        <item name="colorSurfaceInverse">@color/md_theme4_light_inverseSurface</item>
+        <item name="colorPrimaryInverse">@color/md_theme4_light_inversePrimary</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:navigationBarColor">@android:color/transparent</item>
-        <!-- Customize your theme here. -->
     </style>
 </resources>

+ 3 - 6
app/src/main/res/values-zh/strings.xml

@@ -5,13 +5,9 @@
     <string name="edit_watermark">编辑水印</string>
     <string name="text">文本</string>
     <string name="image">图片</string>
-    <string name="opacity_icon">Opacity icon</string>
+    <string name="opacity_icon">透明度图标</string>
     <string name="full_screen">平铺</string>
-    <string name="default_opacity">50%</string>
-    <string name="default_scale">100%</string>
     <string name="page_range">页面范围</string>
-    <string name="mm">mm</string>
-    <string name="default_space">100</string>
     <string name="watermark_image">水印图像</string>
     <string name="text_watermark">文字水印</string>
     <string name="watermark">Watermark</string>
@@ -26,5 +22,6 @@
     <string name="setting_range">设置页面范围</string>
     <string name="custom_range">自定义页面范围</string>
     <string name="cancel">取消</string>
-    <string name="full_screen_mask">Full screen mask</string>
+    <string name="opacity">透明度</string>
+    <string name="size">大小</string>
 </resources>

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

@@ -8,4 +8,314 @@
     <color name="black">#FF000000</color>
     <color name="white">#FFFFFFFF</color>
     <color name="gray">#FFF8F8F8</color>
+
+    <color name="seed">#6750A4</color>
+    <color name="md_theme_light_primary">#6750A4</color>
+    <color name="md_theme_light_onPrimary">#FFFFFF</color>
+    <color name="md_theme_light_primaryContainer">#EADDFF</color>
+    <color name="md_theme_light_onPrimaryContainer">#21005D</color>
+    <color name="md_theme_light_secondary">#625B71</color>
+    <color name="md_theme_light_onSecondary">#FFFFFF</color>
+    <color name="md_theme_light_secondaryContainer">#E8DEF8</color>
+    <color name="md_theme_light_onSecondaryContainer">#1D192B</color>
+    <color name="md_theme_light_tertiary">#7D5260</color>
+    <color name="md_theme_light_onTertiary">#FFFFFF</color>
+    <color name="md_theme_light_tertiaryContainer">#FFD8E4</color>
+    <color name="md_theme_light_onTertiaryContainer">#31111D</color>
+    <color name="md_theme_light_error">#B3261E</color>
+    <color name="md_theme_light_onError">#FFFFFF</color>
+    <color name="md_theme_light_errorContainer">#F9DEDC</color>
+    <color name="md_theme_light_onErrorContainer">#410E0B</color>
+    <color name="md_theme_light_outline">#79747E</color>
+    <color name="md_theme_light_background">#FFFBFE</color>
+    <color name="md_theme_light_onBackground">#1C1B1F</color>
+    <color name="md_theme_light_surface">#FFFBFE</color>
+    <color name="md_theme_light_onSurface">#1C1B1F</color>
+    <color name="md_theme_light_surfaceVariant">#E7E0EC</color>
+    <color name="md_theme_light_onSurfaceVariant">#49454F</color>
+    <color name="md_theme_light_inverseSurface">#313033</color>
+    <color name="md_theme_light_inverseOnSurface">#F4EFF4</color>
+    <color name="md_theme_light_inversePrimary">#D0BCFF</color>
+    <color name="md_theme_light_shadow">#000000</color>
+    <color name="md_theme_light_surfaceTint">#6750A4</color>
+    <color name="md_theme_light_outlineVariant">#CAC4D0</color>
+    <color name="md_theme_light_scrim">#000000</color>
+    <color name="md_theme_dark_primary">#D0BCFF</color>
+    <color name="md_theme_dark_onPrimary">#381E72</color>
+    <color name="md_theme_dark_primaryContainer">#4F378B</color>
+    <color name="md_theme_dark_onPrimaryContainer">#EADDFF</color>
+    <color name="md_theme_dark_secondary">#CCC2DC</color>
+    <color name="md_theme_dark_onSecondary">#332D41</color>
+    <color name="md_theme_dark_secondaryContainer">#4A4458</color>
+    <color name="md_theme_dark_onSecondaryContainer">#E8DEF8</color>
+    <color name="md_theme_dark_tertiary">#EFB8C8</color>
+    <color name="md_theme_dark_onTertiary">#492532</color>
+    <color name="md_theme_dark_tertiaryContainer">#633B48</color>
+    <color name="md_theme_dark_onTertiaryContainer">#FFD8E4</color>
+    <color name="md_theme_dark_error">#F2B8B5</color>
+    <color name="md_theme_dark_onError">#601410</color>
+    <color name="md_theme_dark_errorContainer">#8C1D18</color>
+    <color name="md_theme_dark_onErrorContainer">#F9DEDC</color>
+    <color name="md_theme_dark_outline">#938F99</color>
+    <color name="md_theme_dark_background">#1C1B1F</color>
+    <color name="md_theme_dark_onBackground">#E6E1E5</color>
+    <color name="md_theme_dark_surface">#1C1B1F</color>
+    <color name="md_theme_dark_onSurface">#E6E1E5</color>
+    <color name="md_theme_dark_surfaceVariant">#49454F</color>
+    <color name="md_theme_dark_onSurfaceVariant">#CAC4D0</color>
+    <color name="md_theme_dark_inverseSurface">#E6E1E5</color>
+    <color name="md_theme_dark_inverseOnSurface">#313033</color>
+    <color name="md_theme_dark_inversePrimary">#6750A4</color>
+    <color name="md_theme_dark_shadow">#000000</color>
+    <color name="md_theme_dark_surfaceTint">#D0BCFF</color>
+    <color name="md_theme_dark_outlineVariant">#49454F</color>
+    <color name="md_theme_dark_scrim">#000000</color>
+
+    <color name="seed1">#984061</color>
+    <color name="md_theme1_light_primary">#984061</color>
+    <color name="md_theme1_light_onPrimary">#FFFFFF</color>
+    <color name="md_theme1_light_primaryContainer">#FFD9E2</color>
+    <color name="md_theme1_light_onPrimaryContainer">#3E001D</color>
+    <color name="md_theme1_light_secondary">#74565F</color>
+    <color name="md_theme1_light_onSecondary">#FFFFFF</color>
+    <color name="md_theme1_light_secondaryContainer">#FFD9E2</color>
+    <color name="md_theme1_light_onSecondaryContainer">#2B151C</color>
+    <color name="md_theme1_light_tertiary">#7C5635</color>
+    <color name="md_theme1_light_onTertiary">#FFFFFF</color>
+    <color name="md_theme1_light_tertiaryContainer">#FFDCC2</color>
+    <color name="md_theme1_light_onTertiaryContainer">#2E1500</color>
+    <color name="md_theme1_light_error">#BA1A1A</color>
+    <color name="md_theme1_light_errorContainer">#FFDAD6</color>
+    <color name="md_theme1_light_onError">#FFFFFF</color>
+    <color name="md_theme1_light_onErrorContainer">#410002</color>
+    <color name="md_theme1_light_background">#FFFBFF</color>
+    <color name="md_theme1_light_onBackground">#201A1B</color>
+    <color name="md_theme1_light_surface">#FFFBFF</color>
+    <color name="md_theme1_light_onSurface">#201A1B</color>
+    <color name="md_theme1_light_surfaceVariant">#F2DDE2</color>
+    <color name="md_theme1_light_onSurfaceVariant">#514347</color>
+    <color name="md_theme1_light_outline">#837377</color>
+    <color name="md_theme1_light_inverseOnSurface">#FAEEEF</color>
+    <color name="md_theme1_light_inverseSurface">#352F30</color>
+    <color name="md_theme1_light_inversePrimary">#FFB0C8</color>
+    <color name="md_theme1_light_shadow">#000000</color>
+    <color name="md_theme1_light_surfaceTint">#984061</color>
+    <color name="md_theme1_light_outlineVariant">#D5C2C6</color>
+    <color name="md_theme1_light_scrim">#000000</color>
+    <color name="md_theme1_dark_primary">#FFB0C8</color>
+    <color name="md_theme1_dark_onPrimary">#5E1133</color>
+    <color name="md_theme1_dark_primaryContainer">#7B2949</color>
+    <color name="md_theme1_dark_onPrimaryContainer">#FFD9E2</color>
+    <color name="md_theme1_dark_secondary">#E2BDC6</color>
+    <color name="md_theme1_dark_onSecondary">#422931</color>
+    <color name="md_theme1_dark_secondaryContainer">#5A3F47</color>
+    <color name="md_theme1_dark_onSecondaryContainer">#FFD9E2</color>
+    <color name="md_theme1_dark_tertiary">#EFBD94</color>
+    <color name="md_theme1_dark_onTertiary">#48290C</color>
+    <color name="md_theme1_dark_tertiaryContainer">#623F20</color>
+    <color name="md_theme1_dark_onTertiaryContainer">#FFDCC2</color>
+    <color name="md_theme1_dark_error">#FFB4AB</color>
+    <color name="md_theme1_dark_errorContainer">#93000A</color>
+    <color name="md_theme1_dark_onError">#690005</color>
+    <color name="md_theme1_dark_onErrorContainer">#FFDAD6</color>
+    <color name="md_theme1_dark_background">#201A1B</color>
+    <color name="md_theme1_dark_onBackground">#EBE0E1</color>
+    <color name="md_theme1_dark_surface">#201A1B</color>
+    <color name="md_theme1_dark_onSurface">#EBE0E1</color>
+    <color name="md_theme1_dark_surfaceVariant">#514347</color>
+    <color name="md_theme1_dark_onSurfaceVariant">#D5C2C6</color>
+    <color name="md_theme1_dark_outline">#9E8C90</color>
+    <color name="md_theme1_dark_inverseOnSurface">#201A1B</color>
+    <color name="md_theme1_dark_inverseSurface">#EBE0E1</color>
+    <color name="md_theme1_dark_inversePrimary">#984061</color>
+    <color name="md_theme1_dark_shadow">#000000</color>
+    <color name="md_theme1_dark_surfaceTint">#FFB0C8</color>
+    <color name="md_theme1_dark_outlineVariant">#514347</color>
+    <color name="md_theme1_dark_scrim">#000000</color>
+
+    <color name="seed2">#e18345</color>
+    <color name="md_theme2_light_primary">#96490C</color>
+    <color name="md_theme2_light_onPrimary">#FFFFFF</color>
+    <color name="md_theme2_light_primaryContainer">#FFDBC8</color>
+    <color name="md_theme2_light_onPrimaryContainer">#321300</color>
+    <color name="md_theme2_light_secondary">#765847</color>
+    <color name="md_theme2_light_onSecondary">#FFFFFF</color>
+    <color name="md_theme2_light_secondaryContainer">#FFDBC8</color>
+    <color name="md_theme2_light_onSecondaryContainer">#2B1609</color>
+    <color name="md_theme2_light_tertiary">#626033</color>
+    <color name="md_theme2_light_onTertiary">#FFFFFF</color>
+    <color name="md_theme2_light_tertiaryContainer">#E8E5AC</color>
+    <color name="md_theme2_light_onTertiaryContainer">#1D1D00</color>
+    <color name="md_theme2_light_error">#BA1A1A</color>
+    <color name="md_theme2_light_errorContainer">#FFDAD6</color>
+    <color name="md_theme2_light_onError">#FFFFFF</color>
+    <color name="md_theme2_light_onErrorContainer">#410002</color>
+    <color name="md_theme2_light_background">#FFFBFF</color>
+    <color name="md_theme2_light_onBackground">#201A17</color>
+    <color name="md_theme2_light_surface">#FFFBFF</color>
+    <color name="md_theme2_light_onSurface">#201A17</color>
+    <color name="md_theme2_light_surfaceVariant">#F4DED3</color>
+    <color name="md_theme2_light_onSurfaceVariant">#52443C</color>
+    <color name="md_theme2_light_outline">#85746B</color>
+    <color name="md_theme2_light_inverseOnSurface">#FBEEE9</color>
+    <color name="md_theme2_light_inverseSurface">#362F2C</color>
+    <color name="md_theme2_light_inversePrimary">#FFB68B</color>
+    <color name="md_theme2_light_shadow">#000000</color>
+    <color name="md_theme2_light_surfaceTint">#96490C</color>
+    <color name="md_theme2_light_outlineVariant">#D7C2B8</color>
+    <color name="md_theme2_light_scrim">#000000</color>
+    <color name="md_theme2_dark_primary">#FFB68B</color>
+    <color name="md_theme2_dark_onPrimary">#522300</color>
+    <color name="md_theme2_dark_primaryContainer">#753400</color>
+    <color name="md_theme2_dark_onPrimaryContainer">#FFDBC8</color>
+    <color name="md_theme2_dark_secondary">#E5BFA9</color>
+    <color name="md_theme2_dark_onSecondary">#432B1C</color>
+    <color name="md_theme2_dark_secondaryContainer">#5C4131</color>
+    <color name="md_theme2_dark_onSecondaryContainer">#FFDBC8</color>
+    <color name="md_theme2_dark_tertiary">#CCC992</color>
+    <color name="md_theme2_dark_onTertiary">#333209</color>
+    <color name="md_theme2_dark_tertiaryContainer">#4A491E</color>
+    <color name="md_theme2_dark_onTertiaryContainer">#E8E5AC</color>
+    <color name="md_theme2_dark_error">#FFB4AB</color>
+    <color name="md_theme2_dark_errorContainer">#93000A</color>
+    <color name="md_theme2_dark_onError">#690005</color>
+    <color name="md_theme2_dark_onErrorContainer">#FFDAD6</color>
+    <color name="md_theme2_dark_background">#201A17</color>
+    <color name="md_theme2_dark_onBackground">#ECE0DB</color>
+    <color name="md_theme2_dark_surface">#201A17</color>
+    <color name="md_theme2_dark_onSurface">#ECE0DB</color>
+    <color name="md_theme2_dark_surfaceVariant">#52443C</color>
+    <color name="md_theme2_dark_onSurfaceVariant">#D7C2B8</color>
+    <color name="md_theme2_dark_outline">#9F8D84</color>
+    <color name="md_theme2_dark_inverseOnSurface">#201A17</color>
+    <color name="md_theme2_dark_inverseSurface">#ECE0DB</color>
+    <color name="md_theme2_dark_inversePrimary">#96490C</color>
+    <color name="md_theme2_dark_shadow">#000000</color>
+    <color name="md_theme2_dark_surfaceTint">#FFB68B</color>
+    <color name="md_theme2_dark_outlineVariant">#52443C</color>
+    <color name="md_theme2_dark_scrim">#000000</color>
+
+    <color name="seed3">#639340</color>
+    <color name="md_theme3_light_primary">#3C691B</color>
+    <color name="md_theme3_light_onPrimary">#FFFFFF</color>
+    <color name="md_theme3_light_primaryContainer">#BCF293</color>
+    <color name="md_theme3_light_onPrimaryContainer">#0B2000</color>
+    <color name="md_theme3_light_secondary">#56624B</color>
+    <color name="md_theme3_light_onSecondary">#FFFFFF</color>
+    <color name="md_theme3_light_secondaryContainer">#DAE7CA</color>
+    <color name="md_theme3_light_onSecondaryContainer">#141E0C</color>
+    <color name="md_theme3_light_tertiary">#386665</color>
+    <color name="md_theme3_light_onTertiary">#FFFFFF</color>
+    <color name="md_theme3_light_tertiaryContainer">#BBECEA</color>
+    <color name="md_theme3_light_onTertiaryContainer">#002020</color>
+    <color name="md_theme3_light_error">#BA1A1A</color>
+    <color name="md_theme3_light_errorContainer">#FFDAD6</color>
+    <color name="md_theme3_light_onError">#FFFFFF</color>
+    <color name="md_theme3_light_onErrorContainer">#410002</color>
+    <color name="md_theme3_light_background">#FDFDF5</color>
+    <color name="md_theme3_light_onBackground">#1A1C18</color>
+    <color name="md_theme3_light_surface">#FDFDF5</color>
+    <color name="md_theme3_light_onSurface">#1A1C18</color>
+    <color name="md_theme3_light_surfaceVariant">#E0E4D6</color>
+    <color name="md_theme3_light_onSurfaceVariant">#44483E</color>
+    <color name="md_theme3_light_outline">#74796D</color>
+    <color name="md_theme3_light_inverseOnSurface">#F1F1EA</color>
+    <color name="md_theme3_light_inverseSurface">#2F312C</color>
+    <color name="md_theme3_light_inversePrimary">#A1D57A</color>
+    <color name="md_theme3_light_shadow">#000000</color>
+    <color name="md_theme3_light_surfaceTint">#3C691B</color>
+    <color name="md_theme3_light_outlineVariant">#C4C8BB</color>
+    <color name="md_theme3_light_scrim">#000000</color>
+    <color name="md_theme3_dark_primary">#A1D57A</color>
+    <color name="md_theme3_dark_onPrimary">#173800</color>
+    <color name="md_theme3_dark_primaryContainer">#255102</color>
+    <color name="md_theme3_dark_onPrimaryContainer">#BCF293</color>
+    <color name="md_theme3_dark_secondary">#BECBAF</color>
+    <color name="md_theme3_dark_onSecondary">#293420</color>
+    <color name="md_theme3_dark_secondaryContainer">#3F4A35</color>
+    <color name="md_theme3_dark_onSecondaryContainer">#DAE7CA</color>
+    <color name="md_theme3_dark_tertiary">#A0CFCE</color>
+    <color name="md_theme3_dark_onTertiary">#003737</color>
+    <color name="md_theme3_dark_tertiaryContainer">#1E4E4D</color>
+    <color name="md_theme3_dark_onTertiaryContainer">#BBECEA</color>
+    <color name="md_theme3_dark_error">#FFB4AB</color>
+    <color name="md_theme3_dark_errorContainer">#93000A</color>
+    <color name="md_theme3_dark_onError">#690005</color>
+    <color name="md_theme3_dark_onErrorContainer">#FFDAD6</color>
+    <color name="md_theme3_dark_background">#1A1C18</color>
+    <color name="md_theme3_dark_onBackground">#E3E3DC</color>
+    <color name="md_theme3_dark_surface">#1A1C18</color>
+    <color name="md_theme3_dark_onSurface">#E3E3DC</color>
+    <color name="md_theme3_dark_surfaceVariant">#44483E</color>
+    <color name="md_theme3_dark_onSurfaceVariant">#C4C8BB</color>
+    <color name="md_theme3_dark_outline">#8E9286</color>
+    <color name="md_theme3_dark_inverseOnSurface">#1A1C18</color>
+    <color name="md_theme3_dark_inverseSurface">#E3E3DC</color>
+    <color name="md_theme3_dark_inversePrimary">#3C691B</color>
+    <color name="md_theme3_dark_shadow">#000000</color>
+    <color name="md_theme3_dark_surfaceTint">#A1D57A</color>
+    <color name="md_theme3_dark_outlineVariant">#44483E</color>
+    <color name="md_theme3_dark_scrim">#000000</color>
+
+    <color name="seed4">#12a385</color>
+    <color name="md_theme4_light_primary">#006B56</color>
+    <color name="md_theme4_light_onPrimary">#FFFFFF</color>
+    <color name="md_theme4_light_primaryContainer">#7DF8D5</color>
+    <color name="md_theme4_light_onPrimaryContainer">#002018</color>
+    <color name="md_theme4_light_secondary">#4B635B</color>
+    <color name="md_theme4_light_onSecondary">#FFFFFF</color>
+    <color name="md_theme4_light_secondaryContainer">#CDE9DD</color>
+    <color name="md_theme4_light_onSecondaryContainer">#072019</color>
+    <color name="md_theme4_light_tertiary">#416276</color>
+    <color name="md_theme4_light_onTertiary">#FFFFFF</color>
+    <color name="md_theme4_light_tertiaryContainer">#C4E7FF</color>
+    <color name="md_theme4_light_onTertiaryContainer">#001E2C</color>
+    <color name="md_theme4_light_error">#BA1A1A</color>
+    <color name="md_theme4_light_errorContainer">#FFDAD6</color>
+    <color name="md_theme4_light_onError">#FFFFFF</color>
+    <color name="md_theme4_light_onErrorContainer">#410002</color>
+    <color name="md_theme4_light_background">#FBFDFA</color>
+    <color name="md_theme4_light_onBackground">#191C1B</color>
+    <color name="md_theme4_light_surface">#FBFDFA</color>
+    <color name="md_theme4_light_onSurface">#191C1B</color>
+    <color name="md_theme4_light_surfaceVariant">#DBE5DF</color>
+    <color name="md_theme4_light_onSurfaceVariant">#3F4945</color>
+    <color name="md_theme4_light_outline">#6F7975</color>
+    <color name="md_theme4_light_inverseOnSurface">#EFF1EE</color>
+    <color name="md_theme4_light_inverseSurface">#2E312F</color>
+    <color name="md_theme4_light_inversePrimary">#5FDBBA</color>
+    <color name="md_theme4_light_shadow">#000000</color>
+    <color name="md_theme4_light_surfaceTint">#006B56</color>
+    <color name="md_theme4_light_outlineVariant">#BFC9C3</color>
+    <color name="md_theme4_light_scrim">#000000</color>
+    <color name="md_theme4_dark_primary">#5FDBBA</color>
+    <color name="md_theme4_dark_onPrimary">#00382C</color>
+    <color name="md_theme4_dark_primaryContainer">#005140</color>
+    <color name="md_theme4_dark_onPrimaryContainer">#7DF8D5</color>
+    <color name="md_theme4_dark_secondary">#B2CCC2</color>
+    <color name="md_theme4_dark_onSecondary">#1D352D</color>
+    <color name="md_theme4_dark_secondaryContainer">#344C44</color>
+    <color name="md_theme4_dark_onSecondaryContainer">#CDE9DD</color>
+    <color name="md_theme4_dark_tertiary">#A9CBE2</color>
+    <color name="md_theme4_dark_onTertiary">#0E3446</color>
+    <color name="md_theme4_dark_tertiaryContainer">#284B5E</color>
+    <color name="md_theme4_dark_onTertiaryContainer">#C4E7FF</color>
+    <color name="md_theme4_dark_error">#FFB4AB</color>
+    <color name="md_theme4_dark_errorContainer">#93000A</color>
+    <color name="md_theme4_dark_onError">#690005</color>
+    <color name="md_theme4_dark_onErrorContainer">#FFDAD6</color>
+    <color name="md_theme4_dark_background">#191C1B</color>
+    <color name="md_theme4_dark_onBackground">#E1E3E0</color>
+    <color name="md_theme4_dark_surface">#191C1B</color>
+    <color name="md_theme4_dark_onSurface">#E1E3E0</color>
+    <color name="md_theme4_dark_surfaceVariant">#3F4945</color>
+    <color name="md_theme4_dark_onSurfaceVariant">#BFC9C3</color>
+    <color name="md_theme4_dark_outline">#89938E</color>
+    <color name="md_theme4_dark_inverseOnSurface">#191C1B</color>
+    <color name="md_theme4_dark_inverseSurface">#E1E3E0</color>
+    <color name="md_theme4_dark_inversePrimary">#006B56</color>
+    <color name="md_theme4_dark_shadow">#000000</color>
+    <color name="md_theme4_dark_surfaceTint">#5FDBBA</color>
+    <color name="md_theme4_dark_outlineVariant">#3F4945</color>
+    <color name="md_theme4_dark_scrim">#000000</color>
 </resources>

+ 33 - 5
app/src/main/res/values/strings.xml

@@ -6,11 +6,11 @@
     <string name="image">Image</string>
     <string name="opacity_icon">Opacity icon</string>
     <string name="full_screen">Full screen</string>
-    <string name="default_opacity">50%</string>
-    <string name="default_scale">100%</string>
+    <string name="default_opacity" translatable="false">50%</string>
+    <string name="default_scale" translatable="false">100%</string>
     <string name="page_range">Page Range</string>
-    <string name="mm">mm</string>
-    <string name="default_space">100</string>
+    <string name="mm" translatable="false">mm</string>
+    <string name="default_space" translatable="false">100</string>
     <string name="watermark_image">watermark image</string>
     <string name="text_watermark">Text watermark</string>
     <string name="watermark">Watermark</string>
@@ -25,5 +25,33 @@
     <string name="setting_range">Setting range</string>
     <string name="custom_range">Custom range</string>
     <string name="cancel">Cancel</string>
-    <string name="full_screen_mask">Full screen mask</string>
+    <string name="full_screen_mask" translatable="false">Full screen mask</string>
+    <string name="opacity">opacity</string>
+    <string name="size">size</string>
+    <string name="horizontal_space" translatable="false">H</string>
+    <string name="v" translatable="false">V</string>
+    <string name="title_activity_header_footer_bates">HeaderFooterBatesActivity</string>
+    <!-- Strings used for fragments for navigation -->
+    <string name="first_fragment_label">First Fragment</string>
+    <string name="second_fragment_label">Second Fragment</string>
+    <string name="next">Next</string>
+    <string name="previous">Previous</string>
+
+    <string name="lorem_ipsum">
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris volutpat, dolor id interdum ullamcorper, risus dolor egestas lectus, sit amet mattis purus dui nec risus. Maecenas non sodales nisi, vel dictum
+        dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse blandit eleifend diam, vel rutrum tellus vulputate quis. Aliquam eget libero aliquet, imperdiet nisl a, ornare ex. Sed
+        rhoncus est ut libero porta lobortis. Fusce in dictum tellus.\n\n
+        Suspendisse interdum ornare ante. Aliquam nec cursus lorem. Morbi id magna felis. Vivamus egestas, est a condimentum egestas, turpis nisl iaculis ipsum, in dictum tellus dolor sed neque. Morbi tellus erat, dapibus ut sem a, iaculis
+        tincidunt dui. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur et eros porttitor, ultricies urna vitae, molestie nibh. Phasellus at commodo eros, non aliquet metus. Sed maximus nisl nec dolor bibendum, vel
+        congue leo egestas.\n\n
+        Sed interdum tortor nibh, in sagittis risus mollis quis. Curabitur mi odio, condimentum sit amet auctor at, mollis non turpis. Nullam pretium libero vestibulum, finibus orci vel, molestie quam. Fusce blandit tincidunt nulla, quis
+        sollicitudin libero facilisis et. Integer interdum nunc ligula, et fermentum metus hendrerit id. Vestibulum lectus felis, dictum at lacinia sit amet, tristique id quam. Cras eu consequat dui. Suspendisse sodales nunc ligula, in
+        lobortis sem porta sed. Integer id ultrices magna, in luctus elit. Sed a pellentesque est.\n\n
+        Aenean nunc velit, lacinia sed dolor sed, ultrices viverra nulla. Etiam a venenatis nibh. Morbi laoreet, tortor sed facilisis varius, nibh orci rhoncus nulla, id elementum leo dui non lorem. Nam mollis ipsum quis auctor varius.
+        Quisque elementum eu libero sed commodo. In eros nisl, imperdiet vel imperdiet et, scelerisque a mauris. Pellentesque varius ex nunc, quis imperdiet eros placerat ac. Duis finibus orci et est auctor tincidunt. Sed non viverra ipsum.
+        Nunc quis augue egestas, cursus lorem at, molestie sem. Morbi a consectetur ipsum, a placerat diam. Etiam vulputate dignissim convallis. Integer faucibus mauris sit amet finibus convallis.\n\n
+        Phasellus in aliquet mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In volutpat arcu ut felis sagittis, in finibus massa gravida. Pellentesque id tellus orci. Integer dictum, lorem
+        sed efficitur ullamcorper, libero justo consectetur ipsum, in mollis nisl ex sed nisl. Donec maximus ullamcorper sodales. Praesent bibendum rhoncus tellus nec feugiat. In a ornare nulla. Donec rhoncus libero vel nunc consequat, quis
+        tincidunt nisl eleifend. Cras bibendum enim a justo luctus vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim.
+    </string>
 </resources>

+ 2 - 2
app/src/main/res/values/themes.xml

@@ -1,12 +1,11 @@
 <resources xmlns:tools="http://schemas.android.com/tools">
     <!-- Base application theme. -->
-    <style name="Theme.PDFViewer" parent="Theme.MaterialComponents.Light.NoActionBar">
+    <style name="AppTheme" parent="Theme.MaterialComponents.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/purple_200</item>
         <item name="colorSecondaryVariant">@color/teal_700</item>
@@ -16,4 +15,5 @@
         <item name="android:navigationBarColor">@android:color/transparent</item>
         <!-- Customize your theme here. -->
     </style>
+
 </resources>

+ 3 - 1
gradle.properties

@@ -18,4 +18,6 @@ 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
+android.nonTransitiveRClass=true
+
+android.injected.testOnly=false