Solucionados algunos bugs

parent 0273c0ab
...@@ -3,10 +3,12 @@ apply plugin: 'com.android.application' ...@@ -3,10 +3,12 @@ apply plugin: 'com.android.application'
android { android {
signingConfigs { signingConfigs {
release_config { release_config {
/*
storeFile file('F:/Users/Fernando/GoogleDrive/tmp/keystore.jks') storeFile file('F:/Users/Fernando/GoogleDrive/tmp/keystore.jks')
keyAlias 'default_key' keyAlias 'default_key'
keyPassword 'danoia' keyPassword 'danoia'
storePassword 'danoia' storePassword 'danoia'
*/
} }
} }
compileSdkVersion 21 compileSdkVersion 21
...@@ -23,7 +25,7 @@ android { ...@@ -23,7 +25,7 @@ android {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "server", "https://pre.yottacode.com:1337" resValue "string", "server", "https://pre.yottacode.com"
resValue "string", "db_name", "PCB.db" resValue "string", "db_name", "PCB.db"
resValue "bool", "force_db_create", "false" resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
...@@ -52,7 +54,7 @@ android { ...@@ -52,7 +54,7 @@ android {
resValue "string", "server", "https://192.168.1.37:1337" resValue "string", "server", "https://192.168.1.37:1337"
} }
DefaultFlavor { DefaultFlavor {
resValue "string", "server", "https://pre.yottacode.com:1337" resValue "string", "server", "https://pre.yottacode.com"
signingConfig signingConfigs.release_config signingConfig signingConfigs.release_config
} }
ArturoFlavorNoSSL { ArturoFlavorNoSSL {
......
...@@ -177,15 +177,14 @@ public class RestapiWrapper { ...@@ -177,15 +177,14 @@ public class RestapiWrapper {
os.close(); os.close();
int responseCode=urlConnection.getResponseCode(); int responseCode=urlConnection.getResponseCode();
if (responseCode == HttpsURLConnection.HTTP_OK) { Log.d(LOG_TAG, "RESPONSECODE: " + responseCode);
String line;
BufferedReader br=new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line;
while ((line=br.readLine()) != null) { BufferedReader br = new BufferedReader(new InputStreamReader(responseCode == HttpsURLConnection.HTTP_OK
response+=line; ? urlConnection.getInputStream()
} : urlConnection.getErrorStream()));
} while ((line=br.readLine()) != null) {
else { response+=line;
response="";
} }
} catch (IOException e) { } catch (IOException e) {
Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error:" + e.getLocalizedMessage() + " when asking for " + surl); Log.e(com.yottacode.net.RestapiWrapper.class.getName(), "Error:" + e.getLocalizedMessage() + " when asking for " + surl);
...@@ -228,6 +227,7 @@ public class RestapiWrapper { ...@@ -228,6 +227,7 @@ public class RestapiWrapper {
@Override @Override
protected void onPostExecute(HttpAsyncTaskParams params) { protected void onPostExecute(HttpAsyncTaskParams params) {
try { try {
//if (params.e)
if(params.result!=null) { if(params.result!=null) {
Log.d(LOG_TAG, "JSON: " + params.result); Log.d(LOG_TAG, "JSON: " + params.result);
......
...@@ -183,17 +183,19 @@ public class SerialActivity extends Activity implements iRestapiListener { ...@@ -183,17 +183,19 @@ public class SerialActivity extends Activity implements iRestapiListener {
String password = mSerialViewPass.getText().toString(); String password = mSerialViewPass.getText().toString();
// DE PRUEBA // DE PRUEBA
// Alumno // Alumno
//username = "faf0001"; username = "faf0001";
//password = "faf0001"; password = "faf000";
// Supervisor // Supervisor
//username = "dofer@ujaen.es"; //username = "dofer@ujaen.es";
//password = "dofer"; //password = "dofer";
/*
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit(); SharedPreferences.Editor editor = settings.edit();
editor.putString("username", username); editor.putString("username", username);
editor.putString("password", password); editor.putString("password", password);
editor.commit(); editor.commit();
*/
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper(); RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
if (username.contains("@")){ if (username.contains("@")){
...@@ -279,18 +281,18 @@ public class SerialActivity extends Activity implements iRestapiListener { ...@@ -279,18 +281,18 @@ public class SerialActivity extends Activity implements iRestapiListener {
//User student = PCBcontext.getDevice().findUser(st_id_int, -1); //User student = PCBcontext.getDevice().findUser(st_id_int, -1);
//Log.d(LOG_TAG, "student id:" + student.get_id_stu()); //Log.d(LOG_TAG, "student id:" + student.get_id_stu());
PCBcontext.set_user(student, jsonToken, new iImgDownloaderListener() { PCBcontext.set_user(student, jsonToken, new iImgDownloaderListener() {
@Override @Override
public void loadComplete() { public void loadComplete() {
progressDialog.dismiss(); progressDialog.dismiss();
Intent pictogramActivity = new Intent(SerialActivity.this, PictogramActivity.class); Intent pictogramActivity = new Intent(SerialActivity.this, PictogramActivity.class);
startActivity(pictogramActivity); startActivity(pictogramActivity);
} }
@Override @Override
public void loadImg(Img image) { public void loadImg(Img image) {
} }
}); });
PCBcontext.getDevice().synchronizeUsers(users, new iImgDownloaderListener() { PCBcontext.getDevice().synchronizeUsers(users, new iImgDownloaderListener() {
@Override @Override
...@@ -326,9 +328,11 @@ public class SerialActivity extends Activity implements iRestapiListener { ...@@ -326,9 +328,11 @@ public class SerialActivity extends Activity implements iRestapiListener {
startActivity(loginActivity); startActivity(loginActivity);
} }
} catch (JSONException ex){ } catch (JSONException ex){
//Log.d(LOG_TAG, "ERROR 1");
ex.printStackTrace(); ex.printStackTrace();
} }
} catch (JSONException e) { } catch (JSONException e) {
//Log.d(LOG_TAG, "ERROR 2");
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -350,7 +354,4 @@ public class SerialActivity extends Activity implements iRestapiListener { ...@@ -350,7 +354,4 @@ public class SerialActivity extends Activity implements iRestapiListener {
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
} }
\ No newline at end of file
...@@ -13,41 +13,50 @@ ...@@ -13,41 +13,50 @@
<!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) --> <!-- android:keepScreenOn - To keep the screen bright as long as the app is visible (also forever) -->
<GridView <GridView
android:id="@+id/tape_grid_view" android:id="@+id/tape_grid_view"
android:layout_width="850dp" android:layout_width="850dp"
android:layout_height="85dp" android:layout_height="85dp"
android:gravity="center" android:gravity="center"
android:numColumns="@integer/columns" android:numColumns="@integer/columns"
android:accessibilityLiveRegion="none" android:accessibilityLiveRegion="none"
android:background="@android:color/holo_red_light" android:background="@android:color/holo_red_light"
android:clickable="false" android:clickable="false"
android:layout_alignParentTop="true"> android:layout_alignParentTop="true">
</GridView> </GridView>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="850dp"
android:paddingTop="20dp"
android:src="@drawable/back64"
android:background="@null"
android:id="@+id/button_delete"
android:layout_alignParentTop="true"/>
<ImageButton <ImageButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:paddingLeft="20dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:src="@drawable/play64" android:src="@drawable/play64"
android:background="@null" android:background="@null"
android:id="@+id/button_tts" android:id="@+id/button_tts"
android:layout_toRightOf="@+id/tape_grid_view" android:layout_toRightOf="@+id/tape_grid_view"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:adjustViewBounds="true"/> android:adjustViewBounds="true"/>
<GridView <GridView
android:id="@+id/panel_grid_view" android:id="@+id/panel_grid_view"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingTop="20dp" android:paddingTop="20dp"
android:columnWidth="100dp" android:columnWidth="100dp"
android:verticalSpacing="15dp" android:verticalSpacing="15dp"
android:horizontalSpacing="5dp" android:horizontalSpacing="5dp"
android:stretchMode="columnWidth" android:stretchMode="columnWidth"
android:layout_below="@+id/tape_grid_view"> android:layout_below="@+id/tape_grid_view">
</GridView> </GridView>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
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