改用 ActionBar Pull
This commit is contained in:
1 parent
05dae37a28
commit
f5f7489093
32 files changed
+1249
-840
No files matched your search
+1
-1
@@ -37,7 +37,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:theme="@style/AppTheme.ListActivity" >
|
||||
android:theme="@style/AppTheme.ListActivity.PullList" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:theme="@style/AppTheme.ListActivity" >
|
||||
android:theme="@style/AppTheme.ListActivity.PullList" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,4 @@
|
||||
/com
|
||||
/fr
|
||||
/uk
|
||||
/.gitignore
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,4 @@
|
||||
/com
|
||||
/fr
|
||||
/uk
|
||||
/.gitignore
|
||||
+2
-1
@@ -14,4 +14,5 @@
|
||||
target=android-19
|
||||
#proguard.config=E:/Android/android-sdk/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
android.library.reference.1=..\\..\\..\\code\\SlidingMenu\\library
|
||||
android.library.reference.2=../../../code/SystemBarTint/library
|
||||
android.library.reference.2=..\\..\\..\\code\\SystemBarTint\\library
|
||||
android.library.reference.3=../../../code/ActionBar-PullToRefresh/library/src/main
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.PullListView
|
||||
<com.hippo.ehviewer.widget.HfListView
|
||||
android:id="@+id/list_list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:divider="@null"
|
||||
android:layout_height="fill_parent" />
|
||||
|
||||
<!--
|
||||
android:divider="@null"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:cacheColorHint="@color/main_background"
|
||||
android:clipToPadding="false"
|
||||
android:fitsSystemWindows="true" />
|
||||
|
||||
android:fitsSystemWindows="true" -->
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/list_wait_first"
|
||||
style="@style/ProgressBar.Large"
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<integer-array name="refresh_colors">
|
||||
<item>@color/refresh_color_1</item>
|
||||
<item>@color/refresh_color_2</item>
|
||||
<item>@color/refresh_color_3</item>
|
||||
<item>@color/refresh_color_4</item>
|
||||
</integer-array>
|
||||
|
||||
<color name="refresh_color_1">#3e802f</color>
|
||||
<color name="refresh_color_2">#427fed</color>
|
||||
<color name="refresh_color_3">#b23424</color>
|
||||
<color name="refresh_color_4">#f4b400</color>
|
||||
|
||||
<color name="ab_bg">@android:color/holo_blue_dark</color>
|
||||
<color name="main_background">#ffe5e5e5</color>
|
||||
<color name="holo_blue_light_light">#ff81d3f7</color>
|
||||
|
||||
@@ -94,6 +94,17 @@
|
||||
<item name="android:maxHeight">76dip</item>
|
||||
</style>
|
||||
|
||||
<style name="RefreshSmoothProgressBar" parent="SmoothProgressBar">
|
||||
<item name="spb_stroke_separator_length">0dp</item>
|
||||
<item name="spb_sections_count">2</item>
|
||||
<item name="spb_speed">1.7</item>
|
||||
<item name="spb_interpolator">spb_interpolator_acceleratedecelerate</item>
|
||||
<item name="spb_mirror_mode">true</item>
|
||||
<item name="spb_reversed">true</item>
|
||||
<item name="spb_colors">@array/refresh_colors</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Text -->
|
||||
<style name="CardTitle">
|
||||
<item name="android:textColor">@color/title_primary</item>
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
<item name="android:windowBackground">@color/main_background</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.ListActivity.PullList">
|
||||
<item name="ptrPullText">@string/pull_load_pull</item>
|
||||
<item name="ptrRefreshingText">@string/pull_load_doing</item>
|
||||
<item name="ptrReleaseText">@string/pull_load_release</item>
|
||||
|
||||
<item name="ptrProgressBarColor">@android:color/holo_orange_dark</item>
|
||||
<item name="ptrSmoothProgressBarStyle">@style/RefreshSmoothProgressBar</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for start activity -->
|
||||
<style name="AppTheme.NoActionBar.Transparent">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
|
||||
@@ -57,7 +57,7 @@ public class MangaActivity extends Activity {
|
||||
|
||||
private RelativeLayout mainView;
|
||||
|
||||
private String gid;
|
||||
private int gid;
|
||||
private String title;
|
||||
|
||||
private int retryTimes = 0;
|
||||
@@ -292,13 +292,13 @@ public class MangaActivity extends Activity {
|
||||
Intent intent = getIntent();
|
||||
firstPage = intent.getIntExtra("firstPage", 0);
|
||||
lastPage = firstPage;
|
||||
gid = intent.getStringExtra("gid");
|
||||
gid = intent.getIntExtra("gid", 0);
|
||||
title = intent.getStringExtra("title");
|
||||
mFolder = new File(Config.getDownloadPath(), StringEscapeUtils.escapeHtml4(title));
|
||||
if (mFolder.isFile())
|
||||
mFolder.delete();
|
||||
mFolder.mkdirs();
|
||||
pageSum = Integer.parseInt(intent.getStringExtra("pageSum"));
|
||||
pageSum = intent.getIntExtra("pageSum", 0);
|
||||
|
||||
mImageSet = new ImageSet(this, gid, mFolder, pageSum, firstPage, lastPage, null);
|
||||
GalleryView isv = new GalleryView(getApplicationContext(), mImageSet, firstPage);
|
||||
|
||||
@@ -604,19 +604,7 @@ public class MangaDetailActivity extends Activity {
|
||||
rateButton = (Button)findViewById(R.id.detail_do_rate);
|
||||
|
||||
// TODO
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window win = getWindow();
|
||||
WindowManager.LayoutParams winParams = win.getAttributes();
|
||||
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
winParams.flags |= bits;
|
||||
win.setAttributes(winParams);
|
||||
}
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(this);
|
||||
tintManager.setStatusBarTintEnabled(true);
|
||||
tintManager.setStatusBarTintResource(android.R.color.holo_blue_dark);
|
||||
tintManager.setNavigationBarTintEnabled(true);
|
||||
tintManager.setNavigationBarAlpha(0.0f);
|
||||
Ui.translucent(this);
|
||||
|
||||
setTitle(String.valueOf(mangaDetail.gid));
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class MangaDownloadActivity extends Activity {
|
||||
|
||||
Intent intent = getIntent();
|
||||
String title = intent.getStringExtra(KEY_TITLE);
|
||||
String gid = intent.getStringExtra(KEY_GID);
|
||||
int gid = intent.getIntExtra(KEY_GID, 0);
|
||||
int size = intent.getIntExtra(KEY_SIZE, 1);
|
||||
int endIndex = intent.getIntExtra(KEY_END_INDEX, 0);
|
||||
GLRootView glrv= (GLRootView)findViewById(R.id.gl_root_view);
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
|
||||
import uk.co.senab.actionbarpulltorefresh.library.listeners.OnRefreshListener;
|
||||
|
||||
import com.hippo.ehviewer.AppContext;
|
||||
import com.hippo.ehviewer.BeautifyScreen;
|
||||
import com.hippo.ehviewer.ImageLoadManager;
|
||||
@@ -28,15 +31,15 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Util;
|
||||
import com.hippo.ehviewer.view.AlertButton;
|
||||
import com.hippo.ehviewer.view.CheckImage;
|
||||
import com.hippo.ehviewer.view.GetPaddingRelativeLayout;
|
||||
import com.hippo.ehviewer.view.TagListView;
|
||||
import com.hippo.ehviewer.view.TagsAdapter;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FswListView;
|
||||
import com.hippo.ehviewer.widget.GetPaddingRelativeLayout;
|
||||
import com.hippo.ehviewer.widget.HfListView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.PullListView;
|
||||
import com.hippo.ehviewer.widget.OnfitSystemWindowsListener;
|
||||
import com.hippo.ehviewer.widget.SuperDialogUtil;
|
||||
import com.hippo.ehviewer.widget.PullListView.OnFooterRefreshListener;
|
||||
import com.hippo.ehviewer.widget.PullListView.OnHeaderRefreshListener;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
@@ -44,6 +47,7 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.SearchManager;
|
||||
import android.content.Context;
|
||||
@@ -51,6 +55,7 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -81,10 +86,39 @@ import android.widget.Toast;
|
||||
// TODO check visiblePage is right or not
|
||||
// TODO http://lofi.e-hentai.org/
|
||||
|
||||
public class MangaListActivity extends SlidingActivity {
|
||||
@SuppressWarnings("unused")
|
||||
/*
|
||||
*
|
||||
* Footer 显示产生的 refresh 手动 pull 显示产生的 refresh 按键或其他产生的 refresh
|
||||
* | | |
|
||||
* | | |
|
||||
* ∨ ∨ ∨
|
||||
* 触发 onFootRefresh 触发 onRefreshStart setHeaderRefresh(true)
|
||||
* | | |
|
||||
* |<---------------------------------|-----------------------------|
|
||||
* ∨
|
||||
* set listUrl
|
||||
* set getMode
|
||||
* |
|
||||
* |
|
||||
* ∨
|
||||
* getList
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Make sure when getting list pulllistview is refreshing
|
||||
*
|
||||
* @author Hippo
|
||||
*/
|
||||
public class MangaListActivity extends Activity {
|
||||
private static String TAG = "MangaListActivity";
|
||||
|
||||
private static final int REFRESH = 0x0;
|
||||
private static final int NEXT_PAGE = 0x1;
|
||||
private static final int PRE_PAGE = 0x2;
|
||||
private static final int SOMEWHERE = 0x3;
|
||||
private static final int SET_POSITION = 0x8000;
|
||||
|
||||
private AppContext mAppContext;
|
||||
private EhClient mEhClient;
|
||||
|
||||
@@ -93,7 +127,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
private TagListView listMenu;
|
||||
private RelativeLayout loginMenu;
|
||||
private ListView isExhentaiList;
|
||||
private PullListView pullListView;
|
||||
private HfListView mHlv;
|
||||
private FswListView mMainList;
|
||||
private View waitView;
|
||||
private Button freshButton;
|
||||
private View noFoundView;
|
||||
@@ -121,9 +156,6 @@ public class MangaListActivity extends SlidingActivity {
|
||||
private Data mData;
|
||||
|
||||
private int longClickItemIndex;
|
||||
|
||||
private boolean mListFirst = true;
|
||||
private boolean mLoadListOver = false;
|
||||
|
||||
private AlertDialog loginDialog;
|
||||
private AlertDialog filterDialog;
|
||||
@@ -148,15 +180,12 @@ public class MangaListActivity extends SlidingActivity {
|
||||
|
||||
private String mTitle;
|
||||
|
||||
private class RefreshPackage {
|
||||
public ListUrls listUrls;
|
||||
public String title;
|
||||
|
||||
public RefreshPackage(ListUrls listUrls, String title) {
|
||||
this.listUrls = listUrls;
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
private int mGetMode;
|
||||
|
||||
private int mFswPaddingLeft;
|
||||
private int mFswPaddingTop;
|
||||
private int mFswPaddingRight;
|
||||
private int mFswPaddingBottom;
|
||||
|
||||
private DownloadServiceConnection mServiceConn = new DownloadServiceConnection();
|
||||
|
||||
@@ -230,15 +259,22 @@ public class MangaListActivity extends SlidingActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
showContent();
|
||||
ListUrls listUrls = getLus(filterDialog);
|
||||
String search = listUrls.getSearch();
|
||||
|
||||
// TODO
|
||||
//showContent();
|
||||
|
||||
|
||||
lus = getLus(filterDialog);
|
||||
String search = lus.getSearch();
|
||||
String t = null;
|
||||
if (search == null || search.isEmpty())
|
||||
t = getString(android.R.string.search_go);
|
||||
else
|
||||
t = getString(android.R.string.search_go) + " " + search;
|
||||
refresh(listUrls, t);
|
||||
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
unTriggerGetPage(0);
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -416,6 +452,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
.setView(view, true)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try{
|
||||
@@ -425,25 +462,17 @@ public class MangaListActivity extends SlidingActivity {
|
||||
((AlertButton)v).dialog.dismiss(); // Just jump there
|
||||
int position = (targetPage - firstPage) *
|
||||
lus.getNumPerPage();
|
||||
pullListView.setSelectionFromTop(position, -1);
|
||||
setMainListPosition(position);
|
||||
} else{
|
||||
ListUrls listUrls = lus.clone();
|
||||
if (listUrls.setPage(targetPage)) {
|
||||
if (lus.setPage(targetPage)) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
mListFirst = true;
|
||||
mLoadListOver = false;
|
||||
|
||||
waitView.setVisibility(View.GONE);
|
||||
freshButton.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
if (pullListView.clickHeaderRefresh(new RefreshPackage(listUrls, mTitle)))
|
||||
pullListView.setHeaderString(
|
||||
"下拉加载...",
|
||||
"释放加载...",
|
||||
"正在加载...",
|
||||
"完成加载",
|
||||
"取消加载"); // TODO
|
||||
|
||||
unTriggerGetPage(targetPage, true, true);
|
||||
} else {
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
getString(R.string.toast_invalid_page),
|
||||
@@ -719,18 +748,11 @@ public class MangaListActivity extends SlidingActivity {
|
||||
spinnerMinRating.setSelection(index);
|
||||
}
|
||||
|
||||
private class MangaListGetPackage {
|
||||
public long stamp;
|
||||
public ListUrls targetListUrls;
|
||||
public boolean setPosition;
|
||||
public String title;
|
||||
public MangaListGetPackage(long stamp, ListUrls targetListUrls,
|
||||
boolean setPosition, String title) {
|
||||
this.stamp = stamp;
|
||||
this.targetListUrls = targetListUrls;
|
||||
this.setPosition = setPosition;
|
||||
this.title = title;
|
||||
}
|
||||
private void setMainListPosition(int position) {
|
||||
if (position == 0)
|
||||
mMainList.setSelectionFromTop(position, mFswPaddingTop);
|
||||
else
|
||||
mMainList.setSelectionFromTop(position, 0);
|
||||
}
|
||||
|
||||
private class MangaListGetListener implements
|
||||
@@ -738,94 +760,93 @@ public class MangaListActivity extends SlidingActivity {
|
||||
@Override
|
||||
public void onSuccess(Object checkFlag, ArrayList<GalleryInfo> newLmdArray,
|
||||
int indexPerPage, int maxPage) {
|
||||
MangaListGetPackage getPackage = (MangaListGetPackage)checkFlag;
|
||||
if (getPackage.stamp != lastGetStamp)
|
||||
return;
|
||||
lus = getPackage.targetListUrls;
|
||||
mTitle = getPackage.title;
|
||||
|
||||
// Check no Found view later
|
||||
waitView.setVisibility(View.GONE);
|
||||
freshButton.setVisibility(View.GONE);
|
||||
|
||||
if (maxPage == 0) { // If No hits found
|
||||
mLoadListOver = false;
|
||||
|
||||
pullListView.setVisibility(View.GONE);
|
||||
mHlv.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.VISIBLE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
setTitle(R.string.no_found);
|
||||
lmdArray.clear();
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
} else if (maxPage == -1) { //panda
|
||||
mLoadListOver = false;
|
||||
|
||||
pullListView.setVisibility(View.GONE);
|
||||
mHlv.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.VISIBLE);
|
||||
setTitle(R.string.sadpanda);
|
||||
lmdArray.clear();
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
mLoadListOver = true;
|
||||
|
||||
pullListView.setVisibility(View.VISIBLE);
|
||||
mHlv.setVisibility(View.VISIBLE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
|
||||
// Set indexPerPage and maxPage
|
||||
lus.setNumPerPage(indexPerPage);
|
||||
lus.setMax(maxPage);
|
||||
|
||||
// Check refresh or get more
|
||||
int getPageIndex = lus.getPage();
|
||||
if (getPageIndex == 0 && firstPage == 0) { // Refresh
|
||||
switch (mGetMode & (~SET_POSITION)) {
|
||||
case REFRESH:
|
||||
firstPage = 0;
|
||||
lastPage = 0;
|
||||
lmdArray.clear();
|
||||
lmdArray.addAll(newLmdArray);
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
|
||||
// Get visible page
|
||||
// set visible page
|
||||
firstIndex = 0;
|
||||
lastIndex = newLmdArray.size() - 1;
|
||||
visiblePage = 0;
|
||||
|
||||
// set title
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
|
||||
// Go to top
|
||||
pullListView.setSelection(0);
|
||||
} else if (getPageIndex == firstPage - 1) { // Get last page
|
||||
firstPage = getPageIndex;
|
||||
// set main list positon
|
||||
setMainListPosition(0);
|
||||
break;
|
||||
case PRE_PAGE:
|
||||
firstPage -= 1;
|
||||
lmdArray.addAll(0, newLmdArray);
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
|
||||
if (getPackage.setPosition) {
|
||||
// set position if necessary and set visible page
|
||||
if ((mGetMode & SET_POSITION) != 0) {
|
||||
firstIndex = 0;
|
||||
lastIndex = newLmdArray.size()-1;
|
||||
visiblePage = getPageIndex;
|
||||
visiblePage = lus.getPage();
|
||||
|
||||
setMainListPosition(0);
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
// Go to top
|
||||
pullListView.setSelection(0);
|
||||
} else {
|
||||
firstIndex += newLmdArray.size();
|
||||
lastIndex += newLmdArray.size();
|
||||
// Stay there
|
||||
pullListView.setSelectionFromTop(pullListView.getFirstVisiblePosition() + newLmdArray.size(), -1);
|
||||
|
||||
setMainListPosition(
|
||||
mMainList.getFirstVisiblePosition() + newLmdArray.size());
|
||||
}
|
||||
} else if (getPageIndex == lastPage + 1) { // Get next page
|
||||
lastPage = getPageIndex;
|
||||
break;
|
||||
case NEXT_PAGE:
|
||||
lastPage += 1;
|
||||
lmdArray.addAll(newLmdArray);
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
|
||||
if (getPackage.setPosition) { // Go to next page top
|
||||
// set position if necessary and set visible page
|
||||
if ((mGetMode & SET_POSITION) != 0) {
|
||||
firstIndex = lmdArray.size() - newLmdArray.size();
|
||||
lastIndex = lmdArray.size() - 1;
|
||||
visiblePage = getPageIndex;
|
||||
visiblePage = lus.getPage();
|
||||
|
||||
setMainListPosition(firstIndex);
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
pullListView.setSelectionFromTop(firstIndex, -1);
|
||||
}
|
||||
} else if (getPageIndex < firstPage - 1 ||
|
||||
getPageIndex > lastPage + 1){ // Jump somewhere
|
||||
firstPage = getPageIndex;
|
||||
lastPage = getPageIndex;
|
||||
break;
|
||||
case SOMEWHERE:
|
||||
firstPage = lus.getPage();
|
||||
lastPage = lus.getPage();
|
||||
lmdArray.clear();
|
||||
lmdArray.addAll(newLmdArray);
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
@@ -833,87 +854,58 @@ public class MangaListActivity extends SlidingActivity {
|
||||
// Get visible page
|
||||
firstIndex = 0;
|
||||
lastIndex = newLmdArray.size();
|
||||
visiblePage = getPageIndex;
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
visiblePage = lus.getPage();
|
||||
|
||||
// Go to top
|
||||
pullListView.setSelection(0);
|
||||
setMainListPosition(0);
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Reset pullListView
|
||||
if (pullListView.isHeaderRefreshing())
|
||||
pullListView.onHeaderRefreshComplete();
|
||||
else if (pullListView.isFooterRefreshing())
|
||||
pullListView.onFooterRefreshComplete(true);
|
||||
if (lus.getPage() == lus.getMax() - 1)
|
||||
pullListView.setActionWhenShow(false);
|
||||
|
||||
// Reset pull string
|
||||
setHeaderPullString();
|
||||
mHlv.setAnyRefreshComplete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Object checkFlag, String eMsg) {
|
||||
MangaListGetPackage getPackage = (MangaListGetPackage)checkFlag;
|
||||
if (getPackage.stamp != lastGetStamp)
|
||||
return;
|
||||
|
||||
// Check pull list view later
|
||||
// Check fresh view later
|
||||
waitView.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
|
||||
int getPageIndex = getPackage.targetListUrls.getPage();
|
||||
|
||||
if (getPageIndex == 0 && firstPage == 0) { // Refresh
|
||||
mLoadListOver = false;
|
||||
// Only show freshButton
|
||||
pullListView.setVisibility(View.GONE);
|
||||
switch (mGetMode & (~SET_POSITION)) {
|
||||
case REFRESH:
|
||||
mHlv.setVisibility(View.GONE);
|
||||
freshButton.setVisibility(View.VISIBLE);
|
||||
Toast.makeText(MangaListActivity.this,
|
||||
eMsg, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
lmdArray.clear();
|
||||
gmlAdapter.notifyDataSetChanged();
|
||||
} else {// List is not empty
|
||||
// Only show freshButton
|
||||
break;
|
||||
|
||||
default:
|
||||
freshButton.setVisibility(View.GONE);
|
||||
Toast.makeText(
|
||||
MangaListActivity.this,
|
||||
eMsg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
}
|
||||
|
||||
// Reset pullListView
|
||||
if (pullListView.isHeaderRefreshing())
|
||||
pullListView.onHeaderRefreshComplete();
|
||||
else if (pullListView.isFooterRefreshing())
|
||||
pullListView.onFooterRefreshComplete(false);
|
||||
}
|
||||
|
||||
private void setHeaderPullString() {
|
||||
if (firstPage == 0)
|
||||
pullListView.setHeaderString(getString(R.string.pull_refresh_pull),
|
||||
getString(R.string.pull_refresh_release),
|
||||
getString(R.string.pull_refresh_doing),
|
||||
getString(R.string.pull_refresh_done),
|
||||
getString(R.string.pull_refresh_cancel));
|
||||
else
|
||||
pullListView.setHeaderString(getString(R.string.pull_pre_pull),
|
||||
getString(R.string.pull_pre_release),
|
||||
getString(R.string.pull_pre_doing),
|
||||
getString(R.string.pull_pre_done),
|
||||
getString(R.string.pull_pre_cancel));
|
||||
mHlv.setAnyRefreshComplete(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class MangaListListener implements ListView.OnScrollListener {
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem,
|
||||
int visibleItemCount, int totalItemCount) {
|
||||
pullListView.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
|
||||
mHlv.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
|
||||
|
||||
/*
|
||||
// First time when list is created
|
||||
if (mListFirst && mLoadListOver) {
|
||||
// load image
|
||||
@@ -929,6 +921,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
}
|
||||
mListFirst = false;
|
||||
}
|
||||
*/
|
||||
|
||||
if (lus == null || visibleItemCount < 2)
|
||||
return;
|
||||
@@ -951,6 +944,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
/*
|
||||
|
||||
// When srcoll over load image in view
|
||||
int getChildCount;
|
||||
if (scrollState == SCROLL_STATE_IDLE
|
||||
@@ -965,6 +960,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,8 +1005,9 @@ public class MangaListActivity extends SlidingActivity {
|
||||
((ViewGroup)convertView).addView(thumb, 0, lp);
|
||||
}
|
||||
thumb.setLoadInfo(lmd.thumb, String.valueOf(lmd.gid));
|
||||
mImageLoadManager.add(thumb, false);
|
||||
|
||||
//mImageLoadManager.add(thumb, false);
|
||||
mImageLoadManager.add(thumb, true);
|
||||
|
||||
// Set manga name
|
||||
TextView name = (TextView) convertView.findViewById(R.id.name);
|
||||
name.setText(lmd.title);
|
||||
@@ -1040,10 +1037,6 @@ public class MangaListActivity extends SlidingActivity {
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
/*
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
BeautifyScreen.fixColour(this);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1054,12 +1047,14 @@ public class MangaListActivity extends SlidingActivity {
|
||||
setRequestedOrientation(screenOri);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.list);
|
||||
|
||||
/*
|
||||
|
||||
setBehindContentView(R.layout.list_menu_list);
|
||||
setSlidingActionBarEnabled(false);
|
||||
mSlidingMenu = getSlidingMenu();
|
||||
@@ -1085,7 +1080,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
mAppContext = (AppContext)getApplication();
|
||||
mData = mAppContext.getData();
|
||||
mEhClient = mAppContext.getEhClient();
|
||||
@@ -1094,6 +1089,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
if (screenOri != getRequestedOrientation())
|
||||
setRequestedOrientation(screenOri);
|
||||
|
||||
Ui.translucent(this);
|
||||
|
||||
// Download service
|
||||
Intent it = new Intent(MangaListActivity.this, DownloadService.class);
|
||||
bindService(it, mServiceConn, BIND_AUTO_CREATE);
|
||||
@@ -1115,28 +1112,12 @@ public class MangaListActivity extends SlidingActivity {
|
||||
mImageLoadManager = new ImageLoadManager(getApplicationContext(), Cache.memoryCache, Cache.cpCache);
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window win = getWindow();
|
||||
WindowManager.LayoutParams winParams = win.getAttributes();
|
||||
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
winParams.flags |= bits;
|
||||
win.setAttributes(winParams);
|
||||
}
|
||||
|
||||
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(this);
|
||||
tintManager.setStatusBarTintEnabled(true);
|
||||
tintManager.setStatusBarTintResource(android.R.color.holo_blue_dark);
|
||||
tintManager.setNavigationBarTintEnabled(true);
|
||||
tintManager.setNavigationBarAlpha(0.0f);
|
||||
|
||||
|
||||
// Get View
|
||||
listMenu = (TagListView) findViewById(R.id.list_menu_list);
|
||||
loginMenu = (RelativeLayout)findViewById(R.id.list_menu_login);
|
||||
isExhentaiList = (ListView)findViewById(R.id.is_exhentai);
|
||||
pullListView = ((PullListView)findViewById(R.id.list_list));
|
||||
mHlv = (HfListView)findViewById(R.id.list_list);
|
||||
mMainList = mHlv.getListView();
|
||||
waitView = (View) findViewById(R.id.list_wait_first);
|
||||
freshButton = (Button) findViewById(R.id.list_refresh);
|
||||
noFoundView = (View) findViewById(R.id.list_no_found);
|
||||
@@ -1165,6 +1146,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
for (int i = 0; i < keys.size(); i++)
|
||||
listMenuTitle.add(keys.get(i));
|
||||
tagsAdapter = new TagsAdapter(this, R.layout.menu_item, listMenuTitle);
|
||||
|
||||
/*
|
||||
listMenu.setAdapter(tagsAdapter);
|
||||
listMenu.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
listMenu.setStableItemCount(mStableItemCount);
|
||||
@@ -1174,23 +1157,29 @@ public class MangaListActivity extends SlidingActivity {
|
||||
int position, long arg3) {
|
||||
if (position == 0) { // Home page
|
||||
if (refresh(new ListUrls(ListUrls.ALL_TYPE, null, 0), listMenuTitle.get(position)))
|
||||
showContent();
|
||||
// TODO
|
||||
//showContent();
|
||||
;
|
||||
} else if (position == 1) { // Favourite
|
||||
Intent intent = new Intent(MangaListActivity.this,
|
||||
FavouriteActivity.class);
|
||||
startActivity(intent);
|
||||
showContent();
|
||||
// TODO
|
||||
//showContent();
|
||||
} else if (position == 2) { // filter
|
||||
filterDialog.show();
|
||||
} else if (position == 3) { // Download
|
||||
Intent intent = new Intent(MangaListActivity.this,
|
||||
DownloadActivity.class);
|
||||
startActivity(intent);
|
||||
showContent();
|
||||
// TODO
|
||||
//showContent();
|
||||
} else if (position >= mStableItemCount){
|
||||
ListUrls listUrls = mData.getTag(position - mStableItemCount);
|
||||
if (listUrls != null && refresh(listUrls, listMenuTitle.get(position)))
|
||||
showContent();
|
||||
// TODO
|
||||
//showContent();
|
||||
;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1221,7 +1210,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
mData.deleteTag(position - mStableItemCount);
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
// is Exhentai
|
||||
final String[] isExhentaiListTitle = getResources().getStringArray(R.array.is_exhentai);
|
||||
@@ -1263,6 +1252,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
return tv;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
isExhentaiList.setAdapter(isExhentaiListAdapter);
|
||||
isExhentaiList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
@@ -1279,64 +1270,65 @@ public class MangaListActivity extends SlidingActivity {
|
||||
if (isChanged) {
|
||||
isExhentaiListAdapter.notifyDataSetChanged();
|
||||
refresh(new ListUrls(ListUrls.ALL_TYPE, null, 0), listMenuTitle.get(0));
|
||||
showContent(); // TODO
|
||||
// TODO
|
||||
//showContent(); // TODO
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
// Pull list view
|
||||
pullListView.setOnRefreshListener(new OnHeaderRefreshListener() {
|
||||
// Setup ActionBarPullToRefresh
|
||||
ActionBarPullToRefresh.from(this)
|
||||
.listener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefreshStarted(View view) {
|
||||
if (firstPage != 0) {
|
||||
lus.setPage(firstPage - 1);
|
||||
mGetMode = PRE_PAGE;
|
||||
getList();
|
||||
} else {
|
||||
lus.setPage(0);
|
||||
mGetMode = REFRESH;
|
||||
getList();
|
||||
}
|
||||
}
|
||||
})
|
||||
.setup(mHlv);
|
||||
mHlv.setOnFooterRefreshListener(new HfListView.OnFooterRefreshListener() {
|
||||
@Override
|
||||
public void onHeaderRefresh() {
|
||||
mListFirst = true;
|
||||
mLoadListOver = false;
|
||||
ListUrls listUrls = lus.clone();
|
||||
if (firstPage == 0)
|
||||
listUrls.setPage(0);
|
||||
else
|
||||
listUrls.setPage(firstPage - 1);
|
||||
mEhClient.getMangaList(listUrls.getUrl(),
|
||||
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()), listUrls, false, mTitle),
|
||||
new MangaListGetListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeaderRefresh(Object obj) {
|
||||
mListFirst = true;
|
||||
mLoadListOver = false;
|
||||
RefreshPackage rp = (RefreshPackage)obj;
|
||||
mEhClient.getMangaList(rp.listUrls.getUrl(),
|
||||
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()),
|
||||
rp.listUrls, true, rp.title),
|
||||
new MangaListGetListener());
|
||||
}
|
||||
});
|
||||
|
||||
pullListView.setOnFooterRefreshListener(new OnFooterRefreshListener() {
|
||||
@Override
|
||||
public void onFooterRefresh() {
|
||||
ListUrls listUrls = lus.clone();
|
||||
if (listUrls.setPage(lastPage + 1)) {
|
||||
mListFirst = true;
|
||||
mLoadListOver = false;
|
||||
mEhClient.getMangaList(listUrls.getUrl(),
|
||||
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()), listUrls, false, mTitle),
|
||||
new MangaListGetListener());
|
||||
public boolean onFooterRefresh() {
|
||||
if (lus.pageUp()) {
|
||||
mGetMode = NEXT_PAGE;
|
||||
getList();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
pullListView.onFooterRefreshComplete(true, false);
|
||||
}
|
||||
});
|
||||
pullListView.setFooterString(getString(R.string.footer_loading),
|
||||
mMainList.setOnfitSystemWindowsListener(new OnfitSystemWindowsListener() {
|
||||
public void onfitSystemWindows(int paddingLeft,
|
||||
int paddingTop, int paddingRight, int paddingBottom) {
|
||||
mFswPaddingLeft = paddingLeft;
|
||||
mFswPaddingTop = paddingTop;
|
||||
mFswPaddingRight = paddingRight;
|
||||
mFswPaddingBottom = paddingBottom;
|
||||
}
|
||||
});
|
||||
mHlv.setFooterString(getString(R.string.footer_loading),
|
||||
getString(R.string.footer_loaded),
|
||||
getString(R.string.footer_fail));
|
||||
|
||||
// Listview
|
||||
gmlAdapter = new GmlAdapter();
|
||||
pullListView.setAdapter(gmlAdapter);
|
||||
pullListView.setOnScrollListener(new MangaListListener());
|
||||
pullListView.setOnItemClickListener(new OnItemClickListener() {
|
||||
mMainList.setDivider(null);
|
||||
mMainList.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mMainList.setFitsSystemWindows(true);
|
||||
mMainList.setClipToPadding(false);
|
||||
mMainList.setAdapter(gmlAdapter);
|
||||
mMainList.setOnScrollListener(new MangaListListener());
|
||||
mMainList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1,
|
||||
int position, long arg3) {
|
||||
@@ -1348,7 +1340,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
pullListView.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
mMainList.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
|
||||
int position, long arg3) {
|
||||
@@ -1358,7 +1350,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
}
|
||||
});
|
||||
|
||||
pullListView.setVisibility(View.GONE);
|
||||
mHlv.setVisibility(View.GONE);
|
||||
waitView.setVisibility(View.VISIBLE);
|
||||
freshButton.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
@@ -1374,9 +1366,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
|
||||
// get MangeList
|
||||
mTitle = listMenuTitle.get(0);
|
||||
refresh(lus.clone(), listMenuTitle.get(0));
|
||||
|
||||
setTitle(String.format(getString(R.string.list_title), mTitle, visiblePage + 1));
|
||||
unTriggerGetPage(0, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1402,7 +1393,12 @@ public class MangaListActivity extends SlidingActivity {
|
||||
t = getString(android.R.string.search_go);
|
||||
else
|
||||
t = getString(android.R.string.search_go) + " " + query;
|
||||
refresh(new ListUrls(ListUrls.ALL_TYPE, query), t);
|
||||
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
lus = new ListUrls(ListUrls.ALL_TYPE, query);
|
||||
unTriggerGetPage(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -1431,6 +1427,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
// If the nav drawer is open, hide action items related to the content view
|
||||
@@ -1441,6 +1438,7 @@ public class MangaListActivity extends SlidingActivity {
|
||||
menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
*/
|
||||
|
||||
// Double click back exit
|
||||
@Override
|
||||
@@ -1461,16 +1459,20 @@ public class MangaListActivity extends SlidingActivity {
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (mSlidingMenu.isMenuShowing())
|
||||
showContent();
|
||||
else
|
||||
showMenu();
|
||||
// TODO
|
||||
// if (mSlidingMenu.isMenuShowing())
|
||||
// TODO
|
||||
//showContent();
|
||||
// TODO
|
||||
// else
|
||||
// TODO
|
||||
//showMenu();
|
||||
return true;
|
||||
case R.id.action_refresh: // TODO 点击刷新,pullviewheader 不会自动出来
|
||||
refresh(lus.clone(), listMenuTitle.get(0));
|
||||
unTriggerGetPage(0);
|
||||
return true;
|
||||
case R.id.action_jump:
|
||||
if (mLoadListOver)
|
||||
if (!mHlv.isAnyRefreshing() && isGetOk())
|
||||
jump();
|
||||
return true;
|
||||
case R.id.action_settings:
|
||||
@@ -1482,7 +1484,11 @@ public class MangaListActivity extends SlidingActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isGetOk() {
|
||||
return mHlv.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -1549,6 +1555,8 @@ public class MangaListActivity extends SlidingActivity {
|
||||
}
|
||||
|
||||
private void checkLogin(boolean force) {
|
||||
/*
|
||||
|
||||
if (Config.isLogin() || force) {
|
||||
loginButton.setVisibility(View.GONE);
|
||||
checkLoginButton.setVisibility(View.GONE);
|
||||
@@ -1577,9 +1585,12 @@ public class MangaListActivity extends SlidingActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void layoutDrawRight() {
|
||||
/*
|
||||
|
||||
if (mEhClient.isLogin()) { // If have login
|
||||
loginView.setVisibility(View.GONE);
|
||||
loginOverView.setVisibility(View.VISIBLE);
|
||||
@@ -1598,40 +1609,42 @@ public class MangaListActivity extends SlidingActivity {
|
||||
checkLoginButton.setVisibility(View.GONE);
|
||||
waitloginView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private boolean refresh(ListUrls listUrls, String title) {
|
||||
listUrls.setPage(0);
|
||||
boolean re = pullListView.clickHeaderRefresh(new RefreshPackage(listUrls, title));
|
||||
if (re) {
|
||||
mListFirst = true;
|
||||
mLoadListOver = false;
|
||||
|
||||
// Make sure callback while think it is refresh
|
||||
firstPage = 0;
|
||||
lastPage = 0;
|
||||
|
||||
if (lmdArray.size() == 0)
|
||||
waitView.setVisibility(View.VISIBLE);
|
||||
else
|
||||
waitView.setVisibility(View.GONE);
|
||||
|
||||
freshButton.setVisibility(View.GONE);
|
||||
noFoundView.setVisibility(View.GONE);
|
||||
sadpanda.setVisibility(View.GONE);
|
||||
|
||||
pullListView.setHeaderString(
|
||||
getString(R.string.pull_load_pull),
|
||||
getString(R.string.pull_load_release),
|
||||
getString(R.string.pull_load_doing),
|
||||
getString(R.string.pull_load_done),
|
||||
getString(R.string.pull_load_cancel));
|
||||
}
|
||||
return re;
|
||||
private void getList() {
|
||||
mEhClient.getMangaList(lus.getUrl(),
|
||||
null,
|
||||
new MangaListGetListener());
|
||||
}
|
||||
|
||||
|
||||
public void unTriggerGetPage(int page) {
|
||||
unTriggerGetPage(page, false, true);
|
||||
}
|
||||
|
||||
public void unTriggerGetPage(int page, boolean isSetPosition, boolean isShowProgress) {
|
||||
if (!mHlv.isAnyRefreshing()) {
|
||||
lus.setPage(page);
|
||||
|
||||
if (isShowProgress) {
|
||||
mHlv.setRefreshing(true);
|
||||
}
|
||||
|
||||
if (page == firstPage - 1)
|
||||
mGetMode = PRE_PAGE;
|
||||
else if (page == lastPage + 1)
|
||||
mGetMode = NEXT_PAGE;
|
||||
else
|
||||
mGetMode = SOMEWHERE;
|
||||
if (isSetPosition)
|
||||
mGetMode |= SET_POSITION;
|
||||
getList();
|
||||
}
|
||||
}
|
||||
|
||||
public void buttonRefresh(View arg0) {
|
||||
refresh(lus.clone(), listMenuTitle.get(0));
|
||||
unTriggerGetPage(0);
|
||||
}
|
||||
|
||||
public void buttonLogout(View paramView) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.SuperDialogUtil;
|
||||
import com.hippo.ehviewer.network.Downloader;
|
||||
import com.hippo.ehviewer.preference.AutoListPreference;
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
@@ -38,7 +39,10 @@ import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.support.v4.util.LruCache;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
@@ -72,9 +76,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
BeautifyScreen.fixColour(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,13 +98,27 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
setRequestedOrientation(screenOri);
|
||||
|
||||
mContext = getApplicationContext();
|
||||
|
||||
// Colourfy Screen
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
BeautifyScreen.ColourfyScreen(this);
|
||||
this.getListView().setFitsSystemWindows(true);
|
||||
|
||||
// Tint
|
||||
ListView listView = getListView();
|
||||
listView.setFitsSystemWindows(true);
|
||||
listView.setClipToPadding(false);
|
||||
// TODO
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window win = getWindow();
|
||||
WindowManager.LayoutParams winParams = win.getAttributes();
|
||||
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
winParams.flags |= bits;
|
||||
win.setAttributes(winParams);
|
||||
}
|
||||
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(this);
|
||||
tintManager.setStatusBarTintEnabled(true);
|
||||
tintManager.setStatusBarTintResource(android.R.color.holo_blue_dark);
|
||||
tintManager.setNavigationBarTintEnabled(true);
|
||||
tintManager.setNavigationBarAlpha(0.0f);
|
||||
|
||||
|
||||
// Set PreferenceActivity
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
package com.hippo.ehviewer.gallery.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
|
||||
import com.hippo.ehviewer.service.DownloadService;
|
||||
|
||||
public class DownloadImageSet extends ImageSet {
|
||||
|
||||
public DownloadImageSet(Context context, String gid, File folder, int size,
|
||||
int startIndex, int endIndex, Set<Integer> failIndexSet) {
|
||||
super(context, gid, folder, size, startIndex, endIndex, failIndexSet);
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DownloadService.ACTION_UPDATE);
|
||||
mContext.registerReceiver(mReceiver, filter);
|
||||
}
|
||||
|
||||
public void unregisterReceiver() {
|
||||
mContext.unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver(){
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String gid;
|
||||
if(intent.getAction().equals(DownloadService.ACTION_UPDATE)
|
||||
&& (gid = intent.getStringExtra(DownloadService.KEY_GID)) != null
|
||||
&& gid.equals(mGid)) {
|
||||
int index = intent.getIntExtra(DownloadService.KEY_INDEX, -1);
|
||||
int state = intent.getIntExtra(DownloadService.KEY_STATE, -1);
|
||||
if (index != -1 && state != -1) {
|
||||
changeState(index, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
package com.hippo.ehviewer.gallery.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
|
||||
import com.hippo.ehviewer.service.DownloadService;
|
||||
|
||||
public class DownloadImageSet extends ImageSet {
|
||||
|
||||
public DownloadImageSet(Context context, int gid, File folder, int size,
|
||||
int startIndex, int endIndex, Set<Integer> failIndexSet) {
|
||||
super(context, gid, folder, size, startIndex, endIndex, failIndexSet);
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DownloadService.ACTION_UPDATE);
|
||||
mContext.registerReceiver(mReceiver, filter);
|
||||
}
|
||||
|
||||
public void unregisterReceiver() {
|
||||
mContext.unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver(){
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String gid;
|
||||
if(intent.getAction().equals(DownloadService.ACTION_UPDATE)
|
||||
&& (gid = intent.getStringExtra(DownloadService.KEY_GID)) != null
|
||||
&& gid.equals(mGid)) {
|
||||
int index = intent.getIntExtra(DownloadService.KEY_INDEX, -1);
|
||||
int state = intent.getIntExtra(DownloadService.KEY_STATE, -1);
|
||||
if (index != -1 && state != -1) {
|
||||
changeState(index, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class ImageSet {
|
||||
public static final int STATE_FAIL = 3;
|
||||
|
||||
protected Context mContext;
|
||||
protected String mGid;
|
||||
protected int mGid;
|
||||
protected File mFolder;
|
||||
protected int mSize;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ImageSet {
|
||||
}
|
||||
|
||||
// [startIndex, endIndex)
|
||||
public ImageSet(Context context, String gid, File folder, int size, int startIndex, int endIndex,
|
||||
public ImageSet(Context context, int gid, File folder, int size, int startIndex, int endIndex,
|
||||
Set<Integer> failIndexSet) {
|
||||
|
||||
if (folder == null || !folder.isDirectory())
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.hippo.ehviewer.util;
|
||||
|
||||
import com.hippo.ehviewer.ListUrls;
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -15,6 +17,8 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -315,4 +319,21 @@ public class Ui {
|
||||
}
|
||||
child.measure(childWidthSpec, childHeightSpec);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
public static void translucent(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window win = activity.getWindow();
|
||||
WindowManager.LayoutParams winParams = win.getAttributes();
|
||||
winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
win.setAttributes(winParams);
|
||||
}
|
||||
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
|
||||
tintManager.setStatusBarTintEnabled(true);
|
||||
tintManager.setStatusBarTintResource(R.color.ab_bg);
|
||||
tintManager.setNavigationBarTintEnabled(true);
|
||||
tintManager.setNavigationBarAlpha(0.0f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class FswListView extends ListView {
|
||||
|
||||
private OnfitSystemWindowsListener mListener;
|
||||
|
||||
public FswListView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
public FswListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
public FswListView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public void setOnfitSystemWindowsListener(OnfitSystemWindowsListener l) {
|
||||
mListener = l;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fitSystemWindows(Rect insets) {
|
||||
boolean re = super.fitSystemWindows(insets);
|
||||
if (mListener != null)
|
||||
mListener.onfitSystemWindows(getPaddingLeft(), getPaddingTop(),
|
||||
getPaddingRight(), getPaddingBottom());
|
||||
return re;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.hippo.ehviewer.view;
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout;
|
||||
|
||||
/**
|
||||
* TODO disable pull refreshing when footer refreshing
|
||||
*
|
||||
* @author Hippo
|
||||
*
|
||||
*/
|
||||
public class HfListView extends PullToRefreshLayout
|
||||
implements AbsListView.OnScrollListener {
|
||||
|
||||
private final static int FOOTER_REFRESHING = 0;
|
||||
private final static int FOOTER_SUCCESS = 1;
|
||||
private final static int FOOTER_FAIL = 2;
|
||||
|
||||
private Context mContext;
|
||||
private FswListView mListView;
|
||||
|
||||
private View mFooter;
|
||||
private TextView mFooterTipTextView;
|
||||
private ProgressBar mFooterProgressBar;
|
||||
private int footerState = FOOTER_SUCCESS;
|
||||
private OnFooterRefreshListener mFooterRefreshListener;
|
||||
|
||||
// Footer String to show
|
||||
private String mFooterRefreshStr;
|
||||
private String mFooterSuccessStr;
|
||||
private String mFooterFailStr;
|
||||
|
||||
public HfListView(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
init();
|
||||
}
|
||||
|
||||
public HfListView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public HfListView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mContext = context;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mListView = new FswListView(mContext);
|
||||
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
addView(mListView, lp);
|
||||
|
||||
mListView.setOnScrollListener(this);
|
||||
mFooter = (LinearLayout)LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.pull_list_view_footer, null);
|
||||
mFooterTipTextView = (TextView)mFooter.findViewById(R.id.footer_tip_text);
|
||||
mFooterProgressBar = (ProgressBar)mFooter.findViewById(R.id.footer_progressBar);
|
||||
mFooter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isAnyRefreshing() && footerState == FOOTER_FAIL)
|
||||
footerRefresh();
|
||||
}
|
||||
});
|
||||
changeFooterViewByState();
|
||||
mListView.addFooterView(mFooter);
|
||||
}
|
||||
|
||||
public FswListView getListView() {
|
||||
return mListView;
|
||||
}
|
||||
|
||||
public void setOnFooterRefreshListener(OnFooterRefreshListener l) {
|
||||
mFooterRefreshListener = l;
|
||||
}
|
||||
|
||||
private void footerRefresh() {
|
||||
if (mFooterRefreshListener.onFooterRefresh()) {
|
||||
footerState = FOOTER_REFRESHING;
|
||||
changeFooterViewByState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set footer UI String
|
||||
*
|
||||
* @param refreshStr
|
||||
* @param successStr
|
||||
* @param failStr
|
||||
*/
|
||||
public void setFooterString(String refreshStr, String successStr, String failStr) {
|
||||
mFooterRefreshStr = refreshStr;
|
||||
mFooterSuccessStr = successStr;
|
||||
mFooterFailStr = failStr;
|
||||
|
||||
switch (footerState) {
|
||||
case FOOTER_REFRESHING:
|
||||
mFooterTipTextView.setText(mFooterRefreshStr);
|
||||
break;
|
||||
case FOOTER_SUCCESS:
|
||||
mFooterTipTextView.setText(mFooterSuccessStr);
|
||||
break;
|
||||
case FOOTER_FAIL:
|
||||
mFooterTipTextView.setText(mFooterFailStr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh footer UI
|
||||
*/
|
||||
private void changeFooterViewByState() {
|
||||
switch (footerState) {
|
||||
case FOOTER_REFRESHING:
|
||||
mFooterTipTextView.setText(mFooterRefreshStr);
|
||||
mFooterProgressBar.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case FOOTER_SUCCESS:
|
||||
mFooterTipTextView.setText(mFooterSuccessStr);
|
||||
mFooterProgressBar.setVisibility(View.GONE);
|
||||
break;
|
||||
case FOOTER_FAIL:
|
||||
mFooterTipTextView.setText(mFooterFailStr);
|
||||
mFooterProgressBar.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setHeaderRefreshComplete() {
|
||||
super.setRefreshComplete();
|
||||
}
|
||||
|
||||
public void setFooterRefreshComplete(boolean isSuccess) {
|
||||
if (isSuccess)
|
||||
footerState = FOOTER_SUCCESS;
|
||||
else
|
||||
footerState = FOOTER_FAIL;
|
||||
changeFooterViewByState();
|
||||
}
|
||||
|
||||
public void setAnyRefreshComplete() {
|
||||
setAnyRefreshComplete(true);
|
||||
}
|
||||
|
||||
public void setAnyRefreshComplete(boolean isSuccess) {
|
||||
setHeaderRefreshComplete();
|
||||
setFooterRefreshComplete(isSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if actionbar is refreshing
|
||||
*/
|
||||
public boolean isHeaderRefreshing() {
|
||||
return isSetup() ? isRefreshing() : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if footer is refreshing
|
||||
*/
|
||||
public boolean isFooterRefreshing() {
|
||||
return footerState == FOOTER_REFRESHING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if actionbar or footer is refreshing
|
||||
*/
|
||||
public boolean isAnyRefreshing() {
|
||||
return isHeaderRefreshing() | isFooterRefreshing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem,
|
||||
int visibleItemCount, int totalItemCount) {
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount
|
||||
&& !isAnyRefreshing() && totalItemCount > 1)
|
||||
footerRefresh();
|
||||
}
|
||||
|
||||
public interface OnFooterRefreshListener {
|
||||
/**
|
||||
* @return True if this refresh action is vaild
|
||||
*/
|
||||
boolean onFooterRefresh();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
public interface OnfitSystemWindowsListener {
|
||||
void onfitSystemWindows(int paddingLeft,
|
||||
int paddingTop, int paddingRight, int paddingBottom);
|
||||
}
|
||||
@@ -53,6 +53,9 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
private ProgressBar mFooterProgressBar;
|
||||
|
||||
// Make sure only one pull event
|
||||
/**
|
||||
* True if Header is shown
|
||||
*/
|
||||
private boolean isHeaderRecored = false;
|
||||
private boolean isFooterRecored = false;
|
||||
|
||||
@@ -185,6 +188,9 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
headerState = HEADER_DONE;
|
||||
isHeaderRecored = false;
|
||||
isBack = false;
|
||||
|
||||
|
||||
Log.d(TAG, "cancel animation over");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -243,11 +249,7 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
final int action = event.getAction() & MotionEvent.ACTION_MASK;
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (mHeaderEnabled && !isHeaderRecored && !isFooterRecored && isListAtTop()) {
|
||||
isHeaderRecored = true;
|
||||
startY = (int) event.getY();
|
||||
lastY = startY;
|
||||
}
|
||||
lastY = (int)event.getY();
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
@@ -277,12 +279,10 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
int FingerOffsetY = tempY - lastY;
|
||||
lastY = tempY;
|
||||
if (mHeaderEnabled && !isHeaderRecored && !isFooterRecored && isListAtTop() && FingerOffsetY > 0) {
|
||||
|
||||
Log.d(TAG, "sdsd");
|
||||
|
||||
isHeaderRecored = true;
|
||||
startY = tempY;
|
||||
}
|
||||
|
||||
if (headerState != HEADER_REFRESHING && isHeaderRecored) {
|
||||
int offsetY = getShowOffset(tempY - startY, pullOffestMax);
|
||||
if (headerState == HEADER_RELEASE_TO_REFRESH) {
|
||||
@@ -320,15 +320,9 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
}
|
||||
}
|
||||
|
||||
// 更新headView的size
|
||||
if (headerState == HEADER_PULL_TO_REFRESH) {
|
||||
int topPadding = (int)(offsetY - headerHeight);
|
||||
mHeader.setPadding(headerOriginalLeftPadding, topPadding, headerOriginalRightPadding, headerOriginalBottomPadding);
|
||||
mHeader.invalidate();
|
||||
}
|
||||
|
||||
// 更新headView的paddingTop
|
||||
if (headerState == HEADER_RELEASE_TO_REFRESH) {
|
||||
// update headView
|
||||
if (headerState == HEADER_RELEASE_TO_REFRESH
|
||||
|| headerState == HEADER_PULL_TO_REFRESH) {
|
||||
int topPadding = (int)(offsetY - headerHeight);
|
||||
mHeader.setPadding(headerOriginalLeftPadding, topPadding, headerOriginalRightPadding, headerOriginalBottomPadding);
|
||||
mHeader.invalidate();
|
||||
@@ -337,20 +331,27 @@ public class PullListView extends ListView implements AbsListView.OnScrollListen
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (isHeaderRecored && (headerState == HEADER_PULL_TO_REFRESH ||
|
||||
headerState == HEADER_RELEASE_TO_REFRESH)) {
|
||||
setEnabled(false);
|
||||
}
|
||||
else {
|
||||
setEnabled(true);
|
||||
event.setAction(MotionEvent.ACTION_CANCEL);
|
||||
|
||||
|
||||
Log.d(TAG, "set cancel");
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
super.onTouchEvent(event);
|
||||
|
||||
Log.d(TAG, "get event");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getShowOffset(int eventOffset, int target) {
|
||||
if (eventOffset <= 0) // avoid divide zero
|
||||
if (eventOffset == 0) // avoid divide zero
|
||||
return 0;
|
||||
if (eventOffset < 0)
|
||||
return eventOffset;
|
||||
else
|
||||
return (target * eventOffset) / (eventOffset + target);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user