mirror of
https://github.com/seven332/EhViewer
synced 2026-12-01 03:28:03 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d9701c75 | ||
|
|
d886cbe391 | ||
|
|
5afb351fcc | ||
|
|
7f5569a8d9 | ||
|
|
9df26b94c7 | ||
|
|
103cfe1749 | ||
|
|
006a8684ff | ||
|
|
645f0df208 | ||
|
|
60dc0a7f72 | ||
|
|
4c7c06e8dc | ||
|
|
d361eaf63d |
No files matched your search
+14
-8
@@ -16,8 +16,8 @@
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hippo.ehviewer"
|
||||
android:versionCode="24"
|
||||
android:versionName="0.6.3" >
|
||||
android:versionCode="25"
|
||||
android:versionName="0.6.4" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.GalleryListActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind"
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.GalleryDetailActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:screenOrientation="behind"
|
||||
android:windowSoftInputMode="adjustPan|adjustUnspecified|stateHidden" >
|
||||
<intent-filter>
|
||||
@@ -82,14 +82,14 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.GalleryActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/AppTheme.NoActionBar" >
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.SettingsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:icon="@drawable/ic_action_settings"
|
||||
android:label="@string/preference_settings_title"
|
||||
android:screenOrientation="behind" >
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.FavouriteActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:icon="@drawable/ic_action_favorite"
|
||||
android:label="@string/favourite"
|
||||
android:screenOrientation="behind"
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.DownloadActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|uiMode"
|
||||
android:icon="@drawable/ic_setting_download"
|
||||
android:label="@string/download"
|
||||
android:launchMode="singleTask"
|
||||
@@ -120,6 +120,12 @@
|
||||
<service
|
||||
android:name=".service.DownloadService"
|
||||
android:label="DownloadService" />
|
||||
|
||||
<provider
|
||||
android:name=".SimpleSuggestionProvider"
|
||||
android:authorities="com.hippo.ehviewer.SimpleSuggestionProvider"
|
||||
android:exported="false" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 829 B |
Binary file not shown.
|
After Width: | Height: | Size: 487 B |
Binary file not shown.
|
After Width: | Height: | Size: 974 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -1,3 +1,10 @@
|
||||
Version 0.6.4 (2014-09-14)
|
||||
* 添加搜索记录
|
||||
* 添加通知停止按钮
|
||||
* 修正自定义解码默认值显示错误
|
||||
* 修正 ripple 起点不居中
|
||||
* 修正磁吸充电时重新载入
|
||||
|
||||
Version 0.6.3 (2014-09-06)
|
||||
* 添加自定义图片解码,gif 播放效果更好,可能会优化内存使用,暂不支持 x86,mips
|
||||
* 阅读界面添加电量显示
|
||||
|
||||
@@ -190,6 +190,9 @@
|
||||
<string name="exculde_tag_group_summary">在标签搜索中排除特定标签类别</string>
|
||||
<string name="exculde_language_title">排除语言</string>
|
||||
<string name="exculde_language_summary">在列表与搜索中排除特定语言</string>
|
||||
<string name="search_eh_settings_title">搜索</string>
|
||||
<string name="clear_suggestions_title">清除搜索记录</string>
|
||||
<string name="clear_suggestions_summary">删除您已执行的所有搜索</string>
|
||||
<string name="detail_eh_settings_title">详情</string>
|
||||
<string name="preview_mode_title">预览图模式</string>
|
||||
<string name="preview_mode_normal">正常预览图</string>
|
||||
@@ -330,6 +333,7 @@
|
||||
<string name="attention">注意</string>
|
||||
<string name="start">开始</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="stop_all">全部停止</string>
|
||||
<string name="invalid_input">无效的输入</string>
|
||||
<string name="never_show">不再显示</string>
|
||||
<string name="retry">重试</string>
|
||||
|
||||
@@ -178,6 +178,9 @@
|
||||
<string name="exculde_tag_group_summary">在標籤搜索中排除特定標籤類別</string>
|
||||
<string name="exculde_language_title">排除語言</string>
|
||||
<string name="exculde_language_summary">在列表與搜索中排除特定語言</string>
|
||||
<string name="search_eh_settings_title">搜索</string>
|
||||
<string name="clear_suggestions_title">清除搜索記錄</string>
|
||||
<string name="clear_suggestions_summary">刪除您已執行的所有搜索</string>
|
||||
<string name="detail_eh_settings_title">詳情</string>
|
||||
<string name="preview_mode_title">預覽圖模式</string>
|
||||
<string name="preview_mode_normal">正常預覽圖</string>
|
||||
@@ -318,6 +321,7 @@
|
||||
<string name="attention">注意</string>
|
||||
<string name="start">開始</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="stop_all">全部停止</string>
|
||||
<string name="invalid_input">無效的輸入</string>
|
||||
<string name="never_show">不再顯示</string>
|
||||
<string name="retry">重試</string>
|
||||
|
||||
@@ -178,6 +178,9 @@
|
||||
<string name="exculde_tag_group_summary">在標籤搜索中排除特定標籤類別</string>
|
||||
<string name="exculde_language_title">排除語言</string>
|
||||
<string name="exculde_language_summary">在列表與搜索中排除特定語言</string>
|
||||
<string name="search_eh_settings_title">搜索</string>
|
||||
<string name="clear_suggestions_title">清除搜索記錄</string>
|
||||
<string name="clear_suggestions_summary">刪除您已執行的所有搜索</string>
|
||||
<string name="detail_eh_settings_title">詳情</string>
|
||||
<string name="preview_mode_title">預覽圖模式</string>
|
||||
<string name="preview_mode_normal">正常預覽圖</string>
|
||||
@@ -318,6 +321,7 @@
|
||||
<string name="attention">注意</string>
|
||||
<string name="start">開始</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="stop_all">全部停止</string>
|
||||
<string name="invalid_input">無效的輸入</string>
|
||||
<string name="never_show">不再顯示</string>
|
||||
<string name="retry">重試</string>
|
||||
|
||||
@@ -193,6 +193,9 @@
|
||||
<string name="exculde_tag_group_summary">Exclude certain tag groups from a default tag search</string>
|
||||
<string name="exculde_language_title">Exculde language</string>
|
||||
<string name="exculde_language_summary">To hide galleries in certain languages from the gallery list and searches</string>
|
||||
<string name="search_eh_settings_title">Search</string>
|
||||
<string name="clear_suggestions_title">Clear search history</string>
|
||||
<string name="clear_suggestions_summary">Remove all the searches you have performed</string>
|
||||
<string name="detail_eh_settings_title">Detail</string>
|
||||
<string name="preview_mode_title">Preview mode</string>
|
||||
<string name="preview_mode_normal">Normal</string>
|
||||
@@ -352,6 +355,7 @@
|
||||
<string name="attention">Attention</string>
|
||||
<string name="start">Start</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="stop_all">Stop all</string>
|
||||
<string name="invalid_input">Invalid Input</string>
|
||||
<string name="never_show">Never show me this dialog</string>
|
||||
<string name="retry">Retry</string>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="@android:Theme.Holo.Light">
|
||||
<style name="AppTheme" parent="@android:Theme.Holo.Light.DarkActionBar">
|
||||
|
||||
<item name="@android:textAppearance">@style/TextAppearance</item>
|
||||
<item name="@android:windowBackground">@color/background_light</item>
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
android:title="@string/exculde_language_title" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/search_eh_settings_title" >
|
||||
|
||||
<Preference
|
||||
android:key="clear_suggestions"
|
||||
android:title="@string/clear_suggestions_title"
|
||||
android:summary="@string/clear_suggestions_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/detail_eh_settings_title" >
|
||||
|
||||
<com.hippo.ehviewer.preference.AutoListPreference
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/app_name"
|
||||
android:hint="@string/advance_search_left"
|
||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" />
|
||||
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
|
||||
android:searchSuggestAuthority="com.hippo.ehviewer.SimpleSuggestionProvider"
|
||||
android:searchSuggestSelection=" ?" />
|
||||
@@ -18,25 +18,24 @@ package com.hippo.ehviewer;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.google.analytics.tracking.android.EasyTracker;
|
||||
import com.google.analytics.tracking.android.MapBuilder;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.analytics.tracking.android.EasyTracker;
|
||||
import com.google.analytics.tracking.android.MapBuilder;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
|
||||
public class Analytics {
|
||||
|
||||
|
||||
private static final String KEY_GALLERY = "gallery";
|
||||
private static final String KEY_OPEN = "open";
|
||||
private static final String KEY_READ = "read";
|
||||
private static final String KEY_DOWNLOAD = "download";
|
||||
private static final String KEY_ADD_TO_FAVORITE = "add_to_favorite";
|
||||
|
||||
|
||||
private static void doGallery(Context context, int gid, String token, String method) {
|
||||
if (!Config.getAllowAnalyics())
|
||||
return;
|
||||
|
||||
|
||||
try {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("gid", gid).put("token", token);
|
||||
@@ -44,19 +43,19 @@ public class Analytics {
|
||||
easyTracker.send(MapBuilder.createEvent(KEY_GALLERY, method, js.toString(), null).build());
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
|
||||
public static void openGallery(Context context, int gid, String token) {
|
||||
doGallery(context, gid, token, KEY_OPEN);
|
||||
}
|
||||
|
||||
|
||||
public static void readGallery(Context context, int gid, String token) {
|
||||
doGallery(context, gid, token, KEY_READ);
|
||||
}
|
||||
|
||||
|
||||
public static void downloadGallery(Context context, int gid, String token) {
|
||||
doGallery(context, gid, token, KEY_DOWNLOAD);
|
||||
}
|
||||
|
||||
|
||||
public static void addToFavoriteGallery(Context context, int gid, String token) {
|
||||
doGallery(context, gid, token, KEY_ADD_TO_FAVORITE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer;
|
||||
|
||||
import android.content.SearchRecentSuggestionsProvider;
|
||||
|
||||
public class SimpleSuggestionProvider extends SearchRecentSuggestionsProvider {
|
||||
public final static String AUTHORITY = "com.hippo.ehviewer.SimpleSuggestionProvider";
|
||||
public final static int MODE = DATABASE_MODE_QUERIES;
|
||||
|
||||
public SimpleSuggestionProvider() {
|
||||
setupSuggestions(AUTHORITY, MODE);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
|
||||
public class StartActivity extends Activity {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = StartActivity.class.getSimpleName();
|
||||
|
||||
private static final int CHECK_WARING = 0;
|
||||
|
||||
+12
-16
@@ -11,35 +11,31 @@
|
||||
|
||||
package com.hippo.ehviewer.cache;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Looper;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
|
||||
/**
|
||||
@@ -48,7 +44,7 @@ import com.hippo.ehviewer.util.Utils;
|
||||
public final class ImageCache {
|
||||
|
||||
private static final String TAG = ImageCache.class.getSimpleName();
|
||||
|
||||
|
||||
/**
|
||||
* Default memory cache size as a percent of device memory class
|
||||
*/
|
||||
@@ -90,8 +86,8 @@ public final class ImageCache {
|
||||
* Used to temporarily pause the disk cache while scrolling
|
||||
*/
|
||||
public boolean mPauseDiskAccess = false;
|
||||
private Object mPauseLock = new Object();
|
||||
|
||||
private final Object mPauseLock = new Object();
|
||||
|
||||
/**
|
||||
* Constructor of <code>ImageCache</code>
|
||||
*
|
||||
@@ -404,7 +400,7 @@ public final class ImageCache {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* flush() is called to synchronize up other methods that are accessing the
|
||||
* cache first
|
||||
|
||||
@@ -200,7 +200,7 @@ public class Data {
|
||||
values.put(COLUMN_REFERENCE, reference);
|
||||
|
||||
if (isInsert) { // Set
|
||||
long id = mDatabase.insert(TABLE_GALLERY, null, values);
|
||||
mDatabase.insert(TABLE_GALLERY, null, values);
|
||||
} else { // Update
|
||||
mDatabase.update(TABLE_GALLERY, values, COLUMN_GID + "=?", new String[]{String.valueOf(gid)});
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class NormalPreviewList extends PreviewList{
|
||||
int index = mTargetPage * mPi.getPreviewPerPage(); // it is display index
|
||||
int rowIndex = 0;
|
||||
for (NormalPreviewList.Row row : rowArray) {
|
||||
for (NormalPreviewList.Item item : row.itemArray) {
|
||||
for (int i = 0; i < row.itemArray.size(); i++) {
|
||||
View view = inflater.inflate(R.layout.preview_item, null);
|
||||
|
||||
((TextView)view.findViewById(R.id.text)).setText(String.valueOf(index + 1));
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.hippo.ehviewer.util.Utils;
|
||||
|
||||
public class ImageSet implements ExDownloader.ListenerForImageSet {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = ImageSet.class.getSimpleName();
|
||||
|
||||
/**
|
||||
|
||||
@@ -213,8 +213,6 @@ public abstract class UploadedTexture extends BasicTexture {
|
||||
try {
|
||||
int bWidth = bitmap.getWidth();
|
||||
int bHeight = bitmap.getHeight();
|
||||
int width = bWidth + mBorder * 2;
|
||||
int height = bHeight + mBorder * 2;
|
||||
int texWidth = getTextureWidth();
|
||||
int texHeight = getTextureHeight();
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.hippo.ehviewer.service;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
@@ -24,6 +23,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.data.Data;
|
||||
@@ -41,7 +41,9 @@ public class DownloadService extends Service
|
||||
private static final String TAG = DownloadService.class.getSimpleName();
|
||||
private static final int DOWNLOAD_NOTIFY_ID = -1;
|
||||
|
||||
public static final String ACTION_UPDATE = "com.hippo.ehviewer.service.DownloadService";
|
||||
public static final String ACTION_UPDATE = "com.hippo.ehviewer.service.DownloadService.UPDATE";
|
||||
public static final String ACTION_STOP = "com.hippo.ehviewer.service.DownloadService.STOP";
|
||||
public static final String ACTION_STOP_ALL = "com.hippo.ehviewer.service.DownloadService.STOP_ALL";
|
||||
|
||||
private Context mContext;
|
||||
private Data mData;
|
||||
@@ -50,7 +52,7 @@ public class DownloadService extends Service
|
||||
private volatile ExDownloader mCurExDownloader = null;
|
||||
private ServiceBinder mBinder = null;
|
||||
private NotificationManager mNotifyManager;
|
||||
private Notification.Builder mBuilder;
|
||||
private NotificationCompat.Builder mBuilder;
|
||||
private String mSpeedStr = null;
|
||||
|
||||
@Override
|
||||
@@ -68,6 +70,15 @@ public class DownloadService extends Service
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
if (ACTION_STOP.equals(intent.getAction())) {
|
||||
stopCurrentTask();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
} else if (ACTION_STOP_ALL.equals(intent.getAction())) {
|
||||
stopAll();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
}
|
||||
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@@ -156,6 +167,11 @@ public class DownloadService extends Service
|
||||
}
|
||||
}
|
||||
|
||||
public void stopCurrentTask() {
|
||||
if (mCurDownloadInfo != null)
|
||||
stop(mCurDownloadInfo);
|
||||
}
|
||||
|
||||
public void startAll() {
|
||||
for (DownloadInfo di : mData.getAllDownloads()) {
|
||||
if (di.state == DownloadInfo.STATE_NONE ||
|
||||
@@ -214,16 +230,26 @@ public class DownloadService extends Service
|
||||
if (mBuilder != null)
|
||||
return;
|
||||
|
||||
mBuilder = new Notification.Builder(mContext);
|
||||
mBuilder = new NotificationCompat.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(false).setAutoCancel(false);
|
||||
mBuilder.setOngoing(true).setAutoCancel(false);
|
||||
|
||||
// Add action
|
||||
Intent stopIntent = new Intent(this, DownloadService.class);
|
||||
stopIntent.setAction(ACTION_STOP);
|
||||
PendingIntent piStop = PendingIntent.getService(this, 0, stopIntent, 0);
|
||||
mBuilder.addAction(R.drawable.ic_clear2, getString(R.string.stop), piStop);
|
||||
|
||||
Intent stopAllIntent = new Intent(this, DownloadService.class);
|
||||
stopAllIntent.setAction(ACTION_STOP_ALL);
|
||||
PendingIntent piStopAll = PendingIntent.getService(this, 0, stopAllIntent, 0);
|
||||
mBuilder.addAction(R.drawable.ic_clear, getString(R.string.stop_all), piStopAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onStart(int gid) {
|
||||
if (mCurDownloadInfo == null)
|
||||
return;
|
||||
@@ -236,14 +262,13 @@ public class DownloadService extends Service
|
||||
mBuilder.setContentTitle(getString(R.string.start_download) + " " + gid)
|
||||
.setContentText(null)
|
||||
.setProgress(0, 0, true);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
mNotifyManager.cancel(gid);
|
||||
|
||||
notifyUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onDownload(int gid, int downloadSize, int totalSize) {
|
||||
if (mCurDownloadInfo == null)
|
||||
return;
|
||||
@@ -256,13 +281,12 @@ public class DownloadService extends Service
|
||||
mBuilder.setContentTitle(getString(R.string.downloading) + " " + gid)
|
||||
.setContentText(mSpeedStr)
|
||||
.setProgress(totalSize, downloadSize, false);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
|
||||
notifyUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onUpdateSpeed(int gid, int speed) {
|
||||
if (mCurDownloadInfo == null)
|
||||
return;
|
||||
@@ -276,19 +300,18 @@ public class DownloadService extends Service
|
||||
.setContentText(mSpeedStr)
|
||||
.setProgress(mCurDownloadInfo.total, mCurDownloadInfo.download,
|
||||
mCurDownloadInfo.total == -1 ? true :false);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.getNotification());
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
|
||||
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);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
|
||||
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);
|
||||
@@ -297,7 +320,7 @@ public class DownloadService extends Service
|
||||
.setContentText(legacy == 0 ? getString(R.string.done) :
|
||||
String.format(getString(R.string.legacy_pages), legacy))
|
||||
.setOngoing(false).setAutoCancel(true);
|
||||
mNotifyManager.notify(gid, builder.getNotification());
|
||||
mNotifyManager.notify(gid, builder.build());
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
|
||||
mCurDownloadInfo.legacy = legacy;
|
||||
|
||||
@@ -41,6 +41,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.SearchRecentSuggestions;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ImageSpan;
|
||||
@@ -70,6 +71,7 @@ import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.AppHandler;
|
||||
import com.hippo.ehviewer.ImageLoader;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.SimpleSuggestionProvider;
|
||||
import com.hippo.ehviewer.UpdateHelper;
|
||||
import com.hippo.ehviewer.cardview.CardViewSalon;
|
||||
import com.hippo.ehviewer.data.Data;
|
||||
@@ -124,7 +126,9 @@ import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
* @author Hippo
|
||||
*/
|
||||
public class GalleryListActivity extends AbsGalleryActivity
|
||||
implements View.OnClickListener {
|
||||
implements View.OnClickListener, SearchView.OnQueryTextListener,
|
||||
SearchView.OnFocusChangeListener, SlidingMenu.OnOpenedListener,
|
||||
SlidingMenu.OnClosedListener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = GalleryListActivity.class.getSimpleName();
|
||||
@@ -150,10 +154,12 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
private SlidingMenu mSlidingMenu;
|
||||
private View mMenuLeft;
|
||||
private LinearLayout mUserPanel;
|
||||
private SearchView mSearchView;
|
||||
private ListView itemListMenu;
|
||||
private TagListView tagListMenu;
|
||||
|
||||
private SearchView mSearchView;
|
||||
private MenuItem mSearchItem;
|
||||
|
||||
private ImageView avatar;
|
||||
private TextView userView;
|
||||
private Button loginButton;
|
||||
@@ -837,8 +843,7 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
private void handleIntent(Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_SEARCH.equals(action)) {
|
||||
String query =
|
||||
intent.getStringExtra(SearchManager.QUERY);
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
mSearchView.setQuery(query, true);
|
||||
} else if (ACTION_GALLERY_LIST.equals(action)) {
|
||||
int mode = intent.getIntExtra(GalleryListActivity.KEY_MODE, -1);
|
||||
@@ -911,6 +916,22 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
return R.layout.gallery_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpened() {
|
||||
if (mShowDrawer) {
|
||||
setTitle(R.string.app_name);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed() {
|
||||
if (mShowDrawer) {
|
||||
setTitle(mTitle);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -938,24 +959,8 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
|
||||
mSlidingMenu.setShadowDrawable(R.drawable.shadow);
|
||||
mSlidingMenu.setSecondaryShadowDrawable(R.drawable.shadow_right);
|
||||
mSlidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {
|
||||
@Override
|
||||
public void onOpened() {
|
||||
if (mShowDrawer) {
|
||||
setTitle(R.string.app_name);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
});
|
||||
mSlidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
|
||||
@Override
|
||||
public void onClosed() {
|
||||
if (mShowDrawer) {
|
||||
setTitle(mTitle);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
});
|
||||
mSlidingMenu.setOnOpenedListener(this);
|
||||
mSlidingMenu.setOnClosedListener(this);
|
||||
if (mShowDrawer)
|
||||
mSlidingMenu.setBehindWidth(
|
||||
mResources.getDimensionPixelOffset(R.dimen.menu_width));
|
||||
@@ -1251,6 +1256,41 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
mStaggeredGridView.getPaddingRight(), paddingBottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
// Store suggestion
|
||||
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(
|
||||
GalleryListActivity.this, SimpleSuggestionProvider.AUTHORITY,
|
||||
SimpleSuggestionProvider.MODE);
|
||||
suggestions.saveRecentQuery(query, null);
|
||||
// collapse search view
|
||||
if (mSearchItem != null)
|
||||
mSearchItem.collapseActionView();
|
||||
|
||||
String t = null;
|
||||
if (query == null || query.isEmpty())
|
||||
t = getString(android.R.string.search_go);
|
||||
else
|
||||
t = query;
|
||||
|
||||
lus = new ListUrls(ListUrls.NONE, query);
|
||||
refresh();
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus && mSearchItem != null)
|
||||
mSearchItem.collapseActionView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Do not show menu when mSlidingMenu is shown
|
||||
@@ -1261,31 +1301,12 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
|
||||
SearchManager searchManager =
|
||||
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
mSearchView =
|
||||
(SearchView) menu.findItem(R.id.action_search).getActionView();
|
||||
mSearchItem = menu.findItem(R.id.action_search);
|
||||
mSearchView = (SearchView) mSearchItem.getActionView();
|
||||
mSearchView.setSearchableInfo(
|
||||
searchManager.getSearchableInfo(getComponentName()));
|
||||
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
mSearchView.clearFocus();
|
||||
String t = null;
|
||||
if (query == null || query.isEmpty())
|
||||
t = getString(android.R.string.search_go);
|
||||
else
|
||||
t = query;
|
||||
|
||||
lus = new ListUrls(ListUrls.NONE, query);
|
||||
refresh();
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
mSearchView.setOnQueryTextFocusChangeListener(this);
|
||||
|
||||
// Make search view custom look
|
||||
int searchTextID = mResources.getIdentifier("android:id/search_src_text", null, null);
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.provider.SearchRecentSuggestions;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -51,6 +52,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.SimpleSuggestionProvider;
|
||||
import com.hippo.ehviewer.UpdateHelper;
|
||||
import com.hippo.ehviewer.ehclient.EhInfo;
|
||||
import com.hippo.ehviewer.network.HttpHelper;
|
||||
@@ -295,12 +297,14 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
private static final String KEY_LIST_DEFAULT_CATEGORY = "list_default_category";
|
||||
private static final String KEY_EXCULDE_TAG_GROUP = "exculde_tag_group";
|
||||
private static final String KEY_EXCULDE_LANGUAGE = "exculde_language";
|
||||
private static final String KEY_CLEAR_SUGGESTIONS = "clear_suggestions";
|
||||
private static final String KEY_PREVIEW_MODE = "preview_mode";
|
||||
private static final String KEY_DEFAULT_FAVORITE = "default_favorite";
|
||||
|
||||
private Preference mListDefaultCategory;
|
||||
private Preference mExculdeTagGroup;
|
||||
private Preference mExculdeLanguage;
|
||||
private Preference mClearSuggestions;
|
||||
private AutoListPreference mPreviewMode;
|
||||
private ListPreference mDefaultFavorite;
|
||||
|
||||
@@ -315,6 +319,8 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
mExculdeTagGroup.setOnPreferenceClickListener(this);
|
||||
mExculdeLanguage = findPreference(KEY_EXCULDE_LANGUAGE);
|
||||
mExculdeLanguage.setOnPreferenceClickListener(this);
|
||||
mClearSuggestions = findPreference(KEY_CLEAR_SUGGESTIONS);
|
||||
mClearSuggestions.setOnPreferenceClickListener(this);
|
||||
mPreviewMode = (AutoListPreference)findPreference(KEY_PREVIEW_MODE);
|
||||
mPreviewMode.setOnPreferenceChangeListener(this);
|
||||
mDefaultFavorite = (ListPreference)findPreference(KEY_DEFAULT_FAVORITE);
|
||||
@@ -394,6 +400,11 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
EhInfo.getInstance(mActivity).setExculdeLanguage(newValue);
|
||||
}
|
||||
}).create().show();
|
||||
|
||||
} else if (KEY_CLEAR_SUGGESTIONS.equals(key)) {
|
||||
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(mActivity,
|
||||
SimpleSuggestionProvider.AUTHORITY, SimpleSuggestionProvider.MODE);
|
||||
suggestions.clearHistory();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -449,20 +460,20 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
|
||||
private static final String KEY_CUSTOM_CODEC = "custom_codec";
|
||||
|
||||
private Preference mCustomCodec;
|
||||
private CheckBoxPreference mCustomCodec;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.read_settings);
|
||||
|
||||
mCustomCodec = findPreference(KEY_CUSTOM_CODEC);
|
||||
mCustomCodec = (CheckBoxPreference) findPreference(KEY_CUSTOM_CODEC);
|
||||
if (!Utils.SUPPORT_IMAGE) {
|
||||
mCustomCodec.setEnabled(false);
|
||||
mCustomCodec.setDefaultValue(false);
|
||||
mCustomCodec.setChecked(Config.getCustomCodec());
|
||||
mCustomCodec.setSummary(R.string.custom_codec_summary_not);
|
||||
} else {
|
||||
mCustomCodec.setDefaultValue(true);
|
||||
mCustomCodec.setChecked(Config.getCustomCodec());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.hippo.ehviewer.util;
|
||||
|
||||
public class AutoExpandArray<E> {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = AutoExpandArray.class.getSimpleName();
|
||||
|
||||
private static final int MIN_CAPACITY_INCREMENT = 12;
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Environment;
|
||||
@@ -37,29 +35,31 @@ import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class FileExplorerView extends ListView
|
||||
implements AdapterView.OnItemClickListener {
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = "FileExplorerView";
|
||||
|
||||
|
||||
private static final File PARENT_DIR = null;
|
||||
private static final String PARENT_DIR_NAME = "..";
|
||||
|
||||
|
||||
private static final DirFileFilter dff = new DirFileFilter();
|
||||
private static final FileSort fs = new FileSort();
|
||||
|
||||
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private Filter mFilter;
|
||||
private static final Filter[] sFilterArray = { Filter.ALL,
|
||||
Filter.DIR};
|
||||
|
||||
|
||||
private File mCurDir;
|
||||
|
||||
|
||||
private BaseAdapter mAdapter;
|
||||
private List<File> mFileList;
|
||||
|
||||
|
||||
public enum Filter {
|
||||
ALL(0),
|
||||
DIR(1);
|
||||
@@ -70,34 +70,34 @@ public class FileExplorerView extends ListView
|
||||
|
||||
final int nativeInt;
|
||||
}
|
||||
|
||||
|
||||
public FileExplorerView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
|
||||
public FileExplorerView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs, 0);
|
||||
}
|
||||
|
||||
|
||||
public FileExplorerView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
|
||||
private void init(Context context, AttributeSet attrs, int defStyle) {
|
||||
mContext = context;
|
||||
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.FileExplorerView, defStyle, 0);
|
||||
|
||||
|
||||
int modeIndex = a.getInt(R.styleable.FileExplorerView_filter, 0);
|
||||
if (modeIndex >=0 && modeIndex < sFilterArray.length)
|
||||
mFilter = sFilterArray[modeIndex];
|
||||
else
|
||||
mFilter = Filter.ALL;
|
||||
|
||||
|
||||
String path = a.getString(R.styleable.FileExplorerView_path);
|
||||
if (path != null) {
|
||||
mCurDir = new File(path);
|
||||
@@ -107,21 +107,21 @@ public class FileExplorerView extends ListView
|
||||
if (mCurDir == null)
|
||||
// TODO what if no sdcard
|
||||
mCurDir = Environment.getExternalStorageDirectory();
|
||||
|
||||
|
||||
a.recycle();
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
private void init(Context context) {
|
||||
mContext = context;
|
||||
|
||||
|
||||
mFilter = Filter.ALL;
|
||||
mCurDir = Environment.getExternalStorageDirectory();
|
||||
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
mFileList = new ArrayList<File>();
|
||||
getDirList();
|
||||
@@ -129,15 +129,15 @@ public class FileExplorerView extends ListView
|
||||
setAdapter(mAdapter);
|
||||
setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
private void getDirList() {
|
||||
|
||||
|
||||
File[] files = null;
|
||||
if (mFilter == Filter.DIR)
|
||||
files = mCurDir.listFiles(dff);
|
||||
else
|
||||
files = mCurDir.listFiles();
|
||||
|
||||
|
||||
mFileList.clear();
|
||||
if (mCurDir.getParent() != null)
|
||||
mFileList.add(PARENT_DIR);
|
||||
@@ -148,7 +148,7 @@ public class FileExplorerView extends ListView
|
||||
// sort
|
||||
Collections.sort(mFileList, fs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reget dir list and go to top in the list
|
||||
*/
|
||||
@@ -158,7 +158,7 @@ public class FileExplorerView extends ListView
|
||||
// Go to top
|
||||
setSelection(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set mode
|
||||
* @param mode
|
||||
@@ -167,7 +167,7 @@ public class FileExplorerView extends ListView
|
||||
mFilter = mode;
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param path The path you want to set for current path
|
||||
* @return True if the path is refer to a directory
|
||||
@@ -176,12 +176,12 @@ public class FileExplorerView extends ListView
|
||||
File dir = new File(path);
|
||||
if (!dir.isDirectory())
|
||||
return false;
|
||||
|
||||
|
||||
mCurDir = dir;
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* True if current dir can write
|
||||
* @return
|
||||
@@ -189,7 +189,7 @@ public class FileExplorerView extends ListView
|
||||
public boolean canWrite() {
|
||||
return mCurDir.canWrite();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current path
|
||||
* @return
|
||||
@@ -197,20 +197,20 @@ public class FileExplorerView extends ListView
|
||||
public String getCurPath() {
|
||||
return mCurDir.getPath();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position,
|
||||
long id) {
|
||||
File newFile;
|
||||
File file = mFileList.get(position);
|
||||
if (file == PARENT_DIR)
|
||||
if (file == PARENT_DIR)
|
||||
newFile = mCurDir.getParentFile();
|
||||
else
|
||||
newFile = file;
|
||||
mCurDir = newFile;
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
class FileAdapter extends BaseAdapter {
|
||||
LayoutInflater mInflater = LayoutInflater.from(mContext);
|
||||
@Override
|
||||
@@ -231,8 +231,8 @@ public class FileExplorerView extends ListView
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null)
|
||||
convertView = mInflater.inflate(R.layout.file_explorer_item, null);
|
||||
|
||||
convertView = mInflater.inflate(R.layout.file_explorer_item, parent, false);
|
||||
|
||||
TextView tv = (TextView)convertView.findViewById(R.id.text);
|
||||
File file = mFileList.get(position);
|
||||
String name;
|
||||
@@ -241,18 +241,18 @@ public class FileExplorerView extends ListView
|
||||
else
|
||||
name = file.getName();
|
||||
tv.setText(name);
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class DirFileFilter implements FileFilter {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.isDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class FileSort implements Comparator<File> {
|
||||
@Override
|
||||
public int compare(File lhs, File rhs) {
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
@@ -32,26 +31,28 @@ import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ProgressDialogBulider extends DialogBuilder{
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class ProgressDialogBulider extends DialogBuilder {
|
||||
|
||||
/** Creates a ProgressDialog with a circular, spinning progress
|
||||
* bar. This is not the default.
|
||||
*/
|
||||
public static final int STYLE_SPINNER = 0;
|
||||
|
||||
|
||||
/** Creates a ProgressDialog with a horizontal progress bar.
|
||||
*/
|
||||
public static final int STYLE_HORIZONTAL = 1;
|
||||
|
||||
|
||||
private ProgressBar mProgress;
|
||||
private TextView mMessageView;
|
||||
|
||||
|
||||
private int mProgressStyle = STYLE_HORIZONTAL;
|
||||
private TextView mProgressNumber;
|
||||
private String mProgressNumberFormat;
|
||||
private TextView mProgressPercent;
|
||||
private NumberFormat mProgressPercentFormat;
|
||||
|
||||
|
||||
private int mMax;
|
||||
private int mProgressVal;
|
||||
private int mSecondaryProgressVal;
|
||||
@@ -61,24 +62,24 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
private Drawable mIndeterminateDrawable;
|
||||
private CharSequence mMessage;
|
||||
private boolean mIndeterminate;
|
||||
|
||||
private boolean mHasStarted = true;
|
||||
|
||||
private final boolean mHasStarted = true;
|
||||
private Handler mViewUpdateHandler;
|
||||
|
||||
|
||||
private void initFormats() {
|
||||
mProgressNumberFormat = "%1d/%2d";
|
||||
mProgressPercentFormat = NumberFormat.getPercentInstance();
|
||||
mProgressPercentFormat.setMaximumFractionDigits(0);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
public ProgressDialogBulider(Context context) {
|
||||
super(context);
|
||||
|
||||
|
||||
initFormats();
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
if (mProgressStyle == STYLE_HORIZONTAL) {
|
||||
|
||||
|
||||
/* Use a separate handler to update the text views as they
|
||||
* must be updated on the same thread that created them.
|
||||
*/
|
||||
@@ -86,7 +87,7 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
|
||||
/* Update the number and percent */
|
||||
int progress = mProgress.getProgress();
|
||||
int max = mProgress.getMax();
|
||||
@@ -145,14 +146,14 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
setIndeterminate(mIndeterminate);
|
||||
onProgressChanged();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
public AlertDialog create() {
|
||||
mHasStarted = true;
|
||||
return super.create();
|
||||
}*/
|
||||
|
||||
|
||||
public ProgressDialogBulider setProgress(int value) {
|
||||
if (mHasStarted) {
|
||||
mProgress.setProgress(value);
|
||||
@@ -255,7 +256,7 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
}
|
||||
return mIndeterminate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ProgressDialogBulider setMessage(CharSequence message) {
|
||||
if (mProgress != null) {
|
||||
@@ -269,7 +270,7 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void setProgressStyle(int style) {
|
||||
mProgressStyle = style;
|
||||
}
|
||||
@@ -299,7 +300,7 @@ public class ProgressDialogBulider extends DialogBuilder{
|
||||
mProgressPercentFormat = format;
|
||||
onProgressChanged();
|
||||
}
|
||||
|
||||
|
||||
private void onProgressChanged() {
|
||||
if (mProgressStyle == STYLE_HORIZONTAL) {
|
||||
if (mViewUpdateHandler != null && !mViewUpdateHandler.hasMessages(0)) {
|
||||
|
||||
@@ -112,8 +112,10 @@ public class RippleSprite extends Sprite {
|
||||
mOuterRadius = ((float) Math.sqrt(halfWidth * halfWidth
|
||||
+ halfHeight * halfHeight));
|
||||
|
||||
//mStartingX = mBounds.exactCenterX();
|
||||
//mStartingY = mBounds.exactCenterY();
|
||||
if (!mKeepBound) {
|
||||
mStartingX = mBounds.exactCenterX();
|
||||
mStartingY = mBounds.exactCenterY();
|
||||
}
|
||||
clampStartingPosition();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ import com.hippo.ehviewer.util.ViewUtils;
|
||||
|
||||
public final class WindowsAnimate
|
||||
implements View.OnTouchListener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = WindowsAnimate.class.getSimpleName();
|
||||
|
||||
private static final TimeInterpolator ACCELERATE_INTERPOLATOR = new AccelerateInterpolator();
|
||||
|
||||
Reference in new issue
Block a user