Merge branch 'master' of https://git.oschina.net/zftlive/zftlive.git
This commit is contained in:
commit
4d74268ccd
|
@ -290,7 +290,20 @@
|
|||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.zftlive.android.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</activity>
|
||||
|
||||
<!-- 自动获取表单数据示例 -->
|
||||
<activity
|
||||
android:name=".sample.data.AutoGainFormActivity"
|
||||
android:label="自动获取表单数据示例"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.zftlive.android.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 99 B |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/view_spinner_droplist_down" />
|
||||
<item android:state_focused="true" android:drawable="@drawable/view_spinner_droplist_focus" />
|
||||
<item android:drawable="@drawable/view_spinner_droplist" />
|
||||
</selector>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="?android:attr/spinnerDropDownItemStyle"
|
||||
android:singleLine="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="#000"
|
||||
android:textSize="14sp"/>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="?android:attr/spinnerDropDownItemStyle"
|
||||
android:singleLine="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:ellipsize="marquee"
|
||||
android:textColor="#fff"
|
||||
android:background="#000"/>
|
|
@ -0,0 +1,222 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res/com.zftlive.android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/frame_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".sample.data.AutoGainFormActivity" >
|
||||
|
||||
<!-- 账号 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_account"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_marginTop="18dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_username"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tv_account"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_username"
|
||||
style="@style/accountEditText"
|
||||
android:hint="@string/et_account_hint"
|
||||
android:tag="username" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 密码 -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_password"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_below="@id/ll_account"
|
||||
android:layout_marginTop="15dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tv_password"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_password"
|
||||
style="@style/accountEditText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/et_password_hint"
|
||||
android:inputType="textPassword"
|
||||
android:tag="password" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_view_password"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/lawngreen"
|
||||
android:text="@string/btn_show"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 毕业院校 -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_school"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_below="@id/ll_password"
|
||||
android:layout_marginTop="18dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_school"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tv_school"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<com.zftlive.android.view.SingleSpinner
|
||||
android:id="@+id/sp_school"
|
||||
style="@style/accountEditText"
|
||||
android:tag="school" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 性别 -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_sex"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_below="@id/ll_school"
|
||||
android:layout_marginTop="18dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sex"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/rg_sex"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<com.zftlive.android.view.RadioButton
|
||||
android:id="@+id/radioMale"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:checked="true"
|
||||
android:tag="sex"
|
||||
android:text="@string/sex_male"
|
||||
android:textColor="@color/deepgray"
|
||||
custom:value="male" />
|
||||
|
||||
<com.zftlive.android.view.RadioButton
|
||||
android:id="@+id/radioFemale"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:checked="false"
|
||||
android:tag="sex"
|
||||
android:text="@string/sex_female"
|
||||
android:textColor="@color/deepgray"
|
||||
custom:value="female" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 兴趣爱好 -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_hoby"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_below="@id/ll_sex"
|
||||
android:layout_marginTop="18dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_hoby"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tv_hoby"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<com.zftlive.android.view.CheckBox
|
||||
android:id="@+id/cb_sleep"
|
||||
style="@style/CustomCheckboxTheme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:tag="hoby"
|
||||
android:text="@string/hoby_sleep"
|
||||
android:textColor="@color/deepgray"
|
||||
custom:value="sleep" />
|
||||
|
||||
<com.zftlive.android.view.CheckBox
|
||||
android:id="@+id/cb_boll"
|
||||
style="@style/CustomCheckboxTheme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:tag="hoby"
|
||||
android:text="@string/hoby_boll"
|
||||
android:textColor="@color/deepgray"
|
||||
custom:value="boll" />
|
||||
|
||||
<com.zftlive.android.view.CheckBox
|
||||
android:id="@+id/cb_read"
|
||||
style="@style/CustomCheckboxTheme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:tag="hoby"
|
||||
android:text="@string/hoby_read"
|
||||
android:textColor="@color/deepgray"
|
||||
custom:value="read" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 账号 -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_remark"
|
||||
style="@style/accountInputBorder"
|
||||
android:layout_below="@id/ll_hoby"
|
||||
android:layout_marginTop="18dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_remark"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/remark"
|
||||
android:textColor="@color/grey" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_remark"
|
||||
style="@style/accountEditText"
|
||||
android:hint="@string/hint_remark"
|
||||
android:tag="remark" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 提交表单 -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ll_remark"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginRight="18dp"
|
||||
android:layout_marginTop="13dp" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_login"
|
||||
style="@style/accountButtonStyle"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:background="@color/orange"
|
||||
android:text="@string/btn_auto_gaindata" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -14,10 +14,12 @@
|
|||
|
||||
<EditText
|
||||
android:id="@+id/et_phone"
|
||||
android:inputType="phone"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2.0"
|
||||
android:background="@null" />
|
||||
android:background="@null"
|
||||
android:minHeight="50dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_gain_smscode"
|
||||
|
@ -27,11 +29,20 @@
|
|||
android:text="@string/sms_timer" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1.5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/gray" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_phone_code"
|
||||
android:inputType="phone"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null" />
|
||||
android:background="@null"
|
||||
android:minHeight="45dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_validate"
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<!--
|
||||
Copyright 2011 The Android Open Source Project
|
||||
|
||||
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>
|
||||
<!-- 圆角进度条(开始) -->
|
||||
<declare-styleable name="RoundProgressBar">
|
||||
<attr name="roundColor" format="color"/>
|
||||
<attr name="roundProgressColor" format="color"/>
|
||||
<attr name="roundWidth" format="dimension"></attr>
|
||||
<attr name="textColor" format="color" />
|
||||
<attr name="textSize" format="dimension" />
|
||||
<attr name="max" format="integer"></attr>
|
||||
<attr name="textIsDisplayable" format="boolean"></attr>
|
||||
<attr name="style">
|
||||
<enum name="STROKE" value="0"></enum>
|
||||
<enum name="FILL" value="1"></enum>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
<!-- 圆角进度条(结束) -->
|
||||
|
||||
|
||||
<!-- 圆形图片(开始) -->
|
||||
<declare-styleable name="RoundedImageView">
|
||||
<attr name="border_thickness" format="dimension"></attr>
|
||||
<attr name="border_outside_color" format="color"/>
|
||||
<attr name="border_inside_color" format="color"/>
|
||||
</declare-styleable>
|
||||
<!-- 圆形图片(结束) -->
|
||||
|
||||
|
||||
<!-- 等待操作对话框(开始) -->
|
||||
<style name="CustomDialog" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
</style>
|
||||
<style name="CustomProgressDialog" parent="@style/CustomDialog">
|
||||
<item name="android:windowBackground">@drawable/view_progress_dialog_bg</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
<!-- 等待操作对话框(结束) -->
|
||||
|
||||
|
||||
<!-- TextView(RadioButton/CheckBox)共通value(开始) -->
|
||||
<declare-styleable name="TextView" >
|
||||
<attr name="value" format="string"/>
|
||||
</declare-styleable>
|
||||
<!-- TextView(RadioButton/CheckBox)共通value(结束) -->
|
||||
|
||||
</resources>
|
|
@ -1,20 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- view_pull_refresh(start) -->
|
||||
<declare-styleable name="PullToRefresh">
|
||||
|
||||
<!-- A drawable to use as the background of the Refreshable View -->
|
||||
<attr name="ptrRefreshableViewBackground" format="reference|color" />
|
||||
|
||||
<!-- A drawable to use as the background of the Header and Footer Loading Views -->
|
||||
<attr name="ptrHeaderBackground" format="reference|color" />
|
||||
|
||||
<!-- Text Color of the Header and Footer Loading Views -->
|
||||
<attr name="ptrHeaderTextColor" format="reference|color" />
|
||||
|
||||
<!-- Text Color of the Header and Footer Loading Views Sub Header -->
|
||||
<attr name="ptrHeaderSubTextColor" format="reference|color" />
|
||||
|
||||
<!-- Mode of Pull-to-Refresh that should be used -->
|
||||
<attr name="ptrMode">
|
||||
<flag name="disabled" value="0x0" />
|
||||
|
@ -22,7 +18,6 @@
|
|||
<flag name="pullFromEnd" value="0x2" />
|
||||
<flag name="both" value="0x3" />
|
||||
<flag name="manualOnly" value="0x4" />
|
||||
|
||||
<!-- These last two are depreacted -->
|
||||
<flag name="pullDownFromTop" value="0x1" />
|
||||
<flag name="pullUpFromBottom" value="0x2" />
|
||||
|
@ -30,34 +25,25 @@
|
|||
|
||||
<!-- Whether the Indicator overlay(s) should be used -->
|
||||
<attr name="ptrShowIndicator" format="reference|boolean" />
|
||||
|
||||
<!-- Drawable to use as Loading Indicator. Changes both Header and Footer. -->
|
||||
<attr name="ptrDrawable" format="reference" />
|
||||
|
||||
<!-- Drawable to use as Loading Indicator in the Header View. Overrides value set in ptrDrawable. -->
|
||||
<attr name="ptrDrawableStart" format="reference" />
|
||||
|
||||
<!-- Drawable to use as Loading Indicator in the Footer View. Overrides value set in ptrDrawable. -->
|
||||
<attr name="ptrDrawableEnd" format="reference" />
|
||||
|
||||
<!-- Whether Android's built-in Over Scroll should be utilised for Pull-to-Refresh. -->
|
||||
<attr name="ptrOverScroll" format="reference|boolean" />
|
||||
|
||||
<!-- Base text color, typeface, size, and style for Header and Footer Loading Views -->
|
||||
<attr name="ptrHeaderTextAppearance" format="reference" />
|
||||
|
||||
<!-- Base text color, typeface, size, and style for Header and Footer Loading Views Sub Header -->
|
||||
<attr name="ptrSubHeaderTextAppearance" format="reference" />
|
||||
|
||||
<!-- Style of Animation should be used displayed when pulling. -->
|
||||
<attr name="ptrAnimationStyle">
|
||||
<flag name="rotate" value="0x0" />
|
||||
<flag name="flip" value="0x1" />
|
||||
</attr>
|
||||
|
||||
<!-- Whether the user can scroll while the View is Refreshing -->
|
||||
<attr name="ptrScrollingWhileRefreshingEnabled" format="reference|boolean" />
|
||||
|
||||
<!--
|
||||
Whether PullToRefreshListView has it's extras enabled. This allows the user to be
|
||||
able to scroll while refreshing, and behaves better. It acheives this by adding
|
||||
|
@ -70,11 +56,60 @@
|
|||
takes effect when using the 'Rotate' Animation Style.
|
||||
-->
|
||||
<attr name="ptrRotateDrawableWhilePulling" format="reference|boolean" />
|
||||
|
||||
<!-- BELOW HERE ARE DEPRECEATED. DO NOT USE. -->
|
||||
<attr name="ptrAdapterViewBackground" format="reference|color" />
|
||||
<attr name="ptrDrawableTop" format="reference" />
|
||||
<attr name="ptrDrawableBottom" format="reference" />
|
||||
</declare-styleable>
|
||||
<!-- view_pull_refresh(end) -->
|
||||
|
||||
|
||||
<!-- 圆角进度条(开始) -->
|
||||
<declare-styleable name="RoundProgressBar">
|
||||
<attr name="roundColor" format="color"/>
|
||||
<attr name="roundProgressColor" format="color"/>
|
||||
<attr name="roundWidth" format="dimension"></attr>
|
||||
<attr name="textColor" format="color" />
|
||||
<attr name="textSize" format="dimension" />
|
||||
<attr name="max" format="integer"></attr>
|
||||
<attr name="textIsDisplayable" format="boolean"></attr>
|
||||
<attr name="style">
|
||||
<enum name="STROKE" value="0"></enum>
|
||||
<enum name="FILL" value="1"></enum>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
<!-- 圆角进度条(结束) -->
|
||||
|
||||
|
||||
<!-- 圆形图片(开始) -->
|
||||
<declare-styleable name="RoundedImageView">
|
||||
<attr name="border_thickness" format="dimension"></attr>
|
||||
<attr name="border_outside_color" format="color"/>
|
||||
<attr name="border_inside_color" format="color"/>
|
||||
</declare-styleable>
|
||||
<!-- 圆形图片(结束) -->
|
||||
|
||||
|
||||
<!-- 等待操作对话框(开始) -->
|
||||
<style name="CustomDialog" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
</style>
|
||||
<style name="CustomProgressDialog" parent="@style/CustomDialog">
|
||||
<item name="android:windowBackground">@drawable/view_progress_dialog_bg</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
<!-- 等待操作对话框(结束) -->
|
||||
|
||||
|
||||
<!-- TextView(RadioButton/CheckBox)共通value(开始) -->
|
||||
<declare-styleable name="TextView" >
|
||||
<attr name="value" format="string"/>
|
||||
</declare-styleable>
|
||||
<!-- TextView(RadioButton/CheckBox)共通value(结束) -->
|
||||
|
||||
|
||||
</resources>
|
|
@ -97,6 +97,7 @@
|
|||
<color name="skyblue">#87CEEB</color><!--天蓝色 -->
|
||||
<color name="gray">#808080</color><!--灰色 -->
|
||||
<color name="grey">#808080</color><!--灰色 -->
|
||||
<color name="deepgray">#ff3b3b3b</color><!--深灰色 -->
|
||||
<color name="olive">#808000</color><!--橄榄色 -->
|
||||
<color name="purple">#800080</color><!--紫色 -->
|
||||
<color name="maroon">#800000</color><!--粟色 -->
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="shadow_start">#80000000</color>
|
||||
<color name="shadow_end">#00000000</color>
|
||||
|
||||
<color name="item_n">#ffffff</color>
|
||||
<color name="item_p">#fafafa</color>
|
||||
<color name="table_header">#d7d7d7</color>
|
||||
|
||||
</resources>
|
|
@ -1,18 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- table_fix_headers(start) -->
|
||||
<color name="shadow_start">#80000000</color>
|
||||
<color name="shadow_end">#00000000</color>
|
||||
<color name="item_n">#ffffff</color>
|
||||
<color name="item_p">#fafafa</color>
|
||||
<color name="table_header">#d7d7d7</color>
|
||||
<!-- table_fix_headers(end) -->
|
||||
|
||||
<!-- ZXing Android (start)-->
|
||||
<color name="contents_text">#ff000000</color>
|
||||
<color name="encode_view">#ffffffff</color>
|
||||
<color name="possible_result_points">#c0ffbd21</color> <!-- Android standard ICS color -->
|
||||
<color name="possible_result_points">#c0ffbd21</color>
|
||||
<color name="result_minor_text">#ffc0c0c0</color>
|
||||
<color name="result_points">#c099cc00</color> <!-- Android standard ICS color -->
|
||||
<color name="result_points">#c099cc00</color>
|
||||
<color name="result_text">#ffffffff</color>
|
||||
<color name="result_view">#b0000000</color>
|
||||
<color name="status_text">#ffffffff</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="viewfinder_laser">#ffcc0000</color> <!-- Android standard ICS color -->
|
||||
<color name="viewfinder_laser">#ffcc0000</color>
|
||||
<color name="viewfinder_mask">#00000000</color>
|
||||
<color name="capture_text_cover_bg">#99535353</color>
|
||||
<color name="seek_bar_text">#fff6f6f6</color>
|
||||
<!-- ZXing Android (end)-->
|
||||
<!-- ZXing Android (end)-->
|
||||
|
||||
</resources>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="shadow_size">4dip</dimen>
|
||||
<dimen name="table_width">135dp</dimen>
|
||||
<dimen name="table_height">40dp</dimen>
|
||||
</resources>
|
|
@ -1,10 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<dimen name="indicator_right_padding">10dp</dimen>
|
||||
<dimen name="indicator_corner_radius">12dp</dimen>
|
||||
<dimen name="indicator_internal_padding">4dp</dimen>
|
||||
<dimen name="header_footer_left_right_padding">24dp</dimen>
|
||||
<dimen name="header_footer_top_bottom_padding">12dp</dimen>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- view_pull_refresh(start) -->
|
||||
<dimen name="indicator_right_padding">10dp</dimen>
|
||||
<dimen name="indicator_corner_radius">12dp</dimen>
|
||||
<dimen name="indicator_internal_padding">4dp</dimen>
|
||||
<dimen name="header_footer_left_right_padding">24dp</dimen>
|
||||
<dimen name="header_footer_top_bottom_padding">12dp</dimen>
|
||||
<!-- view_pull_refresh(end) -->
|
||||
|
||||
<!-- table_fix_headers(start) -->
|
||||
<dimen name="shadow_size">4dip</dimen>
|
||||
<dimen name="table_width">135dp</dimen>
|
||||
<dimen name="table_height">40dp</dimen>
|
||||
<!-- table_fix_headers(end) -->
|
||||
</resources>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<item name="tag_type_view" type="id"/>
|
||||
<item name="tag_row" type="id"/>
|
||||
<item name="tag_column" type="id"/>
|
||||
|
||||
</resources>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<item type="id" name="gridview" />
|
||||
<item type="id" name="webview" />
|
||||
<item type="id" name="scrollview" />
|
||||
<item type="id" name="viewpager" />
|
||||
</resources>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- view_pull_refresh(start) -->
|
||||
<item name="gridview" type="id"/>
|
||||
<item name="webview" type="id"/>
|
||||
<item name="scrollview" type="id"/>
|
||||
<item name="viewpager" type="id"/>
|
||||
<!-- view_pull_refresh(end) -->
|
||||
|
||||
|
||||
<!-- table_fix_headers(start) -->
|
||||
<item name="tag_type_view" type="id"/>
|
||||
<item name="tag_row" type="id"/>
|
||||
<item name="tag_column" type="id"/>
|
||||
<!-- table_fix_headers(end) -->
|
||||
|
||||
|
||||
<!-- zxing(start) -->
|
||||
<item name="auto_focus" type="id"/>
|
||||
<item name="decode" type="id"/>
|
||||
<item name="decode_failed" type="id"/>
|
||||
<item name="decode_succeeded" type="id"/>
|
||||
<item name="launch_product_query" type="id"/>
|
||||
<item name="quit" type="id"/>
|
||||
<item name="restart_preview" type="id"/>
|
||||
<item name="return_scan_result" type="id"/>
|
||||
<item name="search_book_contents_failed" type="id"/>
|
||||
<item name="search_book_contents_succeeded" type="id"/>
|
||||
<!-- zxing(end) -->
|
||||
|
||||
</resources>
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 二维码(开始) -->
|
||||
<item type="id" name="auto_focus"/>
|
||||
<item type="id" name="decode"/>
|
||||
<item type="id" name="decode_failed"/>
|
||||
<item type="id" name="decode_succeeded"/>
|
||||
<item type="id" name="launch_product_query"/>
|
||||
<item type="id" name="quit"/>
|
||||
<item type="id" name="restart_preview"/>
|
||||
<item type="id" name="return_scan_result"/>
|
||||
<item type="id" name="search_book_contents_failed"/>
|
||||
<item type="id" name="search_book_contents_succeeded"/>
|
||||
<!-- 二维码(结束) -->
|
||||
</resources>
|
|
@ -1,6 +1,7 @@
|
|||
<resources>
|
||||
|
||||
<string name="app_name">攻城师</string>
|
||||
|
||||
<string name="MainActivity">Android样例锦集</string>
|
||||
<!-- 共通字符串 -->
|
||||
<string name="loading_waiting">加載中,请稍后...</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- 共通字符串 -->
|
||||
<string name="loading_waiting">加載中,请稍后...</string>
|
||||
|
||||
</resources>
|
|
@ -1,3 +1,23 @@
|
|||
<resources>
|
||||
<string name="sms_timer">获取手机验证码(%1$s)</string>
|
||||
|
||||
<!-- 自动获取表单示例(开始) -->
|
||||
<string name="tv_account">帐号:</string>
|
||||
<string name="tv_password">密码:</string>
|
||||
<string name="btn_show">显示</string>
|
||||
<string name="tv_school">毕业院校:</string>
|
||||
<string name="rg_sex">性别:</string>
|
||||
<string name="sex_male">男</string>
|
||||
<string name="sex_female">女</string>
|
||||
<string name="tv_hoby">兴趣爱好:</string>
|
||||
<string name="hoby_sleep">睡觉</string>
|
||||
<string name="hoby_boll">打球</string>
|
||||
<string name="hoby_read">看小说</string>
|
||||
<string name="remark">备注</string>
|
||||
<string name="hint_remark">请输入备注内容</string>
|
||||
<string name="auto_gain_form_data">自动获取表单示例</string>
|
||||
<string name="et_password_hint">请输入密码</string>
|
||||
<string name="et_account_hint">请输入您的手机号\邮箱\用户名</string>
|
||||
<string name="btn_auto_gaindata">提交表单</string>
|
||||
<!-- 自动获取表单示例(结束) -->
|
||||
</resources>
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="pull_to_refresh_tap_label">Tap to refresh...</string>
|
||||
<string name="pull_to_refresh_pull_label">下拉刷新…</string>
|
||||
<string name="pull_to_refresh_release_label">放开以刷新…</string>
|
||||
<string name="pull_to_refresh_refreshing_label">正在载入…</string>
|
||||
|
||||
<!-- Just use standard Pull Down String when pulling up. These can be set for languages which require it -->
|
||||
<string name="pull_to_refresh_from_bottom_pull_label">@string/pull_to_refresh_pull_label</string>
|
||||
<string name="pull_to_refresh_from_bottom_release_label">@string/pull_to_refresh_release_label</string>
|
||||
<string name="pull_to_refresh_from_bottom_refreshing_label">@string/pull_to_refresh_refreshing_label</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- zxing(start) -->
|
||||
<string name="placeHolder">placeHolder</string>
|
||||
<string name="seekbar_add">+</string>
|
||||
<string name="seekbar_minus">-</string>
|
||||
<string name="create">生成</string>
|
||||
<string name="scan_failed">扫描失败</string>
|
||||
<string name="bottom_hint">建议与镜头保持10CM距离,尽量避免逆光和阴影</string>
|
||||
<string name="top_hint">将条形码或二维码置于取景框内系统会自动扫描</string>
|
||||
<string name="cancel">取消</string>
|
||||
<string name="msg_camera_framework_bug">抱歉,Android相机出现问题。您可能需要重启设备。</string>
|
||||
<string name="button_ok">确定</string>
|
||||
<!-- zxing(end) -->
|
||||
|
||||
<!-- view_pull_refresh(start) -->
|
||||
<string name="pull_to_refresh_tap_label">Tap to refresh...</string>
|
||||
<string name="pull_to_refresh_pull_label">下拉刷新…</string>
|
||||
<string name="pull_to_refresh_release_label">放开以刷新…</string>
|
||||
<string name="pull_to_refresh_refreshing_label">正在载入…</string>
|
||||
<!-- Just use standard Pull Down String when pulling up. These can be set for languages which require it -->
|
||||
<string name="pull_to_refresh_from_bottom_pull_label">@string/pull_to_refresh_pull_label</string>
|
||||
<string name="pull_to_refresh_from_bottom_release_label">@string/pull_to_refresh_release_label</string>
|
||||
<string name="pull_to_refresh_from_bottom_refreshing_label">@string/pull_to_refresh_refreshing_label</string>
|
||||
<!-- view_pull_refresh(end) -->
|
||||
|
||||
<!-- xlistview(start) -->
|
||||
<string name="xlistview_header_hint_normal">下拉刷新</string>
|
||||
<string name="xlistview_header_hint_ready">松开刷新数据</string>
|
||||
<string name="xlistview_header_hint_loading">正在加载...</string>
|
||||
<string name="xlistview_header_last_time">上次更新时间:</string>
|
||||
<string name="xlistview_footer_hint_normal">查看更多</string>
|
||||
<string name="xlistview_footer_hint_ready">松开载入更多</string>
|
||||
<!-- xlistview(end) -->
|
||||
|
||||
</resources>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="xlistview_header_hint_normal">下拉刷新</string>
|
||||
<string name="xlistview_header_hint_ready">松开刷新数据</string>
|
||||
<string name="xlistview_header_hint_loading">正在加载...</string>
|
||||
<string name="xlistview_header_last_time">上次更新时间:</string>
|
||||
<string name="xlistview_footer_hint_normal">查看更多</string>
|
||||
<string name="xlistview_footer_hint_ready">松开载入更多</string>
|
||||
|
||||
</resources>
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 二维码 (开始)-->
|
||||
<string name="placeHolder">placeHolder</string>
|
||||
<string name="seekbar_add">+</string>
|
||||
<string name="seekbar_minus">-</string>
|
||||
<string name="create">生成</string>
|
||||
<string name="scan_failed">扫描失败</string>
|
||||
<string name="bottom_hint">建议与镜头保持10CM距离,尽量避免逆光和阴影</string>
|
||||
<string name="top_hint">将条形码或二维码置于取景框内系统会自动扫描</string>
|
||||
<string name="cancel">取消</string>
|
||||
<string name="msg_camera_framework_bug">抱歉,Android相机出现问题。您可能需要重启设备。</string>
|
||||
<string name="button_ok">确定</string>
|
||||
<!-- 二维码 (结束)-->
|
||||
|
||||
</resources>
|
|
@ -1,5 +1,5 @@
|
|||
<resources>
|
||||
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<resources>
|
||||
|
||||
<style name="accountInputBorder">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">36dp</item>
|
||||
<item name="android:layout_marginLeft">18dp</item>
|
||||
<item name="android:layout_marginRight">18dp</item>
|
||||
<item name="android:background">@drawable/view_linnerlayout_border</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:paddingLeft">10dp</item>
|
||||
<item name="android:orientation">horizontal</item>
|
||||
</style>
|
||||
|
||||
<style name="accountEditText">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:background">@color/white</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textColor">@color/grey</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<style name="buttonBarButtonStyle">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
|
||||
<!-- 继承 -->
|
||||
<style name="accountButtonStyle" parent="@style/buttonBarButtonStyle">
|
||||
<item name="android:textColor">@color/white</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<style name="menuTitle">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textSize">13sp</item>
|
||||
</style>
|
||||
|
||||
<style name="operationBtn">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:clickable">true</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<style name="menuItem">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
<item name="android:paddingLeft">30dp</item>
|
||||
<item name="android:paddingRight">20dp</item>
|
||||
</style>
|
||||
|
||||
<style name="menuItemIcon">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_centerVertical">true</item>
|
||||
<item name="android:layout_marginRight">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="menuItemTitle">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_centerVertical">true</item>
|
||||
<item name="android:textColor">@color/deepgray</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Text">
|
||||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<style name="Text.Title" parent="@style/Text">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<style name="Text.Title_Button" parent="@style/Text">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:ellipsize">marquee</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -11,6 +11,9 @@ import android.content.Context;
|
|||
|
||||
import com.android.http.RequestManager;
|
||||
import com.android.volley.toolbox.ImageLoader;
|
||||
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
|
||||
import com.zftlive.android.view.imageindicator.NetworkImageCache;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +51,8 @@ public class MApplication extends Application {
|
|||
//初始化请求队列
|
||||
RequestManager.getInstance().init(MApplication.this);
|
||||
mImageLoader = new ImageLoader(RequestManager.getInstance().getRequestQueue(), imageCacheMap);
|
||||
//初始化图片加载器
|
||||
initImageLoader(getApplicationContext());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,6 +63,22 @@ public class MApplication extends Application {
|
|||
return mImageLoader;
|
||||
}
|
||||
|
||||
public static void initImageLoader(Context context) {
|
||||
// This configuration tuning is custom. You can tune every option, you may tune some of them,
|
||||
// or you can create default configuration by
|
||||
// ImageLoaderConfiguration.createDefault(this);
|
||||
// method.
|
||||
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
|
||||
.threadPriority(Thread.NORM_PRIORITY - 2)
|
||||
.denyCacheImageMultipleSizesInMemory()
|
||||
.discCacheFileNameGenerator(new Md5FileNameGenerator())
|
||||
.discCacheSize(50 * 1024 * 1024) // 50 Mb
|
||||
.tasksProcessingOrder(QueueProcessingType.LIFO)
|
||||
.build();
|
||||
// Initialize ImageLoader with configuration.
|
||||
com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
|
||||
}
|
||||
|
||||
/*******************************************************Application数据操作API(开始)********************************************************/
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.zftlive.android.sample.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.base.BaseActivity;
|
||||
import com.zftlive.android.data.DTO;
|
||||
import com.zftlive.android.model.Option;
|
||||
import com.zftlive.android.tools.ToolAlert;
|
||||
import com.zftlive.android.tools.ToolData;
|
||||
import com.zftlive.android.view.SingleSpinner;
|
||||
import com.zftlive.android.view.SpinnerAdapter;
|
||||
|
||||
/**
|
||||
* 自动获取表单示例
|
||||
* <per>
|
||||
* 自动获取输入框、单选框、下拉框表单元素值:
|
||||
* 1、使用com.zftlive.android.view.SingleSpinner/RadioButton/CheckBox自定义控件
|
||||
* 2、设置android:tag为封装表单键值对的key
|
||||
* 3、声明命名空间xmlns:custom="http://schemas.android.com/apk/res/com.zftlive.android",并追加自定义属性custom:value="male"
|
||||
* 4、如下代码即可获取表单数据,复选框选项结果已##连接
|
||||
* DTO<String, Object> formData = new DTO<String, Object>();
|
||||
* formData = ToolData.gainForm((RelativeLayout) findViewById(R.id.frame_root),formData);
|
||||
* </per>
|
||||
*
|
||||
* @author 曾繁添
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public class AutoGainFormActivity extends BaseActivity {
|
||||
private SingleSpinner sp_school;
|
||||
private Button btn_login;
|
||||
|
||||
@Override
|
||||
public int bindLayout() {
|
||||
return R.layout.activity_auto_gain_form;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(View view) {
|
||||
btn_login = (Button)findViewById(R.id.btn_login);
|
||||
sp_school = (SingleSpinner) findViewById(R.id.sp_school);
|
||||
List<Option> data = new ArrayList<Option>();
|
||||
data.add(new Option("tjdx","天津大学"));
|
||||
data.add(new Option("nkdx","南开大学"));
|
||||
data.add(new Option("bjdx","北京大学"));
|
||||
data.add(new Option("qhdx","清华大学"));
|
||||
SpinnerAdapter mSpinnerAdapter = new SpinnerAdapter(this, R.drawable.view_spinner_drop_list_hover, data);
|
||||
mSpinnerAdapter.setDropDownViewResource(R.drawable.view_spinner_drop_list_ys);
|
||||
sp_school.setAdapter(mSpinnerAdapter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doBusiness(Context mContext) {
|
||||
btn_login.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DTO<String, Object> formData = new DTO<String, Object>();
|
||||
formData = ToolData.gainForm((RelativeLayout) findViewById(R.id.frame_root),formData);
|
||||
|
||||
ToolAlert.dialog(AutoGainFormActivity.this,"自动获取表单数据结果", formData.toString(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
},
|
||||
null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
|
@ -10,11 +10,10 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.base.BaseActivity;
|
||||
import com.zftlive.android.base.BaseAdapter;
|
||||
import com.zftlive.android.tools.ToolImage;
|
||||
|
||||
/**
|
||||
* 异步加载图片示例DEMO,防止图片错位
|
||||
|
@ -70,7 +69,6 @@ public class ImageListviewActivity extends BaseActivity {
|
|||
"多途网络科技 15K 招聘前端开发工程师",
|
||||
"携程无线前端团队招聘 直接内部推荐(携程上海总部)"
|
||||
};
|
||||
private DisplayImageOptions mDisplayImageOptions;
|
||||
private com.nostra13.universalimageloader.core.ImageLoader universalimageloader;
|
||||
|
||||
@Override
|
||||
|
@ -84,14 +82,8 @@ public class ImageListviewActivity extends BaseActivity {
|
|||
mMyListViewAdapter = new MyListViewAdapter();
|
||||
mListView = (ListView)findViewById(R.id.lv_list);
|
||||
|
||||
mDisplayImageOptions = new DisplayImageOptions.Builder()
|
||||
.showStubImage(R.drawable.ic_launcher).cacheInMemory()
|
||||
.cacheOnDisc().build();
|
||||
|
||||
ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this).enableLogging().build();
|
||||
universalimageloader = com.nostra13.universalimageloader.core.ImageLoader.getInstance();
|
||||
universalimageloader.init(imageLoaderConfiguration);
|
||||
|
||||
//图片异步加载器
|
||||
universalimageloader = ToolImage.initImageLoader(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,8 +134,7 @@ public class ImageListviewActivity extends BaseActivity {
|
|||
// mImageLoader.get((String)rowData.get("imageUrl"), mImageListener);
|
||||
|
||||
//异步加载图片防止错位方法二:com.nostra13.universalimageloader.core.ImageLoader
|
||||
universalimageloader.displayImage((String)rowData.get("imageUrl"), mViewHolder.iv_icon, mDisplayImageOptions);
|
||||
|
||||
universalimageloader.displayImage((String)rowData.get("imageUrl"), mViewHolder.iv_icon, ToolImage.getFadeOptions(R.drawable.default_icon,R.drawable.ic_launcher,R.drawable.ic_launcher));
|
||||
mViewHolder.tv_title.setText((String)rowData.get("title"));
|
||||
return convertView;
|
||||
}
|
||||
|
|
|
@ -1,165 +1,138 @@
|
|||
package com.zftlive.android.tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
import java.io.File;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
|
||||
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;
|
||||
import com.nostra13.universalimageloader.cache.memory.impl.UsingFreqLimitedMemoryCache;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
|
||||
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.utils.StorageUtils;
|
||||
|
||||
/**
|
||||
* 图片加载工具类
|
||||
* @author 曾繁添
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public abstract class ToolImage {
|
||||
|
||||
private static ImageLoader imageLoader;
|
||||
private static DisplayImageOptions displayImageOptions;
|
||||
private static DisplayImageOptions displayImageOptions1;
|
||||
private static DisplayImageOptions displayImageOptions2;
|
||||
private static DisplayImageOptions displayImageOptions3;
|
||||
private static DisplayImageOptions displayImageOptions4;
|
||||
private static DisplayImageOptions displayImageOptions5;
|
||||
|
||||
public static void init(Context context, int stubImage,
|
||||
int imageForEmptyUri, int imageOnFail) {
|
||||
ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(
|
||||
context)
|
||||
// 如果图片尺寸大于了这个参数,那么就会这按照这个参数对图片大小进行限制并缓存
|
||||
// .memoryCacheExtraOptions(480, 800) // default=device screen
|
||||
// dimensions
|
||||
// .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
|
||||
// .taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
||||
// .taskExecutorForCachedImages(AsyncTask.THREAD_POOL_EXECUTOR)
|
||||
// .threadPoolSize(3) // default
|
||||
// .threadPriority(Thread.NORM_PRIORITY - 1) // default
|
||||
// .tasksProcessingOrder(QueueProcessingType.FIFO) // default
|
||||
/**
|
||||
* 初始化ImageLoader
|
||||
*/
|
||||
public static ImageLoader initImageLoader(Context context) {
|
||||
// 获取到缓存的目录地址
|
||||
File cacheDir = StorageUtils.getOwnCacheDirectory(context,"ImageLoader/Cache");
|
||||
// 创建配置ImageLoader,可以设定在Application,设置为全局的配置参数
|
||||
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
|
||||
.memoryCacheExtraOptions(480, 800)//缓存文件的最大长宽
|
||||
// Can slow ImageLoader, use it carefully (Better don't use it)设置缓存的详细信息,最好不要设置这个
|
||||
// .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75,null)
|
||||
.threadPoolSize(3)// 线程池内加载的数量
|
||||
.threadPriority(Thread.NORM_PRIORITY - 2)// 线程优先级
|
||||
/*
|
||||
* When you display an image in a small ImageView and later you
|
||||
* try to display this image (from identical URI) in a larger
|
||||
* ImageView so decoded image of bigger size will be cached in
|
||||
* memory as a previous decoded image of smaller size. So the
|
||||
* default behavior is to allow to cache multiple sizes of one
|
||||
* image in memory. You can deny it by calling this method: so
|
||||
* when some image will be cached in memory then previous cached
|
||||
* size of this image (if it exists) will be removed from memory
|
||||
* cache before.
|
||||
*/
|
||||
// .denyCacheImageMultipleSizesInMemory()
|
||||
// .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
|
||||
// .memoryCacheSize(2 * 1024 * 1024)
|
||||
// .discCache(
|
||||
// new
|
||||
// LimitedAgeDiscCache(Environment.getExternalStorageDirectory(),
|
||||
// 5 * 60))
|
||||
// .discCache(new
|
||||
// UnlimitedDiscCache(Environment.getExternalStorageDirectory()))
|
||||
// .discCacheSize(50 * 1024 * 1024)
|
||||
// .discCacheFileCount(50)
|
||||
// .discCacheFileNameGenerator( new HashCodeFileNameGenerator())
|
||||
// // default
|
||||
// .imageDownloader(new BaseImageDownloader(context)) // default
|
||||
// .imageDecoder(new BaseImageDecoder()) // default
|
||||
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
|
||||
// // default
|
||||
.enableLogging().build();
|
||||
ImageLoader.getInstance().init(imageLoaderConfiguration);
|
||||
// You can pass your own memory cache implementation
|
||||
.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 *1024))
|
||||
.memoryCacheSize(2 * 1024 * 1024)
|
||||
.discCacheSize(20 * 1024 * 1024)// 硬盘缓存50MB
|
||||
.discCacheFileNameGenerator(new HashCodeFileNameGenerator())// 将保存的时候的URI名称用MD5
|
||||
.tasksProcessingOrder(QueueProcessingType.LIFO)
|
||||
.discCacheFileCount(100)// 缓存的File数量
|
||||
.discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径
|
||||
//.defaultDisplayImageOptions(DisplayImageOptions.createSimple())
|
||||
//.imageDownloader(new BaseImageDownloader(context, 5 * 1000,30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
|
||||
.build();
|
||||
|
||||
// 全局初始化此配置
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
|
||||
displayImageOptions = new DisplayImageOptions.Builder()
|
||||
// 设置图片在下载期间显示的图片
|
||||
.showStubImage(stubImage) // 在显示真正的图片前,会加载这个资源
|
||||
// 设置图片Uri为空或是错误的时候显示的图片
|
||||
.showImageForEmptyUri(imageForEmptyUri) // 空的Url时
|
||||
// 设置图片加载/解码过程中错误时候显示的图片
|
||||
.showImageOnFail(imageOnFail)
|
||||
// .resetViewBeforeLoading() //
|
||||
// .delayBeforeLoading(1000) // 延长1000ms 加载图片 (想不出来用在什么场景下)
|
||||
// 设置下载的图片是否缓存在内存中
|
||||
.cacheInMemory()
|
||||
// 设置下载的图片是否缓存在SD卡中
|
||||
// .cacheOnDisc()
|
||||
// .preProcessor(...)
|
||||
// .postProcessor(...)
|
||||
// .extraForDownloader(...) //可以向加载器携带一些参数
|
||||
// .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) //
|
||||
// default
|
||||
// .bitmapConfig(Bitmap.Config.ARGB_8888) // default
|
||||
// .decodingOptions(...)
|
||||
// .displayer(new SimpleBitmapDisplayer()) // default
|
||||
// .handler(new Handler()) // default
|
||||
.build();
|
||||
|
||||
// //设置图片在下载前是否重置,复位
|
||||
// resetViewBeforeLoading()
|
||||
// //设置图片的解码类型
|
||||
// bitmapConfig(Bitmap.Config.RGB_565)
|
||||
// //设置图片的解码配置
|
||||
// decodingOptions(android.graphics.BitmapFactory.Options
|
||||
// decodingOptions)
|
||||
// //设置图片下载前的延迟
|
||||
// delayBeforeLoading(int delayInMillis)
|
||||
// //设置额外的内容给ImageDownloader
|
||||
// extraForDownloader(Object extra)
|
||||
// //设置图片加入缓存前,对bitmap进行设置
|
||||
// preProcessor(BitmapProcessor preProcessor)
|
||||
// //设置显示前的图片,显示后这个图片一直保留在缓存中
|
||||
// postProcessor(BitmapProcessor postProcessor)
|
||||
// //设置图片以如何的编码方式显示
|
||||
// imageScaleType(ImageScaleType imageScaleType)
|
||||
}
|
||||
|
||||
public static void settingInit1(int stubImage, int imageForEmptyUri,
|
||||
int imageOnFail) {
|
||||
displayImageOptions1 = new DisplayImageOptions.Builder()
|
||||
.showStubImage(stubImage)
|
||||
.showImageForEmptyUri(imageForEmptyUri)
|
||||
.showImageOnFail(imageOnFail).cacheInMemory().build();
|
||||
|
||||
imageLoader.init(config);
|
||||
|
||||
return imageLoader;
|
||||
}
|
||||
|
||||
public static void settingInit2(int stubImage, int imageForEmptyUri,
|
||||
int imageOnFail) {
|
||||
displayImageOptions2 = new DisplayImageOptions.Builder()
|
||||
.showStubImage(stubImage)
|
||||
.showImageForEmptyUri(imageForEmptyUri)
|
||||
.showImageOnFail(imageOnFail).cacheInMemory().build();
|
||||
|
||||
/**
|
||||
* 获取渐现显示选项
|
||||
* @param loadingImageResId 加载期间显示的图片
|
||||
* @param errorImageResid 加载错误时显示的图片
|
||||
* @param emptyImageResId 空图片或者解析图片出错时显示的图片
|
||||
* @return
|
||||
*/
|
||||
public static DisplayImageOptions getFadeOptions(int loadingImageResId,int errorImageResid,int emptyImageResId ) {
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
//设置图片在下载期间显示的图片
|
||||
.showStubImage(loadingImageResId)
|
||||
// 设置图片加载/解码过程中错误时候显示的图片
|
||||
.showImageOnFail(errorImageResid)
|
||||
// 设置图片Uri为空或是错误的时候显示的图片
|
||||
.showImageForEmptyUri(emptyImageResId)
|
||||
// 设置下载的图片是否缓存在内存中
|
||||
.cacheInMemory()
|
||||
// 设置下载的图片是否缓存在SD卡中
|
||||
.cacheOnDisc()
|
||||
/**设置图片缩放方式:
|
||||
EXACTLY :图像将完全按比例缩小到目标大小
|
||||
EXACTLY_STRETCHED:图片会缩放到目标大小完全
|
||||
IN_SAMPLE_INT:图像将被二次采样的整数倍
|
||||
IN_SAMPLE_POWER_OF_2:图片将降低2倍,直到下一减少步骤,使图像更小的目标大小
|
||||
NONE:图片不会调整
|
||||
***/
|
||||
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
|
||||
// 设置图片的解码类型
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)
|
||||
// 设置图片下载前的延迟
|
||||
.delayBeforeLoading(100)
|
||||
// delayInMillis为你设置的延迟时间
|
||||
// 设置图片加入缓存前,对bitmap进行设置
|
||||
// .preProcessor(BitmapProcessor preProcessor)
|
||||
|
||||
/**
|
||||
* 图片显示方式:
|
||||
* RoundedBitmapDisplayer(int roundPixels)设置圆角图片
|
||||
* FakeBitmapDisplayer()这个类什么都没做
|
||||
* FadeInBitmapDisplayer(int durationMillis)设置图片渐显的时间
|
||||
* SimpleBitmapDisplayer()正常显示一张图片
|
||||
**/
|
||||
.displayer(new FadeInBitmapDisplayer(100))// 渐显--设置图片渐显的时间
|
||||
.build();
|
||||
return options;
|
||||
}
|
||||
|
||||
public static void settingInit3(int stubImage, int imageForEmptyUri,
|
||||
int imageOnFail) {
|
||||
displayImageOptions3 = new DisplayImageOptions.Builder()
|
||||
.showStubImage(stubImage)
|
||||
.showImageForEmptyUri(imageForEmptyUri)
|
||||
.showImageOnFail(imageOnFail).cacheInMemory().build();
|
||||
|
||||
}
|
||||
|
||||
public static void settingInit4(int stubImage, int imageForEmptyUri,
|
||||
int imageOnFail) {
|
||||
displayImageOptions4 = new DisplayImageOptions.Builder()
|
||||
.showStubImage(stubImage)
|
||||
.showImageForEmptyUri(imageForEmptyUri)
|
||||
.showImageOnFail(imageOnFail).cacheInMemory().build();
|
||||
|
||||
}
|
||||
|
||||
public static void settingInit5(int stubImage, int imageForEmptyUri,
|
||||
int imageOnFail) {
|
||||
displayImageOptions5 = new DisplayImageOptions.Builder()
|
||||
.showStubImage(stubImage)
|
||||
.showImageForEmptyUri(imageForEmptyUri)
|
||||
.showImageOnFail(imageOnFail).cacheInMemory().build();
|
||||
|
||||
}
|
||||
|
||||
public static void displayImage(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions);
|
||||
}
|
||||
public static void displayImage1(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions1);
|
||||
}
|
||||
public static void displayImage2(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions2);
|
||||
}
|
||||
public static void displayImage3(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions3);
|
||||
}
|
||||
public static void displayImage4(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions4);
|
||||
}
|
||||
public static void displayImage5(String url, ImageView imageView) {
|
||||
imageLoader.displayImage(url, imageView, displayImageOptions5);
|
||||
/**
|
||||
* 获取默认显示配置选项
|
||||
*/
|
||||
public static DisplayImageOptions getDefaultOptions(){
|
||||
return DisplayImageOptions.createSimple();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
public static void clearCache() {
|
||||
imageLoader.clearMemoryCache();
|
||||
imageLoader.clearDiscCache();
|
||||
}
|
||||
|
||||
public static ImageLoader getImageLoader(){
|
||||
return imageLoader;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue