Compare commits

...
3 Commits
Author SHA1 Message Date
seven332 570796a610 fix date 2014-08-23 12:00:16 +08:00
seven332 3a1fe8da1d 修正可能的布局错误 2014-08-23 11:32:15 +08:00
seven332 5259f2173d 重用 Notification.Builder 避免可能的闪烁 2014-08-22 23:26:40 +08:00
8 changed files with 110 additions and 93 deletions

No files matched your search

+2 -2
View File
@@ -16,8 +16,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="21"
android:versionName="0.6.0" >
android:versionCode="22"
android:versionName="0.6.1" >
<uses-sdk
android:minSdkVersion="14"
+1 -1
View File
@@ -133,7 +133,7 @@
android:text="@string/delete2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
+28 -23
View File
@@ -28,12 +28,12 @@
android:layout_marginTop="4dp" >
<com.hippo.ehviewer.widget.LoadImageView
android:id="@+id/cover"
android:id="@+id/thumb"
android:layout_width="@dimen/list_thumb_width"
android:layout_height="@dimen/list_thumb_height" />
<TextView
android:id="@+id/name"
android:id="@+id/title"
style="@style/CardTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -41,54 +41,59 @@
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_toRightOf="@id/cover" />
android:layout_toRightOf="@id/thumb" />
<TextView
android:id="@+id/uploader"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/name"
android:layout_below="@id/name"
android:layout_alignLeft="@id/title"
android:layout_below="@id/title"
android:layout_marginTop="2dp" />
<com.hippo.ehviewer.widget.RatingView
android:id="@+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/name"
android:layout_alignLeft="@id/title"
android:layout_below="@id/uploader"
android:layout_marginTop="4dp" />
<!-- RelativeLayout layout_marginBottom layout_below -->
<FrameLayout
<TextView
android:id="@+id/category"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/name"
android:layout_alignParentBottom="true" >
<TextView
android:id="@+id/category"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:textColor="@android:color/white" />
</FrameLayout>
android:layout_alignBottom="@id/thumb"
android:layout_alignLeft="@id/title"
android:layout_marginBottom="8dp"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/posted"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@id/thumb"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp" />
<TextView
android:id="@+id/simple_language"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/posted"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp" />
</RelativeLayout>
</LinearLayout>
+27 -35
View File
@@ -55,44 +55,36 @@
<!-- RelativeLayout layout_marginBottom layout_below -->
<FrameLayout
android:id="@+id/box"
android:layout_width="match_parent"
<TextView
android:id="@+id/category"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/title"
android:layout_alignParentBottom="true" >
android:layout_alignBottom="@id/thumb"
android:layout_marginBottom="8dp"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/category"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/posted"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/thumb"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp" />
<TextView
android:id="@+id/posted"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:layout_marginRight="4dp" />
<TextView
android:id="@+id/simple_language"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|top"
android:layout_marginRight="4dp"
android:visibility="gone" />
</FrameLayout>
<TextView
android:id="@+id/simple_language"
style="@style/CardMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/posted"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp" />
</RelativeLayout>
+4
View File
@@ -1,3 +1,7 @@
Version 0.6.1 (2014-08-23)
* 修正早期系统版本布局错误
* 修正可能出现的通知闪烁
Version 0.6.0 (2014-08-22)
* 调整界面
* 用户信息中显示用户名改为显示昵称
-1
View File
@@ -199,7 +199,6 @@
<style name="EmbedButton">
<item name="@android:textAppearance">@style/TextAppearance.EmbedButton</item>
<item name="@android:minHeight">48dp</item>
<item name="@android:minWidth">32dp</item>
</style>
</resources>
@@ -50,6 +50,8 @@ public class DownloadService extends Service
private volatile ExDownloader mCurExDownloader = null;
private ServiceBinder mBinder = null;
private NotificationManager mNotifyManager;
private Notification.Builder mBuilder;
private String mSpeedStr = null;
@Override
public void onCreate() {
@@ -64,15 +66,6 @@ public class DownloadService extends Service
getSystemService(Context.NOTIFICATION_SERVICE);
}
private void setNotification(Notification.Builder builder) {
builder.setSmallIcon(R.drawable.ic_launcher);
Intent intent = new Intent(DownloadService.this,DownloadActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
@@ -178,7 +171,17 @@ public class DownloadService extends Service
}
}
private String mSpeedStr = null;
private void ensureNotification() {
if (mBuilder != null)
return;
mBuilder = new Notification.Builder(mContext);
mBuilder.setSmallIcon(R.drawable.ic_launcher);
Intent intent = new Intent(DownloadService.this,DownloadActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(pendingIntent);
mBuilder.setOngoing(true).setAutoCancel(false);
}
@Override
@SuppressWarnings("deprecation")
@@ -189,61 +192,68 @@ public class DownloadService extends Service
mCurDownloadInfo.download = -1;
mCurDownloadInfo.total = -1;
Notification.Builder builder = new Notification.Builder(mContext);
setNotification(builder);
builder.setContentTitle(getString(R.string.start_download) + " " + gid)
ensureNotification();
mBuilder.setContentTitle(getString(R.string.start_download) + " " + gid)
.setContentText(null)
.setProgress(0, 0, true).setOngoing(true).setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, builder.getNotification());
.setProgress(0, 0, true);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
mNotifyManager.cancel(gid);
notifyUpdate();
}
@Override
@SuppressWarnings("deprecation")
public void onDownload(int gid, int downloadSize, int totalSize) {
if (mCurDownloadInfo == null)
return;
mCurDownloadInfo.download = downloadSize;
mCurDownloadInfo.total = totalSize;
Notification.Builder builder = new Notification.Builder(mContext);
setNotification(builder);
builder.setContentTitle(getString(R.string.downloading) + " " + gid)
ensureNotification();
mBuilder.setContentTitle(getString(R.string.downloading) + " " + gid)
.setContentText(mSpeedStr)
.setProgress(totalSize, downloadSize, false).setOngoing(true).setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, builder.getNotification());
.setProgress(totalSize, downloadSize, false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
notifyUpdate();
}
@Override
@SuppressWarnings("deprecation")
public void onUpdateSpeed(int gid, int speed) {
if (mCurDownloadInfo == null)
return;
mCurDownloadInfo.speed = speed;
mSpeedStr = Utils.sizeToString(speed) + "/S";
Notification.Builder builder = new Notification.Builder(mContext);
setNotification(builder);
builder.setContentTitle(getString(R.string.downloading) + " " + gid)
ensureNotification();
mBuilder.setContentTitle(getString(R.string.downloading) + " " + gid)
.setContentText(mSpeedStr)
.setProgress(mCurDownloadInfo.total, mCurDownloadInfo.download,
mCurDownloadInfo.total == -1 ? true :false)
.setOngoing(true).setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, builder.getNotification());
mCurDownloadInfo.total == -1 ? true :false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
notifyUpdate();
}
@Override
@SuppressWarnings("deprecation")
public void onDownloadOver(int gid, int legacy) {
if (mCurDownloadInfo == null)
return;
mCurDownloadInfo.legacy = legacy;
Notification.Builder builder = new Notification.Builder(mContext);
setNotification(builder);
builder.setSmallIcon(R.drawable.ic_launcher);
Intent intent = new Intent(DownloadService.this,DownloadActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
builder.setContentTitle(getString(R.string.download_over) + " " + gid)
.setContentText(legacy == 0 ? getString(R.string.done) :
String.format(getString(R.string.legacy_pages), legacy))
@@ -640,7 +640,7 @@ public class FavouriteActivity extends AbsGalleryActivity
new int[]{}},
new int[]{0xff84cae4, 0xff33b5e5, 0xFFFAFAFA}, null, false);
}
final LoadImageView thumb = (LoadImageView)convertView.findViewById(R.id.cover);
final LoadImageView thumb = (LoadImageView)convertView.findViewById(R.id.thumb);
if (!String.valueOf(gi.gid).equals(thumb.getKey())) {
// Set margin top 8dp if position is 0, otherwise 4dp
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
@@ -657,7 +657,7 @@ public class FavouriteActivity extends AbsGalleryActivity
new LoadImageView.SimpleImageGetListener(thumb).setFixScaleType(true));
}
// Set manga name
TextView name = (TextView) convertView.findViewById(R.id.name);
TextView name = (TextView) convertView.findViewById(R.id.title);
name.setText(gi.title);
// Set uploder
TextView uploader = (TextView) convertView.findViewById(R.id.uploader);
@@ -674,9 +674,16 @@ public class FavouriteActivity extends AbsGalleryActivity
.findViewById(R.id.rate);
rate.setRating(gi.rating);
// set posted
TextView posted = (TextView) convertView.findViewById(R.id.posted);
TextView posted = (TextView)convertView.findViewById(R.id.posted);
posted.setText(gi.posted);
// Set simple language
TextView simpleLanguage = (TextView)convertView.findViewById(R.id.simple_language);
if (gi.simpleLanguage == null) {
simpleLanguage.setVisibility(View.GONE);
} else {
simpleLanguage.setVisibility(View.VISIBLE);
simpleLanguage.setText(gi.simpleLanguage);
}
return convertView;
}
}