添加检测登陆状态按钮
This commit is contained in:
1 parent
57419fd8d1
commit
6137e851cd
9 files changed
+74
-45
No files matched your search
Binary file not shown.
@@ -86,20 +86,21 @@ int drawable unknown 0x7f020029
|
||||
int drawable welcome 0x7f02002a
|
||||
int drawable western 0x7f02002b
|
||||
int id action 0x7f06003d
|
||||
int id action_download 0x7f060088
|
||||
int id action_favourite 0x7f060087
|
||||
int id action_jump 0x7f06008b
|
||||
int id action_refresh 0x7f06008a
|
||||
int id action_search 0x7f060089
|
||||
int id action_settings 0x7f06008c
|
||||
int id action_download 0x7f060089
|
||||
int id action_favourite 0x7f060088
|
||||
int id action_jump 0x7f06008c
|
||||
int id action_refresh 0x7f06008b
|
||||
int id action_search 0x7f06008a
|
||||
int id action_settings 0x7f06008d
|
||||
int id alignBounds 0x7f060002
|
||||
int id alignMargins 0x7f060003
|
||||
int id app_start_view 0x7f060085
|
||||
int id autoCompleteTextView1 0x7f060082
|
||||
int id app_start_view 0x7f060086
|
||||
int id autoCompleteTextView1 0x7f060083
|
||||
int id bottom 0x7f060005
|
||||
int id bottom_panel 0x7f060074
|
||||
int id bottom_panel 0x7f060075
|
||||
int id button_artistcg 0x7f060041
|
||||
int id button_asianporn 0x7f060047
|
||||
int id button_check_login 0x7f06006d
|
||||
int id button_cosplay 0x7f060046
|
||||
int id button_doujinshi 0x7f06003f
|
||||
int id button_gamecg 0x7f060042
|
||||
@@ -160,22 +161,22 @@ int id fitCenter 0x7f060015
|
||||
int id fitEnd 0x7f060016
|
||||
int id fitStart 0x7f060014
|
||||
int id fitXY 0x7f060013
|
||||
int id footer_progressBar 0x7f060078
|
||||
int id footer_tip_text 0x7f060079
|
||||
int id head_arrowImageView 0x7f06007e
|
||||
int id head_contentLayout 0x7f06007d
|
||||
int id head_progressBar 0x7f06007f
|
||||
int id head_tipsTextView 0x7f060080
|
||||
int id header 0x7f060076
|
||||
int id header_arrow_image 0x7f06007a
|
||||
int id header_progressBar 0x7f06007b
|
||||
int id header_tip_text 0x7f06007c
|
||||
int id footer_progressBar 0x7f060079
|
||||
int id footer_tip_text 0x7f06007a
|
||||
int id head_arrowImageView 0x7f06007f
|
||||
int id head_contentLayout 0x7f06007e
|
||||
int id head_progressBar 0x7f060080
|
||||
int id head_tipsTextView 0x7f060081
|
||||
int id header 0x7f060077
|
||||
int id header_arrow_image 0x7f06007b
|
||||
int id header_progressBar 0x7f06007c
|
||||
int id header_tip_text 0x7f06007d
|
||||
int id horizontal 0x7f060000
|
||||
int id info 0x7f06003c
|
||||
int id is_exhentai 0x7f060068
|
||||
int id left 0x7f060006
|
||||
int id list 0x7f060035
|
||||
int id list_button_logout 0x7f06006f
|
||||
int id list_button_logout 0x7f060070
|
||||
int id list_jump_edit 0x7f060058
|
||||
int id list_jump_sum 0x7f060056
|
||||
int id list_jump_to 0x7f060057
|
||||
@@ -185,10 +186,10 @@ int id list_menu_list 0x7f060064
|
||||
int id list_menu_login 0x7f060065
|
||||
int id list_no_found 0x7f06005f
|
||||
int id list_refresh 0x7f06005d
|
||||
int id list_view 0x7f060077
|
||||
int id list_view 0x7f060078
|
||||
int id list_wait_first 0x7f06005c
|
||||
int id list_wait_login 0x7f06006d
|
||||
int id list_wait_logout 0x7f060070
|
||||
int id list_wait_login 0x7f06006e
|
||||
int id list_wait_logout 0x7f060071
|
||||
int id manga_detail 0x7f06001a
|
||||
int id manga_detail_normal 0x7f06001d
|
||||
int id manga_detail_offensive 0x7f06001e
|
||||
@@ -201,31 +202,31 @@ int id negative_button 0x7f060036
|
||||
int id neutral_button 0x7f060037
|
||||
int id page_list 0x7f06002c
|
||||
int id pager 0x7f06006b
|
||||
int id paper_list_gridLayout 0x7f060071
|
||||
int id paper_list_wait 0x7f060072
|
||||
int id paper_list_gridLayout 0x7f060072
|
||||
int id paper_list_wait 0x7f060073
|
||||
int id password 0x7f06006a
|
||||
int id positive_button 0x7f060038
|
||||
int id preview_button_refresh 0x7f060073
|
||||
int id preview_num 0x7f060075
|
||||
int id preview_button_refresh 0x7f060074
|
||||
int id preview_num 0x7f060076
|
||||
int id progressBar 0x7f06003b
|
||||
int id rate 0x7f060063
|
||||
int id remove 0x7f060083
|
||||
int id remove 0x7f060084
|
||||
int id right 0x7f060007
|
||||
int id sadpanda 0x7f06005e
|
||||
int id scroll_view 0x7f060032
|
||||
int id search_bar 0x7f060081
|
||||
int id search_bar 0x7f060082
|
||||
int id search_text 0x7f060049
|
||||
int id set_name_edit 0x7f060084
|
||||
int id set_name_edit 0x7f060085
|
||||
int id spinner_min_rating 0x7f060055
|
||||
int id start 0x7f060010
|
||||
int id text_username 0x7f06006e
|
||||
int id text_username 0x7f06006f
|
||||
int id thumb 0x7f06003a
|
||||
int id title 0x7f060031
|
||||
int id top 0x7f060004
|
||||
int id type 0x7f060062
|
||||
int id username 0x7f060069
|
||||
int id vertical 0x7f060001
|
||||
int id wait_message 0x7f060086
|
||||
int id wait_message 0x7f060087
|
||||
int layout detail 0x7f030000
|
||||
int layout detail_normal 0x7f030001
|
||||
int layout detail_offensive 0x7f030002
|
||||
@@ -271,6 +272,7 @@ int string advance_search_left 0x7f0a00a5
|
||||
int string app_name 0x7f0a0000
|
||||
int string cache_large 0x7f0a006d
|
||||
int string changelog 0x7f0a0089
|
||||
int string check_login 0x7f0a0009
|
||||
int string checkbox_advance 0x7f0a0012
|
||||
int string checkbox_sdesc 0x7f0a0015
|
||||
int string checkbox_sdt1 0x7f0a0018
|
||||
@@ -283,7 +285,6 @@ int string checkbox_sto 0x7f0a0017
|
||||
int string checkbox_storr 0x7f0a0016
|
||||
int string checking_update 0x7f0a0029
|
||||
int string create_cache_error 0x7f0a006f
|
||||
int string dailog_check_login 0x7f0a0009
|
||||
int string dailog_check_network 0x7f0a0005
|
||||
int string dailog_network_error_no 0x7f0a0007
|
||||
int string dailog_network_error_yes 0x7f0a0006
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -10,9 +10,20 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="100dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:onClick="buttonLogin"
|
||||
android:text="@string/login" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_check_login"
|
||||
style="@style/Button.White"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="120dp"
|
||||
android:onClick="buttonCheckLogin"
|
||||
android:text="@string/check_login" />
|
||||
|
||||
<ProgressBar
|
||||
style="@android:style/Widget.Holo.ProgressBar.Large"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<string name="exit_tip">再按一次退出</string>
|
||||
|
||||
<!-- Login -->
|
||||
<string name="dailog_check_login">检查登陆状态</string>
|
||||
<string name="check_login">检查登陆状态</string>
|
||||
<string name="toast_login_succeeded">登陆成功</string>
|
||||
<string name="toast_login_failed">登陆失败</string>
|
||||
<string name="dialog_title_login_or_not">是否登陆</string>
|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
<string name="exit_tip">Click again to exit</string>
|
||||
|
||||
<!-- Login -->
|
||||
<string name="dailog_check_login">Checking login status</string>
|
||||
<string name="check_login">Checking login status</string>
|
||||
<string name="toast_login_succeeded">Login succeeded</string>
|
||||
<string name="toast_login_failed">Login failed</string>
|
||||
<string name="dialog_title_login_or_not">Login or not</string>
|
||||
<string name="dialog_messgae_login_or_not">What are the benefits of login ?</string>
|
||||
<string name="not_login">Do not login</string>
|
||||
|
||||
|
||||
<string name="toast_logout_succeeded">Logout succeeded</string>
|
||||
<string name="toast_logout_failed">Logout failed</string>
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Util;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.util.LruCache;
|
||||
import android.util.Log;
|
||||
|
||||
public class ImageLoadManager {
|
||||
|
||||
private static final String TAG = "ImageLoadManager";
|
||||
private class LoadTask {
|
||||
public LoadImageView liv;
|
||||
public boolean download;
|
||||
@@ -24,6 +26,7 @@ public class ImageLoadManager {
|
||||
this.download = download;
|
||||
}
|
||||
}
|
||||
private Context mContext;
|
||||
|
||||
private final Stack<LoadTask> mLoadCacheTask;
|
||||
private ImageDownloadManager mImageDownloadTask;
|
||||
@@ -43,11 +46,12 @@ public class ImageLoadManager {
|
||||
}
|
||||
};
|
||||
|
||||
public ImageLoadManager(LruCache<String, Bitmap> memoryCache,
|
||||
public ImageLoadManager(Context context, LruCache<String, Bitmap> memoryCache,
|
||||
DiskCache diskCache) {
|
||||
mLoadCacheTask = new Stack<LoadTask>();
|
||||
mImageDownloadTask = new ImageDownloadManager();
|
||||
|
||||
mContext = context;
|
||||
mMemoryCache = memoryCache;
|
||||
mDiskCache = diskCache;
|
||||
}
|
||||
@@ -99,6 +103,7 @@ public class ImageLoadManager {
|
||||
}
|
||||
|
||||
private class ImageDownloadManager {
|
||||
|
||||
private static final int MAX_DOWNLOAD_THREADS = 3;
|
||||
|
||||
private final Stack<LoadTask> mDownloadTask;
|
||||
@@ -138,6 +143,7 @@ public class ImageLoadManager {
|
||||
Message msg = new Message();
|
||||
msg.obj = loadTask;
|
||||
if (bitmap == null) {
|
||||
Log.d(TAG, mContext.getString(httpHelper.getLastEMsgId()));
|
||||
loadTask.bitmap = Ui.BITMAP_TOUCH;
|
||||
liv.setState(LoadImageView.FAIL);
|
||||
liv.setOnClickListener(ImageLoadManager.this);
|
||||
|
||||
@@ -88,6 +88,7 @@ public class MangaListActivity extends Activity {
|
||||
private ViewGroup loginView;
|
||||
private ViewGroup loginOverView;
|
||||
private Button loginButton;
|
||||
private Button checkLoginButton;
|
||||
private View waitloginView;
|
||||
private TextView usernameText;
|
||||
private Button logoutButton;
|
||||
@@ -1035,7 +1036,7 @@ public class MangaListActivity extends Activity {
|
||||
longClickDialog = createLongClickDialog();
|
||||
|
||||
//
|
||||
mImageLoadManager = new ImageLoadManager(Cache.memoryCache, Cache.cpCache);
|
||||
mImageLoadManager = new ImageLoadManager(getApplicationContext(), Cache.memoryCache, Cache.cpCache);
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@@ -1058,6 +1059,7 @@ public class MangaListActivity extends Activity {
|
||||
sadpanda = (ImageView) findViewById(R.id.sadpanda);
|
||||
loginView = (ViewGroup) findViewById(R.id.drawer_login);
|
||||
loginButton = (Button) findViewById(R.id.button_login);
|
||||
checkLoginButton = (Button) findViewById(R.id.button_check_login);
|
||||
waitloginView = (View) findViewById(R.id.list_wait_login);
|
||||
loginOverView = (ViewGroup) findViewById(R.id.drawer_login_over);
|
||||
usernameText = (TextView) findViewById(R.id.text_username);
|
||||
@@ -1272,18 +1274,13 @@ public class MangaListActivity extends Activity {
|
||||
});
|
||||
|
||||
setTitle(String.format(getString(R.string.some_page), visiblePage + 1));
|
||||
layoutDrawRight();
|
||||
|
||||
pullListView.setVisibility(View.GONE);
|
||||
waitView.setVisibility(View.VISIBLE);
|
||||
freshButton.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
|
||||
loginView.setVisibility(View.VISIBLE);
|
||||
loginOverView.setVisibility(View.GONE);
|
||||
loginButton.setVisibility(View.VISIBLE);
|
||||
waitloginView.setVisibility(View.GONE);
|
||||
layoutDrawRight();
|
||||
|
||||
// Check update
|
||||
checkUpdate();
|
||||
@@ -1405,6 +1402,7 @@ public class MangaListActivity extends Activity {
|
||||
private void checkLogin(boolean force) {
|
||||
if (Config.isLogin() || force) {
|
||||
loginButton.setVisibility(View.GONE);
|
||||
checkLoginButton.setVisibility(View.GONE);
|
||||
waitloginView.setVisibility(View.VISIBLE);
|
||||
EhClient.checkLogin(new EhClient.OnCheckLoginListener() {
|
||||
@Override
|
||||
@@ -1419,6 +1417,10 @@ public class MangaListActivity extends Activity {
|
||||
@Override
|
||||
public void onFailure(int errorMessageId) {
|
||||
loginButton.setVisibility(View.VISIBLE);
|
||||
if (Config.isLogin())
|
||||
checkLoginButton.setVisibility(View.VISIBLE);
|
||||
else
|
||||
checkLoginButton.setVisibility(View.GONE);
|
||||
waitloginView.setVisibility(View.GONE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(errorMessageId),
|
||||
@@ -1441,6 +1443,10 @@ public class MangaListActivity extends Activity {
|
||||
loginOverView.setVisibility(View.GONE);
|
||||
|
||||
loginButton.setVisibility(View.VISIBLE);
|
||||
if (Config.isLogin())
|
||||
checkLoginButton.setVisibility(View.VISIBLE);
|
||||
else
|
||||
checkLoginButton.setVisibility(View.GONE);
|
||||
waitloginView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
@@ -1507,6 +1513,10 @@ public class MangaListActivity extends Activity {
|
||||
loginDialog.show();
|
||||
}
|
||||
|
||||
public void buttonCheckLogin(View v) {
|
||||
checkLogin(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user