Merge branch 'master' of https://github.com/fengyuecanzhu/FYReader into master
commit
f41041c58e
@ -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); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -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…
Reference in new issue