working on PCB supervisor v1.6

parent a6e1e6aa
...@@ -266,14 +266,15 @@ public class UserLogin { ...@@ -266,14 +266,15 @@ public class UserLogin {
public void login(String username, String password, Activity activity, Class PictogramActivity, Class LoginActivity) { public void login(String username, String password, Activity activity, Class PictogramActivity, Class LoginActivity) {
if (PCBcontext.is_user_logged()) PCBcontext.unset_user(); if (PCBcontext.is_user_logged()) PCBcontext.unset_user();
Log.e("WWWWWWWWWWWWWWWWWWW",PCBcontext.getContext().getPackageName());
boolean online = RestapiWrapper.ping(activity.getResources().getString(R.string.server), "server/ping"); boolean online = RestapiWrapper.ping(activity.getResources().getString(R.string.server), "server/ping");
if (isSupervisorLoginPattern(username)) if (isSupervisorLoginPattern(username))
if (PCBcontext.getContext().getPackageName().equals("com.yottacode.pictogram.communicator")) if (PCBcontext.getActivityContext().getPackageName().equals("com.yottacode.pictogram.communicator"))
GUITools.show_alert(PCBcontext.getContext(), R.string.login_ilegaluser); GUITools.show_alert(PCBcontext.getActivityContext(), R.string.login_ilegaluser);
else else
manageSupervisorLogin(username, password, online, activity, PictogramActivity, LoginActivity); manageSupervisorLogin(username, password, online, activity, PictogramActivity, LoginActivity);
else if (!PCBcontext.getContext().getPackageName().equals("com.yottacode.pictogram.communicator")) else if (!PCBcontext.getActivityContext().getPackageName().equals("com.yottacode.pictogram.communicator"))
GUITools.show_alert(PCBcontext.getContext(),R.string.login_ilegaluser); GUITools.show_alert(PCBcontext.getActivityContext(),R.string.login_ilegaluser);
else else
manageStudentLogin(username,password,online, activity, PictogramActivity); manageStudentLogin(username,password,online, activity, PictogramActivity);
} }
......
...@@ -80,8 +80,8 @@ ...@@ -80,8 +80,8 @@
<string name="fa_exclamation_triangle">&#xf071;</string> <string name="fa_exclamation_triangle">&#xf071;</string>
<string name="fa_question_circle">&#xf059;</string> <string name="fa_question_circle">&#xf059;</string>
<string name="fa_user_plus">&#xf234;</string> <string name="fa_user_plus">&#xf234;</string>
<string name="google_play_student_apk">https://play.google.com/store/apps/details?id=com.yottacode.communicator</string> <string name="google_play_student_apk">https://play.google.com/store/apps/details?id=com.yottacode.pictogram.communicator</string>
<string name="google_play_supervisor_apk">https://play.google.com/store/apps/details?id=com.yottacode.supervisor</string> <string name="google_play_supervisor_apk">https://play.google.com/store/apps/details?id=com.yottacode.pictogram.supervisor</string>
<string name="login_ilegaluser">\" \"</string> <string name="login_ilegaluser">\" \"</string>
</resources> </resources>
...@@ -56,12 +56,6 @@ ...@@ -56,12 +56,6 @@
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="landscape" />
<!-- Intent Filter to run the app when the boot is completed --> <!-- Intent Filter to run the app when the boot is completed -->
<receiver android:name="com.yottacode.pictogram.communicator.BootReceiver"> <receiver android:name="com.yottacode.pictogram.communicator.BootReceiver">
<intent-filter> <intent-filter>
...@@ -70,18 +64,5 @@ ...@@ -70,18 +64,5 @@
</receiver> </receiver>
<activity
android:name="com.yottacode.pictogram.supervisor.gui.session.SessionActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.EditPictoActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="landscape" />
</application> </application>
</manifest> </manifest>
...@@ -110,53 +110,36 @@ ...@@ -110,53 +110,36 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" /> <orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="constraint-layout-1.0.0-beta3" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="android-gif-drawable-1.1.7" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" /> <orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.2.1" level="project" /> <orderEntry type="library" exported="" name="androidasync-2.2.1" level="project" />
<orderEntry type="library" exported="" name="android-gif-drawable-1.1.7" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" name="ion-2.2.1" level="project" /> <orderEntry type="library" exported="" name="ion-2.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
...@@ -173,6 +156,5 @@ ...@@ -173,6 +156,5 @@
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="constraint-layout-solver-1.0.0-beta3" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -33,5 +33,4 @@ dependencies { ...@@ -33,5 +33,4 @@ dependencies {
compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1' compile 'com.android.support:support-v4:24.2.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+' compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
} }
...@@ -120,9 +120,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -120,9 +120,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (!PCBcontext.getPcbdb().getCurrentUser().is_supervisor() && !isAppInLockTaskMode()) startLockTask();
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
// after a long inactivity, the pcbdb is discarded // after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) { if (!PCBcontext.is_user_logged()) {
...@@ -304,22 +301,28 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -304,22 +301,28 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (!PCBcontext.getVocabulary().isVisibleAnyPicto()) { Log.e("EEEEEEEEE","EEEEEEEEEEEEEEEEEEEEE"); if (!PCBcontext.getVocabulary().isVisibleAnyPicto()) {
finish(); finish();
Intent activity = new Intent(getBaseContext(), EmptySceneActivity.class); Intent activity = new Intent(getBaseContext(), EmptySceneActivity.class);
startActivity(activity); startActivity(activity);
}else {
if (!PCBcontext.getPcbdb().getCurrentUser().is_supervisor() && !isAppInLockTaskMode())
startLockTask();
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this);
setConfig();
startTTS();
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu() + " " + PCBcontext.getPcbdb().getCurrentUser().get_surname_stu() +
(PCBcontext.getPcbdb().getCurrentUser().is_supervisor()
? " (" + PCBcontext.getPcbdb().getCurrentUser().get_name_sup() + " " + PCBcontext.getPcbdb().getCurrentUser().get_surname_sup() + ")"
: "")
, Toast.LENGTH_SHORT).show();
} }
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this);
setConfig();
startTTS();
Toast.makeText(this.getBaseContext(), PCBcontext.getPcbdb().getCurrentUser().get_name_stu() + " " + PCBcontext.getPcbdb().getCurrentUser().get_surname_stu() +
(PCBcontext.getPcbdb().getCurrentUser().is_supervisor()
? " (" + PCBcontext.getPcbdb().getCurrentUser().get_name_sup() + " " + PCBcontext.getPcbdb().getCurrentUser().get_surname_sup() + ")"
: "")
, Toast.LENGTH_SHORT).show();
} }
public void setConfig() { public void setConfig() {
...@@ -426,7 +429,8 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -426,7 +429,8 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
tts.destroy(); if (tts!=null)
tts.destroy();
Log.e(LOG_TAG, "Closing Pictogram Activity"); Log.e(LOG_TAG, "Closing Pictogram Activity");
PCBcontext.getNetService().closeNotifyStatus(); PCBcontext.getNetService().closeNotifyStatus();
......
...@@ -138,7 +138,7 @@ public class SerialActivity extends Activity { ...@@ -138,7 +138,7 @@ public class SerialActivity extends Activity {
@Override @Override
public void onStart() { public void onStart() {
PCBcontext.setActivityContext(this);
Vector<User> users; Vector<User> users;
Log.i(this.getClass().getCanonicalName(),"Starting serial activity (Reset Prev user:"+getIntent().getBooleanExtra("resetPrevUser", true)+")"); Log.i(this.getClass().getCanonicalName(),"Starting serial activity (Reset Prev user:"+getIntent().getBooleanExtra("resetPrevUser", true)+")");
if (!PCBcontext.init()) PCBcontext.init(this, new NetServiceTablet()); if (!PCBcontext.init()) PCBcontext.init(this, new NetServiceTablet());
...@@ -175,7 +175,6 @@ public class SerialActivity extends Activity { ...@@ -175,7 +175,6 @@ public class SerialActivity extends Activity {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
PCBcontext.setActivityContext(this); PCBcontext.setActivityContext(this);
} }
} }
...@@ -3,36 +3,12 @@ ...@@ -3,36 +3,12 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#BDBDBD" android:background="@color/white"
android:keepScreenOn="true" android:keepScreenOn="true"
android:orientation="horizontal" android:orientation="horizontal"
android:theme="@style/Theme.AppCompat" android:theme="@style/Theme.AppCompat"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.EmptySceneActivity"> tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.EmptySceneActivity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/logo"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/pictogram_logo" />
</LinearLayout>
<LinearLayout
android:layout_width="570dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
>
<LinearLayout <LinearLayout
android:id="@+id/loginlayout" android:id="@+id/loginlayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -42,6 +18,7 @@ ...@@ -42,6 +18,7 @@
android:paddingTop="20dp"> android:paddingTop="20dp">
<LinearLayout <LinearLayout
android:layout_weight=".60"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
...@@ -52,9 +29,10 @@ ...@@ -52,9 +29,10 @@
android:id="@+id/emptyVocabulary_txt" android:id="@+id/emptyVocabulary_txt"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@color/VerdeApp"
android:text="@string/emptyVocabulary_msg" android:text="@string/emptyVocabulary_msg"
android:textAppearance="@android:style/TextAppearance.Material.Large" android:textAppearance="@android:style/TextAppearance.Material.Large"
android:background="@color/VerdeApp"
android:textColor="@color/white" android:textColor="@color/white"
tools:layout_editor_absoluteX="33dp" tools:layout_editor_absoluteX="33dp"
tools:layout_editor_absoluteY="75dp" /> tools:layout_editor_absoluteY="75dp" />
...@@ -71,26 +49,20 @@ ...@@ -71,26 +49,20 @@
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginTop="25dp" android:layout_marginTop="25dp"
android:background="@color/VerdeApp" android:background="@color/VerdeApp"
android:text="@string/action_entrar" android:text="Ok"
android:textColor="@color/white" android:textColor="@color/white"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_marginStart="30px" android:layout_marginStart="30px"
android:elevation="1dp" android:elevation="1dp"
android:orientation="horizontal" android:orientation="horizontal"
android:src="@drawable/login_image" /> android:src="@drawable/emptyvocab" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</FrameLayout> </FrameLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment