working on #63 and #64

parent e135bf24
Showing with 54 additions and 79 deletions
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
......@@ -11,7 +11,7 @@ android {
versionName "1.0"
resValue "string", "db_name", "PCB.db"
resValue "integer", "db_version", "4"
resValue "string", "app_version", "1.0"
resValue "string", "app_version", "1.1"
resValue "string", "core_vocabulary", "core_vocabulary"
resValue "string", "apk", "to_be_set_in_subproject"
}
......
......@@ -5,7 +5,6 @@
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
</application>
</manifest>
......@@ -138,6 +138,6 @@ public class TTSHelper {
Bundle params = new Bundle();
params.putString(TextToSpeech.Engine.KEY_PARAM_VOLUME, "1");
params.putString(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "TAPE_READ");
ttobj.speak(input, TextToSpeech.QUEUE_FLUSH, params, "TAPE_READ");
//ttobj.speak(input, TextToSpeech.QUEUE_FLUSH, params, "TAPE_READ");
}
}
#Sun Jan 15 10:11:11 CET 2017
#Mon Mar 06 08:10:53 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
......@@ -18,7 +18,7 @@ android {
targetSdkVersion 22
versionCode 1
versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.supervisor_tablet.gui.Supervisor_SerialActivity"
resValue "bool","NotifyAllwaysVisible", "false"
resValue "string","apk","pictograms.apk"
// signingConfig signingConfigs.config
}
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yottacode.pictogram.supervisor_tablet">
<!-- The app has the permission to receive the RECEIVE_BOOT_COMPLETED broadcast -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- For kiosk mode -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- For the service that restarts the app when another app go to foreground -->
......@@ -20,6 +19,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
......@@ -40,7 +40,7 @@
android:label="@string/app_name"
android:screenOrientation="landscape" />
<activity
android:name=".gui.Supervisor_SerialActivity"
android:name="com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
android:label="@string/title_activity_serial"
android:screenOrientation="landscape" />
<activity
......
package com.yottacode.pictogram.supervisor_tablet.gui;
import android.app.Activity;
import com.yottacode.pictogram.supervisor_tablet.R;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.tools.GUITools;
/**
* Created by Fernando on 21/11/2016.
*/
public final class Supervisor_SerialActivity extends SerialActivity {
@Override
protected boolean is_legal_user(String user_name, Activity activity) {
boolean legal_user=com.yottacode.pictogram.dao.UserLogin.isSupervisorLoginPattern(user_name);
if (!legal_user)
GUITools.show_alert(activity, R.string.ilegal_user, user_name);
return legal_user;
}
}
......@@ -8,7 +8,7 @@ android {
targetSdkVersion 22
versionCode 1
versionName "1.0"
resValue "string", "SerialClass", "com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
resValue "bool","NotifyAllwaysVisible", "false"
resValue "integer", "rows", "5"
resValue "integer", "columns", "10"
resValue "integer", "rows_big", "4"
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yottacode.pictogram.tabletlibrary">
<application
android:allowBackup="true"
android:label="@string/app_name"
......
package com.yottacode.pictogram.tabletlibrary;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
/**
* Created by Fernando on 09/03/2017.
*/
public class StartAtBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Log.i(this.getClass().getCanonicalName(),"Starting Pictogram Tablet when boot");
Intent appIntent = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
context.startActivity(appIntent,null);
}
}
}
......@@ -52,7 +52,6 @@ import com.yottacode.pictogram.net.websockets.ActionTalk;
import com.yottacode.pictogram.net.websockets.VocabularyTalk;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.EditPictoActivity;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tabletlibrary.gui.session.SessionActivity;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img;
......@@ -1011,14 +1010,7 @@ protected void showOnlyTape(boolean onlyTape) {
e.printStackTrace();
}
}
Class serialClass;
try {
serialClass = Class.forName(getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(this.getClass().getCanonicalName(), "S:" + getString(R.string.SerialClass));
serialClass = SerialActivity.class;
}
Intent serialActivity = new Intent(getBaseContext(), serialClass);
Intent serialActivity = new Intent(getBaseContext(), com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
if (lastUserName != null) {
Log.i(this.getClass().getCanonicalName(), "Switch user to " + lastUserName);
serialActivity.putExtra("switch_usr", lastUserName);
......
......@@ -51,14 +51,8 @@ public class LoginActivity extends FragmentActivity {
logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Class serialClass;
try {
serialClass=Class.forName(getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(this.getClass().getCanonicalName(),"S:"+getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(getBaseContext(), serialClass);
Intent serialActivity = new Intent(getBaseContext(), com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", true);
startActivity(serialActivity);
}
......
......@@ -25,14 +25,7 @@ public class MainActivity extends Activity {
// For deactivating the lock screen (just before setContentView)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
Class serialClass;
try {
serialClass=Class.forName(getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(this.getClass().getCanonicalName(),"S:"+getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(this, serialClass);
Intent serialActivity = new Intent(this, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", false);
startActivity(serialActivity);
}
......
......@@ -43,7 +43,6 @@ public class SerialActivity extends Activity {
LinearLayout stuList;
LinearLayout supList;
protected boolean is_legal_user(String user_name, Activity activity) {return true;}
/**
* Return the default user+pwd when login.The policy is
......@@ -155,7 +154,7 @@ public class SerialActivity extends Activity {
@Override
public void onClick(View view) {
String username = mSerialViewMail.getText().toString();
if (is_legal_user(username,SerialActivity.this)) {
String password = mSerialViewPass.getText().toString();
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
......@@ -164,7 +163,7 @@ public class SerialActivity extends Activity {
editor.commit();
if (!username.equals("") && !password.equals(""))
new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class);
}
}
});
}
......
......@@ -13,7 +13,6 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity;
import com.yottacode.pictogram.tools.PCBcontext;
/**
......@@ -36,10 +35,12 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
TaskStackBuilder stackBuilder = TaskStackBuilder.create(PCBcontext.getContext());
stackBuilder.addParentStack(PictogramActivity.class);
stackBuilder.addNextIntent(resultIntent);
if (PCBcontext.getContext().getResources().getBoolean(R.bool.NotifyAllwaysVisible)){
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(resultPendingIntent);
}
}
public void notifyStatus(boolean updated) {
String user="";
......@@ -78,13 +79,7 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
Log.i(LOG_TAG,"App restarting");
Context context=activity.getBaseContext();
Class serialClass;
try {
serialClass=Class.forName(context.getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(LOG_TAG,"S:"+PCBcontext.getContext().getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(context, serialClass);
Intent serialActivity = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", false);
serialActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(serialActivity);
......@@ -97,14 +92,7 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
Context context=PCBcontext.getContext();
Class serialClass;
try {
serialClass=Class.forName(PCBcontext.getContext().getString(R.string.SerialClass));
} catch (ClassNotFoundException e) {
Log.e(LOG_TAG,"S:"+PCBcontext.getContext().getString(R.string.SerialClass));
serialClass=SerialActivity.class;
}
Intent serialActivity = new Intent(context, serialClass);
Intent serialActivity = new Intent(context, com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", direct_login);
context.startActivity(serialActivity);
......
......@@ -20,6 +20,7 @@ android {
versionName "1.0"
resValue "string","SerialClass","com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity"
resValue "string","apk","pictogram.apk"
resValue "bool","NotifyAllwaysVisible", "true"
// signingConfig signingConfigs.config
}
productFlavors {
......
......@@ -56,7 +56,8 @@
android:launchMode="singleTop"
android:screenOrientation="landscape" />
<!-- Intent Filter to run the app when the boot is completed -->
<receiver android:name=".kiosk.BootReceiver">
<receiver android:name=".kiosk.BootReceiver"
android:label="BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
......@@ -64,7 +65,11 @@
<!-- Service for restarting the app when another app go to foreground -->
<service
android:name=".kiosk.KioskService"
android:exported="false" />
android:exported="false">
<intent-filter>
<action android:name="com.yottacode.pictogram.yotta_tablet.kiosk.KioskService" />
</intent-filter>
</service>
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.session.SessionActivity"
......
......@@ -18,8 +18,10 @@ public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent myIntent = new Intent(context, MainActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
}
}
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