mirror of https://github.com/FongMi/TV.git
parent
8f3c707ade
commit
827311f554
@ -0,0 +1,44 @@ |
||||
package com.fongmi.android.tv.ui.dialog; |
||||
|
||||
import android.content.DialogInterface; |
||||
import android.view.View; |
||||
import android.view.WindowManager; |
||||
|
||||
import androidx.appcompat.app.AlertDialog; |
||||
|
||||
import com.fongmi.android.tv.App; |
||||
import com.fongmi.android.tv.utils.ResUtil; |
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder; |
||||
|
||||
public class WebDialog { |
||||
|
||||
private final AlertDialog dialog; |
||||
|
||||
public static WebDialog create(View view) { |
||||
return new WebDialog(view); |
||||
} |
||||
|
||||
public WebDialog(View view) { |
||||
this.dialog = new MaterialAlertDialogBuilder(App.activity()).setView(view).create(); |
||||
this.dialog.setOnDismissListener((DialogInterface.OnDismissListener) view); |
||||
} |
||||
|
||||
public WebDialog show() { |
||||
initDialog(); |
||||
return this; |
||||
} |
||||
|
||||
public void dismiss() { |
||||
dialog.setOnDismissListener(null); |
||||
dialog.dismiss(); |
||||
} |
||||
|
||||
private void initDialog() { |
||||
WindowManager.LayoutParams params = dialog.getWindow().getAttributes(); |
||||
params.height = (int) (ResUtil.getScreenHeight() * 0.8f); |
||||
params.width = (int) (ResUtil.getScreenWidth() * 0.8f); |
||||
dialog.getWindow().setAttributes(params); |
||||
dialog.getWindow().setDimAmount(0); |
||||
dialog.show(); |
||||
} |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
package com.fongmi.android.tv.ui.dialog; |
||||
|
||||
import android.content.DialogInterface; |
||||
import android.view.View; |
||||
|
||||
import androidx.appcompat.app.AlertDialog; |
||||
|
||||
import com.fongmi.android.tv.App; |
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder; |
||||
|
||||
public class WebDialog { |
||||
|
||||
private final AlertDialog dialog; |
||||
|
||||
public static WebDialog create(View view) { |
||||
return new WebDialog(view); |
||||
} |
||||
|
||||
public WebDialog(View view) { |
||||
this.dialog = new MaterialAlertDialogBuilder(App.activity()).setView(view).create(); |
||||
this.dialog.setOnDismissListener((DialogInterface.OnDismissListener) view); |
||||
} |
||||
|
||||
public WebDialog show() { |
||||
initDialog(); |
||||
return this; |
||||
} |
||||
|
||||
public void dismiss() { |
||||
dialog.setOnDismissListener(null); |
||||
dialog.dismiss(); |
||||
} |
||||
|
||||
private void initDialog() { |
||||
dialog.getWindow().setDimAmount(0); |
||||
dialog.show(); |
||||
} |
||||
} |
||||
@ -1 +1,11 @@ |
||||
<manifest package="com.ghost.thunder" /> |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
package="com.ghost.thunder"> |
||||
|
||||
<application> |
||||
|
||||
<meta-data |
||||
android:name="com.xunlei.download.APP_KEY" |
||||
android:value="bpIzNjAxNTsxNTA0MDk0ODg4LjQyODAwMA&&OxNw==21^5e1c1b6a73^c76f3^cd3c0e331d164^ed3c62==2974DD65D2^39222^5954C5914A8267D" /> |
||||
|
||||
</application> |
||||
</manifest> |
||||
|
||||
Loading…
Reference in new issue