调整下载界面

This commit is contained in:
seven332 committed 2014-11-03 11:19:38 +08:00
1 parent 8149257c27
commit 415a973a97
7 files changed
+76 -201

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@
<CheckBox
android:id="@+id/set_default"
style="@style/DialogMessage"
style="@style/Dialog.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8.0dp"
-134
View File
@@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Hippo Seven
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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/title_layout"
android:layout_width="fill_parent"
android:layout_height="64.0dp"
android:background="@android:color/holo_blue_dark"
android:orientation="horizontal" >
<TextView
android:id="@+id/title"
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="24.0dp"
android:layout_marginRight="24.0dp"
android:layout_weight="1"
android:ellipsize="start"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/primary_text_light"
android:visibility="gone" />
<ImageView
android:id="@+id/action"
android:layout_width="48.0dp"
android:layout_height="48.0dp"
android:layout_gravity="center"
android:layout_marginRight="8.0dp"
android:background="@drawable/clickable_bg_blue"
android:src="@drawable/ic_action_touch"
android:visibility="gone" />
</LinearLayout>
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:visibility="gone" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="36dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="36dp"
android:textSize="18sp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/custom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/custom_no_scroll"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="gone" />
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone" >
</ListView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<com.hippo.ehviewer.widget.AlertButton
android:id="@+id/negative_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textColor="@color/primary_text_light"
android:visibility="gone" />
<com.hippo.ehviewer.widget.AlertButton
android:id="@+id/neutral_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textColor="@color/primary_text_light"
android:visibility="gone" />
<com.hippo.ehviewer.widget.AlertButton
android:id="@+id/positive_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textColor="@color/primary_text_light"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
+36
View File
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Hippo Seven
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.
-->
<LinearLayout 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/message"
style="@style/DialogMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<CheckBox
android:id="@+id/checkbox"
style="@style/Dialog.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
</LinearLayout>
+11 -27
View File
@@ -74,7 +74,7 @@
android:layout_marginRight="16dp"
android:layout_marginTop="10dp" />
<TableLayout
<TableLayout
android:id="@+id/buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -104,32 +104,6 @@
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/delete1"
style="@style/EmbedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:textColor="@color/warning_red"
android:text="@string/delete" />
<TextView
android:id="@+id/delete2"
style="@style/EmbedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:textColor="@color/warning_red"
android:text="@string/delete2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
@@ -143,6 +117,16 @@
android:layout_weight="1"
android:text="@string/detail" />
<TextView
android:id="@+id/delete"
style="@style/EmbedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:textColor="@color/warning_red"
android:text="@string/delete" />
</TableRow>
</TableLayout>
+1
View File
@@ -105,6 +105,7 @@
<string name="download_4">下载失败 %d 项</string>
<string name="download_5" formatted="false">下载成功 %d, 下载失败 %d</string>
<string name="download_6" formatted="false">下载成功 %d 项, 下载失败 %d 项</string>
<string name="delete_item">该下载项将被删除</string>
<!-- ErrorMessage -->
<string name="em_network_error">网络错误</string>
+1
View File
@@ -19,5 +19,6 @@
<item type="id" name="position_x"></item>
<item type="id" name="position_y"></item>
<item type="id" name="edittextpreference_edittext"></item>
<item type="id" name="custom"></item>
</resources>
+26 -39
View File
@@ -18,6 +18,7 @@ package com.hippo.ehviewer.ui;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -33,6 +34,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -216,10 +218,8 @@ public class DownloadActivity extends AbsActivity {
View read = convertView.findViewById(R.id.read);
TextView action = (TextView)convertView.findViewById(R.id.action);
View delete1 = convertView.findViewById(R.id.delete1);
View delete2 = convertView.findViewById(R.id.delete2);
View detail = convertView.findViewById(R.id.detail);
View delete = convertView.findViewById(R.id.delete);
read.setOnClickListener(new View.OnClickListener() {
@Override
@@ -231,8 +231,7 @@ public class DownloadActivity extends AbsActivity {
startActivity(intent);
}
});
delete1.setOnClickListener(new Delete1Action(di));
delete2.setOnClickListener(new Delete2Action(di));
delete.setOnClickListener(new DeleteAction(di));
detail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -309,46 +308,30 @@ public class DownloadActivity extends AbsActivity {
}
}
private class Delete1Action implements View.OnClickListener {
private class DeleteAction implements View.OnClickListener {
private static final String KEY_INCLUDE_PIC = "include_pic";
public DownloadInfo mDownloadInfo;
public Delete1Action(DownloadInfo di) {
public DeleteAction(DownloadInfo di) {
mDownloadInfo = di;
}
@Override
@SuppressLint("InflateParams")
public void onClick(View v) {
final View view = LayoutInflater.from(DownloadActivity.this).inflate(
R.layout.dialog_message_checkbox, null);
final TextView message = (TextView) view.findViewById(R.id.message);
final CheckBox cb = (CheckBox) view.findViewById(R.id.checkbox);
message.setText(R.string.delete_item);
cb.setText("包括图片");
cb.setChecked(Config.getBoolean(KEY_INCLUDE_PIC, false));
new MaterialAlertDialog.Builder(DownloadActivity.this).setTitle(R.string.attention)
.setMessage(R.string.delete)
.setPositiveButton(android.R.string.ok)
.setNegativeButton(android.R.string.cancel)
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
@Override
public boolean onClick(MaterialAlertDialog dialog, int which) {
if (which == MaterialAlertDialog.POSITIVE) {
Intent it = new Intent(DownloadActivity.this, DownloadService.class);
startService(it);
mServiceConn.getService().delete(mDownloadInfo);
}
return true;
}
}).show();
}
}
private class Delete2Action implements View.OnClickListener {
public DownloadInfo mDownloadInfo;
public Delete2Action(DownloadInfo di) {
mDownloadInfo = di;
}
@Override
public void onClick(View v) {
new MaterialAlertDialog.Builder(DownloadActivity.this).setTitle(R.string.attention)
.setMessage(R.string.delete2)
.setPositiveButton(android.R.string.ok)
.setNegativeButton(android.R.string.cancel)
.setView(view, true)
.setDefaultButton(MaterialAlertDialog.POSITIVE | MaterialAlertDialog.NEGATIVE)
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
@Override
public boolean onClick(MaterialAlertDialog dialog, int which) {
@@ -357,8 +340,12 @@ public class DownloadActivity extends AbsActivity {
startService(it);
mServiceConn.getService().delete(mDownloadInfo);
// Delete dir
GalleryInfo gi = mDownloadInfo.galleryInfo;
Utils.deleteDirInThread(EhUtils.getGalleryDir(gi.gid, gi.title));
if (cb.isChecked()) {
GalleryInfo gi = mDownloadInfo.galleryInfo;
Utils.deleteDirInThread(EhUtils.getGalleryDir(gi.gid, gi.title));
}
// Remember delete choice
Config.setBoolean(KEY_INCLUDE_PIC, cb.isChecked());
}
return true;
}