]> iEval git - unical.git/commitdiff
Adds title date and time to alarm layout master
authorPetru <l3asketballplayer@yahoo.com>
Sun, 25 Aug 2013 19:09:43 +0000 (22:09 +0300)
committerPetru <l3asketballplayer@yahoo.com>
Sun, 25 Aug 2013 19:09:43 +0000 (22:09 +0300)
res/layout/alarm.xml
src/ro/ieval/unical/AlarmReceiverActivity.java

index 379eab98f18f074c9412a5dcc4b2ee9039b5b23d..f9316b23f20426157b8ac775e8a0c1aab69483f8 100644 (file)
@@ -9,9 +9,16 @@
         android:scaleType="fitXY"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:src="@android:drawable/title_bar_tall" />
+        android:src="@android:drawable/alert_dark_frame" />
 
-<LinearLayout
+    <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="New Text"
+            android:gravity="center"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:id="@+id/alarm_title"/>
+    <LinearLayout
         android:baselineAligned="false"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
index f01417a83acfc61bd11f991b23bcff0d7d49f12b..f47086700a5f1da9a4047a7968cb58e7560a2955 100644 (file)
@@ -1,6 +1,10 @@
 package ro.ieval.unical;
 
 import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
 
 import android.app.Activity;
 import android.content.Context;
@@ -15,6 +19,7 @@ import android.view.View.OnTouchListener;
 import android.view.Window;
 import android.view.WindowManager;
 import android.widget.Button;
+import android.widget.TextView;
 
 public class AlarmReceiverActivity extends Activity {
        public static final String EXTRA_EVENT = "event";
@@ -25,7 +30,34 @@ public class AlarmReceiverActivity extends Activity {
                super.onCreate(savedInstanceState);
                this.requestWindowFeature(Window.FEATURE_NO_TITLE);
                this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        Event event=Event.getEventById(this,getIntent().getLongExtra(EXTRA_EVENT,1L));
                setContentView(R.layout.alarm);
+
+        TextView title = (TextView)findViewById(R.id.alarm_title);
+        title.setText(event.title);
+
+        final TextView startDay= (TextView) findViewById(R.id.startday);
+        final TextView endDay= (TextView) findViewById(R.id.endday);
+        final TextView startDate= (TextView) findViewById(R.id.startdate);
+        final TextView endDate= (TextView) findViewById(R.id.enddate);
+        final TextView startTime= (TextView) findViewById(R.id.starttime);
+        final TextView endTime= (TextView) findViewById(R.id.endtime);
+        final Date start=new Date(event.dtstart);
+        final Date end=new Date(event.dtend);
+        final DateFormat dateFormat = DateFormat.getDateInstance();
+        final DateFormat timeFormat = DateFormat.getTimeInstance();
+        final DateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
+
+        startDay.setText(dayOfWeekFormat.format(start));
+        startDate.setText(dateFormat.format(start));
+        if(!dateFormat.format(start).equals(dateFormat.format(end))) {
+            endDay.setText(dayOfWeekFormat.format(end));
+            endDate.setText(dateFormat.format(end));
+        }
+
+        startTime.setText(timeFormat.format(start));
+        if(!start.equals(end))
+            endTime.setText(timeFormat.format(end));
                
                final Button stopAlarm = (Button) findViewById(R.id.stopAlarm);
         stopAlarm.setOnTouchListener(new OnTouchListener() {
This page took 0.019617 seconds and 4 git commands to generate.