parent
7f81995bd8
commit
96efa35c4e
@ -0,0 +1,267 @@ |
||||
/* |
||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package com.arialyy.simple.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.util.AttributeSet; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.widget.Button; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
import androidx.appcompat.widget.AppCompatImageButton; |
||||
import com.arialyy.aria.core.common.AbsEntity; |
||||
import com.arialyy.aria.core.common.AbsGroupEntity; |
||||
import com.arialyy.aria.core.common.AbsNormalEntity; |
||||
import com.arialyy.aria.core.inf.IEntity; |
||||
import com.arialyy.aria.util.ALog; |
||||
import com.arialyy.aria.util.CommonUtil; |
||||
import com.arialyy.simple.R; |
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* 统一的进度布局 |
||||
*/ |
||||
public class ProgressLayout extends RelativeLayout implements View.OnClickListener { |
||||
private final String TAG = "ProgressLayout"; |
||||
private TextView speedOrState, fileName, leftTime, fileSize; |
||||
private HorizontalProgressBarWithNumber pb; |
||||
private AppCompatImageButton delBt; |
||||
private Button handleBt; |
||||
private OnProgressLayoutBtListener listener; |
||||
private AbsEntity entity; |
||||
private int currentState; |
||||
|
||||
public interface OnProgressLayoutBtListener { |
||||
/** |
||||
* 处理创建操作 |
||||
*/ |
||||
void create(View v, AbsEntity entity); |
||||
|
||||
/** |
||||
* 处理任务暂停的操作 |
||||
*/ |
||||
void stop(View v, AbsEntity entity); |
||||
|
||||
/** |
||||
* 处理恢复任务的操作 |
||||
*/ |
||||
void resume(View v, AbsEntity entity); |
||||
|
||||
/** |
||||
* 处理任务删除的操作 |
||||
*/ |
||||
void cancel(View v, AbsEntity entity); |
||||
} |
||||
|
||||
public ProgressLayout(Context context) { |
||||
this(context, null); |
||||
} |
||||
|
||||
public ProgressLayout(Context context, AttributeSet attrs) { |
||||
this(context, attrs, -1); |
||||
} |
||||
|
||||
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) { |
||||
super(context, attrs, defStyleAttr); |
||||
init(context, attrs); |
||||
} |
||||
|
||||
private void init(Context context, AttributeSet attrs) { |
||||
LayoutInflater.from(context).inflate(R.layout.layout_progress_content, this, true); |
||||
speedOrState = findViewById(R.id.speed_or_state); |
||||
fileName = findViewById(R.id.file_name); |
||||
leftTime = findViewById(R.id.left_time); |
||||
fileSize = findViewById(R.id.file_size); |
||||
pb = findViewById(R.id.pb); |
||||
delBt = findViewById(R.id.del_bt); |
||||
handleBt = findViewById(R.id.handle_bt); |
||||
delBt.setOnClickListener(this); |
||||
handleBt.setOnClickListener(this); |
||||
} |
||||
|
||||
public void setBtListener(OnProgressLayoutBtListener listener) { |
||||
this.listener = listener; |
||||
} |
||||
|
||||
@Override public void onClick(View v) { |
||||
if (listener == null) { |
||||
ALog.d(TAG, "没有设置OnProgressLayoutBtListener"); |
||||
return; |
||||
} |
||||
if (entity == null) { |
||||
ALog.d(TAG, "entity 为空,请设置信息"); |
||||
return; |
||||
} |
||||
|
||||
switch (v.getId()) { |
||||
case R.id.del_bt: |
||||
listener.cancel(v, entity); |
||||
initState(); |
||||
break; |
||||
case R.id.handle_bt: |
||||
handleTask(v); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
private void initState() { |
||||
fileName.setText("-"); |
||||
leftTime.setText(""); |
||||
speedOrState.setText(""); |
||||
fileSize.setText("-/-"); |
||||
pb.setProgress(0); |
||||
} |
||||
|
||||
private void handleTask(View v) { |
||||
switch (entity.getState()) { |
||||
case IEntity.STATE_OTHER: |
||||
case IEntity.STATE_FAIL: |
||||
case IEntity.STATE_STOP: |
||||
listener.resume(v, entity); |
||||
break; |
||||
case IEntity.STATE_COMPLETE: |
||||
case IEntity.STATE_WAIT: |
||||
if (entity.getId() != -1) { |
||||
listener.resume(v, entity); |
||||
} else { |
||||
listener.create(v, entity); |
||||
} |
||||
break; |
||||
case IEntity.STATE_PRE: |
||||
case IEntity.STATE_POST_PRE: |
||||
case IEntity.STATE_RUNNING: |
||||
listener.stop(v, entity); |
||||
break; |
||||
default: |
||||
listener.create(v, entity); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
public void setInfo(AbsEntity entity) { |
||||
this.entity = entity; |
||||
this.currentState = entity.getState(); |
||||
if (entity instanceof AbsNormalEntity) { |
||||
AbsNormalEntity normalEntity = (AbsNormalEntity) entity; |
||||
ALog.d(TAG, "fileName = " + ((AbsNormalEntity) entity).getFileName()); |
||||
fileName.setText(normalEntity.getFileName()); |
||||
} else if (entity instanceof AbsGroupEntity) { |
||||
AbsGroupEntity groupEntity = (AbsGroupEntity) entity; |
||||
fileName.setText( |
||||
groupEntity.getAlias() == null ? groupEntity.getKey() : groupEntity.getAlias()); |
||||
} |
||||
|
||||
String str = |
||||
formatFileSize(entity.getCurrentProgress()) + "/" + formatFileSize(entity.getFileSize()); |
||||
fileSize.setText(str); |
||||
leftTime.setText(CommonUtil.formatTime(entity.getTimeLeft())); |
||||
String btStr = getResources().getString(R.string.start); |
||||
String stateStr = ""; |
||||
switch (entity.getState()) { |
||||
case IEntity.STATE_WAIT: |
||||
btStr = getResources().getString(R.string.start); |
||||
stateStr = getResources().getString(R.string.waiting); |
||||
break; |
||||
case IEntity.STATE_OTHER: |
||||
case IEntity.STATE_FAIL: |
||||
btStr = getResources().getString(R.string.start); |
||||
stateStr = getResources().getString(R.string.state_error); |
||||
break; |
||||
case IEntity.STATE_STOP: |
||||
btStr = getResources().getString(R.string.resume); |
||||
stateStr = getResources().getString(R.string.stopped); |
||||
break; |
||||
case IEntity.STATE_PRE: |
||||
case IEntity.STATE_POST_PRE: |
||||
case IEntity.STATE_RUNNING: |
||||
btStr = getResources().getString(R.string.stop); |
||||
stateStr = entity.getConvertSpeed(); |
||||
leftTime.setText(CommonUtil.formatTime(entity.getTimeLeft())); |
||||
break; |
||||
case IEntity.STATE_COMPLETE: |
||||
btStr = getResources().getString(R.string.re_start); |
||||
stateStr = getResources().getString(R.string.completed); |
||||
break; |
||||
case IEntity.STATE_CANCEL: |
||||
initState(); |
||||
break; |
||||
default: |
||||
btStr = getResources().getString(R.string.start); |
||||
stateStr = ""; |
||||
leftTime.setText(""); |
||||
} |
||||
this.handleBt.setText(btStr); |
||||
this.speedOrState.setText(stateStr); |
||||
if (entity.getState() != IEntity.STATE_CANCEL){ |
||||
this.pb.setProgress(entity.getPercent()); |
||||
} |
||||
} |
||||
|
||||
public void setFileName(Character fileName) { |
||||
this.fileName.setText(fileName); |
||||
} |
||||
|
||||
public void setLeftTime(Character leftTime) { |
||||
this.leftTime.setText(leftTime); |
||||
} |
||||
|
||||
public void setFileSize(Character fileSize) { |
||||
this.fileSize.setText(fileSize); |
||||
} |
||||
|
||||
public void setProgress(int progress) { |
||||
this.pb.setProgress(progress); |
||||
} |
||||
|
||||
public void setSpeed(Character speed) { |
||||
this.speedOrState.setText(speed); |
||||
} |
||||
|
||||
public void setState(Character state) { |
||||
this.speedOrState.setText(state); |
||||
} |
||||
|
||||
public String formatFileSize(double size) { |
||||
if (size < 0) { |
||||
return "0k"; |
||||
} |
||||
double kiloByte = size / 1024; |
||||
if (kiloByte < 1) { |
||||
return size + "b"; |
||||
} |
||||
|
||||
double megaByte = kiloByte / 1024; |
||||
if (megaByte < 1) { |
||||
BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); |
||||
return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "k"; |
||||
} |
||||
|
||||
double gigaByte = megaByte / 1024; |
||||
if (gigaByte < 1) { |
||||
BigDecimal result2 = new BigDecimal(Double.toString(megaByte)); |
||||
return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "m"; |
||||
} |
||||
|
||||
double teraBytes = gigaByte / 1024; |
||||
if (teraBytes < 1) { |
||||
BigDecimal result3 = new BigDecimal(Double.toString(gigaByte)); |
||||
return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "g"; |
||||
} |
||||
BigDecimal result4 = new BigDecimal(teraBytes); |
||||
return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "t"; |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="24dp" |
||||
android:height="24dp" |
||||
android:viewportWidth="1024" |
||||
android:viewportHeight="1024"> |
||||
<path |
||||
android:pathData="M521.69,449.3L111.41,39.01a51.2,51.2 0,1 0,-72.43 72.36l410.28,410.32 -410.28,410.32a51.2,51.2 0,1 0,72.4 72.4l410.32,-410.28 410.32,410.28a51.2,51.2 0,1 0,72.4 -72.36l-410.28,-410.35 410.28,-410.28a51.2,51.2 0,1 0,-72.4 -72.4l-410.28,410.28z" |
||||
android:fillColor="#515151"/> |
||||
</vector> |
@ -1,86 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:bind="http://schemas.android.com/apk/res-auto" |
||||
> |
||||
|
||||
<data> |
||||
<variable |
||||
name="fileSize" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="speed" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="progress" |
||||
type="int" |
||||
/> |
||||
<variable |
||||
name="stateStr" |
||||
type="String" |
||||
/> |
||||
|
||||
<variable |
||||
name="url" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="filePath" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="viewModel" |
||||
type="com.arialyy.simple.core.download.FtpDownloadActivity" |
||||
/> |
||||
</data> |
||||
|
||||
<LinearLayout |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:fitsSystemWindows="true" |
||||
android:orientation="vertical" |
||||
tools:context=".core.download.SingleTaskActivity" |
||||
> |
||||
|
||||
<include layout="@layout/layout_bar"/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="16dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseUrl()}" |
||||
bind:svg_text_view_icon="@drawable/ic_modify" |
||||
bind:text="@{@string/url(url)}" |
||||
/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="8dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseFilePath()}" |
||||
bind:svg_text_view_icon="@drawable/ic_choose_file" |
||||
bind:text="@{@string/file_path(filePath)}" |
||||
/> |
||||
|
||||
<include |
||||
layout="@layout/layout_content_single" |
||||
bind:fileSize="@{fileSize}" |
||||
bind:progress="@{progress}" |
||||
bind:speed="@{speed}" |
||||
bind:stateStr="@{stateStr}" |
||||
/> |
||||
|
||||
<!-- <com.arialyy.simple.widget.CodeView--> |
||||
<!-- android:id="@+id/code_view"--> |
||||
<!-- android:layout_width="match_parent"--> |
||||
<!-- android:layout_height="match_parent"--> |
||||
<!-- />--> |
||||
|
||||
</LinearLayout> |
||||
</layout> |
@ -1,83 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:bind="http://schemas.android.com/apk/res-auto" |
||||
> |
||||
<data> |
||||
<variable |
||||
name="fileSize" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="speed" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="progress" |
||||
type="int" |
||||
/> |
||||
<variable |
||||
name="url" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="filePath" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="viewModel" |
||||
type="com.arialyy.simple.core.upload.FtpUploadActivity" |
||||
/> |
||||
<variable |
||||
name="stateStr" |
||||
type="String" |
||||
/> |
||||
</data> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical" |
||||
> |
||||
|
||||
<include layout="@layout/layout_bar"/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="16dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseUrl()}" |
||||
bind:svg_text_view_icon="@drawable/ic_modify" |
||||
bind:text="@{@string/url(url)}" |
||||
/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="8dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseFilePath()}" |
||||
bind:svg_text_view_icon="@drawable/ic_choose_file" |
||||
bind:text="@{@string/file_path(filePath)}" |
||||
/> |
||||
|
||||
<include |
||||
layout="@layout/layout_content_single" |
||||
bind:fileSize="@{fileSize}" |
||||
bind:progress="@{progress}" |
||||
bind:speed="@{speed}" |
||||
bind:stateStr="@{stateStr}" |
||||
/> |
||||
|
||||
|
||||
<!-- <com.arialyy.simple.widget.CodeView--> |
||||
<!-- android:id="@+id/code_view"--> |
||||
<!-- android:layout_width="match_parent"--> |
||||
<!-- android:layout_height="match_parent"--> |
||||
<!-- />--> |
||||
|
||||
|
||||
</LinearLayout> |
||||
</layout> |
@ -1,86 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:bind="http://schemas.android.com/apk/res-auto" |
||||
> |
||||
|
||||
<data> |
||||
<variable |
||||
name="fileSize" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="speed" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="progress" |
||||
type="int" |
||||
/> |
||||
<variable |
||||
name="stateStr" |
||||
type="String" |
||||
/> |
||||
|
||||
<variable |
||||
name="url" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="filePath" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="viewModel" |
||||
type="com.arialyy.simple.core.download.SFtpDownloadActivity" |
||||
/> |
||||
</data> |
||||
|
||||
<LinearLayout |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:fitsSystemWindows="true" |
||||
android:orientation="vertical" |
||||
tools:context=".core.download.SingleTaskActivity" |
||||
> |
||||
|
||||
<include layout="@layout/layout_bar"/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="16dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseUrl()}" |
||||
bind:svg_text_view_icon="@drawable/ic_modify" |
||||
bind:text="@{@string/url(url)}" |
||||
/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="8dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseFilePath()}" |
||||
bind:svg_text_view_icon="@drawable/ic_choose_file" |
||||
bind:text="@{@string/file_path(filePath)}" |
||||
/> |
||||
|
||||
<include |
||||
layout="@layout/layout_content_single" |
||||
bind:fileSize="@{fileSize}" |
||||
bind:progress="@{progress}" |
||||
bind:speed="@{speed}" |
||||
bind:stateStr="@{stateStr}" |
||||
/> |
||||
|
||||
<!-- <com.arialyy.simple.widget.CodeView--> |
||||
<!-- android:id="@+id/code_view"--> |
||||
<!-- android:layout_width="match_parent"--> |
||||
<!-- android:layout_height="match_parent"--> |
||||
<!-- />--> |
||||
|
||||
</LinearLayout> |
||||
</layout> |
@ -1,83 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:bind="http://schemas.android.com/apk/res-auto" |
||||
> |
||||
<data> |
||||
<variable |
||||
name="fileSize" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="speed" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="progress" |
||||
type="int" |
||||
/> |
||||
<variable |
||||
name="url" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="filePath" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="viewModel" |
||||
type="com.arialyy.simple.core.upload.SFtpUploadActivity" |
||||
/> |
||||
<variable |
||||
name="stateStr" |
||||
type="String" |
||||
/> |
||||
</data> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical" |
||||
> |
||||
|
||||
<include layout="@layout/layout_bar"/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="16dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseUrl()}" |
||||
bind:svg_text_view_icon="@drawable/ic_modify" |
||||
bind:text="@{@string/url(url)}" |
||||
/> |
||||
|
||||
<com.arialyy.simple.widget.SvgTextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:layout_marginRight="16dp" |
||||
android:layout_marginTop="8dp" |
||||
bind:iconClickListener="@{() -> viewModel.chooseFilePath()}" |
||||
bind:svg_text_view_icon="@drawable/ic_choose_file" |
||||
bind:text="@{@string/file_path(filePath)}" |
||||
/> |
||||
|
||||
<include |
||||
layout="@layout/layout_content_single" |
||||
bind:fileSize="@{fileSize}" |
||||
bind:progress="@{progress}" |
||||
bind:speed="@{speed}" |
||||
bind:stateStr="@{stateStr}" |
||||
/> |
||||
|
||||
|
||||
<!-- <com.arialyy.simple.widget.CodeView--> |
||||
<!-- android:id="@+id/code_view"--> |
||||
<!-- android:layout_width="match_parent"--> |
||||
<!-- android:layout_height="match_parent"--> |
||||
<!-- />--> |
||||
|
||||
|
||||
</LinearLayout> |
||||
</layout> |
@ -1,103 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
||||
<data> |
||||
<variable |
||||
name="fileSize" |
||||
type="String" |
||||
/> |
||||
<variable |
||||
name="speed" |
||||
type="String" |
||||
/> |
||||
|
||||
<variable |
||||
name="progress" |
||||
type="int" |
||||
/> |
||||
|
||||
</data> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical" |
||||
> |
||||
<include layout="@layout/layout_bar"/> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/top_bar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@+id/toolbar" |
||||
> |
||||
|
||||
<com.arialyy.simple.widget.HorizontalProgressBarWithNumber |
||||
android:id="@+id/pb" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="20dp" |
||||
android:layout_margin="16dp" |
||||
android:layout_toLeftOf="@+id/size" |
||||
android:max="100" |
||||
android:progress="@{progress}" |
||||
style="?android:attr/progressBarStyleHorizontal" |
||||
/> |
||||
|
||||
<TextView |
||||
android:id="@+id/size" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginRight="16dp" |
||||
android:text="@{fileSize}" |
||||
/> |
||||
</RelativeLayout> |
||||
|
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="horizontal" |
||||
> |
||||
|
||||
<TextView |
||||
android:id="@+id/speed" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="16dp" |
||||
android:text="@{speed}" |
||||
/> |
||||
|
||||
<Button |
||||
android:id="@+id/upload" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:text="上传" |
||||
style="?buttonBarButtonStyle" |
||||
/> |
||||
|
||||
<Button |
||||
android:id="@+id/stop" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:text="停止" |
||||
style="?buttonBarButtonStyle" |
||||
/> |
||||
|
||||
<Button |
||||
android:id="@+id/remove" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:text="删除" |
||||
style="?buttonBarButtonStyle" |
||||
/> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</layout> |
@ -0,0 +1,101 @@ |
||||
<?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="match_parent" |
||||
android:layout_height="wrap_content" |
||||
> |
||||
|
||||
<TextView |
||||
android:id="@+id/file_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:textColor="@color/black" |
||||
android:textSize="@dimen/text_size_normal" |
||||
/> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/content" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@+id/file_name" |
||||
android:layout_marginTop="8dp" |
||||
android:layout_marginRight="12dp" |
||||
android:layout_toLeftOf="@+id/del_bt" |
||||
> |
||||
|
||||
<TextView |
||||
android:id="@+id/speed_or_state" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/text_grey" |
||||
android:textSize="@dimen/text_size_smallest" |
||||
/> |
||||
|
||||
<TextView |
||||
android:id="@+id/left_time" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignTop="@+id/speed_or_state" |
||||
android:layout_marginStart="4dp" |
||||
android:layout_marginLeft="4dp" |
||||
android:layout_toEndOf="@+id/speed_or_state" |
||||
android:layout_toRightOf="@+id/speed_or_state" |
||||
android:textColor="@color/text_grey" |
||||
android:textSize="@dimen/text_size_smallest" |
||||
/> |
||||
|
||||
<TextView |
||||
android:id="@+id/file_size" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignTop="@+id/speed_or_state" |
||||
android:layout_alignParentEnd="true" |
||||
android:layout_alignParentRight="true" |
||||
android:textSize="@dimen/text_size_smallest" |
||||
tools:ignore="RelativeOverlap" |
||||
/> |
||||
|
||||
<com.arialyy.simple.widget.HorizontalProgressBarWithNumber |
||||
android:id="@+id/pb" |
||||
style="?android:attr/progressBarStyleHorizontal" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="20dp" |
||||
android:layout_below="@+id/speed_or_state" |
||||
android:layout_alignParentStart="true" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_marginTop="4dp" |
||||
android:max="100" |
||||
/> |
||||
|
||||
|
||||
</RelativeLayout> |
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton |
||||
android:id="@+id/del_bt" |
||||
style="?buttonBarButtonStyle" |
||||
android:layout_width="16dp" |
||||
android:layout_height="16dp" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginRight="8dp" |
||||
android:layout_toLeftOf="@+id/handle_bt" |
||||
android:background="@color/transparent" |
||||
android:clickable="true" |
||||
android:focusable="true" |
||||
app:srcCompat="@drawable/ic_close" |
||||
/> |
||||
|
||||
<Button |
||||
android:id="@+id/handle_bt" |
||||
style="?buttonBarButtonStyle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:text="@string/start" |
||||
android:textSize="@dimen/text_size_normal" |
||||
/> |
||||
|
||||
|
||||
</RelativeLayout> |
Loading…
Reference in new issue