Apply text gradient only over text, fade out after clicking on image

This commit is contained in:
Jimmy Shih
2013-11-14 15:40:25 -08:00
parent 6b050d6236
commit 982828d0af
2 changed files with 99 additions and 92 deletions
+96 -92
View File
@@ -24,103 +24,107 @@ limitations under the License.
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<!-- A gradient on top of the text --> <FrameLayout
<ImageView android:layout_height="wrap_content"
android:alpha=".6" android:layout_width="match_parent" >
android:contentDescription="@string/icon_marker" <!-- A gradient on top of the text -->
android:id="@+id/list_item_text_gradient" <ImageView
android:layout_height="match_parent" android:alpha=".6"
android:layout_width="match_parent" android:contentDescription="@string/icon_marker"
android:src="@drawable/text_gradient" /> android:id="@+id/list_item_text_gradient"
<!-- Table 1 --> android:layout_height="match_parent"
<TableLayout android:layout_width="match_parent"
android:layout_height="match_parent" android:src="@drawable/text_gradient" />
android:layout_width="match_parent" <!-- Table 1 -->
android:minHeight="?android:attr/listPreferredItemHeight" <TableLayout
android:paddingBottom="12dp" android:layout_height="wrap_content"
android:paddingRight="12dp" android:layout_width="match_parent"
android:paddingTop="8dp" android:minHeight="?android:attr/listPreferredItemHeight"
android:shrinkColumns="1" android:paddingBottom="12dp"
android:stretchColumns="1" android:paddingRight="12dp"
style="@style/ListItem" > android:paddingTop="8dp"
<!-- Table 1: Row 1 --> android:shrinkColumns="1"
<TableRow> android:stretchColumns="1"
<!-- Table 1: Row 1: Column 1: (icon) --> style="@style/ListItem" >
<ImageView <!-- Table 1: Row 1 -->
android:contentDescription="@string/icon_track" <TableRow>
android:id="@+id/list_item_icon" <!-- Table 1: Row 1: Column 1: (icon) -->
android:layout_gravity="center_vertical" <ImageView
android:layout_height="wrap_content" android:contentDescription="@string/icon_track"
android:layout_marginLeft="8dp" android:id="@+id/list_item_icon"
android:layout_marginRight="8dp" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" /> android:layout_height="wrap_content"
<!-- Table 1: Row 1: Column 2: (Table 2) --> android:layout_marginLeft="8dp"
<TableLayout android:layout_marginRight="8dp"
android:layout_height="wrap_content" android:layout_width="wrap_content" />
android:layout_width="match_parent" <!-- Table 1: Row 1: Column 2: (Table 2) -->
android:shrinkColumns="0" <TableLayout
android:stretchColumns="0" > android:layout_height="wrap_content"
<TableRow> android:layout_width="match_parent"
<!-- Table 2: Row 1: Column 1: (name) --> android:shrinkColumns="0"
<TextView android:stretchColumns="0" >
android:ellipsize="end" <TableRow>
android:id="@+id/list_item_name" <!-- Table 2: Row 1: Column 1: (name) -->
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:singleLine="true"
style="@style/TextMedium" />
<!-- Table 2: Row 1: Column 2: (date) -->
<TextView
android:id="@+id/list_item_date"
style="@style/ListItemDate" />
</TableRow>
<TableRow>
<!-- Need to match the style set in ListItemUtils.setListItem -->
<!-- Table 2: Row 2: Column 1: (shared owner, total time, total distance, and marker count) -->
<LinearLayout
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:layout_width="match_parent" >
<TextView <TextView
android:ellipsize="end" android:ellipsize="end"
android:id="@+id/list_item_owner_time_distance" android:id="@+id/list_item_name"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_width="match_parent"
android:singleLine="true" android:singleLine="true"
style="@style/TextSmall" /> style="@style/TextMedium" />
<ImageView <!-- Table 2: Row 1: Column 2: (date) -->
android:contentDescription="@string/icon_marker" <TextView
android:id="@+id/list_item_marker_count_icon" android:id="@+id/list_item_date"
style="@style/ListItemDate" />
</TableRow>
<TableRow>
<!-- Need to match the style set in ListItemUtils.setListItem -->
<!-- Table 2: Row 2: Column 1: (shared owner, total time, total distance, and marker count) -->
<LinearLayout
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="2dp" android:layout_width="match_parent" >
android:layout_marginRight="2dp" <TextView
android:layout_marginBottom="1dp" android:ellipsize="end"
android:layout_width="wrap_content" android:id="@+id/list_item_owner_time_distance"
android:scaleType="centerInside" android:layout_gravity="bottom"
android:src="@drawable/ic_menu_insert_marker" /> android:singleLine="true"
style="@style/TextSmall" />
<ImageView
android:contentDescription="@string/icon_marker"
android:id="@+id/list_item_marker_count_icon"
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_width="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/ic_menu_insert_marker" />
<TextView
android:ellipsize="end"
android:id="@+id/list_item_marker_count"
android:layout_gravity="bottom"
android:singleLine="true"
style="@style/TextSmall" />
</LinearLayout>
<!-- Table 2: Row 2: Column 2: (time) -->
<TextView <TextView
android:ellipsize="end" android:id="@+id/list_item_time"
android:id="@+id/list_item_marker_count" style="@style/ListItemDate" />
android:layout_gravity="bottom" </TableRow>
android:singleLine="true" </TableLayout>
style="@style/TextSmall" /> </TableRow>
</LinearLayout> <TableRow>
<!-- Table 2: Row 2: Column 2: (time) --> <!-- Table 1: Row 2: (category and description) -->
<TextView <TextView
android:id="@+id/list_item_time" android:ellipsize="end"
style="@style/ListItemDate" /> android:id="@+id/list_item_category_description"
</TableRow> android:layout_column="1"
</TableLayout> android:maxLines="2"
</TableRow> android:singleLine="false"
<TableRow> style="@style/TextSmall" />
<!-- Table 1: Row 2: (category and description) --> </TableRow>
<TextView </TableLayout>
android:ellipsize="end" </FrameLayout>
android:id="@+id/list_item_category_description"
android:layout_column="1"
android:maxLines="2"
android:singleLine="false"
style="@style/TextSmall" />
</TableRow>
</TableLayout>
</FrameLayout> </FrameLayout>
@@ -127,6 +127,9 @@ public class MarkerDetailFragment extends Fragment {
int visibility = waypointInfo.getVisibility() == View.GONE ? View.VISIBLE : View.GONE; int visibility = waypointInfo.getVisibility() == View.GONE ? View.VISIBLE : View.GONE;
textGradient.setVisibility(visibility); textGradient.setVisibility(visibility);
waypointInfo.setVisibility(visibility); waypointInfo.setVisibility(visibility);
if (visibility == View.VISIBLE) {
handler.postDelayed(hideText, HIDE_TEXT_DELAY);
}
} }
}); });
textGradient = (ImageView) view.findViewById(R.id.marker_detail_waypoint_text_gradient); textGradient = (ImageView) view.findViewById(R.id.marker_detail_waypoint_text_gradient);