Skip to content

Commit

Permalink
Merge pull request #44 from chrqls/dev
Browse files Browse the repository at this point in the history
[Issue #36] Adding a screen to get the session id between the login screen and the moment you start making questions
  • Loading branch information
Charles Quelos committed Nov 14, 2013
2 parents 92fa914 + ca851ad commit a9562b8
Show file tree
Hide file tree
Showing 14 changed files with 506 additions and 17 deletions.
25 changes: 12 additions & 13 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="C:/Users/Charles/Desktop/activation.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Charles/Desktop/additionnal.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Users/Charles/Desktop/mail.jar"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="libs/javax.mail-1.5.0.jar"/>
<classpathentry exported="true" kind="lib" path="libs/activation-1.1.1.jar"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/smileplug-adm-test/target
/gen
/bin

lint.xml
1 change: 1 addition & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</intent-filter>
</activity>

<activity android:name=".ui.SessionValuesActivity" android:screenOrientation="landscape"/>
<activity android:name=".ui.GeneralActivity" android:screenOrientation="landscape"/>
<activity android:name=".ui.ChooseActivityFlowDialog" android:screenOrientation="landscape" android:theme="@style/Dialog"/>
<activity android:name=".ui.UsePreparedQuestionsActivity" android:screenOrientation="landscape" android:theme="@style/Theme.Transparent"/>
Expand Down
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-15
target=android-18
73 changes: 73 additions & 0 deletions res/layout-large-land/session_values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rounded_border"
android:gravity="top|center"
android:orientation="vertical"
android:layout_margin="50dip">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:textColor="@color/black"
android:textSize="12sp"
/>

<TextView
android:id="@+id/tv_session_values"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:text="@string/session_values"
android:textColor="@color/black"
android:textSize="12sp"
/>

<EditText
android:id="@+id/teacher_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:hint="@string/teacher_name_hint"
android:singleLine="true"
android:inputType="textAutoCorrect|textCapSentences"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp">
</EditText>

<EditText
android:id="@+id/session_title"
android:layout_width="200dp"
android:layout_height="50dp"
android:hint="@string/session_title_hint"
android:singleLine="true"
android:inputType="textAutoCorrect|textCapSentences"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp">
</EditText>

<EditText
android:id="@+id/group_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:hint="@string/group_name_hint"
android:singleLine="true"
android:inputType="textAutoCorrect|textCapSentences"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp">
</EditText>

<Button
android:id="@+id/btn_create_session"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:text="@string/btn_create_session"
android:textSize="12sp"
android:layout_marginTop="30dip"
android:layout_centerInParent="true"/>

</LinearLayout>
97 changes: 97 additions & 0 deletions res/layout-xlarge-land/session_values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rounded_border"
android:layout_gravity="center"
android:layout_margin="200dip">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:textColor="@color/black"
android:textSize="18sp"
android:layout_centerHorizontal="true"/>

<View
android:id="@+id/view_separator2"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="@color/gray"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="20dip"
android:layout_alignParentBottom="true"/>

<Button
android:id="@+id/btn_create_session"
android:layout_width="150sp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:text="@string/btn_create_session"
android:textSize="20sp" />

<EditText
android:id="@+id/session_title"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/group_name"
android:layout_centerVertical="true"
android:ems="10"
android:hint="@string/session_title_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" />

<EditText
android:id="@+id/group_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/teacher_name"
android:layout_below="@+id/session_title"
android:ems="10"
android:hint="@string/group_name_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" />

<EditText
android:id="@+id/teacher_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="@+id/session_title"
android:layout_centerHorizontal="true"
android:ems="10"
android:hint="@string/teacher_name_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" >

<requestFocus />
</EditText>

<TextView
android:id="@+id/tv_session_values"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_title"
android:layout_alignBottom="@+id/tv_title"
android:layout_centerHorizontal="true"
android:layout_margin="5dip"
android:text="@string/session_values"
android:textColor="@color/black"
android:textSize="20sp" />

<View
android:id="@+id/view_separator"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tv_title"
android:layout_margin="2dip"
android:background="@color/gray" />

</RelativeLayout>
96 changes: 96 additions & 0 deletions res/layout/session_values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rounded_border"
android:layout_gravity="center"
android:layout_margin="50dip">

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:textColor="@color/black"
android:textSize="18sp"
android:layout_centerHorizontal="true"/>

<View
android:id="@+id/view_separator2"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="@color/gray"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="20dip"
android:layout_alignParentBottom="true"/>

<EditText
android:id="@+id/group_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="@+id/view_separator2"
android:layout_alignLeft="@+id/session_title"
android:ems="10"
android:hint="@string/group_name_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" >

<requestFocus />
</EditText>

<EditText
android:id="@+id/teacher_name"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="@+id/session_title"
android:layout_alignLeft="@+id/session_title"
android:ems="10"
android:hint="@string/teacher_name_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" />

<EditText
android:id="@+id/session_title"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="@+id/group_name"
android:layout_alignLeft="@+id/view_separator2"
android:ems="10"
android:hint="@string/session_title_hint"
android:inputType="textAutoCorrect|textCapSentences"
android:singleLine="true" />

<TextView
android:id="@+id/tv_session_values"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/tv_title"
android:layout_centerHorizontal="true"
android:text="@string/session_values"
android:textColor="@color/black"
android:textSize="18sp" />

<View
android:id="@+id/view_separator"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_alignRight="@+id/view_separator2"
android:layout_below="@+id/tv_session_values"
android:layout_margin="5dip"
android:background="@color/gray" />

<Button
android:id="@+id/btn_create_session"
android:layout_width="150sp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/session_title"
android:layout_alignBottom="@+id/session_title"
android:layout_alignRight="@+id/view_separator"
android:layout_marginRight="14dp"
android:text="@string/btn_create_session"
android:textSize="18sp" />

</RelativeLayout>
7 changes: 7 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
<string name="server">Server IP</string>
<string name="connect">Connect</string>
<string name="loading">Loading...</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>
<string name="group_name_hint">Group name</string>
<string name="btn_create_session">Create</string>
<string name="creating_session">Creating session...</string>

<string name="start_making">Start Making Questions</string>
<string name="use_prepared">Use Prepared Questions</string>
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/smilec/smile/bu/SmilePlugServerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ public void resetGame(String ip, Context context) throws NetworkErrorException {

}

public void createSession(String ip, String teacherName, String sessionTitle, String groupName, Context context) throws NetworkErrorException {

String url = SmilePlugUtil.createUrl(ip, SmilePlugUtil.CREATE_SESSION);
JSONObject jsonSessionValues = new JSONObject();

try {
jsonSessionValues.put("teacherName", teacherName);
jsonSessionValues.put("sessionName", sessionTitle);
jsonSessionValues.put("groupName", groupName);

} catch (Exception e) {
Log.e("SMILE_TEACHER:SmilePlugServerManager", "ERROR, reason: " + e.getMessage());
e.printStackTrace();
}

put(ip,context,url,jsonSessionValues.toString());
}

public String currentMessageGame(String ip, Context context) throws NetworkErrorException {
String url = SmilePlugUtil.createUrl(ip, SmilePlugUtil.CURRENT_MESSAGE_URL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected void onResume() {
super.onResume();

ip = this.getIntent().getStringExtra(GeneralActivity.PARAM_IP);

btStart.setOnClickListener(new StartButtonListener());
btUse.setOnClickListener(new UsePreparedQuestionsButtonListener());

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/smilec/smile/ui/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
}

private void loading() {
Intent intent = new Intent(this, ChooseActivityFlowDialog.class);
Intent intent = new Intent(this, SessionValuesActivity.class);
intent.putExtra(GeneralActivity.PARAM_IP, tvIp.getText().toString());
intent.putExtra(GeneralActivity.PARAM_STATUS, status);
//ActivityUtil.showLongToast(this, R.string.connection_established);
Expand All @@ -194,7 +194,7 @@ private void loading() {
msg = mHandler.obtainMessage(MSG_OK, getResources().getString(R.string.connection_established));
mHandler.sendMessage(msg);

//Starting ChooseActivityFlowDialog
//Starting SessionValuesActivity
startActivity(intent);

//Closing LoginActivity
Expand Down
Loading

0 comments on commit a9562b8

Please sign in to comment.