v3.6.6
parent
6d06458df7
commit
ce43e48097
@ -0,0 +1,64 @@ |
|||||||
|
/* |
||||||
|
* 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.common; |
||||||
|
|
||||||
|
import android.annotation.SuppressLint; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.view.View; |
||||||
|
import com.arialyy.simple.R; |
||||||
|
import com.arialyy.simple.base.BaseDialog; |
||||||
|
import com.arialyy.simple.databinding.DialogModifyUrlBinding; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by AriaL on 2017/6/3. |
||||||
|
*/ |
||||||
|
@SuppressLint("ValidFragment") public class ModifyUrlDialog |
||||||
|
extends BaseDialog<DialogModifyUrlBinding> { |
||||||
|
public static final int MODIFY_URL_DIALOG_RESULT = 0xA1; |
||||||
|
|
||||||
|
private String mTitle, mText; |
||||||
|
|
||||||
|
public ModifyUrlDialog(Object obj, String title, String defaultText) { |
||||||
|
super(obj); |
||||||
|
mTitle = title; |
||||||
|
mText = defaultText; |
||||||
|
} |
||||||
|
|
||||||
|
@Override protected void init(Bundle savedInstanceState) { |
||||||
|
super.init(savedInstanceState); |
||||||
|
getBinding().setTitle(mTitle); |
||||||
|
getBinding().setText(mText); |
||||||
|
getBinding().cancel.setOnClickListener(new View.OnClickListener() { |
||||||
|
@Override public void onClick(View v) { |
||||||
|
dismiss(); |
||||||
|
} |
||||||
|
}); |
||||||
|
getBinding().enter.setOnClickListener(new View.OnClickListener() { |
||||||
|
@Override public void onClick(View v) { |
||||||
|
getSimplerModule().onDialog(MODIFY_URL_DIALOG_RESULT, mText); |
||||||
|
} |
||||||
|
}); |
||||||
|
getBinding().edit.post(new Runnable() { |
||||||
|
@Override public void run() { |
||||||
|
getBinding().edit.setSelection(mText.length()); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Override protected int setLayoutId() { |
||||||
|
return R.layout.dialog_modify_url; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,84 @@ |
|||||||
|
/* |
||||||
|
* 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.content.res.TypedArray; |
||||||
|
import android.databinding.BindingAdapter; |
||||||
|
import android.graphics.drawable.Drawable; |
||||||
|
import android.support.annotation.DrawableRes; |
||||||
|
import android.support.v7.widget.AppCompatImageView; |
||||||
|
import android.text.TextUtils; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.view.LayoutInflater; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.RelativeLayout; |
||||||
|
import android.widget.TextView; |
||||||
|
import com.arialyy.simple.R; |
||||||
|
|
||||||
|
public class SvgTextView extends RelativeLayout { |
||||||
|
|
||||||
|
private TextView textView; |
||||||
|
private AppCompatImageView icon; |
||||||
|
|
||||||
|
public SvgTextView(Context context) { |
||||||
|
this(context, null); |
||||||
|
} |
||||||
|
|
||||||
|
public SvgTextView(Context context, AttributeSet attrs) { |
||||||
|
super(context, attrs); |
||||||
|
init(attrs); |
||||||
|
} |
||||||
|
|
||||||
|
private void init(AttributeSet attrs) { |
||||||
|
LayoutInflater.from(getContext()).inflate(R.layout.layout_svg_text, this, true); |
||||||
|
textView = findViewById(R.id.text); |
||||||
|
icon = findViewById(R.id.image); |
||||||
|
|
||||||
|
// init values from custom attributes
|
||||||
|
final TypedArray attributes = |
||||||
|
getContext().obtainStyledAttributes(attrs, R.styleable.SvgTextView); |
||||||
|
Drawable drawable = attributes.getDrawable(R.styleable.SvgTextView_svg_text_view_icon); |
||||||
|
if (drawable != null) { |
||||||
|
icon.setImageDrawable(drawable); |
||||||
|
} |
||||||
|
String str = attributes.getString(R.styleable.SvgTextView_text); |
||||||
|
if (!TextUtils.isEmpty(str)) { |
||||||
|
textView.setText(str); |
||||||
|
} |
||||||
|
|
||||||
|
attributes.recycle(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setIconClickListener(View.OnClickListener listener){ |
||||||
|
icon.setOnClickListener(listener); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter(value = {"svg_text_view_icon"}) |
||||||
|
public static void bindAttr(SvgTextView svgTextView, @DrawableRes int drawable) { |
||||||
|
svgTextView.icon.setImageResource(drawable); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void setIcon(@DrawableRes int drawable) { |
||||||
|
icon.setImageResource(drawable); |
||||||
|
} |
||||||
|
|
||||||
|
public void setText(CharSequence text) { |
||||||
|
textView.setText(text); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<vector android:height="24dp" android:viewportHeight="1024" |
||||||
|
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<path android:fillColor="#2b2b2b" android:pathData="M895.65,672.81c14.3,0 23.74,-9.54 23.74,-23.74L919.39,269.29a30.46,30.46 0,0 0,-8.66 -21.29L738.23,71.19A30.46,30.46 0,0 0,716.42 62L199.21,62c-52.29,0 -95.07,42.78 -95.07,95.07v654h-0.1v51.85h0.1c0,52.25 42.81,95.07 95.07,95.07h625.11c52.25,0 95.07,-42.81 95.07,-95.07v-71.31c0,-14.31 -9.54,-23.74 -23.74,-23.74s-23.74,9.54 -23.74,23.74v71.32a47.69,47.69 0,0 1,-47.48 47.58L199.21,910.51a47.72,47.72 0,0 1,-47.58 -47.58v-28.11h0.1L151.73,157.06a47.63,47.63 0,0 1,47.58 -47.48h482.47v123.57a71.32,71.32 0,0 0,71.32 71.32h118.8v344.6c-0.09,14.2 9.44,23.74 23.75,23.74zM847.19,256.81L753,256.81v0.1c-14.3,0 -23.74,-11.92 -23.74,-23.74v-98.75a2.4,2.4 0,0 1,4.13 -1.67l115.52,120a2.4,2.4 0,0 1,-1.73 4.04z"/> |
||||||
|
<path android:fillColor="#2b2b2b" android:pathData="M318.91,394.59c-14.78,0 -26.81,-12.25 -26.81,-27.3s12,-27.3 26.81,-27.3h300.47c14.78,0 26.81,12.25 26.81,27.3s-12,27.3 -26.81,27.3zM318.91,569.8c-14.78,0 -26.81,-12.25 -26.81,-27.3s12,-27.3 26.81,-27.3h384.85c14.78,0 26.81,12.25 26.81,27.3s-12,27.3 -26.81,27.3zM318.91,742c-14.78,0 -26.81,-12.25 -26.81,-27.3s12,-27.3 26.81,-27.3h261.3c14.78,0 26.81,12.25 26.81,27.3S595,742 580.21,742z"/> |
||||||
|
<path android:fillColor="#2b2b2b" android:pathData="M704.01,367.3m-27.3,0a27.3,27.3 0,1 0,54.6 0,27.3 27.3,0 1,0 -54.6,0Z"/> |
||||||
|
</vector> |
@ -0,0 +1,9 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:height="24dp" |
||||||
|
android:viewportHeight="1024" |
||||||
|
android:viewportWidth="1024" |
||||||
|
android:width="24dp"> |
||||||
|
<path |
||||||
|
android:fillColor="#2b2b2b" |
||||||
|
android:pathData="M768.49,388.36L590.76,215.07 210.93,594.49l-66.2,242.16v0.4L386.48,769.8zM739.52,66.62l-95.2,95.04 178.3,172.65 92.38,-92.3c48.49,-48.41 48.49,-126.99 0,-175.39 -48.4,-48.41 -127.07,-48.41 -175.47,-0zM79.03,878.71h872.33v114.98H79.03z"/> |
||||||
|
</vector> |
@ -0,0 +1,77 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<data> |
||||||
|
<variable |
||||||
|
name="title" |
||||||
|
type="java.lang.String" |
||||||
|
/> |
||||||
|
<variable |
||||||
|
name="text" |
||||||
|
type="java.lang.String" |
||||||
|
/> |
||||||
|
</data> |
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@color/white" |
||||||
|
android:orientation="vertical" |
||||||
|
> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@color/background_color" |
||||||
|
android:gravity="center|left" |
||||||
|
android:maxHeight="400dp" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:paddingRight="16dp" |
||||||
|
android:paddingTop="8dp" |
||||||
|
android:text="@{title}" |
||||||
|
android:textColor="@android:color/black" |
||||||
|
android:textSize="22sp" |
||||||
|
/> |
||||||
|
|
||||||
|
<EditText |
||||||
|
android:id="@+id/edit" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginBottom="15dp" |
||||||
|
android:layout_marginLeft="16dp" |
||||||
|
android:layout_marginRight="16dp" |
||||||
|
android:layout_marginTop="16dp" |
||||||
|
android:background="@android:color/transparent" |
||||||
|
android:lineSpacingMultiplier="1.2" |
||||||
|
android:text="@{text}" |
||||||
|
android:textColor="#000" |
||||||
|
android:textSize="16sp" |
||||||
|
/> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal" |
||||||
|
> |
||||||
|
<Button |
||||||
|
android:id="@+id/cancel" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/cancel" |
||||||
|
style="?buttonBarButtonStyle" |
||||||
|
/> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/enter" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/enter" |
||||||
|
style="?buttonBarButtonStyle" |
||||||
|
/> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
</layout> |
@ -0,0 +1,107 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<layout 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" |
||||||
|
> |
||||||
|
|
||||||
|
<data> |
||||||
|
<variable |
||||||
|
name="fileSize" |
||||||
|
type="String" |
||||||
|
/> |
||||||
|
<variable |
||||||
|
name="speed" |
||||||
|
type="String" |
||||||
|
/> |
||||||
|
<variable |
||||||
|
name="progress" |
||||||
|
type="int" |
||||||
|
/> |
||||||
|
<variable |
||||||
|
name="stateStr" |
||||||
|
type="String" |
||||||
|
/> |
||||||
|
</data> |
||||||
|
|
||||||
|
<RelativeLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" |
||||||
|
tools:context=".core.download.SingleTaskActivity" |
||||||
|
tools:showIn="@layout/activity_single" |
||||||
|
> |
||||||
|
|
||||||
|
<com.arialyy.simple.widget.HorizontalProgressBarWithNumber |
||||||
|
android:id="@+id/progressBar" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="20dp" |
||||||
|
android:layout_alignParentLeft="true" |
||||||
|
android:layout_alignParentStart="true" |
||||||
|
android:layout_alignParentTop="true" |
||||||
|
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_alignTop="@+id/progressBar" |
||||||
|
android:layout_marginRight="16dp" |
||||||
|
android:text="@{fileSize}" |
||||||
|
android:textSize="16sp" |
||||||
|
/> |
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/handle_bar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_below="@+id/progressBar" |
||||||
|
android:orientation="horizontal" |
||||||
|
> |
||||||
|
<TextView |
||||||
|
android:id="@+id/speed" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginLeft="16dp" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@{speed}" |
||||||
|
android:textColor="@color/black" |
||||||
|
/> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/start" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_weight="1" |
||||||
|
android:onClick="onClick" |
||||||
|
android:text="@{stateStr ?? @string/start}" |
||||||
|
style="?buttonBarButtonStyle" |
||||||
|
/> |
||||||
|
|
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/cancel" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_weight="1" |
||||||
|
android:onClick="onClick" |
||||||
|
android:text="@string/delete" |
||||||
|
style="?buttonBarButtonStyle" |
||||||
|
/> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/speed_hint" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_below="@+id/handle_bar" |
||||||
|
/> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
</layout> |
@ -0,0 +1,29 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/text" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:layout_toLeftOf="@+id/image" |
||||||
|
android:ellipsize="end" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/text_size_normal" |
||||||
|
/> |
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatImageView |
||||||
|
android:id="@+id/image" |
||||||
|
android:layout_width="20dp" |
||||||
|
android:layout_height="20dp" |
||||||
|
android:layout_alignParentRight="true" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:layout_marginLeft="8dp" |
||||||
|
android:clickable="true" |
||||||
|
/> |
||||||
|
|
||||||
|
</RelativeLayout> |
@ -1,16 +1,21 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<resources> |
<resources> |
||||||
<declare-styleable name="HorizontalProgressBarWithNumber"> |
<declare-styleable name="HorizontalProgressBarWithNumber"> |
||||||
<attr name="progress_unreached_color" format="color"/> |
<attr format="color" name="progress_unreached_color"/> |
||||||
<attr name="progress_reached_color" format="color"/> |
<attr format="color" name="progress_reached_color"/> |
||||||
<attr name="progress_reached_bar_height" format="dimension"/> |
<attr format="dimension" name="progress_reached_bar_height"/> |
||||||
<attr name="progress_unreached_bar_height" format="dimension"/> |
<attr format="dimension" name="progress_unreached_bar_height"/> |
||||||
<attr name="progress_text_size" format="dimension"/> |
<attr format="dimension" name="progress_text_size"/> |
||||||
<attr name="progress_text_color" format="color"/> |
<attr format="color" name="progress_text_color"/> |
||||||
<attr name="progress_text_offset" format="dimension"/> |
<attr format="dimension" name="progress_text_offset"/> |
||||||
<attr name="progress_text_visibility" format="enum"> |
<attr format="enum" name="progress_text_visibility"> |
||||||
<enum name="visible" value="0"/> |
<enum name="visible" value="0"/> |
||||||
<enum name="invisible" value="1"/> |
<enum name="invisible" value="1"/> |
||||||
</attr> |
</attr> |
||||||
</declare-styleable> |
</declare-styleable> |
||||||
|
|
||||||
|
<declare-styleable name="SvgTextView"> |
||||||
|
<attr format="reference" name="svg_text_view_icon"/> |
||||||
|
<attr name="text"/> |
||||||
|
</declare-styleable> |
||||||
</resources> |
</resources> |
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<root-path |
||||||
|
name="root" |
||||||
|
path="" /> |
||||||
|
<files-path |
||||||
|
name="files" |
||||||
|
path="." /> |
||||||
|
|
||||||
|
<cache-path |
||||||
|
name="cache" |
||||||
|
path="." /> |
||||||
|
|
||||||
|
<external-path |
||||||
|
name="external" |
||||||
|
path="." /> |
||||||
|
|
||||||
|
<external-files-path |
||||||
|
name="external_file_path" |
||||||
|
path="." /> |
||||||
|
<external-cache-path |
||||||
|
name="external_cache_path" |
||||||
|
path="." /> |
||||||
|
|
||||||
|
</paths> |
Loading…
Reference in new issue