Skip to content

Commit

Permalink
Merge pull request SMILEConsortium#104 from chrqls/dev
Browse files Browse the repository at this point in the history
[#4] Better interface for  'use prepared questions' screen, date format modified
  • Loading branch information
Charles Quelos committed Dec 25, 2013
2 parents f2f14db + a7000f5 commit 76b6e20
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 43 deletions.
78 changes: 49 additions & 29 deletions res/layout-large-land/use_prepared_questions_item.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<org.smilec.smile.ui.widget.checkbox.CheckableRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:marvinlabs="http://schemas.android.com/apk/res/fr.marvinlabs.selectablelisttutorial"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
Expand All @@ -18,39 +17,68 @@
android:focusable="false"
android:layout_marginLeft="20dip"
android:layout_gravity="left|center_vertical" />

<TextView
android:id="@+id/tv_file_name"
android:text="@string/brackets_open"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="@color/black"
android:focusable="false"
android:layout_gravity="left|center_vertical"/>

<TextView
android:id="@+id/tv_size"
android:textSize="12sp"
android:text="@string/size_hint"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:textColor="@color/blue" />

<TextView
android:text="@string/brackets_close"
android:textSize="12sp"
android:textColor="@color/black"
android:focusable="false"
android:layout_gravity="left|center_vertical"/>

<TextView
android:textSize="12sp"
android:text="@string/separator"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:textColor="@color/red" />

<TextView
android:id="@+id/tv_file_name"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="@color/black"
android:focusable="false"
android:layout_gravity="left|center_vertical"/>

<TextView
android:textSize="12sp"
android:text="@string/parenthesis_open"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dip"
android:textColor="@color/black" />

<TextView
android:id="@+id/tv_teacher_name"
android:layout_gravity="center_vertical"
android:text="@string/teacher_name_hint"
android:textStyle="italic"
android:textColor="@color/black"
android:textSize="12sp" />

<TextView
android:textSize="12sp"
android:text="@string/separator"
android:textStyle="bold"
android:text="@string/comma"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:textColor="@color/red" />
android:layout_marginLeft="1dip"
android:layout_marginRight="3dip"
android:textColor="@color/black" />

<TextView
android:id="@+id/tv_group_name"
Expand All @@ -61,13 +89,12 @@

<TextView
android:textSize="12sp"
android:text="@string/separator"
android:textStyle="bold"
android:text="@string/comma"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:textColor="@color/red" />

android:layout_marginLeft="1dip"
android:layout_marginRight="3dip"
android:textColor="@color/black" />
<TextView
android:id="@+id/tv_date"
android:textSize="12sp"
Expand All @@ -77,19 +104,12 @@

<TextView
android:textSize="12sp"
android:text="@string/separator"
android:textStyle="bold"
android:text="@string/parenthesis_close"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:textColor="@color/red" />

<TextView
android:id="@+id/tv_size"
android:textSize="12sp"
android:text="@string/size_hint"
android:layout_gravity="center_vertical"
android:textColor="@color/blue" />
android:layout_marginRight="4dip"
android:textColor="@color/black" />



</TableRow>

Expand Down
28 changes: 17 additions & 11 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@
<resources>
<string name="logo">Logo</string>
<string name="separator">-</string>
<string name="comma">,</string>
<string name="brackets_open">[</string>
<string name="brackets_close">]</string>
<string name="parenthesis_open">(</string>
<string name="parenthesis_close">)</string>
<string name="app_name">SMILE Teacher</string>
<string name="server">Smileplug IP</string>
<string name="connect">Connect</string>
<string name="loading">Loading...</string>
<string name="loading">Loading</string>
<string name="confirm">Confirm Deletion</string>

<!-- Toasts -->
<string name="toast_connection_established">Connection established</string>
<string name="toast_creating_session">Creating session…</string>
<string name="toast_starting">Starting…</string>
<string name="toast_solving">Solving…</string>
<string name="toast_sorting">Sorting…</string>
<string name="toast_recovering">Recovering…</string>
<string name="toast_retaking">Retaking…</string>
<string name="toast_down_or_unavailable">Smileplug is down or unavailable</string>

<string name="session_values">Information about teacher\'s session</string>
<string name="teacher_name_hint">Teacher name</string>
<string name="session_title_hint">Session title</string>
Expand Down Expand Up @@ -55,7 +70,7 @@
called the SMILE Teacher, serves to manage and
save data from the activity via an ad-hoc network. It is a
Graphic User Interface-based application that can be
launched on an Android tablet in conjuction with a the Server
launched on an Android tablet in conjunction with a the Server
running on a PlugComputer. The application
allows the teacher to facilitate inquiry-based learning in a collaborative environment
It also allows the teacher to save the
Expand All @@ -77,15 +92,6 @@
<string name="question_uppercase">QUESTION</string>
<string name="student">Students</string>

<!-- Toasts -->
<string name="toast_connection_established">Connection established</string>
<string name="toast_creating_session">Creating session...</string>
<string name="toast_starting">Starting...</string>
<string name="toast_solving">Solving...</string>
<string name="toast_sorting">Sorting...</string>
<string name="toast_recovering">Recovering...</string>
<string name="toast_retaking">Retaking...</string>
<string name="toast_down_or_unavailable">Smileplug is down or unavailable</string>

<string name="question_number">Question Number</string>
<string name="correct_answer">Correct Answer</string>
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/org/smilec/smile/domain/IQSet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.smilec.smile.domain;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;



public class IQSet {

private String id;
Expand All @@ -26,6 +34,25 @@ public void setId(String id) {
this.id = id;
}

public String getDate() {

DateFormat formatDecrypt = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
DateFormat formatDesired = new SimpleDateFormat("MMM dd, yyyy", Locale.ENGLISH);

// key example: 2013-12-25T07:20:45.656Z
String date_s = key.substring(0, Math.min(key.length(), 10));

Date date = null;

try
{ date = formatDecrypt.parse(date_s); }
catch (ParseException e)
{ e.printStackTrace(); }

System.out.println(date);

return formatDesired.format(date);
}
public String getKey() {
return key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public View getView(int position, View convertView, ViewGroup parent) {
tvGroupName.setText(String.valueOf(iqset.getGroupName()));

TextView tvDate = (TextView) convertView.findViewById(R.id.tv_date);
tvDate.setText(String.valueOf(iqset.getKey()));
tvDate.setText(String.valueOf(iqset.getDate()));

String idIQSet;
int size = -1;
int size = 0;
try {

idIQSet = new SmilePlugServerManager().getIdIQSetByPosition(ip, getContext(), position);
Expand All @@ -65,7 +65,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
catch (NetworkErrorException e) { e.printStackTrace(); }

TextView tvSize = (TextView) convertView.findViewById(R.id.tv_size);
tvSize.setText(String.valueOf(size));
if(size < 10) tvSize.setText("0"+String.valueOf(size));
else tvSize.setText(String.valueOf(size));
}

return convertView;
Expand Down

0 comments on commit 76b6e20

Please sign in to comment.