Added button for opening event in browser.
This commit is contained in:
parent
25be6f27f9
commit
cfb15cbb66
|
@ -31,6 +31,7 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -62,6 +63,7 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||
private TextView detailView;
|
||||
private TextView dateFromView;
|
||||
private TextView dateToView;
|
||||
private Button eventUrlButton;
|
||||
|
||||
public DetailFragment() {
|
||||
setHasOptionsMenu(true);
|
||||
|
@ -81,6 +83,7 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||
detailView = (TextView) rootView.findViewById(R.id.list_item_details_textview);
|
||||
dateFromView = (TextView) rootView.findViewById(R.id.list_item_date_from_textview);
|
||||
dateToView = (TextView) rootView.findViewById(R.id.list_item_date_to_textview);
|
||||
eventUrlButton = (Button) rootView.findViewById(R.id.event_url_button);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
@ -113,13 +116,20 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
|
||||
if (data != null && data.moveToFirst()) {
|
||||
titleView.setText(data.getString(COL_EVENT_TITLE));
|
||||
categoryView.setText(data.getString(COL_EVENT_TYPE));
|
||||
detailView.setText(Utility.parseDetailsText(data.getString(COL_EVENT_DETAILS)));
|
||||
dateFromView.setText(Utility.getFriendLyDate(data.getString(COL_EVENT_DATE_FROM)));
|
||||
dateToView.setText(Utility.getFriendLyDate(data.getString(COL_EVENT_DATE_TO)));
|
||||
eventUrlButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://www.uib.no/" + data.getString(COL_EVENT_URL)));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,29 @@
|
|||
android:weightSum="1"
|
||||
android:gravity="fill_horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/list_item_details_textview"
|
||||
android:text="@string/list_item_details_textview"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_weight="1" />
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/list_item_details_textview"
|
||||
android:text="@string/list_item_details_textview"
|
||||
android:paddingLeft="10dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/event_url_button"
|
||||
android:id="@+id/event_url_button"
|
||||
android:layout_gravity="right"
|
||||
android:padding="10dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
|
|
|
@ -11,4 +11,5 @@
|
|||
<string name="sync_account_type">uibevents.nilsnh.no</string>
|
||||
<string name="list_item_details_textview">Studentteateret immaturus inviterer til jubileumsforestillingen \\\"Alice i Eventyrland\\\", med premiere 11. April.</string>
|
||||
<string name="title_activity_detail">UiB event details</string>
|
||||
<string name="event_url_button">Åpne event i nettleser</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue