Commit 38bbfe02 authored by Michalis Masikos's avatar Michalis Masikos

studentcard inspector app for android

parent 52e55b89
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gr.grnet.academicid.inspector"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="16"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<application android:label="@string/app_name"
android:name="InspectorApplication"
android:icon="@drawable/ic_launcher"
android:allowBackup="true">
<activity android:name="MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".InspectionResults"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="stateHidden"/>
<activity android:name=".ScanQR"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.dm.zbar.android.scanner.ZBarScannerActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name=".Preferences"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name=".ChangePassword"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation"
android:windowSoftInputMode="stateHidden"/>
</application>
</manifest>
\ No newline at end of file
/*___Generated_by_IDEA___*/
package gr.grnet.academicid.inspector;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package gr.grnet.academicid.inspector;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package gr.grnet.academicid.inspector;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="3dp"
android:layout_marginLeft="50dp"
android:text="@string/lbl_current_password"/>
<EditText
android:id="@+id/etxt_current_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:contentDescription="@null"
android:inputType="textPassword"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="3dp"
android:layout_marginLeft="50dp"
android:text="@string/lbl_new_password"/>
<EditText
android:id="@+id/etxt_new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:contentDescription="@null"
android:inputType="textPassword"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="3dp"
android:layout_marginLeft="50dp"
android:text="@string/lbl_new_password_confirmation"/>
<EditText
android:id="@+id/etxt_new_password_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:contentDescription="@null"
android:inputType="textPassword"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp">
<Button
android:id="@+id/btn_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="3dp"
android:text="@string/lbl_cancel"
android:onClick="cancel"/>
<Button
android:id="@+id/btn_confirm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="3dp"
android:text="@string/lbl_confirm"
android:onClick="confirm"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<TextView
android:id="@+id/txtv_inspection_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:visibility="gone"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/lbl_serial_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
style="@style/label"
android:layout_below="@id/txtv_inspection_result"
android:visibility="gone"
android:text="@string/lbl_serial_no"/>
<TextView
android:id="@+id/txtv_serial_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/lbl_serial_number"
android:visibility="gone"
style="@style/view_text"/>
<TextView
android:id="@+id/lbl_concat_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
style="@style/label"
android:layout_below="@id/txtv_serial_number"
android:visibility="gone"
android:text="@string/lbl_name"/>
<TextView
android:id="@+id/txtv_concat_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/lbl_concat_name"
android:visibility="gone"
style="@style/view_text"/>
<TextView
android:id="@+id/lbl_university"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
style="@style/label"
android:layout_below="@id/txtv_concat_name"
android:visibility="gone"
android:text="@string/lbl_university"/>
<TextView
android:id="@+id/txtv_university"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/lbl_university"
android:visibility="gone"
style="@style/view_text"/>
<TextView
android:id="@+id/lbl_residence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
style="@style/label"
android:layout_below="@id/txtv_university"
android:visibility="gone"
android:text="@string/lbl_residence"/>
<TextView
android:id="@+id/txtv_residence"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/lbl_residence"
android:visibility="gone"
style="@style/view_text"/>
<TextView
android:id="@+id/lbl_inspection_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/txtv_residence"
android:text="@string/lbl_errorCode"
android:visibility="gone"/>
<TextView
android:id="@+id/txtv_inspection_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_below="@id/lbl_inspection_description"
style="@style/view_text"
android:visibility="gone"/>
<TextView
android:id="@+id/lbl_init_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textStyle="bold|italic"
style="@style/view_text"
android:text="@string/lbl_init_message"/>
</RelativeLayout>
</ScrollView>
<Button
android:id="@+id/btn_scan_qr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/lbl_scan_qr"
android:onClick="scanQR"/>
<RelativeLayout
android:id="@+id/rellay_serial_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<ImageButton
android:id="@+id/btn_check_serial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="@null"
android:src="@drawable/action_search"
android:onClick="checkSerialNo"/>
<EditText
android:id="@+id/etxt_serial_number"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/btn_check_serial"
android:layout_toRightOf="@+id/btn_clear_serial"
android:layout_alignBottom="@id/btn_check_serial"
android:layout_marginTop="4dp"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="12"
android:hint="@string/lbl_enter_serial"/>
<ImageButton
android:id="@+id/btn_clear_serial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:contentDescription="@null"
android:src="@drawable/content_remove"
android:onClick="clearContent"/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:contentDescription="@null"
android:src="@drawable/ic_launcher" android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="3dp"
android:layout_marginLeft="50dp"
android:text="@string/lbl_username"/>
<EditText
android:id="@+id/etxt_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:inputType="text|textNoSuggestions"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="3dp"
android:layout_marginLeft="50dp"
android:text="@string/lbl_password"/>
<EditText
android:id="@+id/etxt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:inputType="textPassword"/>
<Button
android:id="@+id/btn_sign_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:text="@string/lbl_sign_in"
android:onClick="signIn"/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_settings"
android:icon="@drawable/action_settings"
android:title="@string/menu_settings"/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Academic ID Inspector</string>
<string name="lbl_username">Όνομα Χρήστη:</string>
<string name="lbl_password">Κωδικός Πρόσβασης:</string>
<string name="lbl_sign_in">Είσοδος</string>
<string name="msg_wait">Παρακαλώ περιμένετε…</string>
<string name="msg_incorrect_credentials">Το όνομα Χρήστη ή ο Κωδικός Πρόσβασης είναι εσφαλμένα</string>
<string name="msg_no_camera_available">Η κάμερα δεν είναι διαθέσιμη</string>
<string name="title_no_net_available">Δίκτυο μη Διαθέσιμο</string>
<string name="msg_no_net_available">Για ενεργοποίηση πιέστε Επόμενο</string>
<string name="action_next">Επόμενο</string>
<string name="action_close">Τερματισμός</string>
<string name="lbl_init_message">Σαρώστε τον κωδικό QR ή εισάγετε τον σειριακό αριθμό</string>
<string name="lbl_scan_qr">Σάρωση QR</string>
<string name="lbl_enter_serial">Εισαγωγή Σειριακού Αρ.</string>
<string name="lbl_exit">Πιέστε ξανά για έξοδο</string>
<string name="lbl_valid">ΕΓΚΥΡΟ</string>
<string name="lbl_invalid">ΑΚΥΡΟ</string>
<string name="lbl_serial_no">Σειριακός Αριθμός:</string>
<string name="lbl_name">Όνομα:</string>
<string name="lbl_university">Έδρα Σχολής:</string>
<string name="lbl_residence">Κάτοικος:</string>
<string name="lbl_errorCode">Αιτιολογία:</string>
<string name="msg_invalid_input">Το στοιχείο εισόδου δεν αντιστοιχεί σε έγκυρη ακαδημαϊκή ταυτότητα</string>
<string name="msg_error_inspecting_academicId">Παρουσιάστηκε σφάλμα κατά την επιθεώρησης της ακαδημαϊκής ταυτότητας</string>
<string name="menu_settings">Ρυθμίσεις</string>
<string name="title_change_password">Αλλαγή Κωδικού Πρόσβασης</string>
<string name="msg_change_password">Αλλαγή του κωδικού πρόσβασης του χρήστη</string>
<string name="lbl_current_password">Τρέχων Κωδικός Πρόσβασης:</string>
<string name="lbl_new_password">Νέος Κωδικός Πρόσβασης:</string>
<string name="lbl_new_password_confirmation">Επιβεβαίωση Νέου Κωδικού:</string>
<string name="lbl_cancel">Ακύρωση</string>
<string name="lbl_confirm">Επιβεβαίωση</string>
<string name="msg_password_change_required">Απαιτείται αλλαγή του κωδικού πρόσβασης</string>
<string name="msg_incorrect_current_password">Ο τρέχων κωδικός πρόσβασης είναι λάθος</string>
<string name="msg_new_passwords_dont_match">Οι νέοι κωδικοί πρόσβασης δεν είναι ίδιοι</string>
<string name="msg_password_too_short">Ο κωδικός πρόσβασης πρέπει να περιέχει τουλάχιστον 4 χαρακτήρες</string>
<string name="msg_new_current_password_same">Ο νέος και ο τρέχον κωδικός πρόσβασης δεν πρέπει να είναι ίδιοι</string>
<string name="msg_error_changing_password">Παρουσιάστηκε σφάλμα κατα την διαδικασία αποθήκευσης του νέου κωδικού πρόσβασης</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Academic ID Inspector</string>
<string name="lbl_username">Username:</string>
<string name="lbl_password">Password:</string>
<string name="lbl_sign_in">Sign In</string>
<string name="msg_wait">Please wait…</string>
<string name="msg_incorrect_credentials">Incorrect username or password</string>
<string name="msg_no_camera_available">Rear Facing Camera Unavailable</string>
<string name="title_no_net_available">No Network Connection</string>
<string name="msg_no_net_available">To enable network connection touch Next</string>
<string name="action_next">Next</string>
<string name="action_close">Close</string>
<string name="lbl_init_message">Scan QR code or enter serial number</string>
<string name="lbl_scan_qr">Scan QR Code</string>
<string name="lbl_enter_serial">Enter Serial Number</string>
<string name="lbl_exit">Press again to exit</string>
<string name="lbl_valid">VALID</string>
<string name="lbl_invalid">INVALID</string>
<string name="lbl_serial_no">Serial Number:</string>
<string name="lbl_name">Name:</string>
<string name="lbl_university">University Location:</string>
<string name="lbl_residence">Resident:</string>
<string name="lbl_errorCode">Reason:</string>
<string name="msg_invalid_input">Input is not a valid Academic ID</string>
<string name="msg_error_inspecting_academicId">Error trying to inspect academic ID</string>
<string name="menu_settings">Settings</string>
<string name="title_change_password">Change Password</string>
<string name="msg_change_password">Change the user password</string>
<string name="lbl_current_password">Current Password:</string>
<string name="lbl_new_password">New Password:</string>
<string name="lbl_new_password_confirmation">Confirm New Password:</string>
<string name="lbl_cancel">Cancel</string>
<string name="lbl_confirm">Confirm</string>
<string name="msg_password_change_required">Password changed required</string>
<string name="msg_incorrect_current_password">Current password is incorrect</string>
<string name="msg_new_passwords_dont_match">The new passwords don\'t match</string>
<string name="msg_password_too_short">Password must contain at least 4 characters</string>
<string name="msg_new_current_password_same">New and current password should not be the same</string>
<string name="msg_error_changing_password">Error trying to update user password</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="intro_blurb_green">
<item name="android:textSize">30sp</item>
<item name="android:textColor">#00ff00</item>
<item name="android:textStyle">bold</item>
</style>
<style name="intro_blurb_orange">
<item name="android:textSize">30sp</item>
<item name="android:textColor">#ee7620</item>
<item name="android:textStyle">bold</item>
</style>
<style name="label">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#ffffff</item>
</style>
<style name="label_orange">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#ee7620</item>
</style>
<style name="view_text">
<item name="android:textSize">16sp</item>
<item name="android:textColor">#cccccc</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/menu_settings">
<PreferenceScreen
android:title="@string/title_change_password"
android:summary="@string/msg_change_password">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="gr.grnet.academicid.inspector"
android:targetClass="gr.grnet.academicid.inspector.ChangePassword"/>
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
package gr.grnet.academicid.inspector;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Toast;
import gr.grnet.academicid.inspector.domain.Inspector;
import gr.grnet.academicid.inspector.parser.ChangePasswordResponse;
import gr.grnet.academicid.inspector.parser.JSONParser;
import gr.grnet.academicid.inspector.services.ServiceHandler;
import gr.grnet.academicid.inspector.utilities.Constants;
import gr.grnet.academicid.inspector.utilities.Tools;
public class ChangePassword extends Activity {
private EditText etxtCurrentPassword;
private EditText etxtNewPassword;
private EditText etxtNewPasswordConfirmation;
private ProgressDialog progressDialog;