Commit 5286988ea65f2fd476495c67f4649f048984f67f
1 parent
bc6fd306
云盘上传下载提交
Showing
12 changed files
with
175 additions
and
65 deletions
updownfile/libs/mylib.jar
No preview for this file type
updownfile/src/main/java/com/cnlive/updownfile/util/EnterFile.java
| ... | ... | @@ -6,7 +6,6 @@ import android.content.Intent; |
| 6 | 6 | import com.cnlive.media.picker.ImagePicker; |
| 7 | 7 | import com.cnlive.media.picker.PickerConfig; |
| 8 | 8 | import com.cnlive.media.picker.entity.Media; |
| 9 | -import com.cnlive.updownfile.xiaoRay.Constant; | |
| 10 | 9 | |
| 11 | 10 | import java.util.ArrayList; |
| 12 | 11 | ... | ... |
updownfile/src/main/java/com/cnlive/updownfile/util/ZipUtil.java
| ... | ... | @@ -15,9 +15,19 @@ import com.cnlive.updownfile.xiaoRay.view.MD5; |
| 15 | 15 | import com.qiniu.pili.droid.shortvideo.PLShortVideoTranscoder; |
| 16 | 16 | import com.qiniu.pili.droid.shortvideo.PLVideoSaveListener; |
| 17 | 17 | |
| 18 | +import java.io.BufferedInputStream; | |
| 19 | +import java.io.BufferedOutputStream; | |
| 18 | 20 | import java.io.File; |
| 21 | +import java.io.FileOutputStream; | |
| 22 | +import java.io.IOException; | |
| 23 | +import java.io.InputStream; | |
| 24 | +import java.io.OutputStream; | |
| 25 | +import java.io.UnsupportedEncodingException; | |
| 19 | 26 | import java.util.ArrayList; |
| 27 | +import java.util.Enumeration; | |
| 20 | 28 | import java.util.List; |
| 29 | +import java.util.zip.ZipEntry; | |
| 30 | +import java.util.zip.ZipFile; | |
| 21 | 31 | |
| 22 | 32 | import io.reactivex.disposables.Disposable; |
| 23 | 33 | import top.zibin.luban.CompressionPredicate; |
| ... | ... | @@ -220,4 +230,107 @@ public class ZipUtil { |
| 220 | 230 | 4000 * 1000, |
| 221 | 231 | 8000 * 1000, |
| 222 | 232 | }; |
| 233 | + | |
| 234 | + /** | |
| 235 | + * 解压缩功能. | |
| 236 | + * 将zipFile文件解压到folderPath目录下. | |
| 237 | + * | |
| 238 | + * @throws Exception | |
| 239 | + */ | |
| 240 | + public static void upZipFile(File zipFile, String folderPath, String url, Context context) throws IOException { | |
| 241 | + File dirFile = new File(folderPath); | |
| 242 | + if (!dirFile.exists()) { | |
| 243 | + dirFile.mkdir(); | |
| 244 | + } | |
| 245 | + ZipFile zfile = new ZipFile(zipFile); | |
| 246 | + Enumeration zList = zfile.entries(); | |
| 247 | + ZipEntry ze = null; | |
| 248 | + byte[] buf = new byte[1024]; | |
| 249 | + while (zList.hasMoreElements()) { | |
| 250 | + ze = (ZipEntry) zList.nextElement(); | |
| 251 | + if (ze.isDirectory()) { | |
| 252 | + String dirstr = folderPath + ze.getName(); | |
| 253 | + dirstr = new String(dirstr.getBytes("8859_1"), "GB2312"); | |
| 254 | + File tmpFile = new File(dirstr); | |
| 255 | + continue; | |
| 256 | + } | |
| 257 | + File file = getRealFileName(folderPath, ze.getName()); | |
| 258 | + if (file.exists()) { | |
| 259 | + continue; | |
| 260 | + } | |
| 261 | + OutputStream os = new BufferedOutputStream(new FileOutputStream(getRealFileName(folderPath, ze.getName()))); | |
| 262 | + InputStream is = new BufferedInputStream(zfile.getInputStream(ze)); | |
| 263 | + int readLen = 0; | |
| 264 | + while ((readLen = is.read(buf, 0, 1024)) != -1) { | |
| 265 | + os.write(buf, 0, readLen); | |
| 266 | + } | |
| 267 | + is.close(); | |
| 268 | + os.close(); | |
| 269 | + } | |
| 270 | + zfile.close(); | |
| 271 | + //下载成功后,把文件名当作key,保存 | |
| 272 | +// Hawk.put(zipFile.getName(),"1"); | |
| 273 | + //解压完之后 删除压缩包 | |
| 274 | + deleteDir(zipFile); | |
| 275 | + } | |
| 276 | + | |
| 277 | + /** | |
| 278 | + * 给定根目录,返回一个相对路径所对应的实际文件名. | |
| 279 | + * | |
| 280 | + * @param baseDir 指定根目录 | |
| 281 | + * @param absFileName 相对路径名,来自于ZipEntry中的name | |
| 282 | + * @return java.io.File 实际的文件 | |
| 283 | + */ | |
| 284 | + public static File getRealFileName(String baseDir, String absFileName) { | |
| 285 | + String[] dirs = absFileName.split("/"); | |
| 286 | + File ret = new File(baseDir); | |
| 287 | + String substr = null; | |
| 288 | + if (dirs.length > 1) { | |
| 289 | + for (int i = 0; i < dirs.length - 1; i++) { | |
| 290 | + substr = dirs[i]; | |
| 291 | + try { | |
| 292 | + substr = new String(substr.getBytes("8859_1"), "GB2312"); | |
| 293 | + } catch (UnsupportedEncodingException e) { | |
| 294 | + e.printStackTrace(); | |
| 295 | + } | |
| 296 | + ret = new File(ret, substr); | |
| 297 | + } | |
| 298 | + if (!ret.exists()) { | |
| 299 | + ret.mkdirs(); | |
| 300 | + } | |
| 301 | + substr = dirs[dirs.length - 1]; | |
| 302 | + try { | |
| 303 | + substr = new String(substr.getBytes("8859_1"), "GB2312"); | |
| 304 | + } catch (UnsupportedEncodingException e) { | |
| 305 | + e.printStackTrace(); | |
| 306 | + } | |
| 307 | + | |
| 308 | + ret = new File(ret, substr); | |
| 309 | + return ret; | |
| 310 | + } | |
| 311 | + return ret; | |
| 312 | + } | |
| 313 | + | |
| 314 | + | |
| 315 | + /** | |
| 316 | + * 删除整个文件夹 或者文件 | |
| 317 | + * | |
| 318 | + * @param file | |
| 319 | + */ | |
| 320 | + public static void deleteDir(File file) { | |
| 321 | + if (!file.exists()) { | |
| 322 | + return; | |
| 323 | + } | |
| 324 | + if (file.isDirectory()) { | |
| 325 | + File[] childFiles = file.listFiles(); | |
| 326 | + if (childFiles == null || childFiles.length == 0) { | |
| 327 | + file.delete(); | |
| 328 | + } | |
| 329 | + | |
| 330 | + for (int index = 0; index < childFiles.length; index++) { | |
| 331 | + deleteDir(childFiles[index]); | |
| 332 | + } | |
| 333 | + } | |
| 334 | + file.delete(); | |
| 335 | + } | |
| 223 | 336 | } | ... | ... |
updownfile/src/main/java/com/cnlive/updownfile/xiaoRay/Constant.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.updownfile.xiaoRay; |
| 2 | 2 | |
| 3 | 3 | import android.app.ProgressDialog; |
| 4 | 4 | import android.content.Context; |
| 5 | +import android.widget.TextView; | |
| 5 | 6 | import android.widget.Toast; |
| 6 | 7 | |
| 7 | 8 | import com.xiaoray.raysdk.RayLib; |
| ... | ... | @@ -9,15 +10,15 @@ import com.xiaoray.raysdk.listener.ConnectCloudListener; |
| 9 | 10 | import com.xiaoray.raysdk.utils.OkHttpUtils.CloudRequest; |
| 10 | 11 | |
| 11 | 12 | public class Constant { |
| 12 | - //聊天页面视频文件最大19.5M(腾讯短视频最大20M,存在问题) | |
| 13 | - public static final int MEDIA_MAX_SIZE = 19 * 1024 * 1024 + 512 * 1024; | |
| 14 | - //聊天页面图片文件最大20M | |
| 15 | - public static final int IMAGE_MAX_SIZE = 20 * 1024 * 1024; | |
| 13 | + //聊天页面视频文件最大19.5M(腾讯短视频最大20M,存在问题)19 * 1024 * 1024 + 512 * 1024; | |
| 14 | + public static final int MEDIA_MAX_SIZE = 19 * 1024 * 10240 + 512 * 10240; | |
| 15 | + //聊天页面图片文件最大200M | |
| 16 | + public static final int IMAGE_MAX_SIZE = 20 * 1024 * 10240; | |
| 16 | 17 | //聊天页面文件最大28M |
| 17 | 18 | public static final int FILE_MAX_SIZE = 28 * 1024 * 1024; |
| 18 | 19 | public static ProgressDialog waitingDialog; |
| 19 | 20 | |
| 20 | - public static void initXiaoRay(Context context, String mac, String u_id, String code, String term_id) { | |
| 21 | + public static void initXiaoRay(Context context, String mac, String u_id, String code, String term_id, TextView restle) { | |
| 21 | 22 | if(waitingDialog == null){ |
| 22 | 23 | RayLib.init(context); |
| 23 | 24 | waitingDialog = new ProgressDialog(context); |
| ... | ... | @@ -31,14 +32,16 @@ public class Constant { |
| 31 | 32 | @Override |
| 32 | 33 | public void connectSuc() { |
| 33 | 34 | if(waitingDialog.isShowing())waitingDialog.dismiss(); |
| 34 | - Toast.makeText(context, "连接设备成功,IP:" + CloudRequest.getInstance() | |
| 35 | - .getIp(), Toast.LENGTH_LONG).show(); | |
| 35 | + restle.setText("连接成功"); | |
| 36 | +// Toast.makeText(context, "连接设备成功,IP:" + CloudRequest.getInstance() | |
| 37 | +// .getIp(), Toast.LENGTH_LONG).show(); | |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | @Override |
| 39 | 41 | public void error(int error, String errorInfo) { |
| 40 | 42 | if(waitingDialog.isShowing())waitingDialog.dismiss(); |
| 41 | - Toast.makeText(context, "连接设备失败:" + error, Toast.LENGTH_LONG) | |
| 43 | + restle.setText("连接失败:"+error); | |
| 44 | + Toast.makeText(context, "连接设备失败:" + error+",点击重新连接", Toast.LENGTH_LONG) | |
| 42 | 45 | .show(); |
| 43 | 46 | } |
| 44 | 47 | ... | ... |
updownfile/src/main/java/com/cnlive/updownfile/xiaoRay/adapter/TaskDoingAdapter.java
| ... | ... | @@ -32,20 +32,20 @@ public class TaskDoingAdapter extends BaseQuickAdapter<TaskInfoItem, BaseViewHol |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | helper.setText(R.id.tv_name, lv1.getEtDoing().getFileName()); |
| 35 | - if (lv1.getProgress() > 0) { | |
| 36 | - helper.setVisible(R.id.tv_progress_num, true); | |
| 37 | - helper.setText(R.id.tv_progress_num, lv1.getProgress() + ""); | |
| 38 | - } else { | |
| 39 | - helper.setVisible(R.id.tv_progress_num, false); | |
| 40 | - } | |
| 35 | +// if (lv1.getProgress() > 0) { | |
| 36 | +// helper.setVisible(R.id.tv_progress_num, true); | |
| 37 | +// helper.setText(R.id.tv_progress_num, lv1.getProgress() + ""); | |
| 38 | +// } else { | |
| 39 | +// helper.setVisible(R.id.tv_progress_num, false); | |
| 40 | +// } | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | if (lv1.getTaskType() == TaskType.UPLOAD) { |
| 44 | -// RayGlide.loadFromRes(mContext, | |
| 45 | -// R.mipmap.icon_list_upload, (ImageView) helper.getView(R.id.iv_start)); | |
| 44 | + RayGlide.loadFromRes(mContext, | |
| 45 | + R.drawable.icon_list_upload, (ImageView) helper.getView(R.id.iv_start)); | |
| 46 | 46 | } else { |
| 47 | -// RayGlide.loadFromRes(mContext, | |
| 48 | -// R.mipmap.icon_list_download, (ImageView) helper.getView(R.id.iv_start)); | |
| 47 | + RayGlide.loadFromRes(mContext, | |
| 48 | + R.drawable.icon_list_download, (ImageView) helper.getView(R.id.iv_start)); | |
| 49 | 49 | } |
| 50 | 50 | if (!TextUtils.isEmpty(((TaskInfoItem) lv1).getSpeed())) { |
| 51 | 51 | helper.setText(R.id.tv_speed, ((TaskInfoItem) lv1).getSpeed()); | ... | ... |
updownfile/src/main/java/com/cnlive/updownfile/xiaoRay/ui/DiretoryActivity.java
| ... | ... | @@ -31,6 +31,7 @@ import com.cnlive.media.picker.PickerConfig; |
| 31 | 31 | import com.cnlive.media.picker.entity.Media; |
| 32 | 32 | import com.cnlive.updownfile.R; |
| 33 | 33 | import com.cnlive.updownfile.util.DownloadUtil; |
| 34 | +import com.cnlive.updownfile.util.EnterFile; | |
| 34 | 35 | import com.cnlive.updownfile.util.UploadUtil; |
| 35 | 36 | import com.cnlive.updownfile.xiaoRay.Constant; |
| 36 | 37 | import com.cnlive.updownfile.xiaoRay.adapter.ShowDiretoryAdapter; |
| ... | ... | @@ -151,6 +152,10 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 151 | 152 | } else { |
| 152 | 153 | popup.getMenu().getItem(2).setVisible(false); |
| 153 | 154 | } |
| 155 | + | |
| 156 | + if(fileBean.getFile_type_Int() == FileType.TYPE_DIRECTORY){ | |
| 157 | + popup.getMenu().getItem(4).setVisible(false); | |
| 158 | + } | |
| 154 | 159 | //绑定菜单项的点击事件 |
| 155 | 160 | popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { |
| 156 | 161 | @Override |
| ... | ... | @@ -285,7 +290,7 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 285 | 290 | } |
| 286 | 291 | }); |
| 287 | 292 | }else if(item.getItemId() == R.id.menu_down){ |
| 288 | - RayToast.showShort("本地文件中的xiaoRay查看"); | |
| 293 | + RayToast.showShort("已经添加到任务列表,请在本地文件中的xiaoRay查看"); | |
| 289 | 294 | ArrayList<LocalCloudPath> arrayLists = new ArrayList<>(); |
| 290 | 295 | String localPath = Environment.getExternalStorageDirectory().toString() + "/xiaoRay"; |
| 291 | 296 | File file = new File(localPath); |
| ... | ... | @@ -306,22 +311,6 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 306 | 311 | rcyDataShow.setAdapter(showFilesAdapter); |
| 307 | 312 | refreshDataShow.setEnableLoadmore(false); |
| 308 | 313 | refreshDataShow.startRefresh(); |
| 309 | - | |
| 310 | - //上传完成通知刷新 | |
| 311 | - RayLib.setDoneListener(new RayDoneListener() { | |
| 312 | - @Override | |
| 313 | - public void doneAdd(BusTaskDoneAdd busTaskDoneAdd) { | |
| 314 | - //下载完成 | |
| 315 | - loadingLocal.setVisibility(View.GONE); | |
| 316 | - RayToast.showShort("下载完成"); | |
| 317 | - getDiretorys(true, fileType == 0 ? true : false); | |
| 318 | - } | |
| 319 | - | |
| 320 | - @Override | |
| 321 | - public void doneDel(BusTaskDoneDel busTaskDoneDel) { | |
| 322 | - | |
| 323 | - } | |
| 324 | - }); | |
| 325 | 314 | } |
| 326 | 315 | |
| 327 | 316 | private void initListener() { |
| ... | ... | @@ -336,7 +325,7 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 336 | 325 | showFilesAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() { |
| 337 | 326 | @Override |
| 338 | 327 | public void onLoadMoreRequested() { |
| 339 | - getDiretorys(true, fileType == 0 ? true : false); | |
| 328 | + getDiretorys(false, fileType == 0 ? true : false); | |
| 340 | 329 | } |
| 341 | 330 | }); |
| 342 | 331 | showFilesAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { |
| ... | ... | @@ -346,6 +335,8 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 346 | 335 | Intent intent = new Intent(DiretoryActivity.this, DiretoryActivity.class); |
| 347 | 336 | intent.putExtra("path", showFilesAdapter.getData().get(position).getPath() + showFilesAdapter.getData().get(position).getFname() + File.separator); |
| 348 | 337 | startActivity(intent); |
| 338 | + }else { | |
| 339 | + | |
| 349 | 340 | } |
| 350 | 341 | } |
| 351 | 342 | }); |
| ... | ... | @@ -386,12 +377,10 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 386 | 377 | public void onResponseString(String s) { |
| 387 | 378 | Gson gson = new Gson(); |
| 388 | 379 | RecyclerBean bean = gson.fromJson(s, RecyclerBean.class); |
| 389 | - refreshDataShow.finishRefreshing(); | |
| 390 | 380 | isLoadingFinished = true; |
| 391 | 381 | if (header) { |
| 392 | 382 | showFilesAdapter.setNewData(bean.getData()); |
| 393 | 383 | refreshDataShow.finishRefreshing(); |
| 394 | - showFilesAdapter.loadMoreEnd(); | |
| 395 | 384 | } else { |
| 396 | 385 | if (bean.getData().size() > 0) |
| 397 | 386 | showFilesAdapter.addData(bean.getData()); |
| ... | ... | @@ -416,12 +405,10 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 416 | 405 | |
| 417 | 406 | @Override |
| 418 | 407 | public void onResponseString(String s) { |
| 419 | - refreshDataShow.finishRefreshing(); | |
| 420 | 408 | isLoadingFinished = true; |
| 421 | 409 | if (header) { |
| 422 | 410 | showFilesAdapter.setNewData(parseResult(s, false)); |
| 423 | 411 | refreshDataShow.finishRefreshing(); |
| 424 | - showFilesAdapter.loadMoreEnd(); | |
| 425 | 412 | } else { |
| 426 | 413 | if (parseResult(s, false) != null && parseResult(s, false).size() > 0) |
| 427 | 414 | showFilesAdapter.addData(parseResult(s, false)); |
| ... | ... | @@ -446,12 +433,10 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 446 | 433 | |
| 447 | 434 | @Override |
| 448 | 435 | public void onResponseString(String s) { |
| 449 | - refreshDataShow.finishRefreshing(); | |
| 450 | 436 | isLoadingFinished = true; |
| 451 | 437 | if (header) { |
| 452 | 438 | showFilesAdapter.setNewData(parseResult(s, true)); |
| 453 | 439 | refreshDataShow.finishRefreshing(); |
| 454 | - showFilesAdapter.loadMoreEnd(); | |
| 455 | 440 | } else { |
| 456 | 441 | if (parseResult(s, true) != null && parseResult(s, true).size() > 0) |
| 457 | 442 | showFilesAdapter.addData(parseResult(s, true)); |
| ... | ... | @@ -526,17 +511,8 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 526 | 511 | } |
| 527 | 512 | }); |
| 528 | 513 | } else if (vid == R.id.add_picture) {//添加文件 |
| 529 | - ImagePicker imagePicker = new ImagePicker.Builder() | |
| 530 | - .setSelectGif(true) | |
| 531 | - .maxNum(9) | |
| 532 | - .selectMode(PickerConfig.PICKER_IMAGE_VIDEO) | |
| 533 | - .maxVideoSize(Constant.MEDIA_MAX_SIZE) | |
| 534 | - .maxImageSize(Constant.IMAGE_MAX_SIZE) | |
| 535 | -// .cachePath(CacheUtil.getConversationCachePath()) | |
| 536 | - .builder(); | |
| 537 | - imagePicker.start(DiretoryActivity.this, REQUEST_PICKER, PickerConfig.DEFAULT_RESULT_CODE); | |
| 538 | -// EnterFile.startPickerImageAndVideo(DiretoryActivity.this,true,9, PickerConfig.PICKER_IMAGE_VIDEO, | |
| 539 | -// Constant.MEDIA_MAX_SIZE,Constant.IMAGE_MAX_SIZE,"",REQUEST_PICKER); | |
| 514 | + EnterFile.startPickerImageAndVideo(DiretoryActivity.this,true,9, PickerConfig.PICKER_IMAGE_VIDEO, | |
| 515 | + Constant.MEDIA_MAX_SIZE,Constant.IMAGE_MAX_SIZE,null,REQUEST_PICKER); | |
| 540 | 516 | } else if (vid == R.id.add_file) { |
| 541 | 517 | startPickerFile(); |
| 542 | 518 | } else if (vid == R.id.clear_recyfile) {//清空回收站 |
| ... | ... | @@ -579,8 +555,7 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 579 | 555 | lists.add(localCloudPath); |
| 580 | 556 | } |
| 581 | 557 | UploadUtil.xiaoRayUploadFile(this, lists); |
| 582 | - loadingLocal.setVisibility(View.VISIBLE); | |
| 583 | - Toast.makeText(this, "正在开始上传", Toast.LENGTH_LONG).show(); | |
| 558 | + Toast.makeText(this, "已添加到任务列表", Toast.LENGTH_LONG).show(); | |
| 584 | 559 | break; |
| 585 | 560 | case 1009: |
| 586 | 561 | if (data == null) { |
| ... | ... | @@ -598,7 +573,7 @@ public class DiretoryActivity extends AppCompatActivity implements View.OnClickL |
| 598 | 573 | listss.add(localCloudPath); |
| 599 | 574 | } |
| 600 | 575 | UploadUtil.xiaoRayUploadFile(this, listss); |
| 601 | - Toast.makeText(this, "正在开始上传", Toast.LENGTH_LONG).show(); | |
| 576 | + Toast.makeText(this, "已添加到任务列表", Toast.LENGTH_LONG).show(); | |
| 602 | 577 | break; |
| 603 | 578 | } |
| 604 | 579 | } | ... | ... |
updownfile/src/main/java/com/cnlive/updownfile/xiaoRay/ui/InitViewActivity.java
| 1 | 1 | package com.cnlive.updownfile.xiaoRay.ui; |
| 2 | 2 | |
| 3 | -import android.os.Environment; | |
| 4 | 3 | import android.support.v7.app.AppCompatActivity; |
| 5 | 4 | import android.os.Bundle; |
| 6 | 5 | import android.view.View; |
| 7 | 6 | import android.widget.TextView; |
| 8 | 7 | import com.cnlive.updownfile.R; |
| 9 | -import com.cnlive.updownfile.util.DownloadUtil; | |
| 10 | 8 | import com.cnlive.updownfile.xiaoRay.Constant; |
| 11 | 9 | import com.xiaoray.raysdk.RayLib; |
| 12 | -import com.xiaoray.raysdk.entity.bean.LocalCloudPath; | |
| 13 | 10 | import com.xiaoray.raysdk.utils.OkHttpUtils.HttpResult; |
| 14 | 11 | import com.xiaoray.raysdk.view.RayToast; |
| 15 | 12 | |
| 16 | -import java.util.ArrayList; | |
| 17 | 13 | |
| 18 | 14 | |
| 19 | 15 | public class InitViewActivity extends AppCompatActivity implements View.OnClickListener { |
| ... | ... | @@ -22,12 +18,14 @@ public class InitViewActivity extends AppCompatActivity implements View.OnClickL |
| 22 | 18 | private TextView enter_file; |
| 23 | 19 | private TextView recyclerFiles; |
| 24 | 20 | private TextView again; |
| 21 | + private TextView connect_result; | |
| 25 | 22 | |
| 26 | 23 | @Override |
| 27 | 24 | protected void onCreate(Bundle savedInstanceState) { |
| 28 | 25 | super.onCreate(savedInstanceState); |
| 29 | 26 | setContentView(R.layout.activity_init_view); |
| 30 | - Constant.initXiaoRay(this, "a4:11:63:61:00:02", "8656", "625624", "3D6B5148-98D8-4642-9909-45AEBBEEC8E0"); | |
| 27 | + connect_result = findViewById(R.id.connect_result); | |
| 28 | + Constant.initXiaoRay(this, "a4:11:63:61:00:02", "8656", "625624", "3D6B5148-98D8-4642-9909-45AEBBEEC8E0",connect_result); | |
| 31 | 29 | initView(); |
| 32 | 30 | } |
| 33 | 31 | |
| ... | ... | @@ -38,6 +36,7 @@ public class InitViewActivity extends AppCompatActivity implements View.OnClickL |
| 38 | 36 | again = findViewById(R.id.again); |
| 39 | 37 | |
| 40 | 38 | |
| 39 | + | |
| 41 | 40 | show_data.setOnClickListener(this); |
| 42 | 41 | enter_file.setOnClickListener(this); |
| 43 | 42 | recyclerFiles.setOnClickListener(this); |
| ... | ... | @@ -63,7 +62,8 @@ public class InitViewActivity extends AppCompatActivity implements View.OnClickL |
| 63 | 62 | } |
| 64 | 63 | }); |
| 65 | 64 | }else if(i == R.id.again){ |
| 66 | - Constant.initXiaoRay(this, "a4:11:63:61:00:02", "8656", "625624", "3D6B5148-98D8-4642-9909-45AEBBEEC8E0"); | |
| 65 | + connect_result.setText("正在连接..."); | |
| 66 | + Constant.initXiaoRay(this, "a4:11:63:61:00:02", "8656", "625624", "3D6B5148-98D8-4642-9909-45AEBBEEC8E0",connect_result); | |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } | ... | ... |
updownfile/src/main/res/drawable-hdpi/icon_list_download.png
0 → 100644
1.52 KB
updownfile/src/main/res/drawable-hdpi/icon_list_upload.png
0 → 100644
1.53 KB
updownfile/src/main/res/layout/activity_init_view.xml
| ... | ... | @@ -7,6 +7,15 @@ |
| 7 | 7 | android:orientation="vertical" |
| 8 | 8 | android:padding="50dp" |
| 9 | 9 | tools:context=".xiaoRay.ui.InitViewActivity"> |
| 10 | + | |
| 11 | + <TextView | |
| 12 | + android:id="@+id/connect_result" | |
| 13 | + android:layout_width="wrap_content" | |
| 14 | + android:layout_height="wrap_content" | |
| 15 | + android:textSize="20sp" | |
| 16 | + android:textColor="#000000" | |
| 17 | + android:text="正在连接..." | |
| 18 | + /> | |
| 10 | 19 | <TextView |
| 11 | 20 | android:id="@+id/show_data" |
| 12 | 21 | android:layout_width="match_parent" | ... | ... |
updownfile/src/main/res/layout/item_task_info.xml
| ... | ... | @@ -72,9 +72,20 @@ |
| 72 | 72 | android:gravity="bottom|right" |
| 73 | 73 | android:minWidth="@dimen/dp_40" |
| 74 | 74 | android:singleLine="true" |
| 75 | - android:text="进度" | |
| 75 | + android:visibility="gone" | |
| 76 | + android:text="0" | |
| 76 | 77 | android:textColor="@color/color_999999" |
| 77 | 78 | android:textSize="@dimen/sp_12" /> |
| 79 | + <TextView | |
| 80 | + android:layout_width="wrap_content" | |
| 81 | + android:layout_height="wrap_content" | |
| 82 | + android:layout_gravity="bottom" | |
| 83 | + android:gravity="bottom|right" | |
| 84 | + android:singleLine="true" | |
| 85 | + android:text="%" | |
| 86 | + android:textColor="@color/color_999999" | |
| 87 | + android:visibility="gone" | |
| 88 | + android:textSize="@dimen/sp_12" /> | |
| 78 | 89 | |
| 79 | 90 | <ImageView |
| 80 | 91 | android:id="@+id/iv_start" | ... | ... |
updownfile/src/main/res/values/strings.xml
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | <string name="all_pause">全部暂停</string> |
| 13 | 13 | <string name="all_delete">全部删除</string> |
| 14 | 14 | <string name="pause">暂停</string> |
| 15 | - <string name="waiting">正在等待</string> | |
| 15 | + <string name="waiting">正在连接...</string> | |
| 16 | 16 | <string name="upload_check_md5">正在检验文件, 稍等</string> |
| 17 | 17 | <string name="no_known_condition_happen">发生了其他的未知情况</string> |
| 18 | 18 | ... | ... |