Browse Source

完成背景编辑功能,修复部分bug,修改bates编号正则式

dengyujia 1 năm trước cách đây
mục cha
commit
56c7311c60
31 tập tin đã thay đổi với 691 bổ sung166 xóa
  1. 1 2
      app/src/main/AndroidManifest.xml
  2. 46 38
      app/src/main/java/com/compdfkit/pdfviewer/activities/BackgroundActivity.java
  3. 10 21
      app/src/main/java/com/compdfkit/pdfviewer/activities/HeaderFooterActivity.java
  4. 9 21
      app/src/main/java/com/compdfkit/pdfviewer/activities/WatermarkActivity.java
  5. 80 0
      app/src/main/java/com/compdfkit/pdfviewer/customview/picker/BackgroundColorPicker.java
  6. 3 3
      app/src/main/java/com/compdfkit/pdfviewer/customview/picker/FontColorPicker.java
  7. 1 1
      app/src/main/java/com/compdfkit/pdfviewer/entity/BackgroundSetting.java
  8. 115 19
      app/src/main/java/com/compdfkit/pdfviewer/fragments/BackgroundConsoleFragment.java
  9. 72 0
      app/src/main/java/com/compdfkit/pdfviewer/tools/BackgroundHandle.java
  10. 95 12
      app/src/main/java/com/compdfkit/pdfviewer/tools/DialogManager.java
  11. 33 0
      app/src/main/java/com/compdfkit/pdfviewer/tools/DocumentHandle.java
  12. 0 1
      app/src/main/java/com/compdfkit/pdfviewer/tools/HeaderFooterHandle.java
  13. 2 3
      app/src/main/java/com/compdfkit/pdfviewer/tools/TextGenerator.java
  14. 5 0
      app/src/main/res/drawable/ic_baseline_circle_white_24.xml
  15. 2 0
      app/src/main/res/layout-land-v31/fragment_watermark_console.xml
  16. 2 0
      app/src/main/res/layout-land/fragment_watermark_console.xml
  17. 19 1
      app/src/main/res/layout-v31/activity_background.xml
  18. 1 1
      app/src/main/res/layout-v31/fragment_background_console.xml
  19. 2 0
      app/src/main/res/layout-v31/fragment_watermark_console.xml
  20. 74 3
      app/src/main/res/layout/activity_background.xml
  21. 18 16
      app/src/main/res/layout/background_setting_panel.xml
  22. 8 7
      app/src/main/res/layout/bates_setting_panel.xml
  23. 5 4
      app/src/main/res/layout/common_setting_panel.xml
  24. 2 2
      app/src/main/res/layout/content_append_selector.xml
  25. 21 9
      app/src/main/res/layout/fragment_background_console.xml
  26. 2 0
      app/src/main/res/layout/fragment_watermark_console.xml
  27. 7 2
      app/src/main/res/layout/global_setting_panel.xml
  28. 2 0
      app/src/main/res/layout/range_selector.xml
  29. 18 0
      app/src/main/res/values-ja-rJP/strings.xml
  30. 18 0
      app/src/main/res/values-zh/strings.xml
  31. 18 0
      app/src/main/res/values/strings.xml

+ 1 - 2
app/src/main/AndroidManifest.xml

@@ -21,13 +21,11 @@
         <activity
             android:name=".activities.BackgroundActivity"
             android:exported="true">
-
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-
             <meta-data
                 android:name="android.app.lib_name"
                 android:value="" />
@@ -43,6 +41,7 @@
         <activity
             android:name=".activities.WatermarkActivity"
             android:exported="true">
+
             <meta-data
                 android:name="android.app.lib_name"
                 android:value="" />

+ 46 - 38
app/src/main/java/com/compdfkit/pdfviewer/activities/BackgroundActivity.java

@@ -8,6 +8,7 @@ import androidx.core.view.ViewCompat;
 import androidx.core.view.WindowInsetsControllerCompat;
 
 import android.graphics.Bitmap;
+import android.graphics.Color;
 import android.graphics.RectF;
 import android.net.Uri;
 import android.os.Bundle;
@@ -23,8 +24,10 @@ import com.compdfkit.core.document.CPDFBackground;
 import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.core.page.CPDFPage;
 import com.compdfkit.pdfviewer.R;
-import com.compdfkit.pdfviewer.entity.BackgroundSetting;
+import com.compdfkit.pdfviewer.tools.BackgroundHandle;
+import com.compdfkit.pdfviewer.tools.ConvertMapper;
 import com.compdfkit.pdfviewer.tools.DialogManager;
+import com.compdfkit.pdfviewer.tools.DocumentHandle;
 
 import java.io.File;
 import java.util.Random;
@@ -33,6 +36,8 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
     private int pageCount = 0;
 
     private View pageContainer;
+    private ImageView pageBottomLayer;
+    private ImageView backgroundLayer;
     private ImageView pageImage;
 
     private int currentPageHeight = 0;
@@ -47,7 +52,7 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
 
     @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[] 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]);
 
@@ -61,10 +66,13 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
+        BackgroundHandle.setSettingPages("0-" + (pageCount - 1));
 
         pageContainer = findViewById(R.id.page_container);
 
+        pageBottomLayer = findViewById(R.id.page_bottom_layer);
+        backgroundLayer = findViewById(R.id.background_layer);
         pageImage = findViewById(R.id.page_image);
         pageImage.post(this::initPageImage);
 
@@ -113,23 +121,15 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
         currentPageWidth = imageWidth;
         Bitmap pageBitmap = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_4444);
 
-        currentPage.renderPage(pageBitmap, 0, 0, imageWidth, imageHeight, 0xFFFFFFFF, 255, 0, true, true);
-        refreshPageImage(pageBitmap);
-    }
+        currentPage.renderPage(pageBitmap, 0, 0, imageWidth, imageHeight, 0xFFFFFFFF, 0, 0, true, true);
 
-    public void reloadDocument(@NonNull File PDFFile, Uri PDFUri) {
-        CPDFDocument.PDFDocumentError error = document.open(PDFFile.getAbsolutePath());
+        Bitmap pageBottomBitmap = Bitmap.createBitmap(currentPageWidth, currentPageHeight, Bitmap.Config.ARGB_4444);
+        pageBottomBitmap.eraseColor(Color.parseColor("#FFFFFF"));
+        pageBottomLayer.setImageBitmap(pageBottomBitmap);
 
-        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
-            error = document.open(PDFUri, "password");
-        } else if (error != CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
-            Toast.makeText(this, "File failed.", Toast.LENGTH_SHORT).show();
-        } else {
-            pageCount = document.getPageCount();
-        }
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
     }
 
