Skip to content

Commit

Permalink
修改ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ouhuang004 committed Jan 6, 2021
1 parent 9c20275 commit d5bc491
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.kulya.lanzou"
minSdkVersion 19
targetSdkVersion 30
versionCode 5
versionName "2.0"
versionCode 6
versionName "2.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":5,"versionName":"2.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":6,"versionName":"2.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
9 changes: 4 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!-- 网络访问权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 网络访问权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".util.Myapplication"
Expand All @@ -17,14 +17,13 @@

<activity
android:name=".MainActivity"
android:theme="@style/ChenJin"
/>
android:theme="@style/ChenJin" />
<activity
android:name=".LoginActivity"
android:theme="@style/NoTitle"
>
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
43 changes: 29 additions & 14 deletions app/src/main/java/com/kulya/lanzou/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import android.view.View;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.kulya.lanzou.http.HttpWorker;
import com.kulya.lanzou.listview.FileItem;
Expand All @@ -37,6 +36,7 @@
import java.util.List;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
Expand All @@ -49,7 +49,7 @@

import static android.widget.Toast.LENGTH_SHORT;

public class MainActivity extends baseactivity implements SwipeRefreshLayout.OnRefreshListener {
public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {
@BindView(R.id.topbar)
Toolbar topbar;
@BindView(R.id.fileList)
Expand Down Expand Up @@ -179,9 +179,8 @@ public void onClick(QMUIDialog dialog, int index) {
private void initView() {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
fileListView.setLayoutManager(linearLayoutManager);
adapter = new FileListAdapter( fileList);
adapter = new FileListAdapter(fileList);
adapter.setOnItemClickListener2(new itemOnClick());
//adapter.setAnimationEnable(true);
fileListView.setAdapter(adapter);
swipeRefreshLayout.setOnRefreshListener(this);
setSupportActionBar(topbar);
Expand Down Expand Up @@ -209,17 +208,29 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUESTCODE_FROM_ACTIVITY) {
fileProgress.setVisibility(View.VISIBLE);
allProgress.setVisibility(View.VISIBLE);
fileProgress.setProgress(0,false);
allProgress.setProgress(0,false);
fileProgress.setQMUIProgressBarTextGenerator(new QMUIProgressBar.QMUIProgressBarTextGenerator() {
@Override
public String generateText(QMUIProgressBar progressBar, int value, int maxValue) {
return value + "/" + maxValue;
}
});
allProgress.setQMUIProgressBarTextGenerator(new QMUIProgressBar.QMUIProgressBarTextGenerator() {
@Override
public String generateText(QMUIProgressBar progressBar, int value, int maxValue) {
return value + "/" + maxValue;
}
});
fileProgress.setProgress(0, false);
allProgress.setProgress(0, false);
List<String> list = data.getStringArrayListExtra("paths");
String ss[] = history.get(history.size() - 1).split("=");
String folder_id = ss[ss.length - 1];
int filecount = list.size();
allProgress.setMaxValue(filecount);
int fileCount = list.size();
allProgress.setMaxValue(fileCount);
HttpWorker.sendFiles(list, folder_id, new HttpWorker.UpLoadCallbackListener() {
@Override
public void onError(int count) {
fileProgress.setProgress(0,false);
fileProgress.setProgress(0, false);

}

Expand All @@ -230,8 +241,13 @@ public void Progress(double progress) {

@Override
public void onFinish(int count) {
allProgress.setProgress(count+1);
fileProgress.setProgress(0,false);
allProgress.setProgress(count + 1);
fileProgress.setProgress(0, false);
RefreshPage();
if (count >= fileCount - 1) {
fileProgress.setVisibility(View.GONE);
allProgress.setVisibility(View.GONE);
}
}
});
}
Expand Down Expand Up @@ -268,7 +284,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
//listitem点击事件,打开文件夹,唤起详情页
class itemOnClick implements FileListAdapter.OnClickListener {
@Override
public void onItemClick( View view, int position) {
public void onItemClick(View view, int position) {
final FileItem fileItem = fileList.get(position);
if (fileItem.getFileORHolder() == FileItem.ISHOLDER) {
openPage(fileItem.getId());
Expand Down Expand Up @@ -306,7 +322,7 @@ public void onClick(QMUIBottomSheet dialog, View itemView, int position, String
}

@Override
public boolean onItemLongClick( View view, int position) {
public boolean onItemLongClick(View view, int position) {
return false;
}
}
Expand Down Expand Up @@ -419,5 +435,4 @@ public void onFinish() {
}
});
}

}
1 change: 0 additions & 1 deletion app/src/main/java/com/kulya/lanzou/http/HttpWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class HttpWorker {
private static final MediaType FROM_DATA = MediaType.parse("multipart/form-data");

private HttpWorker() {

}

private static HttpWorker getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.listener.OnItemLongClickListener;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import com.kulya.lanzou.R;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;


import java.util.ArrayList;
import java.util.List;
Expand Down
21 changes: 14 additions & 7 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"

xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="match_parent">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
Expand All @@ -23,17 +23,24 @@
android:fitsSystemWindows="true" />

<com.qmuiteam.qmui.widget.QMUIProgressBar
android:visibility="gone"
android:id="@+id/fileProgress"
app:qmui_max_value="100"
android:layout_width="match_parent"
android:layout_height="20dp" />
android:layout_height="20dp"
android:textSize="14dp"
android:visibility="gone"
app:qmui_background_color="@color/windowColor"
app:qmui_max_value="100"
app:qmui_progress_color="@color/colorPrimary"
app:qmui_stroke_width="2dp" />

<com.qmuiteam.qmui.widget.QMUIProgressBar
android:visibility="gone"
android:id="@+id/allProgress"
android:layout_width="match_parent"
android:layout_height="20dp" />
android:layout_height="20dp"
android:textSize="14dp"
app:qmui_background_color="@color/windowColor"
app:qmui_progress_color="@color/colorPrimary"
android:visibility="gone" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fileList"
Expand Down

0 comments on commit d5bc491

Please sign in to comment.