master
fengyuecanzhu 3 years ago
commit f41041c58e
  1. 2
      DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java
  2. 3
      DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java
  3. 4
      DialogX/src/main/res/drawable/rect_dialogx_material_bottom_bkg_light.xml
  4. 4
      DialogX/src/main/res/drawable/rect_dialogx_material_bottom_bkg_night.xml
  5. 1
      app/build.gradle
  6. 22
      app/src/main/AndroidManifest.xml
  7. 5
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  8. 60
      app/src/main/java/xyz/fycz/myreader/ui/dialog/CopyContentDialog.java
  9. 11
      app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java
  10. 4
      app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java
  11. 16
      app/src/main/res/layout/dialog_copy_content.xml

@ -141,7 +141,7 @@ public class MaterialStyle implements DialogXStyle {
@Override
public boolean touchSlide() {
return true;
return false;
}
@Override

@ -1,6 +1,7 @@
package com.kongzue.dialogx.util;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.util.Log;
import android.view.MotionEvent;
@ -43,6 +44,7 @@ public class BottomDialogTouchEventInterceptor {
refresh(me, impl);
}
@SuppressLint("ClickableViewAccessibility")
public void refresh(final BottomDialog me, final BottomDialog.DialogImpl impl) {
if (me == null || impl == null || impl.bkg == null || impl.scrollView == null) {
return;
@ -62,6 +64,7 @@ public class BottomDialogTouchEventInterceptor {
*/
if (me.isAllowInterceptTouch()) {
impl.bkg.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//这里 return 什么实际上无关紧要,重点在于 MaxRelativeLayout.java(dispatchTouchEvent:184) 的事件分发会独立触发此处的额外滑动事件

@ -6,6 +6,6 @@
android:color="@color/white"/>
<corners
android:topRightRadius="10dp"
android:topLeftRadius="10dp"/>
android:topRightRadius="15dp"
android:topLeftRadius="15dp"/>
</shape>

@ -6,6 +6,6 @@
android:color="@color/dialogxMaterialDarkDialogBkgColor"/>
<corners
android:topRightRadius="10dp"
android:topLeftRadius="10dp"/>
android:topRightRadius="15dp"
android:topLeftRadius="15dp"/>
</shape>

@ -104,6 +104,7 @@ android {
if (keyPropsFile.exists()) {
signingConfig signingConfigs.myConifg
}
versionNameSuffix "-debug"
}
android.applicationVariants.all { variant ->
variant.outputs.all {

@ -3,26 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="xyz.fycz.myreader">
<!-- 删除权限 -->
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
<uses-permission
android:name="android.permission.GET_TASKS"
tools:node="remove" />
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:node="remove" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
tools:node="remove" />
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
tools:node="remove" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
tools:node="remove" />
<!-- ********************************permission************************************ -->
<!-- 读取手机状态和身份 -->
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
@ -84,7 +64,7 @@
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="xyz.fycz.myreader.fileprovider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data

@ -81,8 +81,8 @@ import xyz.fycz.myreader.model.audio.ReadAloudService;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
import xyz.fycz.myreader.model.storage.Backup;
import xyz.fycz.myreader.ui.dialog.AudioPlayerDialog;
import xyz.fycz.myreader.ui.dialog.CopyContentDialog;
import xyz.fycz.myreader.ui.dialog.DialogCreator;
import xyz.fycz.myreader.ui.dialog.MyAlertDialog;
import xyz.fycz.myreader.ui.dialog.ReplaceDialog;
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
import xyz.fycz.myreader.ui.popmenu.AutoPageMenu;
@ -760,7 +760,8 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
Intent ruleIntent = new Intent(this, ReplaceRuleActivity.class);
startActivityForResult(ruleIntent, APPCONST.REQUEST_REFRESH_READ_UI);
} else if (itemId == R.id.action_copy_content) {
new CopyContentDialog(this, mPageLoader.getContent()).show();
String content = mPageLoader.getContentStartPage(0);
MyAlertDialog.showTipDialogWithLink(this, "拷贝内容", content == null ? "章节内容为空!" : content);
} else if (itemId == R.id.action_open_link) {
Uri uri = Uri.parse(NetworkUtils.getAbsoluteURL(mReadCrawler.getNameSpace(), mBook.getChapterUrl()));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

@ -1,60 +0,0 @@
package xyz.fycz.myreader.ui.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import xyz.fycz.myreader.databinding.DialogCopyContentBinding;
/**
* Created by Zhouas666 on 2019-04-14
* Github: https://github.com/zas023
* <p>
* 自由复制dialog
*/
public class CopyContentDialog extends Dialog {
private static final String TAG = "CopyContentDialog";
private DialogCopyContentBinding binding;
private String content;
/***************************************************************************/
public CopyContentDialog(@NonNull Context context, String content) {
super(context);
this.content = content;
}
/*****************************Initialization********************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DialogCopyContentBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setUpWindow();
binding.dialogTvContent.setText(content);
}
/**
* 设置Dialog显示的位置
*/
private void setUpWindow() {
Window window = getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.CENTER;
window.setAttributes(lp);
}
}

@ -325,6 +325,17 @@ public class MyAlertDialog {
}).setCancelButton("知道了");
}
public static void showTipDialogWithLink(Context context, String title, String msg){
BottomDialog.show(title, new OnBindView<BottomDialog>(R.layout.dialog_textview) {
@Override
public void onBind(BottomDialog dialog, View v) {
TextView view = (TextView) v;
view.setText(msg);
view.setMovementMethod(LinkMovementMethod.getInstance());
}
}).setCancelButton("取消");
}
public static void showPrivacyDialog(Context context, DialogInterface.OnClickListener pos, DialogInterface.OnClickListener neg) {
TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.dialog_textview, null);
String msg = context.getString(R.string.privacy_tip);

@ -1517,8 +1517,8 @@ public abstract class PageLoader {
private void chapterChangeCallback() {
if (mPageChangeListener != null) {
readAloudParagraph = -1;
mPageChangeListener.onPageChange(0, resetReadAloud);
mPageChangeListener.onChapterChange(mCurChapterPos);
mPageChangeListener.onPageChange(0, resetReadAloud);
resetReadAloud = true;
mPageChangeListener.onPageCountChange(mCurChapter != null ? mCurChapter.getPageSize() : 0);
}
@ -2017,7 +2017,7 @@ public abstract class PageLoader {
* @param page 开始页数
* @return 从page页开始的的当前章节所有内容
*/
private String getContentStartPage(int page) {
public String getContentStartPage(int page) {
if (mCurChapter == null) return null;
if (mCurChapter.getTxtPageList().isEmpty()) return null;
StringBuilder s = new StringBuilder();

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/dialog_tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_normal_size"
android:text="神墓(辰东)"/>
</LinearLayout>
Loading…
Cancel
Save