master
fengyuecanzhu 3 years ago
parent 1c9292c816
commit 60d5bb768c
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 2
      DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java
  3. 3
      DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java
  4. 5
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  5. 60
      app/src/main/java/xyz/fycz/myreader/ui/dialog/CopyContentDialog.java
  6. 11
      app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java
  7. 2
      app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java
  8. 16
      app/src/main/res/layout/dialog_copy_content.xml

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

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

@ -81,8 +81,8 @@ import xyz.fycz.myreader.model.audio.ReadAloudService;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
import xyz.fycz.myreader.model.storage.Backup; import xyz.fycz.myreader.model.storage.Backup;
import xyz.fycz.myreader.ui.dialog.AudioPlayerDialog; 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.DialogCreator;
import xyz.fycz.myreader.ui.dialog.MyAlertDialog;
import xyz.fycz.myreader.ui.dialog.ReplaceDialog; import xyz.fycz.myreader.ui.dialog.ReplaceDialog;
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog; import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
import xyz.fycz.myreader.ui.popmenu.AutoPageMenu; import xyz.fycz.myreader.ui.popmenu.AutoPageMenu;
@ -759,7 +759,8 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
Intent ruleIntent = new Intent(this, ReplaceRuleActivity.class); Intent ruleIntent = new Intent(this, ReplaceRuleActivity.class);
startActivityForResult(ruleIntent, APPCONST.REQUEST_REFRESH_READ_UI); startActivityForResult(ruleIntent, APPCONST.REQUEST_REFRESH_READ_UI);
} else if (itemId == R.id.action_copy_content) { } 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) { } else if (itemId == R.id.action_open_link) {
Uri uri = Uri.parse(NetworkUtils.getAbsoluteURL(mReadCrawler.getNameSpace(), mBook.getChapterUrl())); Uri uri = Uri.parse(NetworkUtils.getAbsoluteURL(mReadCrawler.getNameSpace(), mBook.getChapterUrl()));
Intent intent = new Intent(Intent.ACTION_VIEW, uri); 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("知道了"); }).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) { public static void showPrivacyDialog(Context context, DialogInterface.OnClickListener pos, DialogInterface.OnClickListener neg) {
TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.dialog_textview, null); TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.dialog_textview, null);
String msg = context.getString(R.string.privacy_tip); String msg = context.getString(R.string.privacy_tip);

@ -2017,7 +2017,7 @@ public abstract class PageLoader {
* @param page 开始页数 * @param page 开始页数
* @return 从page页开始的的当前章节所有内容 * @return 从page页开始的的当前章节所有内容
*/ */
private String getContentStartPage(int page) { public String getContentStartPage(int page) {
if (mCurChapter == null) return null; if (mCurChapter == null) return null;
if (mCurChapter.getTxtPageList().isEmpty()) return null; if (mCurChapter.getTxtPageList().isEmpty()) return null;
StringBuilder s = new StringBuilder(); 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