-    //TODO: Replace the same code.
     public void reloadDocument() throws CPDFDocumentException {
         if (document.hasChanges()) {
             boolean res;
@@ -140,16 +140,14 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
+        BackgroundHandle.setSettingPages("0-" + (pageCount - 1));
+
         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 refreshPageImage(Bitmap updatePageBitmap) {
-        pageImage.setImageBitmap(updatePageBitmap);
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
     }
 
     public void showSetting(MenuItem menuItem) {
@@ -159,23 +157,33 @@ public class BackgroundActivity extends AppCompatActivity implements MenuProvide
     public void finishEdit(MenuItem menuItem) throws CPDFDocumentException {
         CPDFBackground background = document.getBackground();
 
-        BackgroundSetting setting = new BackgroundSetting();
-        setting.setColor(background.getColor());
-        setting.setOpacity(background.getOpacity());
-        setting.setRotation(background.getRotation());
-        setting.setxOffset(background.getXOffset());
-        setting.setyOffset(background.getYOffset());
-        setting.setPages(background.getPages());
-        setting.setScale(background.getScale());
-
-        background.setColor(0xFF66CCFF);
-        background.setOpacity(0.f);
-        background.setRotation(0.f);
-        background.setXOffset(0.f);
-        background.setPages("0-4");
-        background.setScale(1.f);
-        background.update();
+        BackgroundHandle.updateBackground(background);
 
         reloadDocument();
     }
+
+    public void setBackgroundLayerAttr(float dx, float dy, float opacity, float scale, float rotation) {
+        backgroundLayer.setX(backgroundLayer.getX() + ConvertMapper.convertMMtoViewUnit(dx, sizeConvertRate));
+        backgroundLayer.setY(backgroundLayer.getY() - ConvertMapper.convertMMtoViewUnit(dy, sizeConvertRate));
+        backgroundLayer.setAlpha(opacity);
+        backgroundLayer.setScaleX(scale);
+        backgroundLayer.setScaleY(scale);
+        backgroundLayer.setRotation(rotation);
+    }
+
+    public ImageView getBackgroundLayer() {
+        return backgroundLayer;
+    }
+
+    public int getCurrentPageWidth() {
+        return currentPageWidth;
+    }
+
+    public int getCurrentPageHeight() {
+        return currentPageHeight;
+    }
+
+    public int getPageCount() {
+        return pageCount;
+    }
 }

+ 10 - 21
app/src/main/java/com/compdfkit/pdfviewer/activities/HeaderFooterActivity.java

@@ -34,6 +34,7 @@ import com.compdfkit.pdfviewer.fragments.HeaderFooterConsoleFragment;
 import com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment;
 import com.compdfkit.pdfviewer.tools.ConvertMapper;
 import com.compdfkit.pdfviewer.tools.DialogManager;
+import com.compdfkit.pdfviewer.tools.DocumentHandle;
 import com.compdfkit.pdfviewer.tools.HeaderFooterHandle;
 import com.compdfkit.pdfviewer.tools.TextGenerator;
 import com.google.android.material.tabs.TabLayout;
@@ -86,7 +87,9 @@ public class HeaderFooterActivity extends AppCompatActivity implements MenuProvi
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
+        HeaderFooterHandle.setSettingPages(0, "0-" + (pageCount - 1));
+        HeaderFooterHandle.setSettingPages(1, "0-" + (pageCount - 1));
 
         pageContainer = findViewById(R.id.page_container);
 
@@ -159,7 +162,7 @@ public class HeaderFooterActivity extends AppCompatActivity implements MenuProvi
         Bitmap pageBitmap = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_4444);
 
         currentPage.renderPage(pageBitmap, 0, 0, imageWidth, imageHeight, 0xFFFFFFFF, 255, 0, true, true);
-        refreshPageImage(pageBitmap);
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
     }
 
     private void initHeaderFooterViews() {
@@ -212,7 +215,6 @@ public class HeaderFooterActivity extends AppCompatActivity implements MenuProvi
         headerFooterViews[5].setPadding(0, 0, (int) viewMargin.right, (int) viewMargin.bottom);
     }
 
-    //TODO: Replace the same code.
     public void reloadDocument() throws CPDFDocumentException {
         if (document.hasChanges()) {
             boolean res;
@@ -223,28 +225,15 @@ public class HeaderFooterActivity extends AppCompatActivity implements MenuProvi
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
+        HeaderFooterHandle.setSettingPages(0, "0-" + (pageCount - 1));
+        HeaderFooterHandle.setSettingPages(1, "0-" + (pageCount - 1));
+
         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 failed.", Toast.LENGTH_SHORT).show();
-        } else {
-            pageCount = document.getPageCount();
-        }
-    }
-
-    public void refreshPageImage(Bitmap updatePageBitmap) {
-        pageImage.setImageBitmap(updatePageBitmap);
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
     }
 
     public void showGlobalSetting(MenuItem menuItem) {

+ 9 - 21
app/src/main/java/com/compdfkit/pdfviewer/activities/WatermarkActivity.java

@@ -41,6 +41,7 @@ import com.compdfkit.pdfviewer.customview.watermarkview.WatermarkView;
 import com.compdfkit.pdfviewer.entity.WatermarkSetting;
 import com.compdfkit.pdfviewer.fragments.WatermarkConsoleFragment;
 import com.compdfkit.pdfviewer.tools.ConvertMapper;
+import com.compdfkit.pdfviewer.tools.DocumentHandle;
 import com.compdfkit.pdfviewer.tools.WatermarkHandle;
 import com.google.android.material.tabs.TabLayout;
 
@@ -63,6 +64,8 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
 
     private MenuItem doneItem;
 
+    private int pageCount = 0;
+
     private int currentPageHeight = 0;
     private int currentPageWidth = 0;
 
@@ -79,7 +82,7 @@ public class WatermarkActivity 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[] 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]);
 
@@ -126,7 +129,7 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
 
         consoleFragment.setDocumentPageCount(document.getPageCount());
 
@@ -156,7 +159,6 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
     }
 
     public void initTabLayout() {
-
         tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
@@ -205,7 +207,7 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
         Bitmap pageBitmap = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_4444);
 
         currentPage.renderPage(pageBitmap, 0, 0, imageWidth, imageHeight, 0xFFFFFFFF, 255, 0, true, true);
-        refreshPageImage(pageBitmap);
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
         fullScreenMask.setImageBitmap(pageBitmap);
     }
 
