mirror of https://github.com/tasks/tasks
Merge remote-tracking branch 'origin/20120221_as_tag_settings' into 4.0
commit
2a8ad3cdd4
Binary file not shown.
After Width: | Height: | Size: 508 B |
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
@ -1,221 +1,229 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- settings tab -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
|
||||
android:id="@+id/settings"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
style="@style/Content">
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="100">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="5dip"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dip">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tag_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="10dip"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/actfm_TVA_tag_label" />
|
||||
<LinearLayout
|
||||
android:id="@+id/save_and_cancel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/tag_label"
|
||||
android:layout_alignParentRight="true"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="right"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
|
||||
<ImageButton
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_save"/>
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tag_name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tag_label"
|
||||
android:layout_marginTop="10dip" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dip"
|
||||
android:paddingBottom="5dip"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/actfm_TVA_members_label" />
|
||||
|
||||
<com.todoroo.astrid.ui.PeopleContainer
|
||||
android:id="@+id/members_container"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="@android:drawable/divider_horizontal_dark" />
|
||||
|
||||
<RelativeLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/picture_label"
|
||||
android:layout_weight="100" >
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/settings"
|
||||
style="@style/Content_EditScroll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="100"
|
||||
android:padding="10dip"
|
||||
android:paddingTop="0dip" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/save_and_cancel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="10dip"
|
||||
android:visibility="gone"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/actfm_TVA_list_icon_label"/>
|
||||
|
||||
<greendroid.widget.AsyncImageView
|
||||
android:layout_marginRight="10dip"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dip"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_save" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dip"
|
||||
android:paddingTop="5dip" >
|
||||
|
||||
<!-- picture -->
|
||||
|
||||
<com.todoroo.astrid.helper.AsyncImageView
|
||||
android:id="@+id/picture"
|
||||
android:layout_width="80dip"
|
||||
android:layout_height="80dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:scaleType="centerInside"
|
||||
android:paddingRight="10dip"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@id/picture_label"
|
||||
astrid:defaultSrc="@android:drawable/ic_menu_gallery" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@id/picture"
|
||||
android:layout_marginTop="10dip"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/actfm_TVA_tag_description_label" />
|
||||
<EditText
|
||||
android:id="@+id/tag_description"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/picture"
|
||||
android:layout_below="@id/description_label"
|
||||
android:layout_marginTop="10dip"
|
||||
android:hint="@string/actfm_TVA_tag_description_hint" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginTop="25dip"
|
||||
android:layout_below="@id/tag_description"
|
||||
style="@style/TEA_Separator" />
|
||||
|
||||
<!-- Footer -->
|
||||
<LinearLayout
|
||||
android:id="@+id/listSettingsMore"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/divider"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/actfm_TVA_tag_owner_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tag_owner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dip"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/tag_silenced"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
android:paddingLeft="45dip"
|
||||
style="@style/TextAppearance"
|
||||
android:text="@string/actfm_TVA_silence_label" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/create_shortcut_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
astrid:defaultSrc="@android:drawable/ic_menu_gallery"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tag_label"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_toRightOf="@id/picture"
|
||||
android:text="@string/actfm_TVA_tag_label" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/EditRow"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tag_label"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginTop="14dip"
|
||||
android:layout_toRightOf="@id/picture"
|
||||
android:padding="10dip"
|
||||
android:paddingBottom="14dip" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tag_name"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:hint="@string/actfm_TVA_tag_description_hint"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:paddingBottom="5dip"
|
||||
android:text="@string/actfm_TVA_members_label" />
|
||||
|
||||
<com.todoroo.astrid.ui.PeopleContainer
|
||||
android:id="@+id/members_container"
|
||||
style="@style/EditRow"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_label"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:text="@string/actfm_TVA_tag_description_label" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/EditRow"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tag_label"
|
||||
android:layout_marginTop="5dip"
|
||||
android:padding="10dip"
|
||||
android:paddingBottom="14dip" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/tag_description"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00000000"
|
||||
android:hint="@string/actfm_TVA_tag_description_hint"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_label"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:text="@string/actfm_TVA_tag_settings_label" />
|
||||
|
||||
<LinearLayout
|
||||
style="@style/EditRow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dip"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/tag_silenced_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/divider"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="right"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dip"
|
||||
style="@style/TextAppearance.GEN_EditLabel"
|
||||
android:text="@string/FLA_shortcut_dialog_title" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/create_shortcut"
|
||||
android:layout_width="75dip"
|
||||
android:maxWidth="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:maxHeight="50dip"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_media_ff"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dip" >
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="10dip"
|
||||
android:paddingLeft="5dip"
|
||||
android:text="@string/actfm_TVA_silence_label" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/tag_silenced"
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="5dip" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/TEA_Separator"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/create_shortcut_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dip" >
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="10dip"
|
||||
android:paddingLeft="5dip"
|
||||
android:text="@string/FLA_shortcut_dialog_title" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/create_shortcut"
|
||||
android:layout_width="40dip"
|
||||
android:layout_height="40dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/icn_list_shortcut" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/leave_list"
|
||||
style="@style/DeleteTag"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dip"
|
||||
android:layout_marginTop="15dip"
|
||||
android:text="@string/tag_delete_button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- See the file "LICENSE" for the full license governing this code. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="57dip"
|
||||
android:paddingTop="2dip"
|
||||
android:paddingBottom="2dip"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:id="@+id/importance_legacy"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- indent -->
|
||||
<View android:id="@+id/indent"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<!-- grabber -->
|
||||
<ImageView android:id="@+id/grabber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/grabber"/>
|
||||
|
||||
<RelativeLayout android:id="@+id/rowBody"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:paddingLeft="5dip">
|
||||
|
||||
|
||||
<com.todoroo.astrid.ui.CheckableImageView
|
||||
android:id="@+id/completeBox"
|
||||
android:layout_width="45dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="30dip"
|
||||
android:scaleType="center"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="2dip"
|
||||
android:button="@drawable/btn_check" />
|
||||
<!-- assignee photo -->
|
||||
|
||||
<com.todoroo.astrid.helper.AsyncImageView
|
||||
android:id="@+id/picture"
|
||||
android:layout_width="35dip"
|
||||
android:layout_height="35dip"
|
||||
android:layout_marginLeft="10dip"
|
||||
astrid:defaultSrc="@drawable/icn_default_person_image"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/task_row"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/completeBox"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="5dip" >
|
||||
|
||||
<!-- task name -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.TAd_ItemTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="100"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="2" />
|
||||
|
||||
<!-- due date -->
|
||||
<LinearLayout
|
||||
android:id="@+id/taskActionContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="40dip"
|
||||
android:layout_marginRight="4dip"
|
||||
android:orientation="vertical"
|
||||
android:gravity="right|center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/dueDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="4dip"
|
||||
android:gravity="center_vertical|right" />
|
||||
<ImageView
|
||||
android:id="@+id/taskActionIcon"
|
||||
android:layout_width="20dip"
|
||||
android:layout_height="20dip"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- details line 1 -->
|
||||
<TextView android:id="@+id/details1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/task_row"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="-1dip"
|
||||
style="@style/TextAppearance.TAd_ItemDetails"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- details line 2 -->
|
||||
<TextView android:id="@+id/details2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/details1"
|
||||
android:layout_alignParentLeft="true"
|
||||
style="@style/TextAppearance.TAd_ItemDetails"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,67 @@
|
||||
package com.todoroo.astrid.helper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
|
||||
/*
|
||||
* Subclass of greendroid.widget.AsyncImageView, so that we can cache the image locally when user is offline
|
||||
* IMPORTANT: cannot load a cached image by setting the url in an xml file. --ImageDiskCache object is created after object is loaded from xml
|
||||
*/
|
||||
public class AsyncImageView extends greendroid.widget.AsyncImageView {
|
||||
|
||||
private final ImageDiskCache imageDiskCache;
|
||||
private Bitmap cacheImage;
|
||||
private String cacheURL = ""; //$NON-NLS-1$
|
||||
public AsyncImageView(Context context) {
|
||||
super(context);
|
||||
|
||||
imageDiskCache = ImageDiskCache.getInstance();
|
||||
}
|
||||
public AsyncImageView(Context context, AttributeSet set) {
|
||||
super(context, set);
|
||||
imageDiskCache = ImageDiskCache.getInstance();
|
||||
}
|
||||
public AsyncImageView(Context context, AttributeSet set, int defStyle) {
|
||||
super(context, set, defStyle);
|
||||
imageDiskCache = ImageDiskCache.getInstance();
|
||||
}
|
||||
@Override
|
||||
public void setUrl(String url) {
|
||||
if (cacheImage != null && cacheURL.equals(url) && !TextUtils.isEmpty(url)) {
|
||||
setImageBitmap(cacheImage);
|
||||
return;
|
||||
}
|
||||
else if(imageDiskCache != null && imageDiskCache.contains(url)) {
|
||||
try {
|
||||
cacheImage = imageDiskCache.get(url);
|
||||
setImageBitmap(cacheImage);
|
||||
cacheURL = url;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
super.setUrl(url);
|
||||
}
|
||||
|
||||
public Bitmap getImageBitmap() {
|
||||
setDrawingCacheEnabled(true);
|
||||
|
||||
// this is the important code :)
|
||||
// Without it the view will have a dimension of 0,0 and the bitmap will be null
|
||||
measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
|
||||
buildDrawingCache(true);
|
||||
Bitmap b = Bitmap.createBitmap(getDrawingCache());
|
||||
setDrawingCacheEnabled(false); // clear drawing cache
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue