Added navigation ability for HTML links in notifications

git-svn-id: https://forja.rediris.es/svn/cusl6-swadroid/trunk@238 5bc14d19-1e4b-4ba2-aa50-860af135f48c
This commit is contained in:
Juan Miguel Boyero Corral 2012-02-25 21:42:24 +00:00
parent 1343d04146
commit 52041869f2
2 changed files with 16 additions and 2 deletions

View File

@ -96,6 +96,7 @@
android:textColor="@color/foreground1"
android:textSize="16sp"
android:padding="1dip"
android:autoLink="web"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View File

@ -76,6 +76,7 @@ public class NotificationsCursorAdapter extends CursorAdapter {
public void bindView(View view, Context context, Cursor cursor) {
final Context ctx = context;
final Long notificationCode = cursor.getLong(cursor.getColumnIndex("id"));
final Cursor curs = cursor;
long unixTime;
String type, sender, senderFirstname, senderSurname1, senderSurname2, summaryText, contentText;
String[] dateContent;
@ -106,6 +107,18 @@ public class NotificationsCursorAdapter extends CursorAdapter {
}
};
OnClickListener contentListener = new OnClickListener() {
public void onClick(View v) {
TextView content = (TextView) v.findViewById(R.id.eventText);
if(content.getSelectionStart() == -1 && content.getSelectionEnd() == -1) {
toggleContentVisibility(curs.getPosition());
}
}
};
content.setOnClickListener(contentListener);
if(eventType != null) {
type = cursor.getString(cursor.getColumnIndex("eventType"));
messageReplyButton.setVisibility(View.GONE);
@ -226,8 +239,8 @@ public class NotificationsCursorAdapter extends CursorAdapter {
Intent activity = new Intent(ctx.getApplicationContext(), Marks.class);
activity.putExtra("content", content.getText().toString());
ctx.startActivity(activity);
} else {
contentVisible[position] = !contentVisible[position];
} else {
contentVisible[position] = !contentVisible[position];
this.notifyDataSetChanged();
}
}