Skip to content

Commit

Permalink
Experience Optimization
Browse files Browse the repository at this point in the history
fix ImageSDCardCacheDemo no default icon
fix ServiceDemo bug
add DropDownListView click item tip
add BorderScrollView tip
  • Loading branch information
Trinea committed Jan 4, 2014
1 parent 4a1d535 commit 40ee1af
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 23 deletions.
7 changes: 3 additions & 4 deletions proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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.** { *; }
Expand All @@ -107,4 +106,4 @@
-dontskipnonpubliclibraryclassmembers

-dontwarn com.google.ads.**
-keep class com.google.** {*;}
-keep class com.google.** {*;}
2 changes: 1 addition & 1 deletion res/layout/border_scroll_view_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

<TextView
android:id="@+id/text2"
Expand Down
3 changes: 1 addition & 2 deletions res/layout/image_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
android:layout_width="300dp"
android:layout_height="500dp"
android:layout_centerInParent="true"
android:contentDescription="@string/image_content"
android:scaleType="fitCenter" />
android:contentDescription="@string/image_content" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions res/layout/search_view_demo_title.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent" >

<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:iconifiedByDefault="true"
android:imeOptions="actionSearch"
Expand Down
3 changes: 3 additions & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<string name="description">更多介绍:&#160;</string>
<string name="http_cache_get">获取内容</string>

<string name="drop_down_tip">下拉刷新或滚动到底部加载更多</string>
<string name="on_border_tip">滚动到顶部或底部进行体验</string>

<string name="desc_search_view">SearchView介绍及搜索提示实现</string>
<string name="desc_view_pager_multi_page">viewpager实现画廊效果</string>
<string name="desc_download_manager">系统下载管理使用</string>
Expand Down
3 changes: 3 additions & 0 deletions res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<string name="description">更多介紹:&#160;</string>
<string name="http_cache_get">獲取內容</string>

<string name="drop_down_tip">下拉刷新或滾動到底部加載更多</string>
<string name="on_border_tip">滾動到頂部或底部進行體驗</string>

<string name="desc_search_view">SearchView介紹及搜索提示實現</string>
<string name="desc_view_pager_multi_page">viewpager實現畫廊效果</string>
<string name="desc_download_manager">系統下載管理使用</string>
Expand Down
3 changes: 3 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<string name="profile">Profile:&#160;</string>
<string name="description">Description:&#160;</string>
<string name="http_cache_get">Get content</string>

<string name="drop_down_tip">Pull down to refresh or scroll to bottom to load more</string>
<string name="on_border_tip">Scroll to top or bottom to xperience</string>

<string name="desc_search_view">SearchView Desc And Implement Search Tip</string>
<string name="desc_view_pager_multi_page">Viewpager With Multi Page</string>
Expand Down
10 changes: 10 additions & 0 deletions src/cn/trinea/android/demo/DropDownListViewDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<String>();
listItems.addAll(Arrays.asList(mStrings));
Expand Down
10 changes: 5 additions & 5 deletions src/cn/trinea/android/demo/ImageCacheDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/cn/trinea/android/demo/ImageSDCardCacheDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/cn/trinea/android/demo/MyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/cn/trinea/android/demo/SearchViewDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
/**
* SearchViewDemo
*
* @author <a href="http://www.trinea.cn/android/android-searchview-and-search-tips-impl/" target="_blank">Trinea</a> 2013-5-9
* @author <a href="http://www.trinea.cn/android/android-searchview-and-search-tips-impl/" target="_blank">Trinea</a>
* 2013-5-9
*/
public class SearchViewDemo extends BaseActivity {

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/cn/trinea/android/demo/ServiceDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 40ee1af

Please sign in to comment.