使用 DrawerLayout
This commit is contained in:
1 parent
c88848d829
commit
e20100ff74
48 files changed
+896
-785
No files matched your search
Binary file not shown.
+1
-2
@@ -12,5 +12,4 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
android.library.reference.1=../../code/FloatingActionButton/FloatingActionButton
|
||||
android.library.reference.2=../../code/SlidingMenu/library
|
||||
android.library.reference.1=..\\..\\code\\FloatingActionButton\\FloatingActionButton
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" >
|
||||
</ListView>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.hippo.ehviewer.widget.FileExplorerView
|
||||
|
||||
+11
-6
@@ -14,18 +14,23 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.hippo.ehviewer.widget.FitWindowView
|
||||
android:id="@+id/standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.hippo.ehviewer.widget.ExpandingListView
|
||||
android:id="@+id/download"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp" >
|
||||
</com.hippo.ehviewer.widget.ExpandingListView>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
@@ -55,7 +55,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -86,7 +86,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -119,7 +119,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -152,7 +152,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -185,7 +185,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -218,7 +218,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -251,7 +251,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -284,7 +284,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -317,7 +317,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -350,7 +350,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -383,7 +383,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -416,7 +416,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -449,7 +449,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -482,7 +482,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -515,7 +515,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
@@ -548,7 +548,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/tag_group_reclass"
|
||||
@@ -44,7 +44,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -67,7 +67,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -90,7 +90,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 Hippo Seven
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.FitWindowView
|
||||
android:id="@+id/standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.hippo.ehviewer.widget.GalleryListView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/gallery_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:glvContent="listview" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/favorite_menu"/>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
@@ -15,12 +15,12 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
-->
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/favorite_menu_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/menu_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right|end"
|
||||
android:background="@android:color/holo_blue_dark"
|
||||
android:clickable="true"
|
||||
android:divider="@color/divider"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="46.0dp" >
|
||||
|
||||
|
||||
@@ -16,18 +16,23 @@
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.FitWindowView
|
||||
android:id="@+id/standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.hippo.ehviewer.widget.ResponedScrollView
|
||||
android:id="@+id/detail_scroll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:visibility="gone" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp" >
|
||||
@@ -36,7 +41,7 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/detail_header"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" >
|
||||
|
||||
@@ -67,7 +72,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/detail_buttons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="16dp"
|
||||
@@ -98,7 +103,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/warning"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -151,7 +156,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/detail_divider_a_m"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -160,7 +165,7 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/detail_more"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:visibility="gone" >
|
||||
@@ -207,7 +212,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/detail_divider_m_r"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -215,7 +220,7 @@
|
||||
<!-- Rate -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/detail_rate"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingTop="16dp"
|
||||
@@ -273,7 +278,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/detail_divider_r_t"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -281,7 +286,7 @@
|
||||
<!-- Tags -->
|
||||
<LinearLayout
|
||||
android:id="@+id/detail_tag"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingTop="16dp"
|
||||
@@ -291,7 +296,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/detail_divider_t_c"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -299,7 +304,7 @@
|
||||
<!-- Comments -->
|
||||
<LinearLayout
|
||||
android:id="@+id/detail_comment"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp"
|
||||
@@ -315,7 +320,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/detail_divider_c_p"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider"
|
||||
android:visibility="gone" />
|
||||
@@ -329,8 +334,8 @@
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/more_detail_scroll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_light"
|
||||
android:clipToPadding="false"
|
||||
android:visibility="gone" >
|
||||
|
||||
+27
-20
@@ -14,26 +14,33 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawerlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.PullStaggeredGridView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/gallery_list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:saveEnabled="false"
|
||||
app:item_margin="8dp" />
|
||||
<FrameLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.RefreshTextView
|
||||
android:id="@+id/refresh_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@android:color/holo_blue_dark"
|
||||
android:textSize="24sp" />
|
||||
<com.hippo.ehviewer.widget.FitWindowView
|
||||
android:id="@+id/standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
<com.hippo.ehviewer.widget.GalleryListView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/gallery_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:glvContent="staggeredgridview" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/list_menu_left"/>
|
||||
|
||||
<include layout="@layout/list_menu_right"/>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
@@ -14,25 +14,21 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<com.hippo.ehviewer.widget.PullListView
|
||||
android:id="@+id/gallery_list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/pull_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:saveEnabled="false" />
|
||||
|
||||
<com.hippo.ehviewer.widget.RefreshTextView
|
||||
android:id="@+id/refresh_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@android:color/holo_blue_dark"
|
||||
android:textSize="24sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</merge>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 Hippo Seven
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<com.hippo.ehviewer.widget.PullStaggeredGridView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/pull_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:saveEnabled="false"
|
||||
app:item_margin="8dp" />
|
||||
|
||||
<com.hippo.ehviewer.widget.RefreshTextView
|
||||
android:id="@+id/refresh_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@android:color/holo_blue_dark"
|
||||
android:textSize="24sp" />
|
||||
|
||||
</merge>
|
||||
@@ -16,19 +16,19 @@
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/gallery_list_thumb"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<com.hippo.ehviewer.widget.LoadImageView
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
auto:aspect="0.667" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/thumb"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -13,8 +13,20 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<dimen name="action_bar_height">48dp</dimen>
|
||||
<com.hippo.ehviewer.widget.FitWindowView
|
||||
android:id="@+id/standard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</resources>
|
||||
<com.hippo.ehviewer.widget.GalleryListView
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/gallery_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:glvContent="listview" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -14,11 +14,11 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/list_menu_left"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/menu_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/holo_blue_dark"
|
||||
android:layout_gravity="left|start"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include
|
||||
@@ -25,7 +25,7 @@
|
||||
android:id="@+id/user_panel" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1.0dp"
|
||||
android:background="@color/divider" />
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:id="@+id/list_menu_right"
|
||||
android:layout_width="@dimen/menu_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right|end" >
|
||||
|
||||
<com.hippo.ehviewer.widget.TagListView
|
||||
android:id="@+id/list_menu_tag_list"
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.hippo.ehviewer.widget.FixedAspectImageView
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/image"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
auto:aspect="0.667" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center" />
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingTop="16dp"
|
||||
@@ -25,7 +25,7 @@
|
||||
<com.hippo.ehviewer.widget.SimpleGridLayout
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/preview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
auto:sgl_item_margin="16dp" >
|
||||
</com.hippo.ehviewer.widget.SimpleGridLayout>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp" >
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -50,7 +50,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
@@ -59,12 +59,12 @@
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/filter_advance"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -91,7 +91,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -116,7 +116,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -141,7 +141,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
@@ -166,7 +166,7 @@
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<CheckBox
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_tag_text"
|
||||
style="@style/DialogMessage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:ems="10"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<EditText
|
||||
android:id="@+id/set_name_edit"
|
||||
style="@style/DialogMessage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
android:layout_margin="8.0dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 Hippo Seven
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<dimen name="action_bar_height">40dip</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 Hippo Seven
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<dimen name="action_bar_height">56dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -77,4 +77,11 @@
|
||||
<attr name="etpMin" format="integer" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="GalleryListView">
|
||||
<attr name="glvContent">
|
||||
<enum name="listview" value="0" />
|
||||
<enum name="staggeredgridview" value="1" />
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -15,9 +15,9 @@
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<dimen name="action_bar_height">48dip</dimen>
|
||||
<dimen name="action_bar_height">56dp</dimen>
|
||||
|
||||
<dimen name="dialog_title_height">64dip</dimen>
|
||||
<dimen name="dialog_title_height">64dp</dimen>
|
||||
|
||||
<dimen name="shadow_width">12dp</dimen>
|
||||
<dimen name="menu_width">200dp</dimen>
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
<item type="id" name="position_y"></item>
|
||||
<item type="id" name="edittextpreference_edittext"></item>
|
||||
<item type="id" name="custom"></item>
|
||||
<item type="id" name="translucent_view"></item>
|
||||
|
||||
</resources>
|
||||
+21
-20
@@ -18,22 +18,23 @@
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="@android:Theme.Holo.Light.DarkActionBar">
|
||||
|
||||
<item name="@android:textAppearance">@style/TextAppearance</item>
|
||||
<item name="@android:windowBackground">@color/background_light</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance</item>
|
||||
<item name="android:windowBackground">@color/background_light</item>
|
||||
|
||||
<!-- ActionBar -->
|
||||
<item name="@android:actionBarSize">@dimen/action_bar_height</item>
|
||||
<item name="@android:actionBarStyle">@style/ActionBar</item>
|
||||
<item name="@android:actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
<item name="@android:homeAsUpIndicator">@drawable/ic_ab_back</item>
|
||||
<item name="@android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowTitleSize">@dimen/action_bar_height</item>
|
||||
<item name="android:actionBarSize">@dimen/action_bar_height</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBar</item>
|
||||
<item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
<item name="android:homeAsUpIndicator">@drawable/ic_ab_back</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
|
||||
<!-- <item name="@android:listChoiceIndicatorSingle">@drawable/btn_radio_material_anim</item> -->
|
||||
<item name="@android:listChoiceIndicatorMultiple">@drawable/btn_check_material</item>
|
||||
<item name="android:listChoiceIndicatorMultiple">@drawable/btn_check_material</item>
|
||||
|
||||
<!-- spinner -->
|
||||
<item name="@android:spinnerDropDownItemStyle">@style/DropDownItem.Spinner</item>
|
||||
<item name="@android:spinnerItemStyle">@style/DropDownItem.Spinner</item>
|
||||
<item name="android:spinnerDropDownItemStyle">@style/DropDownItem.Spinner</item>
|
||||
<item name="android:spinnerItemStyle">@style/DropDownItem.Spinner</item>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -46,30 +47,30 @@
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Main.ListActivity">
|
||||
<item name="@android:windowBackground">@color/background_little_light</item>
|
||||
<item name="android:windowBackground">@color/background_little_light</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="@android:windowActionBar">false</item>
|
||||
<item name="@android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Gallery">
|
||||
<item name="@android:icon">@android:color/transparent</item>
|
||||
<item name="@android:actionBarStyle">@style/ActionBar.Gallery</item>
|
||||
<item name="android:icon">@android:color/transparent</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBar.Gallery</item>
|
||||
</style>
|
||||
|
||||
<!-- For activity whose main view is list, make background darker to match white list -->
|
||||
<style name="AppTheme.ListActivity">
|
||||
<item name="@android:windowBackground">@color/background_little_light</item>
|
||||
<item name="android:windowBackground">@color/background_little_light</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for start activity -->
|
||||
<style name="AppTheme.NoActionBar.Transparent">
|
||||
<item name="@android:windowBackground">@android:color/transparent</item>
|
||||
<item name="@android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="@android:windowIsTranslucent">true</item>
|
||||
<item name="@android:windowAnimationStyle">@android:style/Animation</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -25,10 +25,7 @@ import com.hippo.ehviewer.cache.ImageCache;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
|
||||
public abstract class AbsActivity extends Activity
|
||||
implements OnOrientationChangedListener {
|
||||
|
||||
private static final int[] padding = new int[2];
|
||||
public abstract class AbsActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -43,10 +40,6 @@ public abstract class AbsActivity extends Activity
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
Ui.updateTranslucent(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,10 +56,6 @@ public abstract class AbsActivity extends Activity
|
||||
|
||||
if (Config.getAllowAnalyics())
|
||||
EasyTracker.getInstance(this).activityStart(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.google.analytics.tracking.android.EasyTracker;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
|
||||
public abstract class AbsPreferenceActivity extends PreferenceActivity
|
||||
implements OnOrientationChangedListener {
|
||||
public abstract class AbsPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private static final int[] padding = new int[2];
|
||||
|
||||
@@ -42,10 +41,6 @@ public abstract class AbsPreferenceActivity extends PreferenceActivity
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
Ui.updateTranslucent(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,10 +57,6 @@ public abstract class AbsPreferenceActivity extends PreferenceActivity
|
||||
|
||||
if (Config.getAllowAnalyics())
|
||||
EasyTracker.getInstance(this).activityStart(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.analytics.tracking.android.EasyTracker;
|
||||
import com.hippo.ehviewer.cache.ImageCache;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;
|
||||
|
||||
public abstract class AbsSlidingActivity extends SlidingActivity
|
||||
implements OnOrientationChangedListener {
|
||||
|
||||
private static final int[] padding = new int[2];
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Ui.adjustOrientation(this);
|
||||
Ui.updateTranslucent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
Ui.updateTranslucent(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
Ui.adjustOrientation(this);
|
||||
Ui.updateTranslucent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (Config.getAllowAnalyics())
|
||||
EasyTracker.getInstance(this).activityStart(this);
|
||||
|
||||
// Set window padding
|
||||
Ui.getWindowPadding(getResources(), padding);
|
||||
onOrientationChanged(padding[0], padding[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
if (Config.getAllowAnalyics())
|
||||
EasyTracker.getInstance(this).activityStop(this);
|
||||
ImageCache.getInstance(this).flush();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -54,15 +53,17 @@ import com.hippo.ehviewer.util.Theme;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
import com.hippo.ehviewer.widget.ExpandingListView;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.windowsanimate.WindowsAnimate;
|
||||
|
||||
public class DownloadActivity extends AbsActivity {
|
||||
public class DownloadActivity extends AbsActivity implements FitWindowView.OnFitSystemWindowsListener {
|
||||
|
||||
private WindowsAnimate mWindowsAnimate;
|
||||
private int mThemeColor;
|
||||
private List<DownloadInfo> mDownloads;
|
||||
|
||||
private FitWindowView mStandard;
|
||||
private ExpandingListView mList;
|
||||
private ListAdapter mAdapter;
|
||||
|
||||
@@ -76,11 +77,10 @@ public class DownloadActivity extends AbsActivity {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
if (mList != null) {
|
||||
mList.setPadding(mList.getPaddingLeft(), paddingTop,
|
||||
mList.getPaddingRight(), paddingBottom);
|
||||
}
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
mList.setPadding(mList.getPaddingLeft(), t, mList.getPaddingRight(), b);
|
||||
|
||||
Ui.translucent(this, mThemeColor, t - Ui.ACTION_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,17 +107,17 @@ public class DownloadActivity extends AbsActivity {
|
||||
for (DownloadInfo di : mDownloads)
|
||||
di.setExpanded(false);
|
||||
|
||||
mStandard = (FitWindowView) findViewById(R.id.standard);
|
||||
mList = (ExpandingListView)findViewById(R.id.download);
|
||||
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
mAdapter = new ListAdapter();
|
||||
mList.setAdapter(mAdapter);
|
||||
mList.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mList.setExpandingId(R.id.buttons);
|
||||
|
||||
mThemeColor = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
int actionBarColor = mThemeColor & 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(actionBarColor);
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, actionBarColor);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(mThemeColor));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,9 @@ import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.PathShape;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -45,6 +47,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -66,15 +69,18 @@ import com.hippo.ehviewer.util.Theme;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.widget.ActionableToastBar;
|
||||
import com.hippo.ehviewer.widget.ActionableToastBar.ActionClickedListener;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView.OnGetListListener;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.PullViewGroup;
|
||||
import com.hippo.ehviewer.widget.RatingView;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class FavouriteActivity extends AbsGalleryActivity
|
||||
public class FavouriteActivity extends AbsActivity
|
||||
implements ListView.MultiChoiceModeListener,
|
||||
View.OnTouchListener {
|
||||
View.OnTouchListener, GalleryListView.GalleryListViewHelper,
|
||||
FitWindowView.OnFitSystemWindowsListener {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = "FavouriteActivity";
|
||||
|
||||
@@ -83,14 +89,19 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
private Data mData;
|
||||
private Resources mResources;
|
||||
private EhClient mClient;
|
||||
private ActionBar mActionBar;
|
||||
private int mThemeColor;
|
||||
|
||||
private RelativeLayout mMainView;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mMenu;
|
||||
private FrameLayout mContentView;
|
||||
private FitWindowView mStandard;
|
||||
private GalleryListView mGalleryListView;
|
||||
private PullViewGroup mPullViewGroup;
|
||||
private ListView mList;
|
||||
|
||||
private BaseAdapter mAdapter;
|
||||
|
||||
private SlidingMenu mSlidingMenu;
|
||||
private ListView mMenuList;
|
||||
private ActionableToastBar mActionableToastBar;
|
||||
|
||||
private Set<GalleryInfo> mChoiceGiSet;
|
||||
@@ -117,6 +128,8 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
public void onBackPressed() {
|
||||
if (mActionableToastBar.isShown())
|
||||
mActionableToastBar.hide(true);
|
||||
else if (mDrawerLayout.isDrawerOpen(mMenu))
|
||||
mDrawerLayout.closeDrawer(mMenu);
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
@@ -125,57 +138,50 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
mPullViewGroup.setEnabledHeader(false);
|
||||
mPullViewGroup.setEnabledFooter(false);
|
||||
setTitle(Favorite.FAVORITE_TITLES[mMenuIndex]);
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
|
||||
private void initFavorite() {
|
||||
mPullViewGroup.setEnabledHeader(true);
|
||||
mPullViewGroup.setEnabledFooter(true);
|
||||
setTitle(Favorite.FAVORITE_TITLES[mMenuIndex]);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutRes() {
|
||||
return R.layout.favorite_list;
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.favorite);
|
||||
|
||||
mContext = getApplication();
|
||||
mData = Data.getInstance();
|
||||
mResources =getResources();
|
||||
mClient = EhClient.getInstance();
|
||||
|
||||
final ActionBar actionBar = getActionBar();
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
mActionBar = getActionBar();
|
||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// Download service
|
||||
Intent it = new Intent(FavouriteActivity.this, DownloadService.class);
|
||||
bindService(it, mServiceConn, BIND_AUTO_CREATE);
|
||||
|
||||
setBehindContentView(R.layout.favorite_menu);
|
||||
setSlidingActionBarEnabled(false);
|
||||
mSlidingMenu = getSlidingMenu();
|
||||
mSlidingMenu.setMode(SlidingMenu.RIGHT);
|
||||
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
|
||||
mSlidingMenu.setBehindWidth(
|
||||
mResources.getDimensionPixelOffset(R.dimen.menu_width));
|
||||
mSlidingMenu.setShadowDrawable(R.drawable.shadow_right);
|
||||
mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
|
||||
|
||||
// Get View
|
||||
mMainView = getMainView();
|
||||
mPullViewGroup = getPullViewGroup();
|
||||
mList = (ListView)getContentView();
|
||||
mMenuList = (ListView)findViewById(R.id.favorite_menu_list);
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerlayout);
|
||||
mMenu = (ListView) mDrawerLayout.findViewById(R.id.favorite_menu_list);
|
||||
mContentView = (FrameLayout) mDrawerLayout.findViewById(R.id.content);
|
||||
mStandard = (FitWindowView) mDrawerLayout.findViewById(R.id.standard);
|
||||
mGalleryListView = (GalleryListView) mDrawerLayout.findViewById(R.id.gallery_list);
|
||||
mPullViewGroup = mGalleryListView.getPullViewGroup();
|
||||
mList = (ListView) mGalleryListView.getContentView();
|
||||
|
||||
mActionableToastBar = new ActionableToastBar(this);
|
||||
mActionableToastBar.setBackgroundColor(mResources.getColor(android.R.color.holo_purple));
|
||||
mMainView.addView(mActionableToastBar);
|
||||
mMainView.setOnTouchListener(this);
|
||||
mContentView.addView(mActionableToastBar);
|
||||
mContentView.setOnTouchListener(this);
|
||||
|
||||
mGalleryListView.setGalleryListViewHelper(this);
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
mPullViewGroup.setAgainstToChildPadding(true);
|
||||
|
||||
mChoiceGiSet = new LinkedHashSet<GalleryInfo>();
|
||||
mChoiceGiSetCopy = new LinkedHashSet<GalleryInfo>();
|
||||
@@ -188,18 +194,18 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
int position, long arg3) {
|
||||
Intent intent = new Intent(FavouriteActivity.this,
|
||||
GalleryDetailActivity.class);
|
||||
GalleryInfo gi = getGalleryInfo(position);
|
||||
GalleryInfo gi = mGalleryListView.getGalleryInfo(position);
|
||||
intent.putExtra(GalleryDetailActivity.KEY_G_INFO, gi);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
mList.setMultiChoiceModeListener(this);
|
||||
mAdapter = new ListAdapter(this, getGalleryList());
|
||||
mAdapter = new ListAdapter(this, mGalleryListView.getGalleryList());
|
||||
mList.setAdapter(mAdapter);
|
||||
|
||||
mMenuList.setClipToPadding(false);
|
||||
mMenuList.setAdapter(new BaseAdapter() {
|
||||
mMenu.setClipToPadding(false);
|
||||
mMenu.setAdapter(new BaseAdapter() {
|
||||
private ShapeDrawable d;
|
||||
private ShapeDrawable createDrawable() {
|
||||
Path path = new Path();
|
||||
@@ -245,11 +251,11 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
return convertView;
|
||||
}
|
||||
});
|
||||
mMenuList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
mMenu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
showContent();
|
||||
mDrawerLayout.closeDrawers();
|
||||
// If same index, do nothing
|
||||
if (mMenuIndex == position)
|
||||
return;
|
||||
@@ -264,12 +270,9 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
});
|
||||
|
||||
// Set random color
|
||||
int color = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
color = color & 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(color);
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, color);
|
||||
mMenuList.setBackgroundColor(color);
|
||||
mThemeColor = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
mActionBar.setBackgroundDrawable(new ColorDrawable(mThemeColor));
|
||||
mMenu.setBackgroundColor(mThemeColor);
|
||||
|
||||
// Check login
|
||||
if (!mClient.isLogin()) {
|
||||
@@ -282,22 +285,21 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
int magicSpacing = Ui.dp2pix(20);
|
||||
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.MATCH_PARENT, Ui.dp2pix(60));
|
||||
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
lp.gravity = Gravity.BOTTOM;
|
||||
// Make sure actionable is above navigation bar
|
||||
lp.bottomMargin = paddingBottom + magicSpacing;
|
||||
lp.bottomMargin = b + magicSpacing;
|
||||
lp.leftMargin = magicSpacing;
|
||||
lp.rightMargin = magicSpacing;
|
||||
mActionableToastBar.setLayoutParams(lp);
|
||||
mList.setPadding(mList.getPaddingLeft(), t, mList.getPaddingRight(), b);
|
||||
((DrawerLayout.LayoutParams) mMenu.getLayoutParams()).topMargin = t;
|
||||
mMenu.setPadding(mMenu.getPaddingLeft(), mMenu.getPaddingTop(), mMenu.getPaddingRight(), b);
|
||||
|
||||
mMenuList.setPadding(mMenuList.getPaddingLeft(), paddingTop,
|
||||
mMenuList.getPaddingRight(), paddingBottom);
|
||||
|
||||
mList.setPadding(mList.getPaddingLeft(), paddingTop,
|
||||
mList.getPaddingRight(), paddingBottom);
|
||||
Ui.translucent(this, mThemeColor, t - Ui.ACTION_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -314,7 +316,10 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_list:
|
||||
toggle();
|
||||
if (mDrawerLayout.isDrawerOpen(mMenu))
|
||||
mDrawerLayout.closeDrawer(mMenu);
|
||||
else
|
||||
mDrawerLayout.openDrawer(mMenu);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -396,7 +401,7 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
// remove from set iterator, favorite data
|
||||
mSetIter.remove();
|
||||
mData.deleteLocalFavourite(mTargetGi.gid);
|
||||
getGalleryList().remove(mTargetGi);
|
||||
mGalleryListView.getGalleryList().remove(mTargetGi);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
// set mGiLocal2Cloud null for above
|
||||
mTargetGi = null;
|
||||
@@ -418,8 +423,8 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (getGalleryList().size() == 0)
|
||||
onlyShowNone();
|
||||
if (mGalleryListView.getGalleryList().size() == 0)
|
||||
mGalleryListView.onlyShowNone();
|
||||
mSetIter = null;
|
||||
mProgressDialog.dismiss();
|
||||
mProgressDialog = null;
|
||||
@@ -480,7 +485,7 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
if (mMenuIndex == 0) {
|
||||
for (GalleryInfo gi : mChoiceGiSet)
|
||||
mData.deleteLocalFavourite(gi.gid);
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
} else {
|
||||
mTargetCat = -1;
|
||||
mClient.modifyFavorite(getGids(mChoiceGiSet), mTargetCat,
|
||||
@@ -509,13 +514,13 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
public void onItemCheckedStateChanged(ActionMode mode, int position,
|
||||
long id, boolean checked) {
|
||||
if (checked)
|
||||
mChoiceGiSet.add(getGalleryInfo(position));
|
||||
mChoiceGiSet.add(mGalleryListView.getGalleryInfo(position));
|
||||
else
|
||||
mChoiceGiSet.remove(getGalleryInfo(position));
|
||||
mChoiceGiSet.remove(mGalleryListView.getGalleryInfo(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTargetUrl(int targetPage) {
|
||||
public String getTargetUrl(int targetPage) {
|
||||
if (mMenuIndex == 0)
|
||||
return LOCAL_FAVORITE_URL;
|
||||
else
|
||||
@@ -523,7 +528,7 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGetGallerys(String url, final long taskStamp,
|
||||
public void doGetGallerys(String url, final long taskStamp,
|
||||
final OnGetListListener listener) {
|
||||
// If get local favorite
|
||||
if (mLastModifyGiList != null) {
|
||||
@@ -566,7 +571,7 @@ public class FavouriteActivity extends AbsGalleryActivity
|
||||
public void onSuccess(List<GalleryInfo> gis, int pageNum) {
|
||||
mLastModifyGiList = gis;
|
||||
mLastModifyPageNum = pageNum;
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
MaterialToast.showToast(mSuccStr);
|
||||
|
||||
// add to local
|
||||
|
||||
@@ -86,6 +86,7 @@ import com.hippo.ehviewer.util.Theme;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.ViewUtils;
|
||||
import com.hippo.ehviewer.widget.AutoWrapLayout;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.LinkifyTextView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.MaterialProgress;
|
||||
@@ -103,7 +104,8 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
View.OnTouchListener , ViewSwitcher.ViewFactory,
|
||||
ProgressiveRatingBar.OnUserRateListener, PreviewList.PreviewHolder,
|
||||
View.OnLayoutChangeListener, AdapterView.OnItemClickListener,
|
||||
AdapterView.OnItemLongClickListener, RefreshTextView.OnRefreshListener {
|
||||
AdapterView.OnItemLongClickListener, RefreshTextView.OnRefreshListener,
|
||||
FitWindowView.OnFitSystemWindowsListener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = GalleryDetailActivity.class.getSimpleName();
|
||||
@@ -121,6 +123,7 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
private boolean isCheckmark = false;
|
||||
private boolean isSetDrawable = false;
|
||||
|
||||
private FitWindowView mStandard;
|
||||
private RefreshTextView mRefreshText;
|
||||
private LoadImageView mThumb;
|
||||
private TextView mTitle;
|
||||
@@ -290,6 +293,8 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// Get view
|
||||
mStandard = (FitWindowView) findViewById(R.id.standard);
|
||||
|
||||
mDetailScroll = (ResponedScrollView)findViewById(R.id.detail_scroll);
|
||||
mMoreDetailScroll = (ScrollView)findViewById(R.id.more_detail_scroll);
|
||||
mMoreComment = findViewById(R.id.more_comment);
|
||||
@@ -362,10 +367,7 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
|
||||
// Set random color
|
||||
mThemeColor = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
int actionBarColor = mThemeColor & 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(actionBarColor);
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, actionBarColor);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(mThemeColor));
|
||||
mDownloadButton.setRoundBackground(true, false, mResources.getColor(R.color.background_light), mThemeColor);
|
||||
mDownloadButton.setTextColor(mThemeColor);
|
||||
mReadButton.setRoundBackground(true, mThemeColor, 0);
|
||||
@@ -390,6 +392,7 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
mWindowsAnimate.addRippleEffect(mPreviewFront, true);
|
||||
|
||||
// Set listener
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
mDownloadButton.setOnClickListener(this);
|
||||
mReadButton.setOnClickListener(this);
|
||||
mCategory.setOnClickListener(this);
|
||||
@@ -985,14 +988,16 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
mDetailScroll.setPadding(mDetailScroll.getPaddingLeft(), paddingTop,
|
||||
mDetailScroll.getPaddingRight(), paddingBottom);
|
||||
mMoreDetailScroll.setPadding(mMoreDetailScroll.getPaddingLeft(), paddingTop,
|
||||
mMoreDetailScroll.getPaddingRight(), paddingBottom);
|
||||
mCommentList.setPadding(mCommentList.getPaddingLeft(), paddingTop,
|
||||
mCommentList.getPaddingRight(), paddingBottom + Ui.dp2pix(16 + 56 + 16));
|
||||
((FrameLayout.LayoutParams)mReply.getLayoutParams()).bottomMargin = Ui.dp2pix(16) + paddingBottom;
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
mDetailScroll.setPadding(mDetailScroll.getPaddingLeft(), t,
|
||||
mDetailScroll.getPaddingRight(), b);
|
||||
mMoreDetailScroll.setPadding(mMoreDetailScroll.getPaddingLeft(), t,
|
||||
mMoreDetailScroll.getPaddingRight(), b);
|
||||
mCommentList.setPadding(mCommentList.getPaddingLeft(), t,
|
||||
mCommentList.getPaddingRight(), b + Ui.dp2pix(16 + 56 + 16));
|
||||
((FrameLayout.LayoutParams)mReply.getLayoutParams()).bottomMargin = Ui.dp2pix(16) + b;
|
||||
|
||||
Ui.translucent(this, mThemeColor, t - Ui.ACTION_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,6 +41,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ImageSpan;
|
||||
@@ -91,6 +92,9 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
import com.hippo.ehviewer.util.ViewUtils;
|
||||
import com.hippo.ehviewer.widget.CategoryTable;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView.OnGetListListener;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.RatingView;
|
||||
@@ -99,7 +103,6 @@ import com.hippo.ehviewer.widget.SuggestionTextView;
|
||||
import com.hippo.ehviewer.widget.TagListView;
|
||||
import com.hippo.ehviewer.widget.TagsAdapter;
|
||||
import com.hippo.ehviewer.windowsanimate.WindowsAnimate;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -124,9 +127,10 @@ import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
*
|
||||
* @author Hippo
|
||||
*/
|
||||
public class GalleryListActivity extends AbsGalleryActivity implements View.OnClickListener,
|
||||
SearchView.OnQueryTextListener, SearchView.OnFocusChangeListener, SlidingMenu.OnOpenedListener,
|
||||
SlidingMenu.OnClosedListener, EhClient.OnLoginListener {
|
||||
public class GalleryListActivity extends AbsActivity implements View.OnClickListener,
|
||||
SearchView.OnQueryTextListener, SearchView.OnFocusChangeListener,
|
||||
DrawerLayout.DrawerListener, EhClient.OnLoginListener,
|
||||
GalleryListView.GalleryListViewHelper, FitWindowView.OnFitSystemWindowsListener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = GalleryListActivity.class.getSimpleName();
|
||||
@@ -149,26 +153,34 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
private Resources mResources;
|
||||
private WindowsAnimate mWindowsAnimate;
|
||||
private SuggestionHelper mSuggestions;
|
||||
private ActionBar mActionBar;
|
||||
private int mThemeColor;
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private View mLeftMenu;
|
||||
private View mRightMenu;
|
||||
private FitWindowView mStandard;
|
||||
private GalleryListView mGalleryListView;
|
||||
|
||||
private StaggeredGridView mStaggeredGridView;
|
||||
|
||||
private SlidingMenu mSlidingMenu;
|
||||
private View mMenuLeft;
|
||||
private LinearLayout mUserPanel;
|
||||
private ListView itemListMenu;
|
||||
private TagListView tagListMenu;
|
||||
private ListView mMenuList;
|
||||
private ImageView mAvatar;
|
||||
private TextView mUsernameView;
|
||||
private Button mLoginButton;
|
||||
private Button mRegisterButton;
|
||||
private Button mLogoutButton;
|
||||
private View mWaitLogView;
|
||||
|
||||
private TagListView mQuickSearchList;
|
||||
private View mQuickSearchTip;
|
||||
|
||||
private TextView mSearchImageText;
|
||||
|
||||
private SearchView mSearchView;
|
||||
private MenuItem mSearchItem;
|
||||
|
||||
private ImageView avatar;
|
||||
private TextView userView;
|
||||
private Button loginButton;
|
||||
private Button registerButton;
|
||||
private Button logoutButton;
|
||||
private View waitloginoutView;
|
||||
private View mQuickSearchTip;
|
||||
private TextView mSearchImageText;
|
||||
|
||||
private StaggeredGridView mStaggeredGridView;
|
||||
private BaseAdapter mAdapter;
|
||||
|
||||
private TagsAdapter tagsAdapter;
|
||||
@@ -396,8 +408,8 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
return true;
|
||||
|
||||
lus = listUrls;
|
||||
refresh();
|
||||
showContent();
|
||||
mGalleryListView.refresh();
|
||||
mDrawerLayout.closeDrawers();
|
||||
|
||||
// Get title
|
||||
String search = lus.getSearch();
|
||||
@@ -541,7 +553,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
.setItems(R.array.list_item_long_click, new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int position) {
|
||||
final GalleryInfo gi = getGalleryInfo(longClickItemIndex);
|
||||
final GalleryInfo gi = mGalleryListView.getGalleryInfo(longClickItemIndex);
|
||||
switch (position) {
|
||||
case 0: // Add favourite item
|
||||
Favorite.addToFavorite(GalleryListActivity.this, gi);
|
||||
@@ -564,8 +576,9 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
View view = inflater.inflate(R.layout.jump, null);
|
||||
TextView tv = (TextView) view.findViewById(R.id.list_jump_sum);
|
||||
// For lofi, can not get page num, so use Integer.MAX_VALUE
|
||||
tv.setText(String.format(getString(R.string.jump_summary), getCurPage() + 1,
|
||||
getPageNum() == Integer.MAX_VALUE ? getString(R.string._unknown) : String.valueOf(getPageNum())));
|
||||
tv.setText(String.format(getString(R.string.jump_summary), mGalleryListView.getCurPage() + 1,
|
||||
mGalleryListView.getPageNum() == Integer.MAX_VALUE ? getString(R.string._unknown) :
|
||||
String.valueOf(mGalleryListView.getPageNum())));
|
||||
tv = (TextView) view.findViewById(R.id.list_jump_to);
|
||||
tv.setText(R.string.jump_to);
|
||||
final EditText et = (EditText) view.findViewById(R.id.list_jump_edit);
|
||||
@@ -579,13 +592,13 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
int targetPage;
|
||||
try {
|
||||
targetPage = Integer.parseInt(et.getText().toString()) - 1;
|
||||
if (targetPage < 0 || targetPage >= getPageNum())
|
||||
if (targetPage < 0 || targetPage >= mGalleryListView.getPageNum())
|
||||
throw new Exception();
|
||||
} catch (Exception e) {
|
||||
MaterialToast.showToast(R.string.toast_invalid_page);
|
||||
return false;
|
||||
}
|
||||
jumpTo(targetPage);
|
||||
mGalleryListView.jumpTo(targetPage);
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
@@ -642,6 +655,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
}).create();
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private AlertDialog createModifyTagDialog(final int position) {
|
||||
LayoutInflater inflater = this.getLayoutInflater();
|
||||
final View view = inflater.inflate(R.layout.search, null);
|
||||
@@ -811,8 +825,6 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (mShowDrawer)
|
||||
mSlidingMenu.setBehindWidth(mResources.getDimensionPixelOffset(R.dimen.menu_width));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -876,47 +888,64 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
protected void onNewIntent(Intent intent) {
|
||||
setIntent(intent);
|
||||
handleIntent(intent);
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == loginButton) {
|
||||
if (v == mLoginButton) {
|
||||
loginDialog.show();
|
||||
} else if (v == registerButton) {
|
||||
} else if (v == mRegisterButton) {
|
||||
toRegister();
|
||||
} else if (v == logoutButton) {
|
||||
} else if (v == mLogoutButton) {
|
||||
mClient.logout();
|
||||
setUserPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutRes() {
|
||||
return R.layout.gallery_list;
|
||||
public void onDrawerClosed(View view) {
|
||||
setTitle(mTitle);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpened() {
|
||||
if (mShowDrawer) {
|
||||
if (!mSlidingMenu.isSecondaryMenuShowing())
|
||||
setTitle(R.string.app_name);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
public void onDrawerOpened(View view) {
|
||||
if (view == mLeftMenu)
|
||||
setTitle(R.string.app_name);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed() {
|
||||
if (mShowDrawer) {
|
||||
setTitle(mTitle);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
public void onDrawerSlide(View view, float f) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerStateChanged(int i) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
mStaggeredGridView.setPadding(mStaggeredGridView.getPaddingLeft(), t,
|
||||
mStaggeredGridView.getPaddingRight(), b);
|
||||
((DrawerLayout.LayoutParams) mLeftMenu.getLayoutParams()).topMargin = t;
|
||||
((DrawerLayout.LayoutParams) mRightMenu.getLayoutParams()).topMargin = t;
|
||||
mMenuList.setPadding(mMenuList.getPaddingLeft(), mMenuList.getPaddingTop(),
|
||||
mMenuList.getPaddingRight(), b);
|
||||
mQuickSearchList.setPadding(mQuickSearchList.getPaddingLeft(), mQuickSearchList.getPaddingTop(),
|
||||
mQuickSearchList.getPaddingRight(), b);
|
||||
|
||||
Ui.translucent(this, mThemeColor, t - Ui.ACTION_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("InflateParams")
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.gallery_list);
|
||||
|
||||
mData = Data.getInstance();
|
||||
mClient = EhClient.getInstance();
|
||||
@@ -944,23 +973,6 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
else
|
||||
mShowDrawer = true;
|
||||
|
||||
setBehindContentView(R.layout.list_menu_left);
|
||||
setSlidingActionBarEnabled(false);
|
||||
mSlidingMenu = getSlidingMenu();
|
||||
mSlidingMenu.setSecondaryMenu(R.layout.list_menu_right);
|
||||
mSlidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
|
||||
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
|
||||
mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
|
||||
mSlidingMenu.setShadowDrawable(R.drawable.shadow);
|
||||
mSlidingMenu.setSecondaryShadowDrawable(R.drawable.shadow_right);
|
||||
mSlidingMenu.setOnOpenedListener(this);
|
||||
mSlidingMenu.setOnClosedListener(this);
|
||||
if (mShowDrawer) {
|
||||
mSlidingMenu.setBehindWidth(mResources.getDimensionPixelOffset(R.dimen.menu_width));
|
||||
} else {
|
||||
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
|
||||
}
|
||||
|
||||
// Download service
|
||||
Intent it = new Intent(GalleryListActivity.this, DownloadService.class);
|
||||
bindService(it, mServiceConn, BIND_AUTO_CREATE);
|
||||
@@ -971,32 +983,48 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
longClickDialog = createLongClickDialog();
|
||||
|
||||
// Get View
|
||||
mMenuLeft = findViewById(R.id.list_menu_left);
|
||||
mUserPanel = (LinearLayout) findViewById(R.id.user_panel);
|
||||
itemListMenu = (ListView) findViewById(R.id.list_menu_item_list);
|
||||
tagListMenu = (TagListView) findViewById(R.id.list_menu_tag_list);
|
||||
avatar = (ImageView) mUserPanel.findViewById(R.id.avatar);
|
||||
userView = (TextView) mUserPanel.findViewById(R.id.user);
|
||||
loginButton = (Button) mUserPanel.findViewById(R.id.login);
|
||||
registerButton = (Button) mUserPanel.findViewById(R.id.register);
|
||||
logoutButton = (Button) mUserPanel.findViewById(R.id.logout);
|
||||
waitloginoutView = mUserPanel.findViewById(R.id.wait);
|
||||
mQuickSearchTip = findViewById(R.id.tip_text);
|
||||
mStaggeredGridView = (StaggeredGridView) getContentView();
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerlayout);
|
||||
|
||||
loginButton.setOnClickListener(this);
|
||||
registerButton.setOnClickListener(this);
|
||||
logoutButton.setOnClickListener(this);
|
||||
setNoneText(mResources.getString(R.string.no_found));
|
||||
mLeftMenu = mDrawerLayout.findViewById(R.id.list_menu_left);
|
||||
mRightMenu = mDrawerLayout.findViewById(R.id.list_menu_right);
|
||||
mStandard = (FitWindowView) mDrawerLayout.findViewById(R.id.standard);
|
||||
mGalleryListView = (GalleryListView) mDrawerLayout.findViewById(R.id.gallery_list);
|
||||
|
||||
mStaggeredGridView = (StaggeredGridView) mGalleryListView.getContentView();
|
||||
|
||||
mUserPanel = (LinearLayout) mLeftMenu.findViewById(R.id.user_panel);
|
||||
mMenuList = (ListView) mLeftMenu.findViewById(R.id.list_menu_item_list);
|
||||
mAvatar = (ImageView) mUserPanel.findViewById(R.id.avatar);
|
||||
mUsernameView = (TextView) mUserPanel.findViewById(R.id.user);
|
||||
mLoginButton = (Button) mUserPanel.findViewById(R.id.login);
|
||||
mRegisterButton = (Button) mUserPanel.findViewById(R.id.register);
|
||||
mLogoutButton = (Button) mUserPanel.findViewById(R.id.logout);
|
||||
mWaitLogView = mUserPanel.findViewById(R.id.wait);
|
||||
|
||||
mQuickSearchList = (TagListView) mRightMenu.findViewById(R.id.list_menu_tag_list);
|
||||
mQuickSearchTip = mRightMenu.findViewById(R.id.tip_text);
|
||||
|
||||
|
||||
mLoginButton.setOnClickListener(this);
|
||||
mRegisterButton.setOnClickListener(this);
|
||||
mLogoutButton.setOnClickListener(this);
|
||||
|
||||
// Drawer
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
mActionBar = getActionBar();
|
||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
if (mShowDrawer && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
actionBar.setHomeAsUpIndicator(mResources.getDrawable(R.drawable.ic_navigation_drawer));
|
||||
mActionBar.setHomeAsUpIndicator(mResources.getDrawable(R.drawable.ic_navigation_drawer));
|
||||
mDrawerLayout.setDrawerListener(this);
|
||||
if (!mShowDrawer)
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mLeftMenu);
|
||||
|
||||
// Content
|
||||
mGalleryListView.setGalleryListViewHelper(this);
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
mGalleryListView.getPullViewGroup().setAgainstToChildPadding(true);
|
||||
|
||||
// leftDrawer
|
||||
final int[] data = {
|
||||
final int[] menuListData = {
|
||||
R.drawable.ic_action_home, R.string.homepage,
|
||||
R.drawable.ic_action_panda, R.string.mode,
|
||||
R.drawable.ic_action_search, android.R.string.search_go,
|
||||
@@ -1006,17 +1034,17 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
R.drawable.ic_setting_download, R.string.download,
|
||||
R.drawable.ic_action_settings, R.string.action_settings};
|
||||
|
||||
itemListMenu.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
itemListMenu.setClipToPadding(false);
|
||||
itemListMenu.setAdapter(new BaseAdapter() {
|
||||
mMenuList.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mMenuList.setClipToPadding(false);
|
||||
mMenuList.setAdapter(new BaseAdapter() {
|
||||
@Override
|
||||
public int getCount() {
|
||||
return data.length / 2;
|
||||
return menuListData.length / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return new int[] { data[position * 2], data[position * 2 + 1] };
|
||||
return new int[] { menuListData[position * 2], menuListData[position * 2 + 1] };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1033,23 +1061,23 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
} else {
|
||||
tv = (TextView) convertView;
|
||||
}
|
||||
Drawable d = mResources.getDrawable(data[position * 2]);
|
||||
Drawable d = mResources.getDrawable(menuListData[position * 2]);
|
||||
d.setBounds(0, 0, Ui.dp2pix(36), Ui.dp2pix(36));
|
||||
tv.setCompoundDrawables(d, null, null, null);
|
||||
tv.setCompoundDrawablePadding(Ui.dp2pix(8));
|
||||
tv.setText(data[position * 2 + 1]);
|
||||
tv.setText(menuListData[position * 2 + 1]);
|
||||
return tv;
|
||||
}
|
||||
});
|
||||
itemListMenu.setOnItemClickListener(new OnItemClickListener() {
|
||||
mMenuList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent intent;
|
||||
switch (position) {
|
||||
case 0: // Home page
|
||||
lus = new ListUrls(ListUrls.NONE, null, 0);
|
||||
refresh();
|
||||
showContent();
|
||||
mGalleryListView.refresh();
|
||||
mDrawerLayout.closeDrawers();
|
||||
mTitle = mResources.getString(R.string.homepage);
|
||||
setTitle(mTitle);
|
||||
break;
|
||||
@@ -1072,8 +1100,8 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
lus.setMode(ListUrls.MODE_POPULAR);
|
||||
mTitle = mResources.getString(R.string.popular);
|
||||
setTitle(mTitle);
|
||||
refresh();
|
||||
showContent();
|
||||
mGalleryListView.refresh();
|
||||
mDrawerLayout.closeDrawers();
|
||||
break;
|
||||
|
||||
case 5: // HistoryActivity
|
||||
@@ -1112,26 +1140,26 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
mQuickSearchTip.setVisibility(View.VISIBLE);
|
||||
else
|
||||
mQuickSearchTip.setVisibility(View.GONE);
|
||||
tagListMenu.setClipToPadding(false);
|
||||
tagListMenu.setAdapter(tagsAdapter);
|
||||
tagListMenu.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
tagListMenu.setOnItemClickListener(new OnItemClickListener() {
|
||||
mQuickSearchList.setClipToPadding(false);
|
||||
mQuickSearchList.setAdapter(tagsAdapter);
|
||||
mQuickSearchList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
mQuickSearchList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
|
||||
lus = mData.getTag(position);
|
||||
refresh();
|
||||
showContent();
|
||||
mGalleryListView.refresh();
|
||||
mDrawerLayout.closeDrawers();
|
||||
mTitle = listMenuTag.get(position);
|
||||
setTitle(mTitle);
|
||||
}
|
||||
});
|
||||
tagListMenu.setOnModifyListener(new TagListView.OnModifyListener() {
|
||||
mQuickSearchList.setOnModifyListener(new TagListView.OnModifyListener() {
|
||||
@Override
|
||||
public void onModify(int position) {
|
||||
createModifyTagDialog(position).show();
|
||||
}
|
||||
});
|
||||
tagListMenu.setOnSwapListener(new TagListView.OnSwapListener() {
|
||||
mQuickSearchList.setOnSwapListener(new TagListView.OnSwapListener() {
|
||||
@Override
|
||||
public void onSwap(int positionOne, int positionTwo) {
|
||||
String temp = listMenuTag.get(positionOne);
|
||||
@@ -1141,7 +1169,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
tagsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
tagListMenu.setOnDeleteListener(new TagListView.OnDeleteListener() {
|
||||
mQuickSearchList.setOnDeleteListener(new TagListView.OnDeleteListener() {
|
||||
@Override
|
||||
public void onDelete(int position) {
|
||||
String removeItem = listMenuTag.remove(position);
|
||||
@@ -1152,13 +1180,13 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
});
|
||||
|
||||
// Listview
|
||||
mAdapter = new ListAdapter(this, getGalleryList());
|
||||
mAdapter = new ListAdapter(this, mGalleryListView.getGalleryList());
|
||||
mStaggeredGridView.setAdapter(mAdapter);
|
||||
mStaggeredGridView.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
|
||||
Intent intent = new Intent(GalleryListActivity.this, GalleryDetailActivity.class);
|
||||
GalleryInfo gi = getGalleryInfo(position);
|
||||
GalleryInfo gi = mGalleryListView.getGalleryInfo(position);
|
||||
intent.putExtra(GalleryDetailActivity.KEY_G_INFO, gi);
|
||||
startActivity(intent);
|
||||
}
|
||||
@@ -1173,14 +1201,11 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
});
|
||||
|
||||
// Set random color
|
||||
int color = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
color = color & 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(color);
|
||||
actionBar = getActionBar();
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, color);
|
||||
mMenuLeft.setBackgroundColor(color);
|
||||
tagListMenu.setBackgroundColor(color);
|
||||
mThemeColor = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
mActionBar.setBackgroundDrawable(new ColorDrawable(mThemeColor));
|
||||
|
||||
mLeftMenu.setBackgroundColor(mThemeColor);
|
||||
mRightMenu.setBackgroundColor(mThemeColor);
|
||||
|
||||
// Update user panel
|
||||
setUserPanel();
|
||||
@@ -1190,7 +1215,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
updateGridView();
|
||||
|
||||
// get MangeList
|
||||
firstTimeRefresh();
|
||||
mGalleryListView.firstTimeRefresh();
|
||||
|
||||
// If not show drawer, just return
|
||||
if (!mShowDrawer) {
|
||||
@@ -1209,7 +1234,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
Message m = Message.obtain(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showMenu();
|
||||
mDrawerLayout.openDrawer(mLeftMenu);
|
||||
}
|
||||
});
|
||||
AppHandler.getInstance().sendMessageDelayed(m, 500L);
|
||||
@@ -1239,17 +1264,6 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
mUserPanel.setPadding(mUserPanel.getPaddingLeft(), paddingTop, mUserPanel.getPaddingRight(),
|
||||
mUserPanel.getPaddingBottom());
|
||||
itemListMenu.setPadding(itemListMenu.getPaddingLeft(), itemListMenu.getPaddingTop(),
|
||||
itemListMenu.getPaddingRight(), paddingBottom);
|
||||
tagListMenu.setPadding(tagListMenu.getPaddingLeft(), paddingTop, tagListMenu.getPaddingRight(), paddingBottom);
|
||||
mStaggeredGridView.setPadding(mStaggeredGridView.getPaddingLeft(), paddingTop,
|
||||
mStaggeredGridView.getPaddingRight(), paddingBottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
// Store suggestion
|
||||
@@ -1265,7 +1279,7 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
t = query;
|
||||
|
||||
lus = new ListUrls(ListUrls.NONE, query);
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
mTitle = t;
|
||||
setTitle(mTitle);
|
||||
return true;
|
||||
@@ -1284,9 +1298,9 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (mSlidingMenu.isSecondaryMenuShowing())
|
||||
if (mDrawerLayout.isDrawerOpen(mRightMenu))
|
||||
getMenuInflater().inflate(R.menu.quick_search, menu);
|
||||
else if (mSlidingMenu.isMenuShowing())
|
||||
else if (mDrawerLayout.isDrawerOpen(mLeftMenu))
|
||||
return true;
|
||||
else
|
||||
getMenuInflater().inflate(R.menu.gallery_list, menu);
|
||||
@@ -1367,14 +1381,18 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
// Double click back exit
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (!mShowDrawer) {
|
||||
finish();
|
||||
if (mDrawerLayout.isDrawerOpen(mLeftMenu) || mDrawerLayout.isDrawerOpen(mRightMenu)) {
|
||||
mDrawerLayout.closeDrawers();
|
||||
} else {
|
||||
if (System.currentTimeMillis() - curBackTime > BACK_PRESSED_INTERVAL) {
|
||||
curBackTime = System.currentTimeMillis();
|
||||
MaterialToast.showToast(R.string.exit_tip);
|
||||
} else
|
||||
if (!mShowDrawer) {
|
||||
finish();
|
||||
} else {
|
||||
if (System.currentTimeMillis() - curBackTime > BACK_PRESSED_INTERVAL) {
|
||||
curBackTime = System.currentTimeMillis();
|
||||
MaterialToast.showToast(R.string.exit_tip);
|
||||
} else
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,19 +1406,19 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (mShowDrawer) {
|
||||
if (mSlidingMenu.isMenuShowing())
|
||||
showContent();
|
||||
if (mDrawerLayout.isDrawerOpen(mLeftMenu))
|
||||
mDrawerLayout.closeDrawers();
|
||||
else
|
||||
showMenu();
|
||||
mDrawerLayout.openDrawer(mLeftMenu);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
case R.id.action_refresh:
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
return true;
|
||||
case R.id.action_jump:
|
||||
if (!isRefreshing() && isGetGalleryOk())
|
||||
if (!mGalleryListView.isRefreshing() && mGalleryListView.isGetGalleryOk())
|
||||
jump();
|
||||
return true;
|
||||
case R.id.action_detail:
|
||||
@@ -1514,41 +1532,41 @@ public class GalleryListActivity extends AbsGalleryActivity implements View.OnCl
|
||||
|
||||
switch (state) {
|
||||
case LOGIN:
|
||||
avatar.setImageBitmap(mClient.getAvatar());
|
||||
userView.setVisibility(View.GONE);
|
||||
loginButton.setVisibility(View.VISIBLE);
|
||||
registerButton.setVisibility(View.VISIBLE);
|
||||
logoutButton.setVisibility(View.GONE);
|
||||
waitloginoutView.setVisibility(View.GONE);
|
||||
mAvatar.setImageBitmap(mClient.getAvatar());
|
||||
mUsernameView.setVisibility(View.GONE);
|
||||
mLoginButton.setVisibility(View.VISIBLE);
|
||||
mRegisterButton.setVisibility(View.VISIBLE);
|
||||
mLogoutButton.setVisibility(View.GONE);
|
||||
mWaitLogView.setVisibility(View.GONE);
|
||||
break;
|
||||
case LOGOUT:
|
||||
avatar.setImageBitmap(mClient.getAvatar());
|
||||
userView.setText(mClient.getDisplayname());
|
||||
userView.setVisibility(View.VISIBLE);
|
||||
loginButton.setVisibility(View.GONE);
|
||||
registerButton.setVisibility(View.GONE);
|
||||
logoutButton.setVisibility(View.VISIBLE);
|
||||
waitloginoutView.setVisibility(View.GONE);
|
||||
mAvatar.setImageBitmap(mClient.getAvatar());
|
||||
mUsernameView.setText(mClient.getDisplayname());
|
||||
mUsernameView.setVisibility(View.VISIBLE);
|
||||
mLoginButton.setVisibility(View.GONE);
|
||||
mRegisterButton.setVisibility(View.GONE);
|
||||
mLogoutButton.setVisibility(View.VISIBLE);
|
||||
mWaitLogView.setVisibility(View.GONE);
|
||||
break;
|
||||
case WAIT:
|
||||
avatar.setImageBitmap(mClient.getAvatar());
|
||||
userView.setVisibility(View.GONE);
|
||||
loginButton.setVisibility(View.GONE);
|
||||
registerButton.setVisibility(View.GONE);
|
||||
logoutButton.setVisibility(View.GONE);
|
||||
waitloginoutView.setVisibility(View.VISIBLE);
|
||||
mAvatar.setImageBitmap(mClient.getAvatar());
|
||||
mUsernameView.setVisibility(View.GONE);
|
||||
mLoginButton.setVisibility(View.GONE);
|
||||
mRegisterButton.setVisibility(View.GONE);
|
||||
mLogoutButton.setVisibility(View.GONE);
|
||||
mWaitLogView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTargetUrl(int targetPage) {
|
||||
public String getTargetUrl(int targetPage) {
|
||||
lus.setPage(targetPage);
|
||||
return lus.getUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGetGallerys(String url, final long taskStamp, final OnGetListListener listener) {
|
||||
public void doGetGallerys(String url, final long taskStamp, final OnGetListListener listener) {
|
||||
if (lus.getMode() == ListUrls.MODE_IMAGE_SEARCH) {
|
||||
if (url == null) {
|
||||
// No result url
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.app.ActionBar;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@@ -47,18 +46,25 @@ import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.Theme;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView;
|
||||
import com.hippo.ehviewer.widget.GalleryListView.OnGetListListener;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.PullViewGroup;
|
||||
import com.hippo.ehviewer.widget.RatingView;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class HistoryActivity extends AbsGalleryActivity
|
||||
implements AdapterView.OnItemClickListener, MaterialAlertDialog.OnClickListener {
|
||||
public class HistoryActivity extends AbsActivity
|
||||
implements AdapterView.OnItemClickListener, MaterialAlertDialog.OnClickListener,
|
||||
GalleryListView.GalleryListViewHelper, FitWindowView.OnFitSystemWindowsListener {
|
||||
|
||||
private static final String TAG = HistoryActivity.class.getSimpleName();
|
||||
|
||||
private Data mData;
|
||||
private ActionBar mActionBar;
|
||||
private int mThemeColor;
|
||||
|
||||
private FitWindowView mStandard;
|
||||
private GalleryListView mGalleryListView;
|
||||
private PullViewGroup mPullViewGroup;
|
||||
private ListView mList;
|
||||
|
||||
@@ -101,7 +107,7 @@ public class HistoryActivity extends AbsGalleryActivity
|
||||
if (newFilterMode != mFilterMode) {
|
||||
mFilterMode = newFilterMode;
|
||||
Config.setInt(KEY_HISTORY_FILTER, mFilterMode);
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -110,7 +116,7 @@ public class HistoryActivity extends AbsGalleryActivity
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
Data.getInstance().clearHistory();
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -138,52 +144,43 @@ public class HistoryActivity extends AbsGalleryActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
mList.setPadding(mList.getPaddingLeft(), paddingTop,
|
||||
mList.getPaddingRight(), paddingBottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutRes() {
|
||||
return R.layout.favorite_list;
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
mList.setPadding(mList.getPaddingLeft(), t, mList.getPaddingRight(), b);
|
||||
Ui.translucent(this, mThemeColor, t - Ui.ACTION_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
refresh();
|
||||
mGalleryListView.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.history);
|
||||
|
||||
mData = Data.getInstance();
|
||||
|
||||
mFilterMode = Config.getInt(KEY_HISTORY_FILTER, Data.BROWSE | Data.READ);
|
||||
|
||||
// Just avoid error
|
||||
setBehindContentView(new View(this));
|
||||
setSlidingActionBarEnabled(false);
|
||||
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
|
||||
getSlidingMenu().setEnabled(false);
|
||||
mActionBar = getActionBar();
|
||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
mThemeColor = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
mActionBar.setBackgroundDrawable(new ColorDrawable(mThemeColor));
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
int color = Config.getRandomThemeColor() ? Theme.getRandomDarkColor() : Config.getThemeColor();
|
||||
color = color & 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(color);
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, color);
|
||||
|
||||
mPullViewGroup = getPullViewGroup();
|
||||
mList = (ListView) getContentView();
|
||||
mStandard = (FitWindowView) findViewById(R.id.standard);
|
||||
mGalleryListView = (GalleryListView) findViewById(R.id.gallery_list);
|
||||
mPullViewGroup = mGalleryListView.getPullViewGroup();
|
||||
mList = (ListView) mGalleryListView.getContentView();
|
||||
|
||||
mGalleryListView.setGalleryListViewHelper(this);
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
mPullViewGroup.setAgainstToChildPadding(true);
|
||||
mPullViewGroup.setEnabledHeader(false);
|
||||
mPullViewGroup.setEnabledFooter(false);
|
||||
|
||||
mAdapter = new ListAdapter(getGalleryList());
|
||||
mAdapter = new ListAdapter(mGalleryListView.getGalleryList());
|
||||
mList.setAdapter(mAdapter);
|
||||
mList.setClipToPadding(false);
|
||||
mList.setDivider(null);
|
||||
@@ -224,12 +221,12 @@ public class HistoryActivity extends AbsGalleryActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTargetUrl(int targetPage) {
|
||||
public String getTargetUrl(int targetPage) {
|
||||
return HISTORY_URL;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGetGallerys(String url, long taskStamp,
|
||||
public void doGetGallerys(String url, long taskStamp,
|
||||
OnGetListListener listener) {
|
||||
if (url.equals(HISTORY_URL)) {
|
||||
List<GalleryInfo> giList = new ArrayList<GalleryInfo>(mData.getHistory(mFilterMode, true));
|
||||
@@ -244,7 +241,7 @@ public class HistoryActivity extends AbsGalleryActivity
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position,
|
||||
long id) {
|
||||
Intent intent = new Intent(this, GalleryDetailActivity.class);
|
||||
GalleryInfo gi = getGalleryInfo(position);
|
||||
GalleryInfo gi = mGalleryListView.getGalleryInfo(position);
|
||||
intent.putExtra(GalleryDetailActivity.KEY_G_INFO, gi);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
public interface OnOrientationChangedListener {
|
||||
|
||||
/**
|
||||
* It will invoke when Acticity onStart, Orientation Changed
|
||||
* @param paddingTop
|
||||
* @param paddingBottom
|
||||
*/
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom);
|
||||
}
|
||||
@@ -76,13 +76,15 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
import com.hippo.ehviewer.widget.CategoryTable;
|
||||
import com.hippo.ehviewer.widget.FileExplorerView;
|
||||
import com.hippo.ehviewer.widget.FitWindowView;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.SuggestionHelper;
|
||||
|
||||
public class SettingsActivity extends AbsPreferenceActivity {
|
||||
public class SettingsActivity extends AbsPreferenceActivity implements FitWindowView.OnFitSystemWindowsListener {
|
||||
@SuppressWarnings("unused")
|
||||
private static String TAG = SettingsActivity.class.getSimpleName();
|
||||
|
||||
private FitWindowView mStandard;
|
||||
private List<TranslucentPreferenceFragment> mFragments;
|
||||
private ListView mListView;
|
||||
|
||||
@@ -90,17 +92,28 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
mListView.setPadding(mListView.getPaddingLeft(), paddingTop, mListView.getPaddingRight(), paddingBottom);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
// for (TranslucentPreferenceFragment f : mFragments) {
|
||||
// if (f.isVisible()) {
|
||||
// f.adjustPadding(paddingTop, paddingBottom);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// If no fragment is visible, just headers is shown
|
||||
// adjustPadding(paddingTop, paddingBottom);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onOrientationChanged(int paddingTop, int paddingBottom) {
|
||||
public void onFitSystemWindows(int l, int t, int r, int b) {
|
||||
for (TranslucentPreferenceFragment f : mFragments) {
|
||||
if (f.isVisible()) {
|
||||
f.adjustPadding(paddingTop, paddingBottom);
|
||||
f.adjustPadding(t, b);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If no fragment is visible, just headers is shown
|
||||
adjustPadding(paddingTop, paddingBottom);
|
||||
adjustPadding(t, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +126,7 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
Drawable drawable = new ColorDrawable(color);
|
||||
final ActionBar actionBar = getActionBar();
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
Ui.translucent(this, color);
|
||||
Ui.translucent(this, color, 0);
|
||||
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@@ -121,6 +134,23 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
|
||||
mListView = getListView();
|
||||
mListView.setClipToPadding(false);
|
||||
|
||||
int listIndex = -1;
|
||||
ViewGroup p = (ViewGroup) mListView.getParent();
|
||||
int size = p.getChildCount();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (mListView == p.getChildAt(i)) {
|
||||
listIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex != -1) {
|
||||
mStandard = new FitWindowView(this);
|
||||
mStandard.addOnFitSystemWindowsListener(this);
|
||||
p.addView(mStandard, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyCharacterMap;
|
||||
@@ -40,6 +39,7 @@ import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.FrameLayout.LayoutParams;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -76,6 +76,8 @@ public class Ui {
|
||||
public static int ACTION_BAR_HEIGHT_L;
|
||||
public static int NAV_BAR_HEIGHT;
|
||||
|
||||
public static int ACTION_BAR_HEIGHT;
|
||||
|
||||
static {
|
||||
// Android allows a system property to override the presence of the navigation bar.
|
||||
// Used by the emulator.
|
||||
@@ -128,17 +130,14 @@ public class Ui {
|
||||
|
||||
// Get height info
|
||||
STATUS_BAR_HEIGHT = getInternalDimensionSize(mResources, "status_bar_height");
|
||||
if ("L".equals(Build.VERSION.CODENAME) || Build.VERSION.SDK_INT >= 21) {
|
||||
ACTION_BAR_HEIGHT_P = Ui.dp2pix(56);
|
||||
ACTION_BAR_HEIGHT_L = Ui.dp2pix(48);
|
||||
} else {
|
||||
ACTION_BAR_HEIGHT_P = Ui.dp2pix(48);
|
||||
ACTION_BAR_HEIGHT_L = Ui.dp2pix(40);
|
||||
}
|
||||
ACTION_BAR_HEIGHT_P = Ui.dp2pix(56);
|
||||
ACTION_BAR_HEIGHT_L = Ui.dp2pix(56);
|
||||
if (hasNavBar(mContext))
|
||||
NAV_BAR_HEIGHT = getInternalDimensionSize(mResources, "navigation_bar_height");
|
||||
else
|
||||
NAV_BAR_HEIGHT = 0;
|
||||
|
||||
ACTION_BAR_HEIGHT = mResources.getDimensionPixelSize(R.dimen.action_bar_height);
|
||||
}
|
||||
|
||||
public static int getInternalDimensionSize(Resources res, String key) {
|
||||
@@ -312,19 +311,6 @@ public class Ui {
|
||||
child.measure(childWidthSpec, childHeightSpec);
|
||||
}
|
||||
|
||||
public static final int ORIENTATION_PORTRAIT = 0x0;
|
||||
public static final int ORIENTATION_LANDSCAPE = 0x1;
|
||||
|
||||
public static int getOrientation(Activity activity) {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
if (dm.heightPixels > dm.widthPixels){
|
||||
return ORIENTATION_PORTRAIT;
|
||||
}else{
|
||||
return ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update translucent state for API >= 19, KK or more powerful
|
||||
*
|
||||
@@ -333,13 +319,13 @@ public class Ui {
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
public static void updateTranslucent(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
int screenOri = getOrientation(activity);
|
||||
Configuration c = activity.getResources().getConfiguration();
|
||||
Window w = activity.getWindow();
|
||||
|
||||
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
if (screenOri == ORIENTATION_PORTRAIT)
|
||||
if (c.orientation == Configuration.ORIENTATION_PORTRAIT)
|
||||
w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
else if (screenOri == ORIENTATION_LANDSCAPE)
|
||||
else if (c.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
}
|
||||
}
|
||||
@@ -356,15 +342,32 @@ public class Ui {
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
public static void translucent(
|
||||
Activity activity, int color) {
|
||||
public static void translucent(Activity activity, int color, int height) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
ViewGroup decorViewGroup = (ViewGroup)activity.getWindow().getDecorView();
|
||||
View statusBarBgView = new View(activity);
|
||||
boolean needAdd = false;
|
||||
FrameLayout.LayoutParams lp;
|
||||
ViewGroup decorViewGroup = (ViewGroup) activity.getWindow().getDecorView();
|
||||
|
||||
View statusBarBgView = (View) decorViewGroup.getTag(R.id.translucent_view);
|
||||
if (statusBarBgView == null) {
|
||||
needAdd = true;
|
||||
statusBarBgView = new View(activity);
|
||||
}
|
||||
statusBarBgView.setBackgroundColor(color);
|
||||
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, STATUS_BAR_HEIGHT);
|
||||
|
||||
lp = (FrameLayout.LayoutParams) statusBarBgView.getLayoutParams();
|
||||
if (lp == null)
|
||||
lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, height);
|
||||
else
|
||||
lp.height = height;
|
||||
lp.gravity = Gravity.TOP;
|
||||
decorViewGroup.addView(statusBarBgView, lp);
|
||||
|
||||
if (needAdd) {
|
||||
decorViewGroup.addView(statusBarBgView, lp);
|
||||
decorViewGroup.setTag(R.id.translucent_view, statusBarBgView);
|
||||
} else {
|
||||
statusBarBgView.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.widget;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class FitWindowView extends View {
|
||||
|
||||
private List<OnFitSystemWindowsListener> mListeners;
|
||||
|
||||
public FitWindowView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public FitWindowView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public FitWindowView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public FitWindowView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mListeners = new LinkedList<OnFitSystemWindowsListener>();
|
||||
setFitsSystemWindows(true);
|
||||
}
|
||||
|
||||
public void addOnFitSystemWindowsListener(OnFitSystemWindowsListener l) {
|
||||
mListeners.add(l);
|
||||
}
|
||||
|
||||
public void removeOnFitSystemWindowsListener(OnFitSystemWindowsListener l) {
|
||||
mListeners.remove(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected boolean fitSystemWindows(Rect insets) {
|
||||
int l = insets.left;
|
||||
int t = insets.top;
|
||||
int r = insets.right;
|
||||
int b = insets.bottom;
|
||||
for (OnFitSystemWindowsListener listener : mListeners)
|
||||
listener.onFitSystemWindows(l, t, r, b);
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
|
||||
public static interface OnFitSystemWindowsListener {
|
||||
public void onFitSystemWindows(int l, int t, int r, int b);
|
||||
}
|
||||
}
|
||||
+167
-145
@@ -14,47 +14,47 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.cache.ImageCache;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.ehclient.ListParser;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.PullViewGroup;
|
||||
import com.hippo.ehviewer.widget.RefreshTextView;
|
||||
|
||||
public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
implements PullViewGroup.OnFooterRefreshListener,
|
||||
PullViewGroup.OnRefreshListener {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = AbsGalleryActivity.class.getSimpleName();
|
||||
public class GalleryListView extends FrameLayout implements PullViewGroup.OnFooterRefreshListener,
|
||||
PullViewGroup.OnRefreshListener, ListView.OnScrollListener {
|
||||
|
||||
private static final String TAG = GalleryListView.class.getSimpleName();
|
||||
|
||||
private static final int MODE_REFRESH = 0x0;
|
||||
private static final int MODE_NEXT_PAGE = 0x1;
|
||||
private static final int MODE_PRE_PAGE = 0x2;
|
||||
private static final int MODE_SOMEWHERE = 0x3;
|
||||
|
||||
protected Context mContext;
|
||||
protected EhClient mClient;
|
||||
private Context mContext;
|
||||
private EhClient mClient;
|
||||
private GalleryListViewHelper mHelper;
|
||||
|
||||
private List<GalleryInfo> mGiList;
|
||||
|
||||
private RelativeLayout mMainView;
|
||||
private PullViewGroup mPullViewGroup;
|
||||
private AbsListView mContentView;
|
||||
private RefreshTextView mRefreshTextView;
|
||||
@@ -79,40 +79,110 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
private String mTargetUrl;
|
||||
private boolean isFootRefresh = false;
|
||||
|
||||
public GalleryListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs, 0, 0);
|
||||
}
|
||||
|
||||
public GalleryListView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public GalleryListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
mContext = context;
|
||||
mGiList = new ArrayList<GalleryInfo>();
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GalleryListView, defStyleAttr, defStyleRes);
|
||||
int index = a.getInt(R.styleable.GalleryListView_glvContent, -1);
|
||||
a.recycle();
|
||||
|
||||
int resId;
|
||||
switch(index) {
|
||||
case 0:
|
||||
resId = R.layout.gallery_list_listview;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
resId = R.layout.gallery_list_staggeredgridview;
|
||||
break;
|
||||
}
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
inflater.inflate(resId, this);
|
||||
|
||||
mPullViewGroup = (PullViewGroup) findViewById(R.id.pull_list);
|
||||
mContentView = mPullViewGroup.getContentView();
|
||||
mRefreshTextView = (RefreshTextView) findViewById(R.id.refresh_text);
|
||||
|
||||
mPullViewGroup.setColorScheme(
|
||||
R.color.refresh_color_1,
|
||||
R.color.refresh_color_2,
|
||||
R.color.refresh_color_3,
|
||||
R.color.refresh_color_4);
|
||||
mPullViewGroup.setOnHeaderRefreshListener(this);
|
||||
mPullViewGroup.setOnFooterRefreshListener(this);
|
||||
mPullViewGroup.setFooterString(
|
||||
mContext.getString(R.string.footer_loading),
|
||||
mContext.getString(R.string.footer_loaded),
|
||||
mContext.getString(R.string.footer_fail));
|
||||
|
||||
mContentView.setOnScrollListener(this);
|
||||
mContentView.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mContentView.setClipToPadding(false);
|
||||
|
||||
mRefreshTextView.setDefaultRefresh(R.string.click_retry, new RefreshTextView.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
retry();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setGalleryListViewHelper(GalleryListViewHelper h) {
|
||||
mHelper = h;
|
||||
}
|
||||
|
||||
public PullViewGroup getPullViewGroup() {
|
||||
return mPullViewGroup;
|
||||
}
|
||||
|
||||
public AbsListView getContentView() {
|
||||
return mContentView;
|
||||
}
|
||||
|
||||
public RefreshTextView getRefreshTextView() {
|
||||
return mRefreshTextView;
|
||||
}
|
||||
|
||||
public void setNoneText(CharSequence text) {
|
||||
mRefreshTextView.setVisibility(View.VISIBLE);
|
||||
mRefreshTextView.setEmesg(text, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url string for very page
|
||||
*
|
||||
* @param targetPage
|
||||
* @return
|
||||
*/
|
||||
protected abstract String getTargetUrl(int targetPage);
|
||||
public void onlyShowList() {
|
||||
mPullViewGroup.setVisibility(View.VISIBLE);
|
||||
mRefreshTextView.setRefreshing(false);
|
||||
mRefreshTextView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do get gallarys here, you shuold invoke the onSuccess or
|
||||
* onFailure of listener when over
|
||||
*
|
||||
* @param url
|
||||
* @param taskStamp
|
||||
* @param listener
|
||||
*/
|
||||
protected abstract void doGetGallerys(String url, long taskStamp, OnGetListListener listener);
|
||||
|
||||
/**
|
||||
* Get the layout resources
|
||||
* @return
|
||||
*/
|
||||
protected abstract int getLayoutRes();
|
||||
public void onlyShowNone() {
|
||||
mPullViewGroup.setVisibility(View.GONE);
|
||||
mRefreshTextView.setVisibility(View.VISIBLE);
|
||||
mRefreshTextView.setEmesg(R.string.none, false);
|
||||
}
|
||||
|
||||
private void getGallerys() {
|
||||
setGallerysLayout();
|
||||
|
||||
mTaskStamp = System.currentTimeMillis();
|
||||
doGetGallerys(mTargetUrl, mTaskStamp, mListener);
|
||||
mHelper.doGetGallerys(mTargetUrl, mTaskStamp, mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,19 +207,7 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void onlyShowList() {
|
||||
mPullViewGroup.setVisibility(View.VISIBLE);
|
||||
mRefreshTextView.setRefreshing(false);
|
||||
mRefreshTextView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void onlyShowNone() {
|
||||
mPullViewGroup.setVisibility(View.GONE);
|
||||
mRefreshTextView.setVisibility(View.VISIBLE);
|
||||
mRefreshTextView.setEmesg(R.string.none, false);
|
||||
}
|
||||
|
||||
protected void firstTimeRefresh() {
|
||||
public void firstTimeRefresh() {
|
||||
// set mPullViewGroup gone, make wait view show
|
||||
mPullViewGroup.setVisibility(View.GONE);
|
||||
mRefreshTextView.setVisibility(View.VISIBLE);
|
||||
@@ -172,19 +230,26 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
|
||||
protected boolean retry() {
|
||||
// Need to update url, because mode may be changed
|
||||
mTargetUrl = getTargetUrl(mTargetPage);
|
||||
mTargetUrl = mHelper.getTargetUrl(mTargetPage);
|
||||
getGallerys();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setListPosition(int position) {
|
||||
if (position == 0)
|
||||
mPullViewGroup.setSelectionFromTop(position, Integer.MAX_VALUE);
|
||||
else
|
||||
mPullViewGroup.setSelectionFromTop(position, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to page 0.<br>
|
||||
* You should know you can refresh or not.
|
||||
*/
|
||||
protected void refresh() {
|
||||
public void refresh() {
|
||||
mGetMode = MODE_REFRESH;
|
||||
mTargetPage = 0;
|
||||
mTargetUrl = getTargetUrl(mTargetPage);
|
||||
mTargetUrl = mHelper.getTargetUrl(mTargetPage);
|
||||
mIsKeepPosition = false;
|
||||
getGallerys();
|
||||
}
|
||||
@@ -198,7 +263,7 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
protected void getPrePage(boolean isKeepPosition) {
|
||||
mGetMode = MODE_PRE_PAGE;
|
||||
mTargetPage = mFirstPage - 1;
|
||||
mTargetUrl = getTargetUrl(mTargetPage);
|
||||
mTargetUrl = mHelper.getTargetUrl(mTargetPage);
|
||||
mIsKeepPosition = isKeepPosition;
|
||||
getGallerys();
|
||||
}
|
||||
@@ -212,7 +277,7 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
protected void getNextPage(boolean isKeepPosition) {
|
||||
mGetMode = MODE_NEXT_PAGE;
|
||||
mTargetPage = mLastPage + 1;
|
||||
mTargetUrl = getTargetUrl(mTargetPage);
|
||||
mTargetUrl = mHelper.getTargetUrl(mTargetPage);
|
||||
mIsKeepPosition = isKeepPosition;
|
||||
getGallerys();
|
||||
}
|
||||
@@ -226,7 +291,7 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
protected void getSomewhere(int page) {
|
||||
mGetMode = MODE_SOMEWHERE;
|
||||
mTargetPage = page;
|
||||
mTargetUrl = getTargetUrl(mTargetPage);
|
||||
mTargetUrl = mHelper.getTargetUrl(mTargetPage);
|
||||
mIsKeepPosition = false;
|
||||
getGallerys();
|
||||
}
|
||||
@@ -244,60 +309,6 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getLayoutRes());
|
||||
|
||||
mContext = getApplication();
|
||||
mClient = EhClient.getInstance();
|
||||
|
||||
mGiList = new ArrayList<GalleryInfo>();
|
||||
|
||||
mMainView = (RelativeLayout)findViewById(R.id.main);
|
||||
mPullViewGroup = (PullViewGroup)findViewById(R.id.gallery_list);
|
||||
mPullViewGroup.setAgainstToChildPadding(true);
|
||||
mContentView = mPullViewGroup.getContentView();
|
||||
mRefreshTextView = (RefreshTextView)findViewById(R.id.refresh_text);
|
||||
|
||||
mPullViewGroup.setColorScheme(R.color.refresh_color_1,
|
||||
R.color.refresh_color_2,
|
||||
R.color.refresh_color_3,
|
||||
R.color.refresh_color_4);
|
||||
mPullViewGroup.setOnHeaderRefreshListener(this);
|
||||
mPullViewGroup.setOnFooterRefreshListener(this);
|
||||
mPullViewGroup.setFooterString(getString(R.string.footer_loading),
|
||||
getString(R.string.footer_loaded),
|
||||
getString(R.string.footer_fail));
|
||||
|
||||
mContentView.setOnScrollListener(new ScrollListener());
|
||||
mContentView.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mContentView.setClipToPadding(false);
|
||||
|
||||
mRefreshTextView.setDefaultRefresh(R.string.click_retry,
|
||||
new RefreshTextView.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
retry();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list view
|
||||
*/
|
||||
public AbsListView getContentView() {
|
||||
return mContentView;
|
||||
}
|
||||
|
||||
public RelativeLayout getMainView() {
|
||||
return mMainView;
|
||||
}
|
||||
|
||||
public PullViewGroup getPullViewGroup() {
|
||||
return mPullViewGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if actionbar or footer is refreshing
|
||||
*/
|
||||
@@ -325,46 +336,35 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
return mGiList.get(position);
|
||||
}
|
||||
|
||||
private class ScrollListener implements ListView.OnScrollListener {
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem,
|
||||
int visibleItemCount, int totalItemCount) {
|
||||
mPullViewGroup.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
mPullViewGroup.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
|
||||
|
||||
if (visibleItemCount < 2 || mItemPerPage == 0)
|
||||
return;
|
||||
if (mLastIndex == 0)
|
||||
mLastIndex = mItemPerPage - 1;
|
||||
int pageChanged = (firstVisibleItem - mFirstIndex)
|
||||
/ mItemPerPage;
|
||||
if (pageChanged == 0)
|
||||
pageChanged = (firstVisibleItem + visibleItemCount - mLastIndex - 1)
|
||||
/ mItemPerPage;
|
||||
if (visibleItemCount < 2 || mItemPerPage == 0)
|
||||
return;
|
||||
if (mLastIndex == 0)
|
||||
mLastIndex = mItemPerPage - 1;
|
||||
int pageChanged = (firstVisibleItem - mFirstIndex) / mItemPerPage;
|
||||
if (pageChanged == 0)
|
||||
pageChanged = (firstVisibleItem + visibleItemCount - mLastIndex - 1) / mItemPerPage;
|
||||
|
||||
if (pageChanged != 0) {
|
||||
mCurPage = mCurPage + pageChanged;
|
||||
mFirstIndex += pageChanged * mItemPerPage;
|
||||
mLastIndex += pageChanged * mItemPerPage;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
switch (scrollState) {
|
||||
case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
|
||||
ImageCache.getInstance(mContext).setPauseDiskCache(true);
|
||||
break;
|
||||
case AbsListView.OnScrollListener.SCROLL_STATE_IDLE:
|
||||
ImageCache.getInstance(mContext).setPauseDiskCache(false);
|
||||
break;
|
||||
}
|
||||
if (pageChanged != 0) {
|
||||
mCurPage = mCurPage + pageChanged;
|
||||
mFirstIndex += pageChanged * mItemPerPage;
|
||||
mLastIndex += pageChanged * mItemPerPage;
|
||||
}
|
||||
}
|
||||
|
||||
private void setListPosition(int position) {
|
||||
if (position == 0)
|
||||
mPullViewGroup.setSelectionFromTop(position, Integer.MAX_VALUE);
|
||||
else
|
||||
mPullViewGroup.setSelectionFromTop(position, 0);
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
switch (scrollState) {
|
||||
case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
|
||||
ImageCache.getInstance(mContext).setPauseDiskCache(true);
|
||||
break;
|
||||
case AbsListView.OnScrollListener.SCROLL_STATE_IDLE:
|
||||
ImageCache.getInstance(mContext).setPauseDiskCache(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnGetListListener {
|
||||
@@ -461,6 +461,7 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
|
||||
mPullViewGroup.setAnyRefreshComplete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(BaseAdapter adapter, long taskStamp, String eMsg) {
|
||||
if (mTaskStamp != taskStamp)
|
||||
@@ -492,4 +493,25 @@ public abstract class AbsGalleryActivity extends AbsSlidingActivity
|
||||
mPullViewGroup.setAnyRefreshComplete(false);
|
||||
}
|
||||
};
|
||||
|
||||
public static interface GalleryListViewHelper {
|
||||
/**
|
||||
* Get url string for very page
|
||||
*
|
||||
* @param targetPage
|
||||
* @return
|
||||
*/
|
||||
public String getTargetUrl(int targetPage);
|
||||
|
||||
/**
|
||||
* Do get gallarys here, you shuold invoke the onSuccess or onFailure of
|
||||
* listener when over
|
||||
*
|
||||
* @param url
|
||||
* @param taskStamp
|
||||
* @param listener
|
||||
*/
|
||||
public void doGetGallerys(String url, long taskStamp, OnGetListListener listener);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user