@@ -223,7 +225,7 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
     }
 
     public void setTabLayoutEnable(boolean enable) {
-        ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);;
+        ViewGroup viewGroup = (ViewGroup) tabLayout.getChildAt(0);
         if (viewGroup != null) {
             for (int childIndex = 0; childIndex < viewGroup.getChildCount(); childIndex++) {
                 View tabView = viewGroup.getChildAt(childIndex);
@@ -312,10 +314,6 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
         consoleFragment.changePicker(type);
     }
 
-    public void refreshPageImage(Bitmap updatePageBitmap) {
-        pageImage.setImageBitmap(updatePageBitmap);
-    }
-
     public void reloadDocument() throws CPDFDocumentException {
         if (document.hasChanges()) {
             boolean res;
@@ -326,22 +324,12 @@ public class WatermarkActivity extends AppCompatActivity implements MenuProvider
         File PDFFile = new File("/storage/emulated/0/TestPDFs/test.pdf");
         Uri PDFUri = Uri.fromFile(PDFFile);
 
-        reloadDocument(PDFFile, PDFUri);
+        pageCount = DocumentHandle.reloadDocument(PDFFile, PDFUri, document);
         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 failed.", Toast.LENGTH_SHORT).show();
-        }
+        DocumentHandle.refreshPageImage(pageBitmap, pageImage);
     }
 
     public void createNewWatermark(WatermarkSetting setting) {

+ 80 - 0
app/src/main/java/com/compdfkit/pdfviewer/customview/picker/BackgroundColorPicker.java

@@ -0,0 +1,80 @@
+package com.compdfkit.pdfviewer.customview.picker;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+
+import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.tools.BackgroundHandle;
+
+public class BackgroundColorPicker extends ConstraintLayout {
+    private View currentView;
+    private LayoutInflater inflater;
+    private Context currentContext;
+
+    private int backgroundWidth;
+    private int backgroundHeight;
+
+    private ImageView backgroundView;
+
+    private final int[] colorPickers = { R.id.color_selected, 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 = { 0xFFFFFFFF, 0xFFFF0000, 0xFFFF6600, 0xFFFFDD00, 0xFF00FF33, 0xFF00FFFF, 0xFF000000, 0xFF8800FF };
+
+    public BackgroundColorPicker(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public BackgroundColorPicker(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public BackgroundColorPicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public BackgroundColorPicker(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        init(context);
+    }
+
+    private void init(Context 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 < 8; i++) {
+            ImageView tempColor = currentView.findViewById(colorPickers[i]);
+
+            int tempI = i;
+            tempColor.setOnClickListener(view -> {
+                BackgroundHandle.setSettingColor(colors[tempI]);
+                BackgroundHandle.setSettingImage(null);
+
+                Bitmap backgroundColor = Bitmap.createBitmap(backgroundWidth, backgroundHeight, Bitmap.Config.ARGB_4444);
+                backgroundColor.eraseColor(colors[tempI]);
+                backgroundView.setImageBitmap(backgroundColor);
+                backgroundView.setAlpha(BackgroundHandle.getBackgroundSetting().getOpacity());
+            });
+        }
+    }
+
+    public void setBackgroundView(ImageView backgroundView, int backgroundWidth, int backgroundHeight) {
+        this.backgroundView = backgroundView;
+        this.backgroundWidth = backgroundWidth;
+        this.backgroundHeight = backgroundHeight;
+    }
+}

+ 3 - 3
app/src/main/java/com/compdfkit/pdfviewer/customview/picker/FontColorPicker.java

@@ -20,8 +20,8 @@ public class FontColorPicker extends ConstraintLayout {
 
     private TextView textView;
 
-    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, 0xFF000000, 0xFF8800FF };
+    private final int[] colorPickers = { R.id.color_selected, 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 = { 0xFFFFFFFF, 0xFFFF0000, 0xFFFF6600, 0xFFFFDD00, 0xFF00FF33, 0xFF00FFFF, 0xFF000000, 0xFF8800FF };
 
     public FontColorPicker(@NonNull Context context) {
         this(context, null);
@@ -50,7 +50,7 @@ public class FontColorPicker extends ConstraintLayout {
     }
 
     private void initColorPicker(View currentView) {
-        for (int i = 0; i < 7; i++) {
+        for (int i = 0; i < 8; i++) {
             ImageView tempColor = currentView.findViewById(colorPickers[i]);
 
             int tempI = i;

+ 1 - 1
app/src/main/java/com/compdfkit/pdfviewer/entity/BackgroundSetting.java

@@ -14,7 +14,7 @@ public class BackgroundSetting {
 
     public BackgroundSetting() {
         color = 0xFFFFFFFF;
-        opacity = 1.0f;
+        opacity = 0.5f;
         pages = "0";
         rotation = 0.f;
         scale = 1.0f;

+ 115 - 19
app/src/main/java/com/compdfkit/pdfviewer/fragments/BackgroundConsoleFragment.java

@@ -1,24 +1,51 @@
 package com.compdfkit.pdfviewer.fragments;
 
+import static android.app.Activity.RESULT_OK;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.content.ContentUris;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
 
+import androidx.annotation.Nullable;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
 import androidx.fragment.app.Fragment;
 
+import android.provider.DocumentsContract;
+import android.provider.MediaStore;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.activities.BackgroundActivity;
+import com.compdfkit.pdfviewer.activities.HeaderFooterActivity;
+import com.compdfkit.pdfviewer.customview.picker.BackgroundColorPicker;
+import com.compdfkit.pdfviewer.customview.picker.ImagePicker;
+import com.compdfkit.pdfviewer.customview.watermarkview.ImageWatermarkView;
+import com.compdfkit.pdfviewer.tools.BackgroundHandle;
 
-/**
- * A simple {@link Fragment} subclass.
- * Use the {@link BackgroundConsoleFragment#newInstance} factory method to
- * create an instance of this fragment.
- */
 public class BackgroundConsoleFragment extends Fragment {
 
-    // TODO: Rename parameter arguments, choose names that match
-    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+    private BackgroundActivity activity;
+
+    private ImageView backgroundLayer;
+    private BackgroundColorPicker colorPicker;
+    private ImagePicker imagePicker;
+
+    private TextView imageSelectPathView;
+
     private static final String ARG_PARAM1 = "param1";
     private static final String ARG_PARAM2 = "param2";
 
@@ -27,18 +54,8 @@ public class BackgroundConsoleFragment extends Fragment {
     private String mParam2;
 
     public BackgroundConsoleFragment() {
-        // Required empty public constructor
     }
 
-    /**
-     * Use this factory method to create a new instance of
-     * this fragment using the provided parameters.
-     *
-     * @param param1 Parameter 1.
-     * @param param2 Parameter 2.
-     * @return A new instance of fragment BackgroundConsoleFragment.
-     */
-    // TODO: Rename and change types and number of parameters
     public static BackgroundConsoleFragment newInstance(String param1, String param2) {
         BackgroundConsoleFragment fragment = new BackgroundConsoleFragment();
         Bundle args = new Bundle();
@@ -60,7 +77,86 @@ public class BackgroundConsoleFragment extends Fragment {
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.fragment_background_console, container, false);
+        activity = (BackgroundActivity) getActivity();
+        View returnView = inflater.inflate(R.layout.fragment_background_console, container, false);
+        initView(returnView);
+
+        return returnView;
+    }
+
+    private void initView(View returnView) {
+        colorPicker = returnView.findViewById(R.id.color_picker);
+        colorPicker.post(() -> colorPicker.setBackgroundView(activity.getBackgroundLayer(), activity.getCurrentPageWidth(), activity.getCurrentPageHeight()));
+
+        backgroundLayer = activity.getBackgroundLayer();
+        imagePicker = returnView.findViewById(R.id.image_picker);
+        Button imageSelectBtn = imagePicker.getImageSelectBtn();
+        imageSelectPathView = imagePicker.getImageSelectPathView();
+        imageSelectBtn.setOnClickListener(v -> {
+            if (ContextCompat.checkSelfPermission(getActivity(),
+                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+                ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 101);
+            } else {
+                //打开相册
+                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); // 打开相册
+                }
+            }
+        });
+    }
+
+    @Override
+    //TODO:Replace the deprecated method.
+    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (resultCode == RESULT_OK) {
+            handleImageOnKitKat(data);
+        }
+    }
+
+    private void handleImageOnKitKat(Intent data) {
+        String imagePath = null;
+        Uri uri = data.getData();
+        if (DocumentsContract.isDocumentUri(getActivity(), uri)) {
+            String docId = DocumentsContract.getDocumentId(uri);
+            if ("com.android.providers.media.documents".equals(uri.getAuthority())) {
+                String id = docId.split(":")[1];
+                String selection = MediaStore.Images.Media._ID + "=" + id;
+                imagePath = getImagePath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection);
+            } else if ("com.android.providers.downloads.documents".equals(uri.getAuthority())) {
+                Uri contentUri = ContentUris.withAppendedId(Uri.parse("content: //downloads/public_downloads"), Long.valueOf(docId));
+                imagePath = getImagePath(contentUri, null);
+            }
+        } else if ("content".equalsIgnoreCase(uri.getScheme())) {
+            imagePath = getImagePath(uri, null);
+        } else if ("file".equalsIgnoreCase(uri.getScheme())) {
+            imagePath = uri.getPath();
+        }
+        imageSelectPathView.setText(imagePath);
+
+        Bitmap backgroundImage = BitmapFactory.decodeFile(imagePath);
+        BackgroundHandle.setSettingImage(backgroundImage);
+        backgroundLayer.setImageBitmap(backgroundImage);
+    }
+
+    @SuppressLint("Range")
+    private String getImagePath(Uri uri, String selection) {
+        String path = null;
+
+        Cursor cursor = getActivity().getContentResolver().query(uri, null, selection, null, null);
+        if (cursor != null) {
+            if (cursor.moveToFirst()) {
+                path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
+            }
+            cursor.close();
+        }
+        return path;
     }
 }

+ 72 - 0
app/src/main/java/com/compdfkit/pdfviewer/tools/BackgroundHandle.java

@@ -0,0 +1,72 @@
+package com.compdfkit.pdfviewer.tools;
+
+import android.graphics.Bitmap;
+
+import com.compdfkit.core.annotation.CPDFImageScaleType;
+import com.compdfkit.core.document.CPDFBackground;
+import com.compdfkit.pdfviewer.entity.BackgroundSetting;
+
+public class BackgroundHandle {
+    private static BackgroundSetting backgroundSetting = new BackgroundSetting();
+
+    public static void updateBackground(CPDFBackground background) {
+        background.setColor(backgroundSetting.getColor());
+        background.setOpacity(backgroundSetting.getOpacity());
+        background.setRotation(backgroundSetting.getRotation());
+        background.setXOffset(backgroundSetting.getxOffset());
+        background.setYOffset(backgroundSetting.getyOffset());
+        background.setPages(backgroundSetting.getPages());
+        background.setScale(backgroundSetting.getScale());
+
+        if (backgroundSetting.getImage() != null) {
+            background.setImage(backgroundSetting.getImage(), CPDFImageScaleType.SCALETYPE_fitEnd);
+            background.setType(CPDFBackground.CPDFBackgroundType.Image);
+        } else {
+            background.setType(CPDFBackground.CPDFBackgroundType.Color);
+        }
+
+        //TODO: bug is here
+        BackgroundSetting setting = new BackgroundSetting();
+        setting.setColor(background.getColor());
+        float opacity = background.getOpacity();
+        setting.setRotation(background.getRotation());
+        setting.setxOffset(background.getXOffset());
+        setting.setyOffset(background.getYOffset());
+        setting.setPages(background.getPages());
+        setting.setScale(background.getScale());
+        CPDFBackground.CPDFBackgroundType type = background.getType();
+        CPDFBackground.CPDFBackgroundAlign hAlign = background.getHorizalign();
+        CPDFBackground.CPDFBackgroundAlign vAlign = background.getVertalign();
+        boolean test = background.isValid();
+
+        background.update();
+    }
+
+    public static void setSettingColor(int color) {
+        backgroundSetting.setColor(color);
+    }
+
+    public static void setSettingImage(Bitmap image) {
+        backgroundSetting.setImage(image);
+    }
+
+    public static void setSettingMsg(float xOffset, float yOffset, float opacity, float scale, float rotation) {
+        backgroundSetting.setxOffset(xOffset);
+        backgroundSetting.setyOffset(yOffset);
+        backgroundSetting.setOpacity(opacity);
+        backgroundSetting.setScale(scale);
+        backgroundSetting.setRotation(rotation);
+    }
+
+    public static void setSettingPages(String pages) {
+        backgroundSetting.setPages(pages);
+    }
+
+    public static String getSettingPages() {
+        return backgroundSetting.getPages();
+    }
+
+    public static BackgroundSetting getBackgroundSetting() {
+        return backgroundSetting;
+    }
+}

+ 95 - 12
app/src/main/java/com/compdfkit/pdfviewer/tools/DialogManager.java

@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.RectF;
+import android.text.Editable;
+import android.text.TextWatcher;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.AdapterView;
@@ -13,6 +15,7 @@ import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
 import androidx.appcompat.app.AlertDialog;
 import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
 import androidx.appcompat.widget.AppCompatEditText;
@@ -20,20 +23,75 @@ import androidx.appcompat.widget.AppCompatRadioButton;
 import androidx.constraintlayout.widget.ConstraintLayout;
 
 import com.compdfkit.pdfviewer.R;
+import com.compdfkit.pdfviewer.activities.BackgroundActivity;
 import com.compdfkit.pdfviewer.activities.HeaderFooterActivity;
 import com.compdfkit.pdfviewer.customview.picker.FontColorPicker;
+import com.compdfkit.pdfviewer.entity.BackgroundSetting;
 import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.google.android.material.slider.Slider;
 import com.google.android.material.textfield.TextInputEditText;
 
+import java.util.Objects;
+
 public class DialogManager {
+    @SuppressLint("SetTextI18n")
     public static void showBackgroundSettingDialog(Context context) {
+        BackgroundActivity activity = (BackgroundActivity) context;
+
         LayoutInflater inflater = LayoutInflater.from(context);
-        final ConstraintLayout globalSettingLayout = (ConstraintLayout) inflater.inflate(R.layout.background_setting_panel, null);
+        final ConstraintLayout backgroundSettingLayout = (ConstraintLayout) inflater.inflate(R.layout.background_setting_panel, null);
         final Button[] positiveButton = new Button[1];
+        boolean isCustomRange = true;
+
+        BackgroundSetting currentSetting = BackgroundHandle.getBackgroundSetting();
+
+        TextInputEditText xOffset = backgroundSettingLayout.findViewById(R.id.x_offset);
+        xOffset.setText(String.valueOf(currentSetting.getxOffset()));
+        TextInputEditText yOffset = backgroundSettingLayout.findViewById(R.id.y_offset);
+        yOffset.setText(String.valueOf(currentSetting.getyOffset()));
+
+        Slider opacitySlider = backgroundSettingLayout.findViewById(R.id.opacity_slider);
+        opacitySlider.setValue(currentSetting.getOpacity() * 100);
+        Slider sizeSlider = backgroundSettingLayout.findViewById(R.id.size_slider);
+        sizeSlider.setValue(currentSetting.getScale() * 100);
+        Slider rotationSlider = backgroundSettingLayout.findViewById(R.id.rotation_slider);
+        rotationSlider.setValue((float) Math.toDegrees(currentSetting.getRotation()));
+
+        TextView opacityText = backgroundSettingLayout.findViewById(R.id.opacity_text);
+        opacityText.setText((int) opacitySlider.getValue() + "%");
+        TextView sizeText = backgroundSettingLayout.findViewById(R.id.size_text);
+        sizeText.setText((int) sizeSlider.getValue() + "%");
+        TextView rotationText = backgroundSettingLayout.findViewById(R.id.rotation_text);
+        rotationText.setText((int) rotationSlider.getValue() + "°");
+
+        ImageButton pageRangeBtn = backgroundSettingLayout.findViewById(R.id.page_range_button);
+        TextView pageRangeMsg = backgroundSettingLayout.findViewById(R.id.page_range_msg);
+        isCustomRange = !BackgroundHandle.getSettingPages().equals("0-" + (activity.getPageCount() - 1));
+
+        boolean finalIsCustomRange = isCustomRange;
+        pageRangeBtn.setOnClickListener((view) -> showPageRangeDialog(context, 3, finalIsCustomRange, BackgroundHandle.getSettingPages(), pageRangeMsg, activity.getPageCount()));
+
+        opacitySlider.addOnChangeListener((slider, value, fromUser) -> opacityText.setText((int) value + "%"));
+        sizeSlider.addOnChangeListener((slider, value, fromUser) -> sizeText.setText((int) value + "%"));
+        rotationSlider.addOnChangeListener((slider, value, fromUser) -> rotationText.setText((int) value + "°"));
 
         MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(context);
-        inputDialog.setTitle("Background setting").setView(globalSettingLayout);
-        inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {});
+        inputDialog.setTitle(R.string.background_setting).setView(backgroundSettingLayout);
+        inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
+            BackgroundHandle.setSettingMsg(
+                    Float.parseFloat(xOffset.getText().toString()),
+                    Float.parseFloat(yOffset.getText().toString()),
+                    opacitySlider.getValue() / 100,
+                    sizeSlider.getValue() / 100,
+                    (float) Math.toRadians(rotationSlider.getValue()));
+
+            activity.setBackgroundLayerAttr(
+                    Float.parseFloat(xOffset.getText().toString()),
+                    Float.parseFloat(yOffset.getText().toString()),
+                    opacitySlider.getValue() / 100,
+                    sizeSlider.getValue() / 100,
+                    -rotationSlider.getValue());
+        });
 
         inputDialog.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {});
 
@@ -72,10 +130,10 @@ public class DialogManager {
             pageRangeMsg.setText(HeaderFooterHandle.getSettingPages(type));
 
         boolean finalIsCustomRange = isCustomRange;
-        pageRangeBtn.setOnClickListener((view) -> showPageRangeDialog(context, type, finalIsCustomRange, HeaderFooterHandle.getSettingPages(type), pageRangeMsg));
+        pageRangeBtn.setOnClickListener((view) -> showPageRangeDialog(context, type, finalIsCustomRange, HeaderFooterHandle.getSettingPages(type), pageRangeMsg, activity.getPageCount()));
 
         MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(context);
-        inputDialog.setTitle("Global header-footer setting").setView(globalSettingLayout);
+        inputDialog.setTitle(R.string.global_header_footer_setting).setView(globalSettingLayout);
         inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
             float top = Float.parseFloat(topMargin.getText().toString());
             float bottom = Float.parseFloat(bottomMargin.getText().toString());
@@ -130,7 +188,7 @@ public class DialogManager {
         startPagePicker.setText(String.valueOf(HeaderFooterHandle.getIndexStartPageNumber(index)));
 
         MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(context);
-        inputDialog.setTitle("HeaderFooter setting").setView(commonSettingLayout);
+        inputDialog.setTitle(R.string.headerfooter_setting).setView(commonSettingLayout);
 
         inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
             HeaderFooterHandle.setSettingColor(0, index, fontColorText.getCurrentTextColor());
@@ -177,7 +235,7 @@ public class DialogManager {
         digitsEdit.setText(String.valueOf(HeaderFooterHandle.getIndexDigits(index)));
 
         MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(context);
-        inputDialog.setTitle("Global bates number setting").setView(batesSettingLayout);
+        inputDialog.setTitle(R.string.global_bates_setting).setView(batesSettingLayout);
         inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
             HeaderFooterHandle.setSettingColor(1, index, fontColorText.getCurrentTextColor());
             HeaderFooterHandle.setSettingFontName(1, index, fontPicker.getText().toString());
@@ -200,13 +258,11 @@ public class DialogManager {
         positiveButton[0] = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
     }
 
-    public static void showPageRangeDialog(Context context, int type, boolean isCustomRange, String pageRange, TextView textView) {
+    public static void showPageRangeDialog(Context context, int type, boolean isCustomRange, String pageRange, TextView textView, int pageCount) {
         LayoutInflater inflater = LayoutInflater.from(context);
         final ConstraintLayout rangeSelectLayout = (ConstraintLayout) inflater.inflate(R.layout.range_selector, null);
         final Button[] positiveButton = new Button[1];
 
-        HeaderFooterActivity activity = (HeaderFooterActivity) context;
-
         AppCompatRadioButton customRadioBtn = rangeSelectLayout.findViewById(R.id.custom_range);
         customRadioBtn.setChecked(isCustomRange);
 
@@ -215,15 +271,42 @@ public class DialogManager {
         if (isCustomRange)
             rangeEditText.setText(pageRange);
 
+        customRadioBtn.setOnCheckedChangeListener((compoundButton, b) -> {
+            rangeEditText.setEnabled(b);
+            if (b && Objects.requireNonNull(rangeEditText.getText()).toString().equals(""))
+                positiveButton[0].setEnabled(false);
+        });
+
+        rangeEditText.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
+
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
+
+            @Override
+            public void afterTextChanged(Editable editable) {
+                positiveButton[0].setEnabled(!rangeEditText.getText().toString().equals(""));
+            }
+        });
+
         MaterialAlertDialogBuilder inputDialog = new MaterialAlertDialogBuilder(context);
         inputDialog.setTitle(R.string.setting_range).setView(rangeSelectLayout);
 
         inputDialog.setPositiveButton(R.string.done, (dialogInterface, i) -> {
             if (customRadioBtn.isChecked()) {
-                HeaderFooterHandle.setSettingPages(type, rangeEditText.getText().toString());
+                if (type != 3)
+                    HeaderFooterHandle.setSettingPages(type, rangeEditText.getText().toString());
+                else
+                    BackgroundHandle.setSettingPages(rangeEditText.getText().toString());
+
                 textView.setText(rangeEditText.getText().toString());
             } else {
-                HeaderFooterHandle.setSettingPages(type, "0-" + (activity.getPageCount() - 1));
+                if (type != 3)
+                    HeaderFooterHandle.setSettingPages(type, "0-" + (pageCount - 1));
+                else
+                    BackgroundHandle.setSettingPages("0-" + (pageCount - 1));
+
                 textView.setText(R.string.all_pages);
             }
         });

+ 33 - 0
app/src/main/java/com/compdfkit/pdfviewer/tools/DocumentHandle.java

@@ -0,0 +1,33 @@
+package com.compdfkit.pdfviewer.tools;
+
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.util.Log;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+
+import com.compdfkit.core.document.CPDFDocument;
+
+import java.io.File;
+
+public class DocumentHandle {
+    public static int reloadDocument(@NonNull File PDFFile, Uri PDFUri, CPDFDocument document) {
+        CPDFDocument.PDFDocumentError error = document.open(PDFFile.getAbsolutePath());
+        int pageCount = 0;
+
+        if (error == CPDFDocument.PDFDocumentError.PDFDocumentErrorPassword) {
+            error = document.open(PDFUri, "password");
+        } else if (error != CPDFDocument.PDFDocumentError.PDFDocumentErrorSuccess) {
+            Log.d("CPDFDocumentError", "File open failed");
+        } else {
+            pageCount = document.getPageCount();
+        }
+        return pageCount;
+    }
+
+    public static void refreshPageImage(Bitmap updatePageBitmap, ImageView pageImage) {
+        pageImage.setImageBitmap(updatePageBitmap);
+    }
+
+}

+ 0 - 1
app/src/main/java/com/compdfkit/pdfviewer/tools/HeaderFooterHandle.java

@@ -30,7 +30,6 @@ public class HeaderFooterHandle {
             headerFooter.setFontName(i, commonTypeSetting.getFontName(i));
             headerFooter.setFontSize(i, commonTypeSetting.getFontSize(i));
             headerFooter.setText(i, commonTypeSetting.getText(i));
-//            headerFooter.setText(i, "<<Page 1>>");
             headerFooter.setTextColor(i, commonTypeSetting.getColor(i));
         }
 

+ 2 - 3
app/src/main/java/com/compdfkit/pdfviewer/tools/TextGenerator.java

@@ -79,7 +79,6 @@ public class TextGenerator {
 
         Matcher m = r.matcher(contentText);
         while (m.find()) {
-            Log.d("Match", "convertContentText: " + convertCommonDisplayText(m.group(), pageCount));
             displayText = displayText.replaceAll(m.group(), convertCommonDisplayText(m.group(), pageCount));
         }
 
@@ -132,12 +131,12 @@ public class TextGenerator {
 
     public static String convertBatesDisplayText(int type, String contentText) {
         String settingText = contentText;
-        String pair = "<<#.*#.*#.*#.*>>";
+        String pair = "<<#[0-9]*#[0-9]*#[^<>]*#[^<>]*>>";
         Pattern r = Pattern.compile(pair);
 
         Matcher m = r.matcher(contentText);
         while (m.find()) {
-            Log.d("Match", "convertContentText: " + convertBatesDisplayText(m.group()));
+//            Log.d("Match", "convertContentText: " + convertBatesDisplayText(m.group()));
             settingText = settingText.replaceAll(m.group(), convertBatesDisplayText(m.group()));
         }
 

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

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

+ 2 - 0
app/src/main/res/layout-land-v31/fragment_watermark_console.xml

@@ -176,6 +176,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/horizontal_space_mm"
             app:layout_constraintStart_toStartOf="parent"
@@ -199,6 +200,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
             app:layout_constraintEnd_toStartOf="@id/vertical_space_mm"
             app:layout_constraintStart_toEndOf="@id/horizontal_space_mm"

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

@@ -177,6 +177,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/horizontal_space_mm"
             app:layout_constraintStart_toStartOf="parent"
@@ -200,6 +201,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
             app:layout_constraintEnd_toStartOf="@id/vertical_space_mm"
             app:layout_constraintStart_toEndOf="@id/horizontal_space_mm"

+ 19 - 1
app/src/main/res/layout-v31/activity_background.xml

@@ -15,6 +15,24 @@
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent" />
 
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/page_bottom_layer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/background_layer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
     <androidx.appcompat.widget.AppCompatImageView
         android:id="@+id/page_image"
         android:layout_width="wrap_content"
@@ -35,7 +53,7 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
-        app:title="Edit Background" />
+        app:title="@string/edit_background" />
 
     <View
         android:id="@+id/divider"

+ 1 - 1
app/src/main/res/layout-v31/fragment_background_console.xml

@@ -7,7 +7,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools">
 
-    <com.compdfkit.pdfviewer.customview.picker.ColorPicker
+    <com.compdfkit.pdfviewer.customview.picker.BackgroundColorPicker
         android:id="@+id/color_picker"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"

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

@@ -190,6 +190,7 @@
                 android:hint="@string/default_space"
                 android:text="@string/default_space"
                 android:enabled="false"
+                android:inputType="number|numberDecimal"
                 tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
         </com.google.android.material.textfield.TextInputLayout>
@@ -222,6 +223,7 @@
                 android:hint="@string/default_space"
                 android:text="@string/default_space"
                 android:enabled="false"
+                android:inputType="number|numberDecimal"
                 tools:ignore="TouchTargetSizeCheck" />
 
         </com.google.android.material.textfield.TextInputLayout>

+ 74 - 3
app/src/main/res/layout/activity_background.xml

@@ -1,9 +1,80 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".activities.BackgroundActivity">
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <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_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/page_bottom_layer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/background_layer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/page_image"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:srcCompat="@drawable/pdf"
+        app:layout_constraintTop_toBottomOf="@id/toolbar"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        android:contentDescription="@string/page_image" />
+
+    <com.google.android.material.appbar.MaterialToolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="?actionBarSize"
+        android:background="?attr/colorPrimary"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:titleTextColor="?attr/colorOnPrimary"
+        app:title="@string/edit_background" />
+
+    <View
+        android:id="@+id/divider"
+        android:layout_width="409dp"
+        android:layout_height="1dp"
+        android:background="?attr/colorSecondaryContainer"
+        app:layout_constraintBottom_toTopOf="@id/console_view"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
+
+    <androidx.fragment.app.FragmentContainerView
+        android:name="com.compdfkit.pdfviewer.fragments.BackgroundConsoleFragment"
+        android:id="@+id/console_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:tag="console_fragment"
+        android:elevation="4dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        tools:layout="@layout/fragment_background_console" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 18 - 16
app/src/main/res/layout/background_setting_panel.xml

@@ -6,30 +6,31 @@
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/font_div"
+        android:id="@+id/x_offset_div"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:paddingRight="4dp"
         app:layout_constraintBottom_toTopOf="@id/opacity_slider"
-        app:layout_constraintEnd_toStartOf="@id/font_size_div"
+        app:layout_constraintEnd_toStartOf="@id/y_offset_div"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent">
 
         <com.google.android.material.textfield.TextInputLayout
-            android:id="@+id/font_menu"
+            android:id="@+id/x_offset_layout"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:hint="XOffset"
+            android:hint="@string/xoffset"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent">
 
             <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/font_picker"
+                android:id="@+id/x_offset"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:inputType="none"
+                android:inputType="number|numberDecimal"
+                android:digits="0123456789-"
                 android:maxLines="1"
                 app:simpleItems="@array/font_family_items" />
 
@@ -37,30 +38,31 @@
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/font_size_div"
+        android:id="@+id/y_offset_div"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:paddingLeft="4dp"
-        app:layout_constraintBottom_toBottomOf="@+id/font_div"
+        app:layout_constraintBottom_toBottomOf="@id/x_offset_div"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toEndOf="@id/font_div"
-        app:layout_constraintTop_toTopOf="@+id/font_div">
+        app:layout_constraintStart_toEndOf="@id/x_offset_div"
+        app:layout_constraintTop_toTopOf="@id/x_offset_div">
 
         <com.google.android.material.textfield.TextInputLayout
-            android:id="@+id/font_size_menu"
+            android:id="@+id/y_offset_layout"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:hint="YOffset"
+            android:hint="@string/yoffset"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent">
 
             <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/font_size_picker"
+                android:id="@+id/y_offset"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:inputType="none"
+                android:inputType="number|numberDecimal"
+                android:digits="0123456789-"
                 app:simpleItems="@array/font_size_items" />
 
         </com.google.android.material.textfield.TextInputLayout>
@@ -89,8 +91,8 @@
         android:valueTo="100.0"
         app:layout_constraintBottom_toTopOf="@id/size_slider"
         app:layout_constraintEnd_toStartOf="@id/opacity_text"
-        app:layout_constraintStart_toEndOf="@+id/opacity_icon"
-        app:layout_constraintTop_toBottomOf="@+id/font_div" />
+        app:layout_constraintStart_toEndOf="@id/opacity_icon"
+        app:layout_constraintTop_toBottomOf="@id/x_offset_div" />
 
     <TextView
         android:id="@+id/opacity_text"

+ 8 - 7
app/src/main/res/layout/bates_setting_panel.xml

@@ -12,7 +12,7 @@
         android:layout_height="wrap_content"
         android:textSize="16sp"
         android:padding="8dp"
-        android:text="Font Color"
+        android:text="@string/font_color"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toTopOf="@id/color_picker"
         app:layout_constraintStart_toStartOf="parent" />
@@ -104,7 +104,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Prefix"
+            android:text="@string/prefix"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -114,7 +114,7 @@
             android:id="@+id/prefix_field"
             android:layout_width="100dp"
             android:layout_height="wrap_content"
-            android:hint="Prefix"
+            android:hint="@string/prefix"
             android:padding="4dp"
             app:layout_constraintBottom_toBottomOf="@+id/prefix_text"
             app:layout_constraintEnd_toEndOf="parent"
@@ -145,7 +145,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Suffix"
+            android:text="@string/suffix"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -155,7 +155,7 @@
             android:id="@+id/suffix_field"
             android:layout_width="100dp"
             android:layout_height="wrap_content"
-            android:hint="Suffix"
+            android:hint="@string/suffix"
             android:padding="4dp"
             app:layout_constraintBottom_toBottomOf="@+id/suffix_text"
             app:layout_constraintEnd_toEndOf="parent"
@@ -186,7 +186,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Number of digits"
+            android:text="@string/number_of_digits"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -196,7 +196,7 @@
             android:id="@+id/number_field"
             android:layout_width="100dp"
             android:layout_height="wrap_content"
-            android:hint="Digits"
+            android:hint="@string/digits"
             android:padding="4dp"
             app:layout_constraintBottom_toBottomOf="@+id/number_text"
             app:layout_constraintEnd_toEndOf="parent"
@@ -207,6 +207,7 @@
                 android:id="@+id/number"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:inputType="number"
                 tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
         </com.google.android.material.textfield.TextInputLayout>

+ 5 - 4
app/src/main/res/layout/common_setting_panel.xml

@@ -12,7 +12,7 @@
         android:layout_height="wrap_content"
         android:textSize="16sp"
         android:padding="8dp"
-        android:text="Font Color"
+        android:text="@string/font_color"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toTopOf="@id/color_picker"
         app:layout_constraintStart_toStartOf="parent" />
@@ -104,7 +104,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Date Format"
+            android:text="@string/date_format"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -144,7 +144,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Page Format"
+            android:text="@string/page_format"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -184,7 +184,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Start Page Number"
+            android:text="@string/start_page_number"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -202,6 +202,7 @@
                 android:id="@+id/start_page_picker"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:inputType="number"
                 tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
         </com.google.android.material.textfield.TextInputLayout>

+ 2 - 2
app/src/main/res/layout/content_append_selector.xml

@@ -16,14 +16,14 @@
             android:id="@+id/add_date"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="Add date"
+            android:text="@string/add_date"
             android:checked="true"/>
 
         <com.google.android.material.radiobutton.MaterialRadioButton
             android:id="@+id/add_page_number"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="Add page number" />
+            android:text="@string/add_page_number" />
 
     </RadioGroup>
 

+ 21 - 9
app/src/main/res/layout/fragment_background_console.xml

@@ -1,14 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context=".fragments.BackgroundConsoleFragment">
+    android:layout_height="wrap_content"
+    android:padding="4dp"
+    android:background="?attr/colorSurface"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
 
-    <!-- TODO: Update blank fragment layout -->
-    <TextView
+    <com.compdfkit.pdfviewer.customview.picker.BackgroundColorPicker
+        android:id="@+id/color_picker"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:text="@string/hello_blank_fragment" />
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
 
-</FrameLayout>
+    <com.compdfkit.pdfviewer.customview.picker.ImagePicker
+        android:id="@+id/image_picker"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/color_picker"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -181,6 +181,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/horizontal_space_mm"
             app:layout_constraintStart_toStartOf="parent"
@@ -204,6 +205,7 @@
             android:hint="@string/default_space"
             android:text="@string/default_space"
             android:enabled="false"
+            android:inputType="number|numberDecimal"
             app:layout_constraintBottom_toBottomOf="@id/horizontal_space"
             app:layout_constraintEnd_toStartOf="@id/vertical_space_mm"
             app:layout_constraintStart_toEndOf="@id/horizontal_space_mm"

+ 7 - 2
app/src/main/res/layout/global_setting_panel.xml

@@ -21,7 +21,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:padding="8dp"
-            android:text="Start Page Number"
+            android:text="@string/start_page_number"
             android:textSize="16sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
@@ -31,7 +31,7 @@
             android:id="@+id/start_page_field"
             android:layout_width="100dp"
             android:layout_height="wrap_content"
-            android:hint="Offset"
+            android:hint="@string/offset"
             android:padding="4dp"
             app:layout_constraintBottom_toBottomOf="@id/start_page_text"
             app:layout_constraintEnd_toEndOf="parent"
@@ -41,6 +41,7 @@
                 android:id="@+id/start_page"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:inputType="number"
                 tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
         </com.google.android.material.textfield.TextInputLayout>
@@ -109,6 +110,7 @@
             android:id="@+id/top_margin"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:inputType="number|numberDecimal"
             tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
     </com.google.android.material.textfield.TextInputLayout>
@@ -128,6 +130,7 @@
             android:id="@+id/bottom_margin"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:inputType="number|numberDecimal"
             tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
     </com.google.android.material.textfield.TextInputLayout>
@@ -147,6 +150,7 @@
             android:id="@+id/left_margin"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:inputType="number|numberDecimal"
             tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
     </com.google.android.material.textfield.TextInputLayout>
@@ -166,6 +170,7 @@
             android:id="@+id/right_margin"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:inputType="number|numberDecimal"
             tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
 
     </com.google.android.material.textfield.TextInputLayout>

+ 2 - 0
app/src/main/res/layout/range_selector.xml

@@ -42,6 +42,8 @@
             android:layout_width="200dp"
             android:layout_height="wrap_content"
             android:enabled="false"
+            android:inputType="number"
+            android:digits="0123456789-,"
             android:minHeight="48dp" />
 
     </com.google.android.material.textfield.TextInputLayout>

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

@@ -45,4 +45,22 @@
     <string name="add_header_footer">ヘッダーとフッターを追加する</string>
     <string name="common">普通</string>
     <string name="bates">ベイツ</string>
+    <string name="edit_background">背景を編集</string>
+    <string name="xoffset">水平オフセット</string>
+    <string name="yoffset">垂直オフセット</string>
+    <string name="font_color">フォントの色</string>
+    <string name="prefix">プレフィックス</string>
+    <string name="suffix">サフィックス</string>
+    <string name="number_of_digits">桁数</string>
+    <string name="digits">少し</string>
+    <string name="date_format">日付形式</string>
+    <string name="page_format">ページ番号の形式</string>
+    <string name="start_page_number">スタートページ</string>
+    <string name="add_date">追加日</string>
+    <string name="add_page_number">ページ番号を追加</string>
+    <string name="offset">オフセット</string>
+    <string name="background_setting">背景設定</string>
+    <string name="global_header_footer_setting">ヘッダーとフッターのグローバル設定</string>
+    <string name="headerfooter_setting">ヘッダーとフッターの設定</string>
+    <string name="global_bates_setting">グローバルベイツ設定</string>
 </resources>

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

@@ -45,4 +45,22 @@
     <string name="add_header_footer">添加页眉页脚</string>
     <string name="common">普通类型</string>
     <string name="bates">贝茨编号</string>
+    <string name="edit_background">编辑背景</string>
+    <string name="xoffset">水平偏移</string>
+    <string name="yoffset">垂直偏移</string>
+    <string name="font_color">字体颜色</string>
+    <string name="prefix">前缀</string>
+    <string name="suffix">后缀</string>
+    <string name="number_of_digits">位数</string>
+    <string name="digits">位</string>
+    <string name="date_format">日期格式</string>
+    <string name="page_format">页码格式</string>
+    <string name="start_page_number">起始页数</string>
+    <string name="add_date">添加日期</string>
+    <string name="add_page_number">添加页码</string>
+    <string name="offset">偏移数</string>
+    <string name="background_setting">背景设置</string>
+    <string name="global_header_footer_setting">全局页眉页脚设置</string>
+    <string name="headerfooter_setting">页眉页脚设置</string>
+    <string name="global_bates_setting">全局贝茨编号设置</string>
 </resources>

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

@@ -53,4 +53,22 @@
     <string name="right_footer">Right Footer</string>
     <string name="common">Common</string>
     <string name="bates">Bates</string>
+    <string name="edit_background">Edit Background</string>
+    <string name="xoffset">XOffset</string>
+    <string name="yoffset">YOffset</string>
+    <string name="font_color">Font Color</string>
+    <string name="prefix">Prefix</string>
+    <string name="suffix">Suffix</string>
+    <string name="number_of_digits">Number of digits</string>
+    <string name="digits">Digits</string>
+    <string name="date_format">Date Format</string>
+    <string name="page_format">Page Format</string>
+    <string name="start_page_number">Start Page Number</string>
+    <string name="add_date">Add date</string>
+    <string name="add_page_number">Add page number</string>
+    <string name="offset">Offset</string>
+    <string name="background_setting">Background Setting</string>
+    <string name="global_header_footer_setting">Global header-footer setting</string>
+    <string name="headerfooter_setting">HeaderFooter setting</string>
+    <string name="global_bates_setting">Global bates number setting</string>
 </resources>