version:
update:增加弹窗删除,优化动态权限提示 fix bug:
1
.gitignore
vendored
@@ -17,3 +17,4 @@
|
||||
/app/src/test/java/com/uiui/videoplayer/
|
||||
/app/src/androidTest/java/com/uiui/videoplayer/
|
||||
/library/build/
|
||||
/JZVideo/build/
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".activity.PlayActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:screenOrientation="sensor" />
|
||||
<activity android:name=".activity.MainActivity">
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
package com.uiui.videoplayer.activity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -29,13 +18,23 @@ import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.uiui.videoplayer.R;
|
||||
import com.uiui.videoplayer.adapter.VideoAdapter;
|
||||
import com.uiui.videoplayer.base.CustomDialog;
|
||||
import com.uiui.videoplayer.base.RecycleGridLayoutManager;
|
||||
import com.uiui.videoplayer.base.SpacesItemDecoration;
|
||||
import com.uiui.videoplayer.adapter.VideoAdapter;
|
||||
import com.uiui.videoplayer.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -64,8 +63,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
// String rootPath = Environment.getExternalStorageDirectory().getPath() + File.separator;
|
||||
// traverseFolder(rootPath);
|
||||
|
||||
ScanTask scanTask = new ScanTask();
|
||||
scanTask.execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,9 +118,50 @@ public class MainActivity extends AppCompatActivity {
|
||||
getResources().getDimensionPixelSize(R.dimen.PX1x), getResources().getDimensionPixelSize(R.dimen.PX1x)));
|
||||
((DefaultItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
|
||||
adapter = new VideoAdapter(MainActivity.this);
|
||||
adapter.setOnLongClickListener(new VideoAdapter.onItemLongClickListener() {
|
||||
@Override
|
||||
public void onItemLongClick(String path, int position) {
|
||||
showDialog(path, position);
|
||||
}
|
||||
});
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private void showDialog(String path, int position) {
|
||||
CustomDialog dialog = new CustomDialog(MainActivity.this);
|
||||
dialog.setTitle("删除文件")
|
||||
.setMessage("确定要删除文件 " + getFileName(path) + "吗")
|
||||
.setPositive("确定")
|
||||
.setNegtive("取消")
|
||||
// .setSingle(true)
|
||||
.setOnClickBottomListener(new CustomDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
dialog.dismiss();
|
||||
File file = new File(path);
|
||||
if (file.delete()) {
|
||||
adapter.removeItem(position);
|
||||
ToastUtil.show("删除成功");
|
||||
} else {
|
||||
ToastUtil.show("删除失败,检查权限是否开启");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
// dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private String getFileName(String path) {
|
||||
String name = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."));
|
||||
Log.e("getFileName", "Name: " + name);
|
||||
return name;
|
||||
}
|
||||
|
||||
private void initActionBar() {
|
||||
setToolbarCustomTheme();
|
||||
//显示返回按钮
|
||||
@@ -277,6 +321,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
for (String s : permissions) {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
|
||||
mPermissionList.add(s);
|
||||
}else {
|
||||
ScanTask scanTask = new ScanTask();
|
||||
scanTask.execute();
|
||||
}
|
||||
}
|
||||
if (mPermissionList.size() > 0) {//有权限没有通过,需要申请
|
||||
@@ -291,13 +338,26 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (requestCode == REQUEST_PERMISSION_CODE) {
|
||||
//当然权限多了,建议使用Switch,不必纠结于此
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
ScanTask scanTask = new ScanTask();
|
||||
scanTask.execute();
|
||||
} else if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
|
||||
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)){
|
||||
ToastUtil.show("需要存储空间权限才能正常使用软件");
|
||||
checkSelfPermission();
|
||||
}else {
|
||||
ToastUtil.show("请打开存储空间权限后使用软件");
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + this.getPackageName()));
|
||||
startActivity(intent);
|
||||
}
|
||||
refreshLayout.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
|
||||
@@ -49,7 +49,7 @@ import wseemann.media.FFmpegMediaMetadataRetriever;
|
||||
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder> {
|
||||
private Context mContext;
|
||||
private List<String> videoPath;
|
||||
|
||||
private onItemLongClickListener onItemLongClickListener;
|
||||
|
||||
public VideoAdapter() {
|
||||
|
||||
@@ -74,6 +74,10 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnLongClickListener(onItemLongClickListener listener) {
|
||||
this.onItemLongClickListener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public VideoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
@@ -155,6 +159,21 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.root.setOnLongClickListener(view -> {
|
||||
onItemLongClickListener.onItemLongClick(path, position);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public interface onItemLongClickListener {
|
||||
void onItemLongClick(String path, int position);
|
||||
}
|
||||
|
||||
public void removeItem(int position) {
|
||||
if (null != videoPath.get(position)) {
|
||||
videoPath.remove(position);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
259
app/src/main/java/com/uiui/videoplayer/base/CustomDialog.java
Normal file
@@ -0,0 +1,259 @@
|
||||
package com.uiui.videoplayer.base;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.uiui.videoplayer.R;
|
||||
import com.uiui.videoplayer.activity.MainActivity;
|
||||
|
||||
|
||||
/**
|
||||
* description:自定义dialog
|
||||
*/
|
||||
|
||||
public class CustomDialog extends Dialog {
|
||||
/**
|
||||
* 显示的图片
|
||||
*/
|
||||
private ImageView imageIv;
|
||||
|
||||
/**
|
||||
* 显示的标题
|
||||
*/
|
||||
private TextView titleTv;
|
||||
|
||||
/**
|
||||
* 显示的消息
|
||||
*/
|
||||
private TextView messageTv;
|
||||
|
||||
/**
|
||||
* 确认和取消按钮
|
||||
*/
|
||||
private Button negtiveBn, positiveBn;
|
||||
|
||||
/**
|
||||
* 按钮之间的分割线
|
||||
*/
|
||||
private View columnLineView;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public CustomDialog(Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 都是内容数据
|
||||
*/
|
||||
private String message;
|
||||
private String title;
|
||||
private String positive, negtive;
|
||||
private int imageResId = -1;
|
||||
|
||||
/**
|
||||
* 底部是否只有一个按钮
|
||||
*/
|
||||
private boolean isSingle = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.custom_dialog);
|
||||
//按空白处不能取消动画
|
||||
setCanceledOnTouchOutside(false);
|
||||
//初始化界面控件
|
||||
initView();
|
||||
//初始化界面数据
|
||||
refreshView();
|
||||
//初始化界面控件的事件
|
||||
initEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面的确定和取消监听器
|
||||
*/
|
||||
private void initEvent() {
|
||||
//设置确定按钮被点击后,向外界提供监听
|
||||
positiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onPositiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
//设置取消按钮被点击后,向外界提供监听
|
||||
negtiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onNegtiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件的显示数据
|
||||
*/
|
||||
private void refreshView() {
|
||||
//如果用户自定了title和message
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTv.setText(title);
|
||||
titleTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
titleTv.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(message)) {
|
||||
messageTv.setText(message);
|
||||
}
|
||||
//如果设置按钮的文字
|
||||
if (!TextUtils.isEmpty(positive)) {
|
||||
positiveBn.setText(positive);
|
||||
} else {
|
||||
positiveBn.setText("确定");
|
||||
}
|
||||
if (!TextUtils.isEmpty(negtive)) {
|
||||
negtiveBn.setText(negtive);
|
||||
} else {
|
||||
negtiveBn.setText("取消");
|
||||
}
|
||||
|
||||
if (imageResId != -1) {
|
||||
imageIv.setImageResource(imageResId);
|
||||
imageIv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageIv.setVisibility(View.GONE);
|
||||
}
|
||||
/**
|
||||
* 只显示一个按钮的时候隐藏取消按钮,回掉只执行确定的事件
|
||||
*/
|
||||
if (isSingle) {
|
||||
// columnLineView.setVisibility(View.GONE);
|
||||
negtiveBn.setVisibility(View.GONE);
|
||||
} else {
|
||||
// columnLineView.setVisibility(View.VISIBLE);
|
||||
negtiveBn.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
refreshView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件
|
||||
*/
|
||||
private void initView() {
|
||||
negtiveBn = findViewById(R.id.negtive);
|
||||
positiveBn = findViewById(R.id.positive);
|
||||
titleTv = findViewById(R.id.title);
|
||||
messageTv = findViewById(R.id.message);
|
||||
imageIv = findViewById(R.id.image);
|
||||
columnLineView = findViewById(R.id.column_line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置确定取消按钮的回调
|
||||
*/
|
||||
public OnClickBottomListener onClickBottomListener;
|
||||
|
||||
public CustomDialog setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
|
||||
this.onClickBottomListener = onClickBottomListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnClickBottomListener {
|
||||
/**
|
||||
* 点击确定按钮事件
|
||||
*/
|
||||
void onPositiveClick();
|
||||
|
||||
/**
|
||||
* 点击取消按钮事件
|
||||
*/
|
||||
void onNegtiveClick();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public CustomDialog setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CustomDialog setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPositive() {
|
||||
return positive;
|
||||
}
|
||||
|
||||
public CustomDialog setPositive(String positive) {
|
||||
this.positive = positive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNegtive() {
|
||||
return negtive;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtive(String negtive) {
|
||||
this.negtive = negtive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtiveText(String negtive) {
|
||||
negtiveBn.setText(negtive);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getImageResId() {
|
||||
return imageResId;
|
||||
}
|
||||
|
||||
public boolean isSingle() {
|
||||
return isSingle;
|
||||
}
|
||||
|
||||
public CustomDialog setSingle(boolean single) {
|
||||
isSingle = single;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setImageResId(int imageResId) {
|
||||
this.imageResId = imageResId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
Intent intent = new Intent(mContext, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class ToastUtil {
|
||||
time2 = System.currentTimeMillis();
|
||||
if ((time2 - time1) > 3499) {
|
||||
showToast(mContext, msg, Toast.LENGTH_LONG);
|
||||
Log.e("fht", "LENGTH_LONG");
|
||||
// Log.e("fht", "LENGTH_LONG");
|
||||
time1 = time2;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 799 B |
9
app/src/main/res/drawable/bg_dialog.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/bt_cancel_normnl.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid
|
||||
android:color="@color/btn_cancel" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/Btn_Radius"
|
||||
android:topRightRadius="@dimen/Btn_Radius"
|
||||
android:bottomLeftRadius="@dimen/Btn_Radius"
|
||||
android:bottomRightRadius="@dimen/Btn_Radius" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/bt_cancel_pressed.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid
|
||||
android:color="@color/btn_cancel_pressed" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/Btn_Radius"
|
||||
android:topRightRadius="@dimen/Btn_Radius"
|
||||
android:bottomLeftRadius="@dimen/Btn_Radius"
|
||||
android:bottomRightRadius="@dimen/Btn_Radius" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/bt_cancel_selector.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 没有焦点时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_cancel_normnl" android:state_window_focused="false" />
|
||||
<!-- 非触摸模式下获得焦点并单击时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_cancel_normnl" android:state_focused="true" android:state_pressed="true" />
|
||||
<!-- 触摸模式下单击时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_cancel_pressed" android:state_focused="false" android:state_pressed="true" />
|
||||
<!-- 选中时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_cancel_normnl" android:state_selected="true" />
|
||||
<!-- 获得焦点时的背景 颜色 -->
|
||||
<item android:drawable="@drawable/bt_cancel_normnl" android:state_focused="true" />
|
||||
</selector>
|
||||
13
app/src/main/res/drawable/bt_sure_normnl.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid
|
||||
android:color="@color/btn_sure" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/Btn_Radius"
|
||||
android:topRightRadius="@dimen/Btn_Radius"
|
||||
android:bottomLeftRadius="@dimen/Btn_Radius"
|
||||
android:bottomRightRadius="@dimen/Btn_Radius" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/bt_sure_pressed.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid
|
||||
android:color="@color/btn_sure" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/Btn_Radius"
|
||||
android:topRightRadius="@dimen/Btn_Radius"
|
||||
android:bottomLeftRadius="@dimen/Btn_Radius"
|
||||
android:bottomRightRadius="@dimen/Btn_Radius" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/bt_sure_selector.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 没有焦点时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_sure_normnl" android:state_window_focused="false" />
|
||||
<!-- 非触摸模式下获得焦点并单击时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_sure_normnl" android:state_focused="true" android:state_pressed="true" />
|
||||
<!-- 触摸模式下单击时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_sure_pressed" android:state_focused="false" android:state_pressed="true" />
|
||||
<!-- 选中时的背景颜色 -->
|
||||
<item android:drawable="@drawable/bt_sure_normnl" android:state_selected="true" />
|
||||
<!-- 获得焦点时的背景 颜色 -->
|
||||
<item android:drawable="@drawable/bt_sure_normnl" android:state_focused="true" />
|
||||
</selector>
|
||||
126
app/src/main/res/layout-land/custom_dialog.xml
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="350dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:minWidth="260dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="16dp"
|
||||
android:maxWidth="80dp"
|
||||
android:maxHeight="80dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/defaultColor"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
tools:text="消息提示" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center|left"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textColor="#999999"
|
||||
android:textSize="17sp"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="#E4E4E4"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="48dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bt_sure_selector"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="Yes" />
|
||||
|
||||
<View
|
||||
android:id="@+id/column_line"
|
||||
android:layout_width="1px"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#E4E4E4"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/negtive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bt_cancel_selector"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="No" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
126
app/src/main/res/layout-port/custom_dialog.xml
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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="400dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:minWidth="260dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="16dp"
|
||||
android:maxWidth="80dp"
|
||||
android:maxHeight="80dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/defaultColor"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
tools:text="消息提示" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="center|left"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textColor="#999999"
|
||||
android:textSize="17sp"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="#E4E4E4"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="48dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bt_sure_selector"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="Yes" />
|
||||
|
||||
<View
|
||||
android:id="@+id/column_line"
|
||||
android:layout_width="1px"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#E4E4E4"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/negtive"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bt_cancel_selector"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="No" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -6,4 +6,9 @@
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="defaultColor">#333333</color>
|
||||
<color name="btn_sure">#4880ff</color>
|
||||
<color name="btn_sure_pressed">#1E63FF</color>
|
||||
<color name="btn_cancel">#d0d0d0</color>
|
||||
<color name="btn_cancel_pressed">#9F9F9F</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<dimen name="PX0x">0dp</dimen>
|
||||
<dimen name="PX1x">1dp</dimen>
|
||||
<dimen name="PX5x">5dp</dimen>
|
||||
<dimen name="Btn_Radius">40dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">快易播放器</string>
|
||||
<string name="app_name">Ao播放器</string>
|
||||
</resources>
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
<item name="colorAccent">@color/defaultColor</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="CustomDialog" parent="android:style/Theme.Dialog">
|
||||
<!--背景颜色及和透明程度-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--是否去除标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--是否去除边框-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否模糊-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
rootProject.name='快易播放器'
|
||||
rootProject.name='Ao播放器'
|
||||
include ':app', ':JZVideo', ':niceimageview'
|
||||
|
||||