From 40ee1afa07581cba0b1505d9a3c7e76b5b491675 Mon Sep 17 00:00:00 2001 From: Trinea Date: Sat, 4 Jan 2014 23:03:00 +0800 Subject: [PATCH] Experience Optimization fix ImageSDCardCacheDemo no default icon fix ServiceDemo bug add DropDownListView click item tip add BorderScrollView tip --- proguard.cfg | 7 +++---- res/layout/border_scroll_view_demo.xml | 2 +- res/layout/image_list_item.xml | 3 +-- res/layout/search_view_demo_title.xml | 4 ++-- res/values-zh-rCN/strings.xml | 3 +++ res/values-zh-rTW/strings.xml | 3 +++ res/values/strings.xml | 3 +++ src/cn/trinea/android/demo/DropDownListViewDemo.java | 10 ++++++++++ src/cn/trinea/android/demo/ImageCacheDemo.java | 10 +++++----- src/cn/trinea/android/demo/ImageSDCardCacheDemo.java | 7 ++++++- src/cn/trinea/android/demo/MyService.java | 4 ---- src/cn/trinea/android/demo/SearchViewDemo.java | 6 +++--- src/cn/trinea/android/demo/ServiceDemo.java | 2 +- 13 files changed, 41 insertions(+), 23 deletions(-) diff --git a/proguard.cfg b/proguard.cfg index 6ac870e..34b26e6 100644 --- a/proguard.cfg +++ b/proguard.cfg @@ -94,10 +94,9 @@ # Don't warn about those in case this app is linking against an older # platform version. We know about them, and they are safe. # See proguard-android.txt in the SDK package. --dontwarn android.support.** - -libraryjars libs/android-support-v4.jar --dontwarn android.support.v4.** + +-dontwarn android.support.** -keep class android.support.v4.** { *; } -keep interface android.support.v4.app.** { *; } -keep class cn.trinea.android.common.** { *; } @@ -107,4 +106,4 @@ -dontskipnonpubliclibraryclassmembers -dontwarn com.google.ads.** --keep class com.google.** {*;} +-keep class com.google.** {*;} \ No newline at end of file diff --git a/res/layout/border_scroll_view_demo.xml b/res/layout/border_scroll_view_demo.xml index 1dadfb6..75b20eb 100644 --- a/res/layout/border_scroll_view_demo.xml +++ b/res/layout/border_scroll_view_demo.xml @@ -27,7 +27,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/top_text" android:gravity="center" - android:text="text1" /> + android:text="@string/on_border_tip" /> + android:contentDescription="@string/image_content" /> \ No newline at end of file diff --git a/res/layout/search_view_demo_title.xml b/res/layout/search_view_demo_title.xml index 230ad7b..ac4e47e 100644 --- a/res/layout/search_view_demo_title.xml +++ b/res/layout/search_view_demo_title.xml @@ -1,11 +1,11 @@ 更多介绍:  获取内容 + 下拉刷新或滚动到底部加载更多 + 滚动到顶部或底部进行体验 + SearchView介绍及搜索提示实现 viewpager实现画廊效果 系统下载管理使用 diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 42ad99d..ec58fa3 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -47,6 +47,9 @@ 更多介紹:  獲取內容 + 下拉刷新或滾動到底部加載更多 + 滾動到頂部或底部進行體驗 + SearchView介紹及搜索提示實現 viewpager實現畫廊效果 系統下載管理使用 diff --git a/res/values/strings.xml b/res/values/strings.xml index 45b87b0..64f324d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -64,6 +64,9 @@ Profile:  Description:  Get content + + Pull down to refresh or scroll to bottom to load more + Scroll to top or bottom to xperience SearchView Desc And Implement Search Tip Viewpager With Multi Page diff --git a/src/cn/trinea/android/demo/DropDownListViewDemo.java b/src/cn/trinea/android/demo/DropDownListViewDemo.java index 9baeb1b..c39a791 100644 --- a/src/cn/trinea/android/demo/DropDownListViewDemo.java +++ b/src/cn/trinea/android/demo/DropDownListViewDemo.java @@ -9,7 +9,10 @@ import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; +import cn.trinea.android.common.util.ToastUtils; import cn.trinea.android.common.view.DropDownListView; import cn.trinea.android.common.view.DropDownListView.OnDropDownListener; @@ -49,6 +52,13 @@ public void onClick(View v) { new GetDataTask(false).execute(); } }); + listView.setOnItemClickListener(new OnItemClickListener() { + + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + ToastUtils.show(context, R.string.drop_down_tip); + } + }); listItems = new LinkedList(); listItems.addAll(Arrays.asList(mStrings)); diff --git a/src/cn/trinea/android/demo/ImageCacheDemo.java b/src/cn/trinea/android/demo/ImageCacheDemo.java index d875533..8eaf7c3 100644 --- a/src/cn/trinea/android/demo/ImageCacheDemo.java +++ b/src/cn/trinea/android/demo/ImageCacheDemo.java @@ -96,12 +96,10 @@ public void onCreate(Bundle savedInstanceState) { if (column > 0) { layoutParams.addRule(RelativeLayout.RIGHT_OF, viewId - 1); } + layoutParams.height = IMAGEVIEW_DEFAULT_HEIGHT; // get image - if (!IMAGE_CACHE.get(imageUrl, imageView)) { - imageView.setImageResource(R.drawable.trinea); - layoutParams.height = IMAGEVIEW_DEFAULT_HEIGHT; - } + IMAGE_CACHE.get(imageUrl, imageView); count++; } } @@ -174,7 +172,9 @@ public void onGetFailed(String imageUrl, Drawable imageDrawable, View view, Fail @Override public void onGetNotInCache(String imageUrl, View view) { - // you can do something when image not in cache, for example set default image + if (view != null && view instanceof ImageView) { + ((ImageView)view).setImageResource(R.drawable.trinea); + } } }; IMAGE_CACHE.setOnImageCallbackListener(imageCallBack); diff --git a/src/cn/trinea/android/demo/ImageSDCardCacheDemo.java b/src/cn/trinea/android/demo/ImageSDCardCacheDemo.java index 164c7a8..f690f57 100644 --- a/src/cn/trinea/android/demo/ImageSDCardCacheDemo.java +++ b/src/cn/trinea/android/demo/ImageSDCardCacheDemo.java @@ -16,6 +16,7 @@ import android.view.animation.AlphaAnimation; import android.widget.BaseAdapter; import android.widget.ImageView; +import android.widget.ImageView.ScaleType; import cn.trinea.android.common.entity.FailedReason; import cn.trinea.android.common.service.impl.FileNameRuleImageUrl; import cn.trinea.android.common.service.impl.ImageSDCardCache; @@ -94,6 +95,7 @@ public void onGetSuccess(String imageUrl, String imagePath, View view, boolean i if (!isInCache) { imageView.startAnimation(getInAlphaAnimation(2000)); } + imageView.setScaleType(ScaleType.FIT_CENTER); } } @@ -111,7 +113,10 @@ public void onPreGet(String imageUrl, View view) { @Override public void onGetNotInCache(String imageUrl, View view) { // you can do something when image not in cache, for example set default image - // holder.imageView.setImageResource(R.drawable.trinea); + if (view != null && view instanceof ImageView) { + ((ImageView)view).setImageResource(R.drawable.trinea); + ((ImageView)view).setScaleType(ScaleType.CENTER); + } } /** diff --git a/src/cn/trinea/android/demo/MyService.java b/src/cn/trinea/android/demo/MyService.java index 69f62a8..a6f1e26 100644 --- a/src/cn/trinea/android/demo/MyService.java +++ b/src/cn/trinea/android/demo/MyService.java @@ -34,10 +34,6 @@ public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId); } - /** - * 服务被绑定时调用 返回值用于让调用者和服务通信,传入ServiceConnection的public void onServiceConnected(ComponentName name, IBinder - * service)函数第二个参数 - */ @Override public IBinder onBind(Intent intent) { Toast.makeText(this, "Service onBind", Toast.LENGTH_SHORT).show(); diff --git a/src/cn/trinea/android/demo/SearchViewDemo.java b/src/cn/trinea/android/demo/SearchViewDemo.java index cd48c55..9074000 100644 --- a/src/cn/trinea/android/demo/SearchViewDemo.java +++ b/src/cn/trinea/android/demo/SearchViewDemo.java @@ -25,7 +25,8 @@ /** * SearchViewDemo * - * @author Trinea 2013-5-9 + * @author Trinea + * 2013-5-9 */ public class SearchViewDemo extends BaseActivity { @@ -89,8 +90,7 @@ public boolean onQueryTextChange(String newText) { } }); Display display = getWindowManager().getDefaultDisplay(); - LayoutParams params = new LayoutParams(display.getWidth() - - getResources().getDimensionPixelSize(R.dimen.search_view_margin_left), + LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT); bar.setCustomView(customActionBarView, params); diff --git a/src/cn/trinea/android/demo/ServiceDemo.java b/src/cn/trinea/android/demo/ServiceDemo.java index 3692bbb..771a7c2 100644 --- a/src/cn/trinea/android/demo/ServiceDemo.java +++ b/src/cn/trinea/android/demo/ServiceDemo.java @@ -125,7 +125,7 @@ public void onClick(View v) { @Override public void onClick(View v) { if (myService != null) { - ToastUtils.show(context, R.string.operate_value_tip, Integer.toString(myService.increaseCount())); + ToastUtils.show(context, R.string.operate_value_tip, Integer.toString(myService.getCount())); } else { ToastUtils.show(context, R.string.bind_service_tip, Toast.LENGTH_SHORT); }