Commit c9ff8ab5 by Sebastián Collado Montañez

merge pictogramactivityrefactor

parents 90cd98a1 36ae13dc
Showing with 2633 additions and 694 deletions
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.scollado.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/scollado/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.example.scollado.myapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.scollado.myapplication", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.scollado.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.scollado.myapplication;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="#FF000000"
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
</vector>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="135"
android:centerColor="#4CAF50"
android:endColor="#2E7D32"
android:startColor="#81C784"
android:type="linear" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.scollado.myapplication.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.scollado.myapplication.MainActivity"
tools:showIn="@layout/app_bar_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
app:srcCompat="@android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="Android Studio"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="android.studio@android.com" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/ic_menu_camera"
android:title="Import" />
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/ic_menu_gallery"
android:title="Gallery" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="Slideshow" />
<item
android:id="@+id/nav_manage"
android:icon="@drawable/ic_menu_manage"
android:title="Tools" />
</group>
<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_menu_share"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/ic_menu_send"
android:title="Send" />
</menu>
</item>
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="nav_header_vertical_spacing">16dp</dimen>
<dimen name="nav_header_height">160dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item name="ic_menu_camera" type="drawable">@android:drawable/ic_menu_camera</item>
<item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item>
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
</resources>
<resources>
<string name="app_name">My Application</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_settings">Settings</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
package com.example.scollado.myapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Fri Jul 14 13:10:28 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
......@@ -3,16 +3,22 @@
<dimen name="activity_horizontal_margin">8px</dimen>
<dimen name="activity_vertical_margin">8px</dimen>
<dimen name="small_padding">4px</dimen>
<!-- Horizontal and vertical spacing between pictos -->
<dimen name="picto_grid_spacing">1px</dimen>
<!-- Picto border -->
<dimen name="picto_border_width">2px</dimen>
<!-- Picto padding ¿? -->
<dimen name="picto_padding">1px</dimen>
<dimen name="picto_normal_height">90px</dimen>
<dimen name="picto_normal_width">90px</dimen>
<dimen name="tape_normal_height">100px</dimen>
<dimen name="picto_big_height">115px</dimen>
<dimen name="picto_big_width">115px</dimen>
<dimen name="tape_big_height">125px</dimen>
<!-- Picto normal size -->
<dimen name="picto_normal_side">90px</dimen>
<!-- Picto big size -->
<dimen name="picto_big_side">115dp</dimen>
<!-- Tape -->
<dimen name="tape_normal_height">100dp</dimen>
<dimen name="tape_big_height">126dp</dimen>
<!-- Menu size -->
<dimen name="menu_top_height">64dp</dimen>
<!-- Picto session -->
<dimen name="picto_session_height">75px</dimen>
<dimen name="picto_session_width">75px</dimen>
</resources>
......
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8px</dimen>
<dimen name="activity_vertical_margin">8px</dimen>
<dimen name="small_padding">4px</dimen>
<!-- Horizontal and vertical spacing between pictos -->
<dimen name="picto_grid_spacing">1px</dimen>
<!-- Picto border -->
<dimen name="picto_border_width">2px</dimen>
<!-- Picto padding ¿? -->
<dimen name="picto_padding">1px</dimen>
<!-- Picto normal size -->
<dimen name="picto_normal_side">125dp</dimen>
<!-- Picto big size -->
<dimen name="picto_big_side">153dp</dimen>
<!-- Tape -->
<dimen name="tape_normal_height">135dp</dimen>
<dimen name="tape_big_height">165dp</dimen>
<!-- Menu size -->
<dimen name="menu_top_height">64dp</dimen>
<!-- Picto session -->
<dimen name="picto_session_height">75px</dimen>
<dimen name="picto_session_width">75px</dimen>
</resources>
\ No newline at end of file
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8px</dimen>
<dimen name="activity_vertical_margin">8px</dimen>
<dimen name="small_padding">4px</dimen>
<dimen name="picto_grid_spacing">2px</dimen>
<dimen name="picto_border_width">1px</dimen>
<dimen name="picto_padding">1px</dimen>
<dimen name="picto_normal_height">90px</dimen>
<dimen name="picto_normal_width">90px</dimen>
<dimen name="tape_normal_height">100px</dimen>
<dimen name="picto_big_height">135px</dimen>
<dimen name="picto_big_width">135px</dimen>
<dimen name="tape_big_height">145px</dimen>
<dimen name="picto_session_height">84dp</dimen>
<dimen name="picto_session_width">84dp</dimen>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8px</dimen>
<dimen name="activity_vertical_margin">8px</dimen>
<dimen name="small_padding">4px</dimen>
<dimen name="picto_grid_spacing">1px</dimen>
<dimen name="picto_border_width">1px</dimen>
<dimen name="picto_padding">1px</dimen>
<dimen name="picto_normal_height">90px</dimen>
<dimen name="picto_normal_width">90px</dimen>
<dimen name="tape_normal_height">100px</dimen>
<dimen name="picto_big_height">116px</dimen>
<dimen name="picto_big_width">116px</dimen>
<dimen name="tape_big_height">118px</dimen>
<dimen name="picto_session_height">75px</dimen>
<dimen name="picto_session_width">75px</dimen>
</resources>
......@@ -49,7 +49,7 @@
android:label="@string/title_activity_login_activity_fragments"
android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yottacode.pictogram.tabletlibrary">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"
......
......@@ -3,11 +3,9 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
......@@ -33,7 +31,7 @@ public class PictoAnimation {
private final static String LOG_TAG = PictoAnimation.class.getCanonicalName();
public void animateTapeView(final PictogramActivity activity,final int position, final ViewGroup view) {
public void animateTapeView(final VOCA activity, final int position, final ViewGroup view) {
final GridView gridview = (GridView) view.getChildAt(1);
final TapeAdapter tapeAdapter=(TapeAdapter)gridview.getAdapter();
......@@ -106,7 +104,7 @@ public class PictoAnimation {
return argb(alpha, red, green, blue);
}
public void animateTapeViewVertical(final PictogramActivity activity, final boolean up) {
public void animateTapeViewVertical(final VOCA activity, final boolean up) {
final View v = activity.findViewById(R.id.pictogramLayout);
int y=v.getHeight()/2-activity.tapeGridView.getHeight()/2;
final ValueAnimator moveAnim = up
......@@ -149,7 +147,7 @@ public class PictoAnimation {
public void animateOnDeleteView(final PictogramActivity activity, View view, final int position) {
public void animateOnDeleteView(final VOCA activity, View view, final int position) {
if (activity.deleting) return;
View borderlayout=((RelativeLayout)view).getChildAt(0);
......@@ -224,7 +222,7 @@ public class PictoAnimation {
public static void animateOnGridView(final RelativeLayout layout) {
final PictogramActivity activity=(PictogramActivity)PCBcontext.getActivityContext();
final VOCA activity=(VOCA)PCBcontext.getActivityContext();
if (activity.inserting) return;
FrameLayout borderlayout=(FrameLayout)layout.getChildAt(0);
......@@ -277,7 +275,7 @@ public class PictoAnimation {
public static void animateOutGridView(final PictoGridAdapter pictoGridAdapter, final Picto picto, RelativeLayout layout, final Vector<Picto> pictoLinkedList_inTape) {
final PictogramActivity activity=(PictogramActivity)PCBcontext.getActivityContext();
final VOCA activity=(VOCA)PCBcontext.getActivityContext();
if (activity.inserting) return;
FrameLayout borderlayout=(FrameLayout)layout.getChildAt(0);
......
......@@ -2,6 +2,7 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -23,6 +24,7 @@ import java.util.ArrayList;
* or a picto tape.
*/
public class PictoItemViewGenerator {
public static final int LAYOUT = R.layout.picto_grid_item;
public static final int LAYOUT_BIG = R.layout.picto_grid_item_big;
private static final byte MAX_LINE_LENGTH = 12;
......@@ -30,7 +32,6 @@ public class PictoItemViewGenerator {
private static final String LOG_TAG = PictoItemViewGenerator.class.getCanonicalName();
public static int mirror_color=0;
/**
*
* @param picto Pictogram to set the legend text
......@@ -60,68 +61,92 @@ public class PictoItemViewGenerator {
}
/**
*
* @param picto
* @param convertView
* @param parent
* @return
*/
public static View getPictoView(Picto picto, View convertView, ViewGroup parent) {
return getPictoView(picto, convertView, parent, false);
}
/**
*
* @param picto Pictogram to show
* @param convertView View object
* @param parent
* @param preventMirror
* @return Picto view
*/
public static View getPictoView(Picto picto, View convertView, ViewGroup parent, boolean preventMirror) {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? LAYOUT_BIG : LAYOUT, parent, false);
}
if (parent.getId()==R.id.tape_grid_view)
convertView.setPadding(0,0,0,0);
RelativeLayout layoutWrapper ;
FrameLayout layout ;
final ImageView pictoImage ;
ImageView redCrossImage ;
TextView legend;
TextView legend_full;
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout_big);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image_big);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross_big);
legend = (TextView) convertView.findViewById(R.id.legend_text_big);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_big_full);
} else {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross);
legend = (TextView) convertView.findViewById(R.id.legend_text);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_full);
}
layout.setBackgroundColor(convertView.getResources()
.getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE);
layoutWrapper.setVisibility(View.GONE);
pictoImage.setVisibility(View.GONE);
legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE);
pictoImage.setImageBitmap(null);
layoutWrapper.setAlpha(1f);
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor() || (picto!=null && !picto.is_invisible())) {
layoutWrapper.setVisibility(View.VISIBLE);
pictoImage.setVisibility(View.VISIBLE);
layoutWrapper.setBackground(convertView.getResources()
.getDrawable(R.drawable.picto_grid_item_border));
if (picto!=null) {
layoutWrapper.setAlpha(!picto.is_invisible() ? 1.00f : PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0f);
RelativeLayout layoutWrapper;
FrameLayout layout;
final ImageView pictoImage;
ImageView redCrossImage;
TextView legend;
TextView legend_full;
// View init
if (convertView == null)
convertView = LayoutInflater.from(parent.getContext()).inflate(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? LAYOUT_BIG : LAYOUT, parent, false);
// Padding respect to the tape
if (parent.getId() == R.id.tape_grid_view)
convertView.setPadding(0,0,0,0);
// Picto size
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout_big);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image_big);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross_big);
legend = (TextView) convertView.findViewById(R.id.legend_text_big);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_big_full);
} else {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross);
legend = (TextView) convertView.findViewById(R.id.legend_text);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_full);
}
layout.setBackgroundColor(convertView.getResources().getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE);
layoutWrapper.setVisibility(View.GONE);
pictoImage.setVisibility(View.GONE);
legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE);
pictoImage.setImageBitmap(null);
layoutWrapper.setAlpha(1f);
// Picto visibility
if (PCBcontext.getActivityContext().getClass().getSimpleName().equals("VocabularyManager") || (picto != null && !picto.is_invisible())) {
layoutWrapper.setVisibility(View.VISIBLE);
pictoImage.setVisibility(View.VISIBLE);
layoutWrapper.setBackground(convertView.getResources().getDrawable(R.drawable.picto_grid_item_border));
if (picto!=null) {
layoutWrapper.setAlpha(!picto.is_invisible() ? 1.00f : PCBcontext.getActivityContext().getClass().getSimpleName().equals("VocabularyManager") ? 0.25f : 0f);
try {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
switch (picto.get_legend()) {
case "none":
legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE);
break;
case "normal":
legend.setText(format_legend(picto, MAX_LINE_LENGTH, false));
legend.setVisibility(View.VISIBLE);
legend_full.setVisibility(View.GONE);
break;
default:
legend_full.setText(format_legend(picto, MAX_LINE_LENGTH_FULL, true));
legend.setVisibility(View.GONE);
......@@ -130,7 +155,6 @@ public class PictoItemViewGenerator {
pictoImage.setImageBitmap(bm);
if (picto.is_magnify()) {
pictoImage.setScaleX(1.2f);
pictoImage.setScaleY(1.2f);
......@@ -148,10 +172,10 @@ public class PictoItemViewGenerator {
mirror_color++;
pictoImage.setScaleX(scale[mirror_color % scale.length]);
pictoImage.setScaleY(scale[mirror_color % scale.length]);
if (picto.is_highlight_background())
layout.setBackgroundColor(color[mirror_color % color.length]);
}
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -26,7 +26,7 @@ public class PictoMenu {
public static final String IMAGE_PICTO = "imagePicto";
public static final String PATH_SOUND = "pathSound";
PictogramActivity activity;
VocabularyManager activity;
//Variables used on the picto menu (only supervisors)
private static final int CAMERA_PIC_REQUEST = 1;
......@@ -40,7 +40,7 @@ public class PictoMenu {
// TODO describe this variable
static final int SELECT_PICTURE = 1;
public PictoMenu(PictogramActivity activity) {
public PictoMenu(VocabularyManager activity) {
this.activity=activity;
}
......@@ -81,7 +81,7 @@ public class PictoMenu {
public void addPicto(int row, int col, int cat, int source) {
//Enviar al PictogramActivity los datos necesarios para crear el picto despues
//Enviar al voca los datos necesarios para crear el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
activity.getIntent().putExtra(Picto.JSON_ATTTRS.ROW, row);
......@@ -107,7 +107,7 @@ public class PictoMenu {
Intent intent = new Intent(activity, EditPictoActivity.class);
intent.putExtra(ID_PICTO_IMAGE,id_picto);
//Enviar al PictogramActivity los datos necesarios para editar el picto despues
//Enviar al voca los datos necesarios para editar el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
intent.putExtra(Picto.JSON_ATTTRS.ROW, row);
......
......@@ -3,22 +3,17 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.speech.tts.UtteranceProgressListener;
import android.util.DisplayMetrics;
import android.util.Log;
......@@ -39,8 +34,6 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
......@@ -49,19 +42,15 @@ import com.yottacode.pictogram.action.TalkAction;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.net.PictoUploader;
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.session.SessionActivity;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.tts.TTSHelper;
import com.yottacode.tools.BitmapTools;
import com.yottacode.tools.GUITools;
import org.json.JSONArray;
......@@ -69,7 +58,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
......@@ -79,8 +67,7 @@ import java.util.Locale;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class PictogramActivity extends Activity implements VocabularyTalk.iVocabularyListener {
public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener {
private static final int CAMERA_PIC_REQUEST = 1;
private static final int GALLERY_PIC_REQUEST = 2;
......@@ -105,6 +92,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
TTSHelper tts;
// Element used for loading new pictos (while changing categories)
Vocabulary vocabulary;
// For disabling volume button (See method at the end of the class)
private final List blockedKeys = new ArrayList(Arrays.asList(KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP));
// String constant for logs
......@@ -128,27 +116,25 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
protected boolean deleting;
protected boolean tape_delivered=false;
protected boolean tape_delivered = false;
float firstTouchX = -1;
public boolean inserting=false;
public boolean inserting = false;
@TargetApi(Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// blockNotificationBar();
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
onWindowFocusChanged(true);
// after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) {
Log.i(LOG_TAG,"PCBDB was discarded. App restarting");
Log.i(LOG_TAG, "PCBDB was discarded. App restarting");
NetServiceTablet.restart_PictogramTablet(this);
return;
}
setContentView(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? R.layout.activity_pictogram_big : R.layout.activity_pictogram);
setContentView(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? R.layout.voca_big : R.layout.voca);
this.mainLayout = (RelativeLayout) findViewById(R.id.pictogramLayout);
this.currentCategory = null;
......@@ -159,7 +145,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
return;
}
this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
......@@ -167,35 +152,35 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override
public void action(action action, int picto_cat, int picto_id, JSONObject msg) {
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
if (action==ActionTalk.iActionListener.action.show) {
if (action == ActionTalk.iActionListener.action.show) {
Log.i("TAG_PRUEBAS","show message received:"+msg.toString());
Log.i("TAG_PRUEBAS", "show message received:" + msg.toString());
JSONObject msg_attrs = null;
JSONArray pictos = null;
String mensaje= "";
String mensaje = "";
try {
msg_attrs = msg.getJSONObject("attributes");
pictos = msg_attrs.getJSONArray("pictos");
String user = pictos.getJSONObject(0).getJSONObject("attributes").getString("user_avatar");
if(user.equals(PCBcontext.getPcbdb().getCurrentUser().get_email_sup())){ //si el primer picto tiene ese sup asociado
mensaje += getResources().getString(R.string.message_from)+": "+PCBcontext.getPcbdb().getCurrentUser().get_name_stu()+", "+ PCBcontext.getPcbdb().getCurrentUser().get_surname_stu()+"\n";
mensaje += getResources().getString(R.string.says)+": ";
for(int i = 0; i < pictos.length(); i++) {
if (user.equals(PCBcontext.getPcbdb().getCurrentUser().get_email_sup())) { //si el primer picto tiene ese sup asociado
mensaje += getResources().getString(R.string.message_from) + ": " + PCBcontext.getPcbdb().getCurrentUser().get_name_stu() + ", " + PCBcontext.getPcbdb().getCurrentUser().get_surname_stu() + "\n";
mensaje += getResources().getString(R.string.says) + ": ";
for (int i = 0; i < pictos.length(); i++) {
JSONObject picto = pictos.getJSONObject(i).getJSONObject("attributes");
mensaje += (i != pictos.length()-1 ? picto.get("expression").toString()+" - " : picto.get("expression").toString());
mensaje += (i != pictos.length() - 1 ? picto.get("expression").toString() + " - " : picto.get("expression").toString());
}
Log.i(LOG_TAG,"Mensaje: "+msg.toString());
final AlertDialog.Builder builder = new AlertDialog.Builder(PictogramActivity.this);
Log.i(LOG_TAG, "Mensaje: " + msg.toString());
final AlertDialog.Builder builder = new AlertDialog.Builder(VOCA.this);
builder.setMessage(mensaje)
.setPositiveButton("Vale", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
.setPositiveButton("Vale", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
}
});
// Create the AlertDialog object and return it
runOnUiThread(new Runnable() {
@Override
......@@ -211,11 +196,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
}
}
else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) {
} else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) {
Picto picto = vocabulary.get_picto(picto_cat, picto_id);
PictogramActivity.this.execHighligthFeeback(picto, true);
VOCA.this.execHighligthFeeback(picto, true);
}
}
});
......@@ -223,7 +206,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.vocabulary.setImgDownloaderListener(new ImgDownloader.iImgDownloaderListener() {
@Override
public void loadComplete() {
PictogramActivity.this.refresh();
VOCA.this.refresh();
}
@Override
......@@ -268,7 +251,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
Log.i(this.getClass().getCanonicalName(), " Changing mirror mode");
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
int res_id = PCBcontext.getPcbdb().getCurrentUser().alter_mirror_mode() == true ? R.string.mirror_mode_on : R.string.mirror_mode_off;
Toast.makeText(PictogramActivity.this, res_id, Toast.LENGTH_SHORT).show();
Toast.makeText(VOCA.this, res_id, Toast.LENGTH_SHORT).show();
}
return true;
}
......@@ -282,21 +265,22 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.tapeGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (!deleting) {
Log.i(PictogramActivity.class.getCanonicalName(), " Deleting item " + position + "-" + id + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")");
Picto deletedPicto=PictogramActivity.this.tapeAdapter.getItem(position);
Log.i(VOCA.class.getCanonicalName(), " Deleting item " + position + "-" + id + "(" + VOCA.this.tapeAdapter.getItem(position).get_translation() + ")");
Picto deletedPicto = VOCA.this.tapeAdapter.getItem(position);
new PictoAnimation().animateOnDeleteView(PictogramActivity.this,view, position);
PictogramActivity.this.tapeAdapter.notifyDataSetChanged();
new PictoAnimation().animateOnDeleteView(VOCA.this, view, position);
VOCA.this.tapeAdapter.notifyDataSetChanged();
if (pictoMainGridAdapter.pictoInThisCategory(deletedPicto))
pictoMainGridAdapter.pictoInGrid(deletedPicto);
if (pictoCategoryGridAdapter.pictoInThisCategory(deletedPicto))
pictoCategoryGridAdapter.pictoInGrid(deletedPicto);
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, deletedPicto));
}
}});
((NetServiceTablet) PCBcontext.getNetService().getNetServiceDevice()).setPictogramActivity(this);
}
});
((NetServiceTablet) PCBcontext.getNetService().getNetServiceDevice()).setVOCA(this);
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
maxColumns = getResources().getInteger(R.integer.columns_big);
......@@ -307,8 +291,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
maxRows = getResources().getInteger(R.integer.rows);
maxInTape = getResources().getInteger(R.integer.maxInTape);
}
PictogramActivity.this.pictoMainGridView.setNumColumns(PictogramActivity.this.maxColumns);
PictogramActivity.this.pictoCategoryGridView.setNumColumns(PictogramActivity.this.maxColumns);
VOCA.this.pictoMainGridView.setNumColumns(VOCA.this.maxColumns);
VOCA.this.pictoCategoryGridView.setNumColumns(VOCA.this.maxColumns);
this.generateAnimations();
......@@ -324,36 +308,22 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override
protected void onResume() {
super.onResume();
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();
}
private void blockNotificationBar() {
WindowManager manager = ((WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE));
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
// this is to enable the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
localLayoutParams.height = (int) (50 * getResources().getDisplayMetrics().scaledDensity);
localLayoutParams.format = PixelFormat.TRANSPARENT;
customViewGroup view = new customViewGroup(this);
manager.addView(view, localLayoutParams);
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() {
setFeedback(new View[]{deleteButton, ttsButton, this.showPictoCategoriesViewButton, this.pictoCategoryGridView, this.pictoMainGridView});
}
private void setFeedback(View views[]) {
boolean vibration = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.VIBRATION);
boolean click = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.BEEP);
......@@ -364,45 +334,45 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
View.OnTouchListener touchListener;
touchListener =
vibration ? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean enable_haptic;
enable_haptic = !(v instanceof GridView);
if (!enable_haptic) {
int x = Math.round(event.getX());
int y = Math.round(event.getY());
int position = ((GridView) v).pointToPosition(x, y);
Picto p = position > -1 ? (Picto) ((GridView) v).getItemAtPosition(position) : null;
enable_haptic = (p != null && p.get_id() != 0 && !p.is_invisible() && p.is_enabled());
}
if (enable_haptic)
v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
vibration ? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean enable_haptic;
enable_haptic = !(v instanceof GridView);
if (!enable_haptic) {
int x = Math.round(event.getX());
int y = Math.round(event.getY());
int position = ((GridView) v).pointToPosition(x, y);
Picto p = position > -1 ? (Picto) ((GridView) v).getItemAtPosition(position) : null;
enable_haptic = (p != null && p.get_id() != 0 && !p.is_invisible() && p.is_enabled());
}
if (enable_haptic)
v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
return false;
}
}
: click
? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return false;
}
}
: new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
: click
? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
};
: new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
};
for (View view : views)
view.setOnTouchListener(touchListener);
......@@ -410,13 +380,13 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public void startTTS() {
String engine = PCBcontext.getPcbdb().getCurrentUser().get_tts_engine_sup() == null
? getString(R.string.default_tts_engine)
: PCBcontext.getPcbdb().getCurrentUser().get_tts_engine_sup();
? getString(R.string.default_tts_engine)
: PCBcontext.getPcbdb().getCurrentUser().get_tts_engine_sup();
String tts_voice = PCBcontext.getPcbdb().getCurrentUser().get_json_attr("tts voice") == null
? PCBcontext.getPcbdb().getCurrentUser().get_gender_stu().charAt(0) == 'M'
? getString(R.string.default_tts_voice_male)
: getString(R.string.default_tts_voice_female)
: PCBcontext.getPcbdb().getCurrentUser().get_json_attr("tts voice");
? PCBcontext.getPcbdb().getCurrentUser().get_gender_stu().charAt(0) == 'M'
? getString(R.string.default_tts_voice_male)
: getString(R.string.default_tts_voice_female)
: PCBcontext.getPcbdb().getCurrentUser().get_json_attr("tts voice");
tts = new TTSHelper(this, engine, new Locale(PCBcontext.getPcbdb().getCurrentUser().get_lang_stu()), tts_voice);
......@@ -451,6 +421,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.pictoCategoryGridAdapter.allPictosInGrid();
this.pictoMainGridAdapter.allPictosInGrid();
}
@Override
protected void onStop() {
super.onStop();
......@@ -581,17 +552,17 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
// This is to show the pictos ordered in the 2D Array that represents the panel
Picto[][] mp = new Picto[maxRows][maxColumns];
Iterator<Picto> pictos=list.iterator();
Iterator<Picto> pictos = list.iterator();
while (pictos.hasNext()) {
Picto p= pictos.next();
Picto p = pictos.next();
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) {
&& p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p;
}
} else {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1
&& p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) {
&& p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) {
mp[p.getFreeColumn()][p.getFreeRow()] = p;
}
}
......@@ -607,7 +578,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
for (int i = 0; i < maxRows; i++)
for (int j = 0; j < maxColumns; j++)
ll.add(mp[i][j]);
ll.add(mp[i][j]);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -690,7 +661,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
// Change the keyword
PCBcontext.getDevice().setKeyword(m_Text1);
Toast.makeText(PCBcontext.getContext(), getResources().getString(R.string.codeModified), Toast.LENGTH_SHORT).show();
// And exit PictogramActivity
// And exit voca
finish();
} else
......@@ -738,18 +709,18 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
/**
......@@ -766,6 +737,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
}
}
/**
* @return
*/
public Picto getCurrentCategory() {
return currentCategory;
}
......@@ -807,12 +781,12 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ViewGroup viewgroup = (ViewGroup) view.getParent();
int position = Integer.parseInt((String) event.getClipDescription().getLabel());
Log.d("Drag:", "Posición: " + position + " es categoria:" + v.getTransitionName()+" "+viewgroup.getTransitionName());
Log.d("Drag:", "Posición: " + position + " es categoria:" + v.getTransitionName() + " " + viewgroup.getTransitionName());
// if the view is the tape_grid_view, we accept the drag item
// Destino tape_grid_view y origen panel_grid_view
if (v == findViewById(R.id.tape_grid_view) && (viewgroup == findViewById(R.id.picto_category_grid_view) || viewgroup == findViewById(R.id.picto_main_grid_view))) {
Picto p = viewgroup == findViewById(R.id.picto_category_grid_view) ? pictoCategoryGridAdapter.getItem(position)
: pictoMainGridAdapter.getItem(position);
: pictoMainGridAdapter.getItem(position);
if (!p.is_category()) addPictoWord(view, p);
}
......@@ -838,7 +812,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
}
}
/**f
/**
* f
* Class used for picto clicking feedback
*/
private class OnPictoClickListener implements AdapterView.OnItemClickListener {
......@@ -848,7 +823,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && p.get_id() != 0 && !p.is_invisible() && p.is_enabled()) {
p.set_mirror(false, false);
p.set_mirror(false, false);
// If the picto is a category
if (p.is_category()) {
......@@ -856,32 +831,40 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
PCBcontext.getActionLog().log(new TalkAction(TalkAction.SELECT, p));
hidePictoMainGridView();
} else if (tapeAdapter.getCount() < PictogramActivity.this.maxInTape && !PictogramActivity.this.tapeAdapter.play()) {
addPictoWord(parent.getChildAt(position),p);
} else if (tapeAdapter.getCount() < VOCA.this.maxInTape && !VOCA.this.tapeAdapter.play()) {
addPictoWord(parent.getChildAt(position), p);
}
}
}
}
/**
* @param view
* @param p
*/
private void addPictoWord(View view, Picto p) {
tapeAdapter.addItem(p);
getCurrentPictoGridAdapter().pictoInTape(view,p);
getCurrentPictoGridAdapter().pictoInTape(view, p);
currentCategory = null;
tapeAdapter.notifyDataSetChanged();
showPictoMainGridView();
PCBcontext.getActionLog().log(new TalkAction(TalkAction.ADD, p));
if (PictogramActivity.this.feedback_read && !PictogramActivity.this.tapeAdapter.play() && !p.is_category()) {
if (VOCA.this.feedback_read && !VOCA.this.tapeAdapter.play() && !p.is_category()) {
File audioFile = p.get_audioFile();
Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath());
Log.e(LOG_TAG, "AUDIO:" + (audioFile != null) + ":" + p.get_audioPath());
if (audioFile != null)
PictogramActivity.this.tts.playRecord(audioFile);
else
PictogramActivity.this.tts.play(p.get_translation());
VOCA.this.tts.playRecord(audioFile);
else
VOCA.this.tts.play(p.get_translation());
}
if (PictogramActivity.this.feedback_highlight) execHighligthFeeback(p, false);
if (VOCA.this.feedback_highlight) execHighligthFeeback(p, false);
}
/**
* @param picto
* @param highlight_background
*/
private void execHighligthFeeback(final Picto picto, boolean highlight_background) {
boolean same_picto = false;
picto.set_mirror(true, highlight_background); //comienza feedback
......@@ -901,6 +884,7 @@ Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath());
prev_picto = picto;
exec_mirror.scheduleAtFixedRate(new Runnable() {
int repeating = 0;
@Override
public void run() {
refresh();
......@@ -916,49 +900,32 @@ Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath());
}
}
// TODO: REVISAR
/**
* Class used for long pressing on pictos (start drag)
*/
private class OnPictoLongClickListener implements AdapterView.OnItemLongClickListener {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
// Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().has_categories()) {
int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY;
new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
} else
Toast.makeText(PictogramActivity.this, PictogramActivity.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
ClipData.Item item = new ClipData.Item("" + position);
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClipData data = new ClipData("" + position, mimeTypes, item);
} else {
//Si es supervisor hacer aparecer el menú de opciones del picto
new PictoMenu(PictogramActivity.this).createMenuForPicto(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big(),p);
getCurrentPictoGridAdapter().notifyDataSetChanged();
}
} else {
ClipData.Item item = new ClipData.Item("" + position);
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClipData data = new ClipData("" + position, mimeTypes, item);
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && !p.is_invisible() && p.is_enabled()) {
// If is not the blank picto, it isn't invisible or disabled
if (p.get_id() != 0 &&
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && !p.is_invisible() && p.is_enabled()) {
// If is not the blank picto, it isn't invisible or disabled
if (p.get_id() != 0 &&
!p.get_status().equalsIgnoreCase("invisible") &&
!p.get_status().equalsIgnoreCase("disabled") &&
tapeAdapter.getCount() < PictogramActivity.this.maxInTape) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
tapeAdapter.getCount() < VOCA.this.maxInTape) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, //data to be dragged
view.startDrag(data, //data to be dragged
shadowBuilder, //drag shadow
view, //local data about the drag and drop operation
0 //no needed flags
);
//view.setVisibility(View.INVISIBLE);
}
);
//view.setVisibility(View.INVISIBLE);
}
}
return true;
......@@ -973,61 +940,63 @@ Log.e(LOG_TAG,"AUDIO:"+(audioFile!=null)+":"+p.get_audioPath());
public void onClick(View arg0) {
LinkedList<Picto> lp = tapeAdapter.getAll();
// This triggers the "Show" websocket action SI hay algo en la cinta y esta no está vacia
if (lp.size()>0 && !PictogramActivity.this.tapeAdapter.play()) {
if (lp.size() > 0 && !VOCA.this.tapeAdapter.play()) {
PCBcontext.getActionLog().log(new PictosAction(lp));
tapeAdapter.ttsAllNew(tts);
new PictoAnimation().animateTapeView(PictogramActivity.this,0,(ViewGroup)arg0.getParent());
if (PCBcontext.getPcbdb().getCurrentUser().delivery()!= User.JSON_STUDENT_ATTTRS.delivery.clean) {
new PictoAnimation().animateTapeView(VOCA.this, 0, (ViewGroup) arg0.getParent());
if (PCBcontext.getPcbdb().getCurrentUser().delivery() != User.JSON_STUDENT_ATTTRS.delivery.clean) {
showOnlyTape(true);
}
}
}
}
protected void showOnlyTape(boolean onlyTape) {
boolean tape_delivered_prev=this.tape_delivered;
Log.e(LOG_TAG,"ONLY TAPE->"+onlyTape+" "+ttsButton.isEnabled());
this.tape_delivered=onlyTape;
if (onlyTape) {
if (!tape_delivered_prev) {
if (PCBcontext.getPcbdb().getCurrentUser().delivery()== User.JSON_STUDENT_ATTTRS.delivery.one)
ttsButton.setEnabled(false);
Log.e(LOG_TAG,"ONLY TAPE0->"+onlyTape+" "+ttsButton.isEnabled());
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.INVISIBLE);
this.pictoCategoryGridView.setVisibility(View.INVISIBLE);
this.pictoMainGridView.setAlpha(0.25f);
this.pictoMainGridView.setEnabled(false);
/**
* @param onlyTape
*/
protected void showOnlyTape(boolean onlyTape) {
boolean tape_delivered_prev = this.tape_delivered;
Log.e(LOG_TAG, "ONLY TAPE->" + onlyTape + " " + ttsButton.isEnabled());
this.tape_delivered = onlyTape;
if (onlyTape) {
if (!tape_delivered_prev) {
if (PCBcontext.getPcbdb().getCurrentUser().delivery() == User.JSON_STUDENT_ATTTRS.delivery.one)
ttsButton.setEnabled(false);
Log.e(LOG_TAG, "ONLY TAPE0->" + onlyTape + " " + ttsButton.isEnabled());
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.INVISIBLE);
this.pictoCategoryGridView.setVisibility(View.INVISIBLE);
this.pictoMainGridView.setAlpha(0.25f);
this.pictoMainGridView.setEnabled(false);
} else {
this.pictoCategoryGridView.setAlpha(0.25f);
this.pictoCategoryGridView.setEnabled(false);
this.showPictoCategoriesViewButton.setAlpha(0f);
}
new PictoAnimation().animateTapeViewVertical(this, false);
}
} else {
ttsButton.setEnabled(true);
ttsButton.refreshDrawableState();
Log.e(LOG_TAG, "ONLY TAPE1->" + onlyTape + " " + ttsButton.isEnabled());
new PictoAnimation().animateTapeViewVertical(this, true);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE);
this.pictoCategoryGridView.setVisibility(View.VISIBLE);
this.pictoMainGridView.setAlpha(1f);
this.pictoMainGridView.setEnabled(true);
this.showPictoCategoriesViewButton.setAlpha(1f);
} else {
this.pictoCategoryGridView.setAlpha(0.25f);
this.pictoCategoryGridView.setEnabled(false);
this.showPictoCategoriesViewButton.setAlpha(0f);
this.pictoCategoryGridView.setAlpha(1f);
this.pictoCategoryGridView.setEnabled(true);
this.showPictoCategoriesViewButton.setAlpha(1f);
}
new PictoAnimation().animateTapeViewVertical(this, false);
}
}
else {
ttsButton.setEnabled(true);
ttsButton.refreshDrawableState();
Log.e(LOG_TAG,"ONLY TAPE1->"+onlyTape+" "+ttsButton.isEnabled());
new PictoAnimation().animateTapeViewVertical(this,true);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE);
this.pictoCategoryGridView.setVisibility(View.VISIBLE);
this.pictoMainGridView.setAlpha(1f);
this.pictoMainGridView.setEnabled(true);
this.showPictoCategoriesViewButton.setAlpha(1f);
}
else {
this.pictoCategoryGridView.setAlpha(1f);
this.pictoCategoryGridView.setEnabled(true);
this.showPictoCategoriesViewButton.setAlpha(1f);
}
}
}
/**
* Class used for canceling a list of pictos on the tape
*/
......@@ -1042,7 +1011,7 @@ protected void showOnlyTape(boolean onlyTape) {
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, p));
// Send websocket action
Picto last=tapeAdapter.deleteLastView();
Picto last = tapeAdapter.deleteLastView();
tapeAdapter.notifyDataSetChanged();
if (pictoMainGridAdapter.pictoInThisCategory(last))
pictoMainGridAdapter.pictoInGrid(last);
......@@ -1107,8 +1076,8 @@ protected void showOnlyTape(boolean onlyTape) {
pictoCategoryGridAdapter.notifyDataSetInvalidated();
pictoMainGridAdapter.notifyDataSetInvalidated();
PictogramActivity.this.finish();
if (SessionActivity.session!=null) SessionActivity.session.finish();
VOCA.this.finish();
if (SessionActivity.session != null) SessionActivity.session.finish();
PCBcontext.getNetService().restart_app(true);
}
return true;
......@@ -1127,51 +1096,38 @@ protected void showOnlyTape(boolean onlyTape) {
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int in=0,out=0;
Intent nextActivity=null;
int in = 0, out = 0;
Intent nextActivity = null;
Intent intent = getIntent();
boolean student_view=intent.getBooleanExtra("student_view",false);
if (PCBcontext.getPcbdb()!=null && (PCBcontext.getPcbdb().getCurrentUser().is_supervisor() || student_view) ) {
if (PCBcontext.getPcbdb() != null && PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX();
break;
case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { //izquierda a derecha
if (!student_view || !PCBcontext.getPcbdb().getCurrentUser().is_teacher()) {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(student_view ? PCBcontext.getDevice().getLastSupId() : User.NO_SUPERVISOR);
nextActivity = intent;
} else
if (!PCBcontext.getNetService().online())
GUITools.show_alert(PictogramActivity.this, R.string.session_noinet);
else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId());
nextActivity = new Intent(this, SessionActivity.class);
}
in = R.anim.rightin;
out = R.anim.rightout;
overridePendingTransition(R.anim.leftin, R.anim.leftout);
if (event.getX() > firstTouchX + 150) { // izquierda a derecha
// No action
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!student_view && PCBcontext.getPcbdb().getCurrentUser().is_teacher() ) {
if (!PCBcontext.getNetService().online())
GUITools.show_alert(PictogramActivity.this, R.string.session_noinet);
else
nextActivity = new Intent(this, SessionActivity.class);
} else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(student_view ? PCBcontext.getDevice().getLastSupId() : User.NO_SUPERVISOR);
nextActivity = intent;
}
in = R.anim.leftin;
out = R.anim.leftout;
// Pasa de voca a VocabularyManager
nextActivity = new Intent(this, VocabularyManager.class);
}
in = R.anim.leftin;
out = R.anim.leftout;
if (nextActivity != null) {
tape_delivered=false;
intent.putExtra("student_view", !PCBcontext.getPcbdb().getCurrentUser().is_supervisor());
tape_delivered = false;
finish();
startActivity(nextActivity);
overridePendingTransition(in, out);
}
break;
}
}
......@@ -1184,7 +1140,7 @@ protected void showOnlyTape(boolean onlyTape) {
* @param resultCode
* @param data
*/
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
/*protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap imagen;
......@@ -1216,7 +1172,7 @@ protected void showOnlyTape(boolean onlyTape) {
int freeColumn = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1);
String path_sound = data.getExtras().getString(PictoMenu.PATH_SOUND);
String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR)/* : getIntent().getStringExtra(Picto.JSON_ATTTRS.USER_AVATAR, "----")*/;
String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR)*//* : getIntent().getStringExtra(Picto.JSON_ATTTRS.USER_AVATAR, "----")*//*;
int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1);
......@@ -1230,12 +1186,12 @@ protected void showOnlyTape(boolean onlyTape) {
break;
}
}
}*/
/**
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/
public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn,
/*public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn,
final int category, final String legend,final String path_sound ,final String user_avatar) {
// Set up the buttons
......@@ -1261,16 +1217,16 @@ protected void showOnlyTape(boolean onlyTape) {
}
}
});
}
}*/
/**Para cambiar la activity de PictogramActivity a EditPictoActivity
/**Para cambiar la activity de voca a EditPictoActivity
* @param image
*/
public void launchEditPictoActivity(Bitmap image){
/*public void launchEditPictoActivity(Bitmap image){
Intent intent = new Intent(this, EditPictoActivity.class);
BitmapTools.save_temporal(image);
startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
}
}*/
}
package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.DragEvent;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.yottacode.pictogram.action.TalkAction;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.net.PictoUploader;
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.session.SessionActivity;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.BitmapTools;
import com.yottacode.tools.GUITools;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class VocabularyManager extends Activity implements VocabularyTalk.iVocabularyListener {
private static final int CAMERA_PIC_REQUEST = 1;
private static final int GALLERY_PIC_REQUEST = 2;
// Main layout for this activity
RelativeLayout mainLayout;
// Adapter for de grid showing the categories grid (and main pictos)
PictoGridAdapter pictoMainGridAdapter;
// Grid showing the categories grid (and main pictos)
GridView pictoMainGridView;
// Adapter for the grid showing pictos from a category (initially hidden)
PictoGridAdapter pictoCategoryGridAdapter;
// Grid showing pictos from a category (initially hidden)
GridView pictoCategoryGridView;
// Current picto category, if not null the corresponding category grid will be shown
private Picto currentCategory;
// Element used for loading new pictos (while changing categories)
Vocabulary vocabulary;
// For disabling volume button (See method at the end of the class)
private final List blockedKeys = new ArrayList(Arrays.asList(KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP));
// String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
// Count for delete long press (hidden exit)
private int count_deletelong = 0;
// Animation for hidding the picto category view
Animation hidePictoMainViewAnimation;
// Animation for showing the picto category view
Animation showPictoMainViewAnimation;
// Button used for showing the picto category view
ImageButton showPictoCategoriesViewButton;
int maxColumns, maxRows, maxInTape;
ScheduledThreadPoolExecutor exec_mirror = null;
Picto prev_picto = null;
private boolean feedback_read;
private boolean feedback_highlight;
protected boolean deleting;
protected boolean tape_delivered = false;
float firstTouchX = -1;
public boolean inserting = false;
@TargetApi(Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
// after a long inactivity, the pcbdb is discarded
if (!PCBcontext.is_user_logged()) {
Log.i(LOG_TAG, "PCBDB was discarded. App restarting");
NetServiceTablet.restart_PictogramTablet(this);
return;
}
setContentView(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big() ? R.layout.vocabulary_manager_big : R.layout.vocabulary_manager);
this.mainLayout = (RelativeLayout) findViewById(R.id.pictogramLayout);
this.currentCategory = null;
this.count_deletelong = 0;
if (!PCBcontext.is_user_logged()) {
Log.i(LOG_TAG, "No user logged. Restarting app");
NetServiceTablet.restart_PictogramTablet(this);
return;
}
this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override
public void action(action action, int picto_cat, int picto_id, JSONObject msg) {
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
if (action == ActionTalk.iActionListener.action.show) {
Log.i("TAG_PRUEBAS", "show message received:" + msg.toString());
JSONObject msg_attrs = null;
JSONArray pictos = null;
String mensaje = "";
try {
msg_attrs = msg.getJSONObject("attributes");
pictos = msg_attrs.getJSONArray("pictos");
String user = pictos.getJSONObject(0).getJSONObject("attributes").getString("user_avatar");
if (user.equals(PCBcontext.getPcbdb().getCurrentUser().get_email_sup())) { //si el primer picto tiene ese sup asociado
mensaje += getResources().getString(R.string.message_from) + ": " + PCBcontext.getPcbdb().getCurrentUser().get_name_stu() + ", " + PCBcontext.getPcbdb().getCurrentUser().get_surname_stu() + "\n";
mensaje += getResources().getString(R.string.says) + ": ";
for (int i = 0; i < pictos.length(); i++) {
JSONObject picto = pictos.getJSONObject(i).getJSONObject("attributes");
mensaje += (i != pictos.length() - 1 ? picto.get("expression").toString() + " - " : picto.get("expression").toString());
}
Log.i(LOG_TAG, "Mensaje: " + msg.toString());
final AlertDialog.Builder builder = new AlertDialog.Builder(VocabularyManager.this);
builder.setMessage(mensaje)
.setPositiveButton("Vale", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialog alert = builder.create();
alert.show();
}
});
}
} catch (JSONException e) {
e.printStackTrace();
}
} else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) {
Picto picto = vocabulary.get_picto(picto_cat, picto_id);
VocabularyManager.this.execHighligthFeeback(picto, true);
}
}
});
this.vocabulary.setImgDownloaderListener(new ImgDownloader.iImgDownloaderListener() {
@Override
public void loadComplete() {
VocabularyManager.this.refresh();
}
@Override
public void loadImg(Img image) {
}
@Override
public void error(Exception err) {
}
});
this.pictoMainGridAdapter = new PictoGridAdapter(new LinkedList<Picto>());
this.pictoMainGridView = (GridView) this.findViewById(R.id.picto_main_grid_view);
this.pictoMainGridView.setAdapter(this.pictoMainGridAdapter);
this.pictoCategoryGridAdapter = new PictoGridAdapter(new LinkedList<Picto>());
this.pictoCategoryGridView = (GridView) this.findViewById(R.id.picto_category_grid_view);
this.pictoCategoryGridView.setAdapter(this.pictoCategoryGridAdapter);
this.pictoMainGridView.setOnItemClickListener(new OnPictoClickListener());
this.pictoCategoryGridView.setOnItemClickListener(new OnPictoClickListener());
this.pictoMainGridView.setOnItemLongClickListener(new OnPictoLongClickListener());
this.pictoCategoryGridView.setOnItemLongClickListener(new OnPictoLongClickListener());
this.showPictoCategoriesViewButton = (ImageButton) this.findViewById(R.id.showPictoCategoriesViewButton);
this.showPictoCategoriesViewButton.setOnClickListener(new OnShowPictoCategoriesViewButtonClick());
//((NetServiceTablet) PCBcontext.getNetService().getNetServiceDevice()).setVOCA(this);
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
maxColumns = getResources().getInteger(R.integer.columns_big);
maxRows = getResources().getInteger(R.integer.rows_big);
maxInTape = getResources().getInteger(R.integer.maxInTape_big);
} else {
maxColumns = getResources().getInteger(R.integer.columns);
maxRows = getResources().getInteger(R.integer.rows);
maxInTape = getResources().getInteger(R.integer.maxInTape);
}
VocabularyManager.this.pictoMainGridView.setNumColumns(VocabularyManager.this.maxColumns);
VocabularyManager.this.pictoCategoryGridView.setNumColumns(VocabularyManager.this.maxColumns);
this.generateAnimations();
if (this.getCurrentCategory() != null) {
this.hidePictoMainGridView();
} else {
this.showPictoMainGridView();
}
// vmTopbar and vmBigTopbar data
User student = PCBcontext.getPcbdb().getCurrentUser();
final TextView StudentFullNameView = (TextView) findViewById(R.id.vmTopbarStudentFullName);
final ImageView StudentPhotoView = (ImageView) findViewById(R.id.vmTopbarStudentPhoto);
StudentFullNameView.setText(student.get_name_stu() + " " + student.get_surname_stu());
try {
StudentPhotoView.setImageBitmap(student.get_bitmap_stu(this.getBaseContext()));
} catch (IOException e) {
Log.e(LOG_TAG, e.getMessage());
}
}
@Override
protected void onResume() {
super.onResume();
onWindowFocusChanged(true);
Log.i(LOG_TAG, "Resuming Pictogram Activity");
PCBcontext.setActivityContext(this);
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();
}
private void setFeedback(View views[]) {
boolean vibration = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.VIBRATION);
boolean click = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.BEEP);
this.feedback_read = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.READ);
this.feedback_highlight = PCBcontext.getPcbdb().getCurrentUser().input_feedback_on(User.JSON_STUDENT_INPUT_FEEDBACK.HIGHLIGHT);
Log.i(this.getClass().getCanonicalName(), "Feedback:" + " vibration:" + vibration + " Beep:" + click + " Read:" + feedback_read + " Highlight:" + feedback_highlight);
View.OnTouchListener touchListener;
touchListener =
vibration ? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean enable_haptic;
enable_haptic = !(v instanceof GridView);
if (!enable_haptic) {
int x = Math.round(event.getX());
int y = Math.round(event.getY());
int position = ((GridView) v).pointToPosition(x, y);
Picto p = position > -1 ? (Picto) ((GridView) v).getItemAtPosition(position) : null;
enable_haptic = (p != null && p.get_id() != 0 && !p.is_invisible() && p.is_enabled());
}
if (enable_haptic)
v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
return false;
}
}
: click
? new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
: new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
};
for (View view : views)
view.setOnTouchListener(touchListener);
}
@Override
protected void onPause() {
super.onPause();
this.pictoCategoryGridAdapter.allPictosInGrid();
this.pictoMainGridAdapter.allPictosInGrid();
}
@Override
protected void onStop() {
super.onStop();
Log.e(LOG_TAG, "Closing Pictogram Activity");
PCBcontext.getNetService().closeNotifyStatus();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* Creates the animations for moving the picto view
*/
private void generateAnimations() {
DisplayMetrics displayMetrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int animationDuration = 400;
int animationWidth = displayMetrics.widthPixels;
this.hidePictoMainViewAnimation = new TranslateAnimation(0, -animationWidth, 0, 0);
this.hidePictoMainViewAnimation.setDuration(animationDuration);
this.hidePictoMainViewAnimation.setFillAfter(true);
this.hidePictoMainViewAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
this.hidePictoMainViewAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
pictoMainGridView.setTranslationZ(-1000.0f);
pictoMainGridView.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
this.showPictoMainViewAnimation = new TranslateAnimation(-animationWidth, 0, 0, 0);
this.showPictoMainViewAnimation.setDuration(animationDuration);
this.showPictoMainViewAnimation.setFillAfter(true);
this.showPictoMainViewAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
this.showPictoMainViewAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
pictoMainGridView.setTranslationZ(1000.0f);
pictoMainGridView.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
/**
* Show the main category grid view and hide the pictoGrid, unloading all pictos
* if necesary.
*/
private void showPictoMainGridView() {
this.pictoMainGridAdapter.clear();
this.pictoMainGridAdapter.addAll(this.sort(this.vocabulary.startSentence()));
this.pictoMainGridAdapter.notifyDataSetChanged();
this.pictoMainGridView.setEnabled(true);
this.pictoCategoryGridView.setEnabled(false);
if (this.pictoMainGridView.getAnimation() == this.hidePictoMainViewAnimation) {
this.pictoMainGridView.startAnimation(this.showPictoMainViewAnimation);
}
this.currentCategory = null;
}
/**
* Hides the main category grid view and show a concrete category (this.currentCategory)
*/
private void hidePictoMainGridView() {
this.pictoCategoryGridAdapter.clear();
this.pictoCategoryGridAdapter.addAll(this.sort(this.vocabulary.next(this.getCurrentCategory())));
this.pictoCategoryGridAdapter.notifyDataSetChanged();
if (this.getCurrentCategory().get_color() != -1)
this.pictoCategoryGridView.setBackgroundColor(this.getCurrentCategory().get_color());
this.pictoMainGridView.setEnabled(false);
this.pictoCategoryGridView.setEnabled(true);
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation) {
this.pictoMainGridView.startAnimation(this.hidePictoMainViewAnimation);
}
}
/**
* Returns pictoCategoryGridAdapter or pictoMainGridAdapter depending on the current View
*/
protected PictoGridAdapter getCurrentPictoGridAdapter() {
return (getCurrentCategory() == null) ? this.pictoMainGridAdapter : this.pictoCategoryGridAdapter;
}
/**
* Order a linked list of pictos with "blank spaces" between them
*
* @param list
* @return
*/
public LinkedList<Picto> sort(LinkedList<Picto> list) {
if (list == null) {
list = new LinkedList<>();
}
LinkedList<Picto> ll = new LinkedList<>();
// This is to show the pictos ordered in the 2D Array that represents the panel
Picto[][] mp = new Picto[maxRows][maxColumns];
Iterator<Picto> pictos = list.iterator();
while (pictos.hasNext()) {
Picto p = pictos.next();
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) {
if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p;
}
} else {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1
&& p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) {
mp[p.getFreeColumn()][p.getFreeRow()] = p;
}
}
}
try {
/*
Picto blankPicto = new Picto(0,
"/symbolstx/color/png/arts_crafts/eraser.png", // TODO Definir imagen para picto en blanco
"Blank picto",
"{\"magnify\":false,\"highlight\":false,\"coord_y\":1,\"id_cat\":12303,\"status\":\"invisible\",\"coord_x\":4}");
*/
for (int i = 0; i < maxRows; i++)
for (int j = 0; j < maxColumns; j++)
ll.add(mp[i][j]);
} catch (Exception e) {
e.printStackTrace();
}
return ll;
}
/**
* Background task that updates the ui into the main thread
*/
public void refresh() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (getCurrentCategory() != null) {
hidePictoMainGridView();
} else {
showPictoMainGridView();
}
}
});
}
/**
* @TODO check documentation
* De la interfaz iVocabularyListener
*/
@Override
public void change(action action, int picto_cat, int picto_id, JSONObject args) {
Log.i(LOG_TAG, "Vocabulary action listened: " + action);
if (args != null) Log.d(LOG_TAG, "args: " + args.toString());
refresh();
}
/**
* Disable Back Button --> Kiosk mode
*/
@Override
public void onBackPressed() {
// Inflate the layout for the AlertDialog
View dialogEscape = View.inflate(this, R.layout.dialog_escape, null);
final CheckBox checkBox = (CheckBox) dialogEscape.findViewById(R.id.checkBox);
final EditText input = (EditText) dialogEscape.findViewById(R.id.editText);
// Build de AlertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.exitPictogram));
builder.setView(dialogEscape);
// Set up the buttons
builder.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String m_Text = input.getText().toString();
String keyword = PCBcontext.getDevice().getKeyword();
if (m_Text.equalsIgnoreCase(keyword)) {
// Change the password
if (checkBox.isChecked()) {
// Show a new dialog
View dialogChangeEscapeCode = View.inflate(PCBcontext.getContext(), R.layout.dialog_change_escape_code, null);
final EditText input1 = (EditText) dialogChangeEscapeCode.findViewById(R.id.editText1);
final EditText input2 = (EditText) dialogChangeEscapeCode.findViewById(R.id.editText2);
// Build the AlertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(PCBcontext.getContext());
builder.setTitle(PCBcontext.getContext().getResources().getString(R.string.newEscapeCode));
builder.setView(dialogChangeEscapeCode);
// Set up the buttons
builder.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Retrieve the text of the 2 password inputs
String m_Text1 = input1.getText().toString();
String m_Text2 = input2.getText().toString();
// If they are equal
if (m_Text1.equalsIgnoreCase(m_Text2)) {
// Change the keyword
PCBcontext.getDevice().setKeyword(m_Text1);
Toast.makeText(PCBcontext.getContext(), getResources().getString(R.string.codeModified), Toast.LENGTH_SHORT).show();
// And exit voca
finish();
} else
Toast.makeText(PCBcontext.getContext(), getResources().getString(R.string.codesNotEqual), Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
} else {
// Finish this Activity it the code is ok and is not checked the checkbox to change the code
finish();
/*
// Start the main activity
Intent mainActivity = new Intent(context, MainActivity.class);
startActivity(mainActivity);
*/
}
// Wrong code
} else
Toast.makeText(PCBcontext.getContext(), getResources().getString(R.string.wrongCode), Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
/**
* Disable long power button press (system menu)
*
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
/**
* Disable volume button on key event
*
* @param event
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (blockedKeys.contains(event.getKeyCode())) {
return true;
} else {
return super.dispatchKeyEvent(event);
}
}
/**
* @return
*/
public Picto getCurrentCategory() {
return currentCategory;
}
/* *********************************************************************************************
* Event listener classes
* ********************************************************************************************/
/**
* f
* Class used for picto clicking feedback
*/
private class OnPictoClickListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (inserting) return;
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && p.get_id() != 0 && !p.is_invisible() && p.is_enabled()) {
p.set_mirror(false, false);
// If the picto is a category
if (p.is_category()) {
currentCategory = p;
PCBcontext.getActionLog().log(new TalkAction(TalkAction.SELECT, p));
hidePictoMainGridView();
}
}
}
}
/**
* @param picto
* @param highlight_background
*/
private void execHighligthFeeback(final Picto picto, boolean highlight_background) {
boolean same_picto = false;
picto.set_mirror(true, highlight_background); //comienza feedback
if (exec_mirror != null) { //se cancela ejecución del feedbcack anterior, si lo hay
exec_mirror.shutdown();
exec_mirror = null;
}
if (prev_picto != null) { //se cancela marca de feedback del anterior, si lo hay
prev_picto.set_mirror(false, false);
same_picto = prev_picto == picto;
}
if (same_picto)
prev_picto = null; //por si se pulsaa el mismo boton varias veces
else {
prev_picto = picto;
exec_mirror = new ScheduledThreadPoolExecutor(1);
prev_picto = picto;
exec_mirror.scheduleAtFixedRate(new Runnable() {
int repeating = 0;
@Override
public void run() {
refresh();
if (repeating++ == 20) {
picto.set_mirror(false, false);
if (exec_mirror != null) {
exec_mirror.shutdown();
exec_mirror = null;
}
}
}
}, 0, 250, TimeUnit.MILLISECONDS);
}
}
// TODO: REVISAR
/**
* Class used for long pressing on pictos (pictomenu)
*/
private class OnPictoLongClickListener implements AdapterView.OnItemLongClickListener {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
// Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().has_categories()) {
int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY;
new PictoMenu(VocabularyManager.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
} else
Toast.makeText(VocabularyManager.this, VocabularyManager.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
} else {
//Si es supervisor hacer aparecer el menú de opciones del picto
new PictoMenu(VocabularyManager.this).createMenuForPicto(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big(), p);
getCurrentPictoGridAdapter().notifyDataSetChanged();
}
return true;
}
}
/**
* Listener used for bringing back the picto categories grid when clicked.
*/
private class OnShowPictoCategoriesViewButtonClick implements View.OnClickListener {
@Override
public void onClick(View v) {
showPictoMainGridView();
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int in = 0, out = 0;
Intent nextActivity = null;
Intent intent = getIntent();
if (PCBcontext.getPcbdb() != null && PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX();
break;
case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { // izquierda a derecha
// Pasa de VocabularyManager a voca
nextActivity = new Intent(this, VOCA.class);
in = R.anim.rightin;
out = R.anim.rightout;
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
// Pasa de VocabularyManager a SessionActivity
if (!PCBcontext.getNetService().online()) {
GUITools.show_alert(VocabularyManager.this, R.string.session_noinet);
} else {
nextActivity = new Intent(this, SessionActivity.class);
in = R.anim.leftin;
out = R.anim.leftout;
}
}
if (nextActivity != null) {
tape_delivered = false;
finish();
startActivity(nextActivity);
overridePendingTransition(in, out);
}
break;
}
}
return super.dispatchTouchEvent(event);
}
/**
* Para capturar el evento para abrir camara o galeria y procesar
*
* @param requestCode
* @param resultCode
* @param data
*/
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap imagen;
switch (requestCode) {
case CAMERA_PIC_REQUEST: //Captura de foto
if (data != null && resultCode == RESULT_OK) {
imagen = (Bitmap) data.getExtras().get("data");
this.launchEditPictoActivity(imagen);
}
break;
case GALLERY_PIC_REQUEST: //Galeria
if (data != null) {
Uri selectedImage = data.getData();
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImage);
} catch (IOException e) {
e.printStackTrace();
}
this.launchEditPictoActivity(bitmap);
}
break;
case EditPictoActivity.EDIT_PICTO_REQUEST:
if (resultCode == RESULT_OK) {
boolean edit = data.getBooleanExtra(PictoMenu.IS_EDIT, false);
int row = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.ROW, -1);
int col = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.COLUMN, -1);
int freeRow = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_ROW, -1);
int freeColumn = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1);
String path_sound = data.getExtras().getString(PictoMenu.PATH_SOUND);
String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR);
int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1);
String path = data.getExtras().getString(PictoMenu.PATH);
String legend = data.getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend, path_sound, user_avatar);
refresh();
}
break;
}
}
/**
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/
public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn,
final int category, final String legend, final String path_sound, final String user_avatar) {
// Set up the buttons
PCBcontext.getVocabulary().saveLocalPicto(
selectedImagePath,
legend,
category,
row,
col,
freeRow,
freeColumn,
user_avatar,
path_sound,
new iLocalPicto() {
@Override
public void saved(Picto localPicto) {
refresh();
try {
if (PCBcontext.is_user_online())
new PictoUploader(localPicto).upload();
} catch (IOException e) {
Log.e(Vocabulary.class.getCanonicalName(), e.getMessage());
}
}
});
}
/**
* Para cambiar la activity de voca a EditPictoActivity
*
* @param image
*/
public void launchEditPictoActivity(Bitmap image) {
Intent intent = new Intent(this, EditPictoActivity.class);
BitmapTools.save_temporal(image);
startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
}
}
......@@ -26,7 +26,7 @@ import java.util.Vector;
* LoginActivity show the login window to select the student and supervisor
* It uses device to read the token value
*/
public class LoginActivity extends FragmentActivity {
public class LoginActivity extends FragmentActivity {
// String constant for logs
......@@ -34,27 +34,31 @@ public class LoginActivity extends FragmentActivity {
/**
* If there is Internet connection it calls the WS to recover the pairs student-supervisor
*
* @param savedInstanceState
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login);
// Enable logout button
final Button logoutButton = (Button) findViewById(R.id.loginTopbarLogout);
logoutButton.setEnabled(true);
logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent serialActivity = new Intent(getBaseContext(), com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", true);
startActivity(serialActivity);
}
});
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(com.yottacode.pictogram.tabletlibrary.R.layout.activity_login);
// Enable logout button
final Button logoutButton = (Button) findViewById(R.id.loginTopbarLogout);
logoutButton.setEnabled(true);
logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent serialActivity = new Intent(getBaseContext(), com.yottacode.pictogram.tabletlibrary.gui.login.SerialActivity.class);
serialActivity.putExtra("resetPrevUser", true);
startActivity(serialActivity);
}
});
}
@Override
......@@ -62,13 +66,11 @@ public class LoginActivity extends FragmentActivity {
super.onStart();
// Set supervisor information on topbar
final TextView supervisorFullNameView = (TextView) findViewById(R.id.loginTopbarSupervisorFullName);
final TextView supervisorUserNameView = (TextView) findViewById(R.id.loginTopbarSupervisorUserName);
final ImageView supervisorPhotoView = (ImageView) findViewById(R.id.loginTopbarSupervisorPhoto);
supervisorFullNameView.setText(
this.getIntent().getStringExtra("name") + " " +
this.getIntent().getStringExtra("surname")+" ("+this.getIntent().getStringExtra("office")+")");
supervisorUserNameView.setText(this.getIntent().getStringExtra("email"));
this.getIntent().getStringExtra("surname") + " (" + this.getIntent().getStringExtra("email") + ")");
final Vector<Img> imgs = new Vector<>(1);
imgs.add(new Img(
......@@ -80,7 +82,7 @@ public class LoginActivity extends FragmentActivity {
@Override
public void loadComplete() {
try {
supervisorPhotoView.setImageBitmap(
supervisorPhotoView.setImageBitmap(
imgs.get(0).get_bitmap(PCBcontext.getContext())
);
supervisorPhotoView.invalidate();
......@@ -90,25 +92,48 @@ public class LoginActivity extends FragmentActivity {
}
@Override
public void loadImg(Img image) {}
@Override
public void error(Exception e) {
GUITools.show_alert(PCBcontext.getContext(), R.string.serverError, e.getMessage());
Log.e(this.getClass().getCanonicalName(), "Server error:"+ e.getLocalizedMessage());
}
public void loadImg(Img image) {
}
@Override
public void error(Exception e) {
GUITools.show_alert(PCBcontext.getContext(), R.string.serverError, e.getMessage());
Log.e(this.getClass().getCanonicalName(), "Server error:" + e.getLocalizedMessage());
}
}, ImgDownloader.tsource.remote);
downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs);
}
@Override
protected void onStop() {
super.onStop();
Log.i(LOG_TAG,"Closing Login window");
PCBcontext.getNetService().closeNotifyStatus();
}
@Override
protected void onStop() {
super.onStop();
Log.i(LOG_TAG, "Closing Login window");
PCBcontext.getNetService().closeNotifyStatus();
}
@Override
public void onResume() {
super.onResume();
PCBcontext.setActivityContext(this);
}
/**
* Disable long power button press (system menu)
*
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
}
......@@ -22,7 +22,7 @@ import com.yottacode.pictogram.dao.Device;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.dao.UserLogin;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.PCBcontext;
......@@ -99,7 +99,7 @@ public class SerialActivity extends Activity {
editor.putString("password", supUsers.elementAt(position).get_pwd_sup());
editor.commit();
new UserLogin().login(supUsers.elementAt(position).get_email_sup(),
supUsers.elementAt(position).get_pwd_sup(), SerialActivity.this, PictogramActivity.class, LoginActivity.class);
supUsers.elementAt(position).get_pwd_sup(), SerialActivity.this, VOCA.class, LoginActivity.class);
}
}
});
......@@ -133,7 +133,7 @@ public class SerialActivity extends Activity {
editor.putString("password", stuUsers.elementAt(position).get_pwd_stu());
editor.commit();
new UserLogin().login(stuUsers.elementAt(position).get_nickname_stu(),
stuUsers.elementAt(position).get_pwd_stu(),SerialActivity.this, PictogramActivity.class, LoginActivity.class);
stuUsers.elementAt(position).get_pwd_stu(),SerialActivity.this, VOCA.class, LoginActivity.class);
}
});
}
......@@ -172,7 +172,7 @@ public class SerialActivity extends Activity {
editor.putString("password", password);
editor.commit();
if (!username.equals("") && !password.equals(""))
new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class);
new UserLogin().login(username, password, SerialActivity.this, VOCA.class, LoginActivity.class);
}
});
......@@ -193,7 +193,7 @@ public class SerialActivity extends Activity {
mSerialViewPass.setText(password);
if (!username.equals("") && !password.equals("") && !getIntent().getBooleanExtra("resetPrevUser", true))
new UserLogin().login(username, password, SerialActivity.this, PictogramActivity.class, LoginActivity.class);
new UserLogin().login(username, password, SerialActivity.this, VOCA.class, LoginActivity.class);
super.onStart();
try {
......
......@@ -17,7 +17,7 @@ import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools;
......@@ -80,7 +80,7 @@ public class StudentFragmentGrid extends Fragment{
Log.e(StudentFragmentGrid.this.getClass().getCanonicalName(), e.getMessage());
}
PCBcontext.set_user(currentUser, null, null);
Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class);
Intent pictogramActivity = new Intent(getActivity(), VOCA.class);
startActivity(pictogramActivity);
} else {
new_user(i);
......@@ -124,7 +124,7 @@ public class StudentFragmentGrid extends Fragment{
@Override
public void loadComplete() {
if (progressDialog!=null && progressDialog.isShowing()) progressDialog.dismiss();
Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class);
Intent pictogramActivity = new Intent(getActivity(), VOCA.class);
startActivity(pictogramActivity);
}
......
......@@ -15,7 +15,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tools.PCBcontext;
......@@ -116,7 +116,7 @@ public class ListInstructionsFragment extends Fragment{
}
void close() {
ListInstructionsFragment.this.getActivity().finish();
startActivity(new Intent(getActivity(), PictogramActivity.class));
startActivity(new Intent(getActivity(), VOCA.class));
}
private void checkStudent() {
SessionWrapper.validateStudent(new SessionWrapper.iValidateStudent() {
......
......@@ -127,13 +127,13 @@ public long getItemId(int position) {
}
public void evaluateItem(Bitmap bmp, String evaluation,int position) {
Item item=this.msg.get(position);
Bitmap oldmsg=item.getImg();
float width =context.getResources().getDimension(R.dimen.picto_session_width);
public void evaluateItem(Bitmap bmp, String evaluation, int position) {
Item item = this.msg.get(position);
Bitmap oldmsg = item.getImg();
float width = context.getResources().getDimension(R.dimen.picto_session_width);
float height = context.getResources().getDimension(R.dimen.picto_session_height);
bmp=new BitmapTools(bmp).resize((int)width ,(int)height).get();
bmp=set_text(context,bmp,getTimeDiff(new Date().getTime()));
bmp = new BitmapTools(bmp).resize((int)width ,(int)height).get();
bmp = set_text(context,bmp,getTimeDiff(new Date().getTime()));
Bitmap currmsg = position>=this.msg.size()-1 ? combineImages(oldmsg,bmp) : updateImage(oldmsg,bmp);
item.setImg(currmsg,evaluation,true);
}
......
......@@ -21,7 +21,8 @@ import android.widget.ToggleButton;
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.communicator.VOCA;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools;
......@@ -33,30 +34,30 @@ import java.util.Hashtable;
public class SessionActivity extends FragmentActivity implements ListInstructionsFragment.iListInstructionsFragment, SessionFragment.iSessionFragment {
private static final String FRAGMENT_SESSION="session";
private static final String FRAGMENT_METHOD="method";
private static final String FRAGMENT_SESSION = "session";
private static final String FRAGMENT_METHOD = "method";
private static final String LOG_TAG = SessionActivity.class.getCanonicalName();
public static FragmentActivity session=null;
public static FragmentActivity session = null;
private int currentInstruction;
private int id_session;
private Hashtable<Integer,Integer> msgs=new Hashtable<>(20);
private Hashtable<Integer, Integer> msgs = new Hashtable<>(20);
private NetService.iNetServiceStatus listenerStatus;
float firstTouchX=-1;
float firstTouchX = -1;
ListInstructionsFragment listInstructionsFragment= new ListInstructionsFragment();
ListInstructionsFragment listInstructionsFragment = new ListInstructionsFragment();
private void addLogMsg(final String msg) {
private void addLogMsg(final String msg) {
runOnUiThread(new Runnable() {
public void run() {
ListView log=(ListView) findViewById(R.id.session_serverlog);
ArrayAdapter adapter = (ArrayAdapter) log.getAdapter();
adapter.add(new java.text.SimpleDateFormat("HH:mm:ss").format(new Date())+": "+msg+'\n');
}
});
runOnUiThread(new Runnable() {
public void run() {
ListView log = (ListView) findViewById(R.id.session_serverlog);
ArrayAdapter adapter = (ArrayAdapter) log.getAdapter();
adapter.add(new java.text.SimpleDateFormat("HH:mm:ss").format(new Date()) + ": " + msg + '\n');
}
});
}
......@@ -67,24 +68,31 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override
public void play_msg() {
evaluateMsg(this.msgs.size()-1, null, R.string.session_eval_notevuated,R.drawable.session_notevaluated);
evaluateMsg(this.msgs.size() - 1, null, R.string.session_eval_notevuated, R.drawable.session_notevaluated);
}
private void evaluateMsg(final int msg_pos, final String evaluation_value, final int evaluation_translation, final int evaluation_bitmap) {
final SessionFragment sessionFragment = (SessionFragment) getSupportFragmentManager().findFragmentByTag(SessionActivity.FRAGMENT_SESSION);
final int currentMsgId=SessionActivity.this.msgs.get(msg_pos);
if (sessionFragment.get_current_msg_text().trim().length()>0) //no se permiten trys vacios
SessionWrapper.evaluateTry(currentMsgId, msg_pos==this.msgs.size()-1, evaluation_value, new SessionWrapper.iTryUpdated() {
final int currentMsgId = SessionActivity.this.msgs.get(msg_pos);
if (sessionFragment.get_current_msg_text().trim().length() > 0) //no se permiten trys vacios
SessionWrapper.evaluateTry(currentMsgId, msg_pos == this.msgs.size() - 1, evaluation_value, new SessionWrapper.iTryUpdated() {
@Override
public void update(int next_try_id) {
<<<<<<< HEAD
addLogMsg("Msg: "+ sessionFragment.get_current_msg_text()+".");
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),evaluation_bitmap);
sessionFragment.evaluateMsg(bitmap,getString(evaluation_translation),msg_pos);
addLogMsg("#"+(msg_pos<9 ? "0" : "")+(msg_pos+1)+sessionFragment.get_msg_text(msg_pos));
=======
addLogMsg("añadiendo " + sessionFragment.get_current_msg_text() + ".");
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), evaluation_bitmap);
sessionFragment.evaluateMsg(bitmap, getString(evaluation_translation), msg_pos);
addLogMsg("#" + (msg_pos < 9 ? "0" : "") + (msg_pos + 1) + sessionFragment.get_msg_text(msg_pos));
>>>>>>> pictogramactivityrefactor
if (!msgs.containsValue(next_try_id))
new_try(sessionFragment, next_try_id);
if (evaluation_value!=null && msg_pos==msgs.size()-1){
if (evaluation_value != null && msg_pos == msgs.size() - 1) {
SessionWrapper.newTry(id_session, new SessionWrapper.iTryUpdated() {
@Override
public void update(int id) {
......@@ -103,18 +111,17 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override
public void error(String error) {
addLogMsg(getString(R.string.session_error)+":"+error);
Log.e(LOG_TAG,"server error:"+error+" when updating try "+currentMsgId+" to "+evaluation_value);
addLogMsg(getString(R.string.session_error) + ":" + error);
Log.e(LOG_TAG, "server error:" + error + " when updating try " + currentMsgId + " to " + evaluation_value);
}
});
}
private void new_try(SessionFragment sessionFragment, int next_try_id) {
int pos_newmsg=sessionFragment.newMsg();
msgs.put(pos_newmsg,next_try_id);
int pos_newmsg = sessionFragment.newMsg();
msgs.put(pos_newmsg, next_try_id);
addLogMsg(getString(R.string.session_log_newtry));
}
......@@ -141,7 +148,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
final int msg_pos = sessionFragment.get_current_msg_pos();
evaluateMsg(msg_pos, value, translation, button);
if (msg_pos != sessionFragment.get_last_msg_pos())
sessionFragment.adapter_pictomsg.setCurrentMsg(sessionFragment.adapter_pictomsg.getCount()-1);
sessionFragment.adapter_pictomsg.setCurrentMsg(sessionFragment.adapter_pictomsg.getCount() - 1);
}
return true;
......@@ -149,46 +156,51 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
}
<<<<<<< HEAD
=======
>>>>>>> pictogramactivityrefactor
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SessionActivity.session=this;
SessionActivity.session = this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
onWindowFocusChanged(true);
setContentView(R.layout.activity_session);
User student=PCBcontext.getPcbdb().getCurrentUser();
User student = PCBcontext.getPcbdb().getCurrentUser();
final TextView StudentFullNameView = (TextView) findViewById(R.id.sessionTopbarStudentFullName);
final TextView StudentUserNameView = (TextView) findViewById(R.id.sessionTopbarStudentUserName);
final ImageView StudentPhotoView = (ImageView) findViewById(R.id.sessionTopbarStudentPhoto);
final ToggleButton onoffBtn=((ToggleButton)findViewById(R.id.sessionOnOffBtn));
final ToggleButton pauseBtn=((ToggleButton)findViewById(R.id.sessionPauseBtn));
final Button okBtn =((Button)findViewById(R.id.btn_correct));
final Button disBtn =((Button)findViewById(R.id.btn_discarded));
final Button spoBtn =((Button)findViewById(R.id.btn_spontaneous));
final Button failBtn =((Button)findViewById(R.id.btn_fail));
final Button supBtn =((Button)findViewById(R.id.btn_supervised));
final Button modBtn =((Button)findViewById(R.id.btn_model));
final ToggleButton onoffBtn = ((ToggleButton) findViewById(R.id.sessionOnOffBtn));
final ToggleButton pauseBtn = ((ToggleButton) findViewById(R.id.sessionPauseBtn));
final Button okBtn = ((Button) findViewById(R.id.btn_correct));
final Button disBtn = ((Button) findViewById(R.id.btn_discarded));
final Button spoBtn = ((Button) findViewById(R.id.btn_spontaneous));
final Button failBtn = ((Button) findViewById(R.id.btn_fail));
final Button supBtn = ((Button) findViewById(R.id.btn_supervised));
final Button modBtn = ((Button) findViewById(R.id.btn_model));
((ListView) findViewById(R.id.session_serverlog)).setAdapter(new ArrayAdapter<String>(getBaseContext(), R.layout.list_logsessions));
StudentFullNameView.setText(student.get_name_stu() + " " + student.get_surname_stu());
StudentUserNameView.setText(student.get_office());
try {
StudentPhotoView.setImageBitmap(student.get_bitmap_stu(this.getBaseContext()));
} catch (IOException e) {
Log.e(LOG_TAG,e.getMessage());
Log.e(LOG_TAG, e.getMessage());
}
okBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_ok,"SUCCESS",R.string.session_eval_success));
failBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_fail,"FAIL",R.string.session_eval_fail));
spoBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_spontaneous,"SPONTANEOUS SUCCESS",R.string.session_eval_spontaneous));
supBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_supervised,"SUPERVISED SUCCESS",R.string.session_eval_supervised));
modBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_model,"MODEL", R.string.session_eval_model));
disBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_discarded,"DISCARDED", R.string.session_eval_discarded));
okBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_ok, "SUCCESS", R.string.session_eval_success));
failBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_fail, "FAIL", R.string.session_eval_fail));
spoBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_spontaneous, "SPONTANEOUS SUCCESS", R.string.session_eval_spontaneous));
supBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_supervised, "SUPERVISED SUCCESS", R.string.session_eval_supervised));
modBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_model, "MODEL", R.string.session_eval_model));
disBtn.setOnTouchListener(new TouchButtonListener(R.drawable.session_discarded, "DISCARDED", R.string.session_eval_discarded));
onoffBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
set_fragment(isChecked,onoffBtn);
set_fragment(isChecked, onoffBtn);
}
});
onoffBtn.setEnabled(false);
......@@ -205,7 +217,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override
public void error(String error) {
GUITools.show_alert(SessionActivity.this, R.string.session_pause_error,"error "+error);
GUITools.show_alert(SessionActivity.this, R.string.session_pause_error, "error " + error);
}
});
}
......@@ -216,23 +228,23 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override
protected void onStart() {
super.onStart();
if (((ToggleButton)findViewById(R.id.sessionOnOffBtn)).isChecked())
set_fragment_sesion();
else set_fragment_method();
if (((ToggleButton) findViewById(R.id.sessionOnOffBtn)).isChecked())
set_fragment_sesion();
else set_fragment_method();
this.listenerStatus = new NetService.iNetServiceStatus() {
boolean m_updated=true;
boolean m_updated = true;
@Override
public void notifyStatus(final boolean updated) {
runOnUiThread(new Runnable() {
public void run() {
if (!updated && m_updated) {
m_updated=false;
m_updated = false;
GUITools.show_alert(SessionActivity.this, R.string.session_noinet);
addLogMsg(getString(R.string.session_noinet));
} else
if (updated && !m_updated) {
m_updated=true;
} else if (updated && !m_updated) {
m_updated = true;
GUITools.show_alert(SessionActivity.this, R.string.session_inetok);
addLogMsg(getString(R.string.session_inetok));
}
......@@ -252,62 +264,60 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
@Override
public void instruction_selected(int instruction, String instruction_name) {
addLogMsg(instruction_name);
this.currentInstruction=instruction;
((TextView)findViewById(R.id.sessionTopbarInstructionName)).setText(instruction_name);
this.currentInstruction = instruction;
((TextView) findViewById(R.id.sessionTopbarInstructionName)).setText(instruction_name);
findViewById(R.id.sessionOnOffBtn).setEnabled(true);
}
@Override
public void method_selected(int method, String method_name) {
((ToggleButton)findViewById(R.id.sessionOnOffBtn)).setEnabled(false);
((TextView)findViewById(R.id.sessionTopbarMethodName)).setText(method_name);
((ToggleButton) findViewById(R.id.sessionOnOffBtn)).setEnabled(false);
((TextView) findViewById(R.id.sessionTopbarMethodName)).setText(method_name);
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
int in=0,out=0;
Intent nextActivity=null;
int in = 0, out = 0;
Intent nextActivity = null;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX();
break;
case MotionEvent.ACTION_UP:
if (event.getX()> firstTouchX+100) { //izquierda->derecha
nextActivity=new Intent(this,PictogramActivity.class);
nextActivity.putExtra("student_view", false);
in=R.anim.rightin;
out=R.anim.rightout;
}
else if (firstTouchX > event.getX()+100) { //derecha->izquierda
nextActivity=new Intent(this,PictogramActivity.class);
nextActivity.putExtra("student_view", true);
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
in=R.anim.leftin;
out=R.anim.leftout;
}
if (nextActivity!=null) {
startActivity(nextActivity);
overridePendingTransition(in, out);
}
break;
case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX();
break;
case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 100) { //izquierda->derecha
// Pasa de SessionActivity a Vocabulary Manager
nextActivity = new Intent(this, VocabularyManager.class);
in = R.anim.rightin;
out = R.anim.rightout;
} else if (firstTouchX > event.getX() + 100) { //derecha->izquierda
// No action
}
if (nextActivity != null) {
startActivity(nextActivity);
overridePendingTransition(in, out);
}
break;
}
return super.dispatchTouchEvent(event);
}
private SessionFragment set_fragment_sesion() {
final Button okBtn =((Button)findViewById(R.id.btn_correct));
final Button disBtn =((Button)findViewById(R.id.btn_discarded));
final Button spoBtn =((Button)findViewById(R.id.btn_spontaneous));
final Button failBtn =((Button)findViewById(R.id.btn_fail));
final Button supBtn =((Button)findViewById(R.id.btn_supervised));
final Button modBtn =((Button)findViewById(R.id.btn_model));
private SessionFragment set_fragment_sesion() {
final Button okBtn = ((Button) findViewById(R.id.btn_correct));
final Button disBtn = ((Button) findViewById(R.id.btn_discarded));
final Button spoBtn = ((Button) findViewById(R.id.btn_spontaneous));
final Button failBtn = ((Button) findViewById(R.id.btn_fail));
final Button supBtn = ((Button) findViewById(R.id.btn_supervised));
final Button modBtn = ((Button) findViewById(R.id.btn_model));
SessionFragment sessionFragment = (SessionFragment) getSupportFragmentManager().findFragmentByTag(SessionActivity.FRAGMENT_SESSION);
if (sessionFragment==null) sessionFragment=new SessionFragment();
if (sessionFragment == null) sessionFragment = new SessionFragment();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.sessions_fragment_container, sessionFragment, SessionActivity.FRAGMENT_SESSION)
.commitNow()
.beginTransaction()
.replace(R.id.sessions_fragment_container, sessionFragment, SessionActivity.FRAGMENT_SESSION)
.commitNow()
;
findViewById(R.id.sessionPauseBtn).setVisibility(View.VISIBLE);
okBtn.setVisibility(View.VISIBLE);
......@@ -320,18 +330,19 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.VISIBLE);
return sessionFragment;
}
private void set_fragment_method() {
final Button okBtn =((Button)findViewById(R.id.btn_correct));
final Button disBtn =((Button)findViewById(R.id.btn_discarded));
final Button spoBtn =((Button)findViewById(R.id.btn_spontaneous));
final Button failBtn =((Button)findViewById(R.id.btn_fail));
final Button supBtn =((Button)findViewById(R.id.btn_supervised));
final Button modBtn =((Button)findViewById(R.id.btn_model));
final Button okBtn = ((Button) findViewById(R.id.btn_correct));
final Button disBtn = ((Button) findViewById(R.id.btn_discarded));
final Button spoBtn = ((Button) findViewById(R.id.btn_spontaneous));
final Button failBtn = ((Button) findViewById(R.id.btn_fail));
final Button supBtn = ((Button) findViewById(R.id.btn_supervised));
final Button modBtn = ((Button) findViewById(R.id.btn_model));
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.sessions_fragment_container, listInstructionsFragment, SessionActivity.FRAGMENT_METHOD)
.commit()
.beginTransaction()
.replace(R.id.sessions_fragment_container, listInstructionsFragment, SessionActivity.FRAGMENT_METHOD)
.commit()
;
findViewById(R.id.sessionPauseBtn).setVisibility(View.INVISIBLE);
okBtn.setVisibility(View.INVISIBLE);
......@@ -343,10 +354,12 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
findViewById(R.id.sessionTopbarMethodName).setVisibility(View.INVISIBLE);
findViewById(R.id.sessionTopbarInstructionName).setVisibility(View.INVISIBLE);
}
void close() {
finish();
startActivity(new Intent(SessionActivity.this, PictogramActivity.class));
startActivity(new Intent(SessionActivity.this, VOCA.class));
}
private void set_fragment(boolean isChecked, final ToggleButton onoffBtn) {
if (isChecked) {
......@@ -354,11 +367,11 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
SessionWrapper.startSession(this.currentInstruction, new SessionWrapper.iStartSession() {
@Override
public void started(int id_session, int id_first_try) {
addLogMsg(getString(R.string.session_log_startsession));
SessionActivity.this.id_session = id_session;
SessionFragment session= set_fragment_sesion();
onoffBtn.setText("STOP");
new_try(session, id_first_try);
addLogMsg(getString(R.string.session_log_startsession));
SessionActivity.this.id_session = id_session;
SessionFragment session = set_fragment_sesion();
onoffBtn.setText("STOP");
new_try(session, id_first_try);
}
@Override
......@@ -399,15 +412,36 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
}
}
/**
* Disable long power button press (system menu)
*
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
}
@Override
public void onResume() {
super.onResume();
onWindowFocusChanged(true);
PCBcontext.setActivityContext(this);
}
@Override
public void onDestroy() {
super.onDestroy();
SessionActivity.session=null;
SessionActivity.session = null;
}
}
......@@ -12,7 +12,7 @@ import android.util.Log;
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.communicator.VOCA;
import com.yottacode.pictogram.tools.PCBcontext;
/**
......@@ -25,15 +25,15 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
private static final String LOG_TAG = NetServiceTablet.class.getName();
private static NotificationCompat.Builder builder;
private PictogramActivity pictogramActivity;
private VOCA VOCA;
int notifyID = 666;
public void build() {
this.builder = new NotificationCompat.Builder(PCBcontext.getContext()).setAutoCancel(true).setOngoing(PCBcontext.getContext().getResources().getBoolean(R.bool.NotifyAllwaysVisible));
Intent resultIntent = new Intent(PCBcontext.getContext(), PictogramActivity.class);
Intent resultIntent = new Intent(PCBcontext.getContext(), VOCA.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(PCBcontext.getContext());
stackBuilder.addParentStack(PictogramActivity.class);
stackBuilder.addParentStack(VOCA.class);
stackBuilder.addNextIntent(resultIntent);
if (PCBcontext.getContext().getResources().getBoolean(R.bool.NotifyAllwaysVisible)){
PendingIntent resultPendingIntent =
......@@ -96,8 +96,8 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
context.startActivity(serialActivity);
}
public void setPictogramActivity(PictogramActivity pictogramActivity) {this.pictogramActivity=pictogramActivity;}
public void setVOCA(VOCA VOCA) {this.VOCA = VOCA;}
public void updateUserConfig(User user) {
if (this.pictogramActivity!=null) this.pictogramActivity.setConfig();
if (this.VOCA !=null) this.VOCA.setConfig();
}
}
......@@ -8,22 +8,18 @@
<RelativeLayout
android:id="@+id/loginTopbarLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/VerdeApp"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp">
android:layout_height="@dimen/menu_top_height"
android:background="@color/VerdeApp">
<ImageView
android:id="@+id/loginTopbarSupervisorPhoto"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_gravity="left"
android:background="@color/accent_material_dark"
android:scaleType="centerCrop"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/loginTopbarSupervisorNameLayout"
......@@ -44,26 +40,19 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/BlancoApp" />
<TextView
android:id="@+id/loginTopbarSupervisorUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/BlancoApp" />
</LinearLayout>
<Button
android:id="@+id/loginTopbarLogout"
style="@android:style/TextAppearance.Material.Button"
android:textColor="@color/BlancoApp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:enabled="false"
android:text="@string/logout" />
android:text="@string/logout"
android:textColor="@color/BlancoApp" />
</RelativeLayout>
......
......@@ -7,109 +7,103 @@
tools:context="com.yottacode.pictogram.tabletlibrary.gui.session.SessionActivity">
<RelativeLayout
android:id="@+id/sessionTopbarLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="0dp"
android:layout_height="64dp"
android:background="@color/VerdeApp"
android:id="@+id/sessionTopbarLayout">
android:layout_alignParentEnd="true">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/sessionTopbarStudentPhoto"
android:layout_gravity="left"
android:layout_alignParentTop="true"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_gravity="left"
android:background="@color/accent_material_dark"
android:scaleType="centerCrop" />
<LinearLayout
android:orientation="vertical"
android:id="@+id/sessionTopbarStudentNameLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/sessionTopbarStudentNameLayout"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/sessionTopbarStudentPhoto"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="@+id/sessionTopbarStudentFullName" />
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/sessionTopbarStudentFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="@+id/sessionTopbarStudentUserName"
android:textColor="@color/abc_secondary_text_material_light" />
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:id="@+id/methodLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/methodLayout"
android:layout_centerVertical="true"
android:gravity="end"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/sessionPauseBtn"
android:layout_marginRight="20dp">
android:gravity="end"
android:orientation="vertical">
<TextView
android:id="@+id/sessionTopbarMethodName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="@+id/sessionTopbarMethodName"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/blue" />
<TextView
android:id="@+id/sessionTopbarInstructionName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="@+id/sessionTopbarInstructionName"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/blue" />
</LinearLayout>
<ToggleButton
android:id="@+id/sessionPauseBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sessionPauseBtn"
android:layout_alignParentBottom="true"
android:layout_marginRight="10px"
android:textColorLink="@color/darkgreen"
android:textOff="||"
android:textOn="||"
android:layout_toLeftOf="@+id/sessionOnOffBtn"
android:textColorLink="@color/darkgreen"
android:layout_marginRight="10px" />
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/sessionOnOffBtn" />
<ToggleButton
android:id="@+id/sessionOnOffBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sessionOnOffBtn"
android:layout_alignParentBottom="true"
android:layout_alignBaseline="@+id/sessionPauseBtn"
android:layout_alignBottom="@+id/sessionPauseBtn"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10px"
android:textOff="REC"
android:textOn="REC" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@android:color/darker_gray"
android:layout_marginBottom="16dp"
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@+id/sessionTopbarLayout"
android:layout_marginTop="0dp" />
android:layout_marginBottom="16dp"
android:layout_marginTop="0dp"
android:background="@android:color/darker_gray" />
<RelativeLayout
......
......@@ -27,13 +27,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4">
<TextView
android:text="@string/session_method"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="normal|bold"
android:background="@color/VerdeApp"
android:textColor="@color/white"
android:textAlignment="center"
android:background="@color/VerdeApp" />
android:textStyle="normal|bold"
android:text="@string/session_method" />
<ListView
android:id="@+id/methodsListView"
......@@ -56,6 +58,7 @@
<TextView
android:text="@string/session_instruction"
android:background="@color/VerdeApp"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="normal|bold"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/picto_grid_item_layout_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center|center_horizontal"
android:id="@+id/picto_grid_item_layout_wrapper"
android:background="@drawable/picto_grid_item_border"
android:gravity="center_vertical|center|center_horizontal"
android:padding="@dimen/picto_border_width">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/picto_normal_height"
android:id="@+id/picto_grid_item_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/picto_normal_side"
android:background="@color/picto_default_background"
android:padding="@dimen/picto_padding">
......@@ -20,35 +20,35 @@
android:layout_height="match_parent" />
<TextView
android:text="Legend"
android:id="@+id/legend_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/legend_text"
android:textSize="11sp"
android:textColor="@android:color/black"
android:textAlignment="center"
android:layout_gravity="bottom"
android:visibility="gone"
android:background="@android:color/white" />
android:background="@android:color/white"
android:text="Legend"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="11sp"
android:visibility="gone" />
<TextView
android:text="Legend"
android:id="@+id/legend_text_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/legend_text_full"
android:textSize="18sp"
android:textColor="@android:color/black"
android:textAlignment="center"
android:maxLines="5"
android:gravity="center"
android:layout_gravity="center"
android:visibility="gone"
android:background="@android:color/white" />
android:background="@android:color/white"
android:gravity="center"
android:maxLines="5"
android:text="Legend"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:visibility="gone" />
<ImageView
android:id="@+id/picto_grid_item_redcross"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/picto_grid_item_redcross"
android:src="@drawable/disabled_picto" />
</FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/picto_big_width"
android:layout_height="@dimen/picto_big_height"
android:gravity="center_vertical|center|center_horizontal"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/picto_grid_item_layout_wrapper_big"
android:layout_width="@dimen/picto_big_side"
android:layout_height="@dimen/picto_big_side"
android:background="@drawable/picto_grid_item_border"
android:gravity="center_vertical|center|center_horizontal"
android:padding="@dimen/picto_border_width">
<FrameLayout
android:id="@+id/picto_grid_item_layout_big"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/picto_grid_item_layout_big"
android:background="@color/picto_default_background"
>
android:background="@color/picto_default_background">
<ImageView
android:id="@+id/picto_grid_item_image_big"
......@@ -20,32 +20,32 @@
android:layout_height="match_parent" />
<TextView
android:id="@+id/legend_text_big"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/legend_text_big"
android:textSize="13sp"
android:textColor="@android:color/black"
android:textAlignment="center"
android:layout_gravity="bottom"
android:visibility="gone"
android:background="@android:color/white" />
android:background="@android:color/white"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="13sp"
android:visibility="gone" />
<TextView
android:id="@+id/legend_text_big_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/legend_text_big_full"
android:textSize="20sp"
android:textColor="@android:color/black"
android:textAlignment="center"
android:gravity="center"
android:layout_gravity="center"
android:visibility="gone"
android:background="@android:color/white" />
android:background="@android:color/white"
android:gravity="center"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="20sp"
android:visibility="gone" />
<ImageView
android:id="@+id/picto_grid_item_redcross_big"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/picto_grid_item_redcross_big"
android:src="@drawable/disabled_picto" />
</FrameLayout>
......
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#BDBDBD"
android:keepScreenOn="true"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:padding="@dimen/small_padding">
android:orientation="horizontal"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pictogramLayout"
>
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<ImageButton
android:layout_width="@dimen/picto_normal_width"
android:layout_height="@dimen/tape_normal_height"
android:src="@drawable/remove_picto_from_tape"
android:id="@+id/button_delete"
android:layout_alignParentTop="true"
android:layout_width="@dimen/tape_normal_height"
android:layout_height="@dimen/tape_normal_height"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@android:color/holo_red_light"
android:clickable="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:clickable="true"
android:background="@android:color/holo_red_light" />
android:src="@drawable/remove_picto_from_tape" />
<GridView
android:id="@+id/tape_grid_view"
android:layout_width="@dimen/picto_normal_width"
android:layout_width="match_parent"
android:layout_height="@dimen/tape_normal_height"
android:layout_toEndOf="@+id/button_delete"
android:layout_toStartOf="@+id/button_tts"
......@@ -44,27 +40,27 @@
android:numColumns="8"></GridView>
<ImageButton
android:layout_width="@dimen/picto_normal_width"
android:layout_height="@dimen/tape_normal_height"
android:src="@drawable/send_tape"
android:background="@android:color/holo_red_light"
android:id="@+id/button_tts"
android:adjustViewBounds="true"
android:layout_alignParentTop="true"
android:layout_width="@dimen/tape_normal_height"
android:layout_height="@dimen/tape_normal_height"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:background="@android:color/holo_red_light"
android:clickable="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:clickable="true" />
android:src="@drawable/send_tape" />
<ImageButton
android:id="@+id/showPictoCategoriesViewButton"
android:layout_width="96dp"
android:layout_height="match_parent"
android:id="@+id/showPictoCategoriesViewButton"
android:layout_alignParentStart="true"
android:src="@drawable/show_categories_grid"
android:layout_below="@+id/button_delete"
android:background="#EEEEEE"
android:layout_below="@+id/tape_grid_view"
android:scaleType="fitCenter" />
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
<GridView
android:id="@+id/picto_category_grid_view"
......@@ -89,7 +85,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tape_grid_view"
android:layout_below="@+id/button_delete"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
......
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#BDBDBD"
android:keepScreenOn="true"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:padding="@dimen/small_padding">
android:orientation="horizontal"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA">
<RelativeLayout
android:id="@+id/pictogramLayout"
......@@ -16,10 +14,9 @@
android:layout_height="match_parent">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<ImageButton
android:id="@+id/button_delete"
android:layout_width="@dimen/picto_big_width"
android:layout_width="@dimen/tape_big_height"
android:layout_height="@dimen/tape_big_height"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
......@@ -31,7 +28,7 @@
<GridView
android:id="@+id/tape_grid_view"
android:layout_width="@dimen/picto_big_width"
android:layout_width="match_parent"
android:layout_height="@dimen/tape_big_height"
android:layout_toEndOf="@+id/button_delete"
android:layout_toStartOf="@+id/button_tts"
......@@ -46,7 +43,7 @@
<ImageButton
android:id="@+id/button_tts"
android:layout_width="@dimen/picto_big_width"
android:layout_width="@dimen/tape_big_height"
android:layout_height="@dimen/tape_big_height"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
......@@ -62,7 +59,7 @@
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/tape_grid_view"
android:layout_below="@+id/button_delete"
android:background="#EEEEEE"
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
......@@ -90,7 +87,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tape_grid_view"
android:layout_below="@+id/button_delete"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
......
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#BDBDBD"
android:keepScreenOn="true"
android:orientation="horizontal"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager">
<RelativeLayout
android:id="@+id/pictogramLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout
android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height"
android:background="@color/VerdeApp">
<ImageView
android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_gravity="left"
android:background="@color/accent_material_dark"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/BlancoApp" />
</LinearLayout>
</RelativeLayout>
<ImageButton
android:id="@+id/showPictoCategoriesViewButton"
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE"
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
<GridView
android:id="@+id/picto_category_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
android:numColumns="10"
android:paddingLeft="@dimen/small_padding"
android:paddingRight="@dimen/small_padding"
android:verticalSpacing="@dimen/picto_grid_spacing"></GridView>
<GridView
android:id="@+id/picto_main_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/vmTopbarLayout"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
android:verticalSpacing="@dimen/picto_grid_spacing"></GridView>
</RelativeLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal">
</FrameLayout>
</FrameLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#BDBDBD"
android:keepScreenOn="true"
android:orientation="horizontal"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:context="com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager">
<RelativeLayout
android:id="@+id/pictogramLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<RelativeLayout
android:id="@+id/vmTopbarLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
android:background="@color/VerdeApp">
<ImageView
android:id="@+id/vmTopbarStudentPhoto"
android:layout_width="@dimen/menu_top_height"
android:layout_height="@dimen/menu_top_height"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_gravity="left"
android:background="@color/accent_material_dark"
android:scaleType="centerCrop" />
<LinearLayout
android:id="@+id/vmTopbarStudentNameLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toEndOf="@+id/vmTopbarStudentPhoto"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/vmTopbarStudentFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
<ImageButton
android:id="@+id/showPictoCategoriesViewButton"
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="@+id/vmTopbarLayout"
android:background="#EEEEEE"
android:scaleType="fitCenter"
android:src="@drawable/show_categories_grid" />
<GridView
android:id="@+id/picto_category_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/vmTopbarLayout"
android:layout_toEndOf="@+id/showPictoCategoriesViewButton"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
android:numColumns="8"
android:paddingLeft="@dimen/small_padding"
android:paddingRight="@dimen/small_padding"
android:verticalSpacing="@dimen/picto_grid_spacing"></GridView>
<GridView
android:id="@+id/picto_main_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/vmTopbarLayout"
android:background="#DDDDDD"
android:gravity="center_vertical|center|center_horizontal"
android:horizontalSpacing="@dimen/picto_grid_spacing"
android:paddingLeft="@dimen/small_padding"
android:verticalSpacing="@dimen/picto_grid_spacing"></GridView>
</RelativeLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal">
</FrameLayout>
</FrameLayout>
......@@ -62,13 +62,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
......@@ -76,6 +69,13 @@
<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/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
......@@ -121,17 +121,5 @@
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.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="json-20090211" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -50,7 +50,13 @@
android:label="@string/title_activity_login_activity_fragments"
android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity"
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
......
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