2.再次思考完成解压需要做的事情 点击文件,有个按钮直接检测md5值在数据库中有没有数据,有的话填充密码框,密码框可勾选是否明文,还有一个选项是是否上传当前文件的密码,有密码指定目的路径点击解压按钮就可以直接解压 3.改了APP主题 4.添加了一个解压用的dialog,但是要给dialog传入bundle数据不知道从何下手master
parent
3f421d1d69
commit
8fde82cffd
@ -0,0 +1,48 @@
|
|||||||
|
package com.thankvinci.CloudKey.Fragment;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
import com.thankvinci.CloudKey.R;
|
||||||
|
|
||||||
|
public class UnzipDialogFragment extends DialogFragment {
|
||||||
|
//点击压缩文件弹出来的Dialog
|
||||||
|
private UnzipDialogListener listener;
|
||||||
|
//源文件绝对路径,目标文件夹绝对路径和密码
|
||||||
|
private EditText srcFile_edit;
|
||||||
|
private EditText desPath_edit;
|
||||||
|
private EditText passwd_edit;
|
||||||
|
|
||||||
|
public interface UnzipDialogListener{
|
||||||
|
public void onDialogUnzipClicked();
|
||||||
|
}
|
||||||
|
public void setListener(UnzipDialogListener listener){
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
public AlertDialog onCreateDialog(Bundle bundle){
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||||
|
View view = inflater.inflate(R.layout.unzip_dialog,null);
|
||||||
|
srcFile_edit = view.findViewById(R.id.src_edit);
|
||||||
|
desPath_edit = view.findViewById(R.id.des_edit);
|
||||||
|
builder.setView(view).setTitle("解压到当前路径").setPositiveButton("解压", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
listener.onDialogUnzipClicked();
|
||||||
|
}
|
||||||
|
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Toast.makeText(getActivity(),"取消操作",Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});;
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="false" android:color="@color/blue_1"/>
|
||||||
|
<item android:state_pressed="true" android:color="@color/grey"/>
|
||||||
|
</selector>
|
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/src_text"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:text="源文件名:"
|
||||||
|
android:textColor="@color/blue_1"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
<EditText
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:id="@+id/src_edit"
|
||||||
|
android:textColor="@color/grey"
|
||||||
|
android:focusable="false"
|
||||||
|
tools:ignore="MissingConstraints"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/src_text"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/src_text"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/des_text"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:text="目标地址:"
|
||||||
|
android:textColor="@color/blue_1"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/src_text"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
<EditText
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:id="@+id/des_edit"
|
||||||
|
android:textColor="@color/grey"
|
||||||
|
android:focusable="false"
|
||||||
|
tools:ignore="MissingConstraints"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/des_text"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/des_text"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/pwd_text"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:text="文件密码:"
|
||||||
|
android:textColor="@color/blue_1"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/des_text"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
<EditText
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14dp"
|
||||||
|
android:id="@+id/pwd_edit"
|
||||||
|
android:textColor="@color/grey"
|
||||||
|
android:focusable="false"
|
||||||
|
tools:ignore="MissingConstraints"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/pwd_text"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/pwd_text"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
/>
|
||||||
|
<CheckBox
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/accept_pwd_2_sql"
|
||||||
|
android:text="同意将密码同步到数据库"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pwd_edit"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/getpwd"
|
||||||
|
android:text="获取密码"
|
||||||
|
android:clickable="true"
|
||||||
|
android:textColor="@drawable/text_be_clicked"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/accept_pwd_2_sql"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/accept_pwd_2_sql"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,16 +1,17 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.CloudKey" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.CloudKey" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color.
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
<item name="colorOnPrimary">@color/black</item>-->
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color.
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>-->
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color.
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>-->
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorAccent">@color/blue_1</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
@ -1,16 +1,17 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.CloudKey" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.CloudKey" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color.
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>-->
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color.
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>-->
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color.
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>-->
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorAccent">@color/blue_1</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in new issue