Desde Pictogram ya va a la ventana de Login, con unos gestos concretos

parent e8951017
...@@ -46,6 +46,7 @@ public class MainActivity extends Activity { ...@@ -46,6 +46,7 @@ public class MainActivity extends Activity {
// Nota magc: al pasar ya siempre por serial no tiene sentido tener main ¿no? // Nota magc: al pasar ya siempre por serial no tiene sentido tener main ¿no?
Intent serialActivity = new Intent(this, SerialActivity.class); Intent serialActivity = new Intent(this, SerialActivity.class);
serialActivity.putExtra("activity_name","MainActivity");
startActivity(serialActivity); startActivity(serialActivity);
} }
......
...@@ -79,11 +79,15 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -79,11 +79,15 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
// String constant for logs // String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName() private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
private int count_deletelong = 0;
/*
float xAxis = 0f; float xAxis = 0f;
float yAxis = 0f; float yAxis = 0f;
float lastXAxis = 0f; float lastXAxis = 0f;
float lastYAxis = 0f; float lastYAxis = 0f;
*/
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -95,6 +99,8 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -95,6 +99,8 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
actualCategory = null; // this for refresh vocabulary when a websocket action arrived from the dashboard actualCategory = null; // this for refresh vocabulary when a websocket action arrived from the dashboard
count_deletelong = 0;
// Singleton getInstance // Singleton getInstance
//pcb = PCBcontext.getInstance(); //pcb = PCBcontext.getInstance();
...@@ -137,6 +143,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -137,6 +143,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tapeGridView.getLayoutParams().width = width - 120; tapeGridView.getLayoutParams().width = width - 120;
tapeGridView.requestLayout(); tapeGridView.requestLayout();
/*
tapeGridView.setOnTouchListener(new View.OnTouchListener() { tapeGridView.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
...@@ -173,6 +180,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -173,6 +180,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
return true; return true;
} }
}); });
*/
final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view); final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view);
final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete); final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete);
...@@ -286,6 +294,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -286,6 +294,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
Picto p = panelAdapter.getItem(position); Picto p = panelAdapter.getItem(position);
if (p!=null && !p.is_invisible() && p.is_enabled()){
// If is not the blank picto, it isn't invisible or disabled // If is not the blank picto, it isn't invisible or disabled
if(p.get_id() != 0 && if(p.get_id() != 0 &&
!p.get_status().equalsIgnoreCase("invisible") && !p.get_status().equalsIgnoreCase("invisible") &&
...@@ -300,6 +309,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -300,6 +309,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
); );
//view.setVisibility(View.INVISIBLE); //view.setVisibility(View.INVISIBLE);
} }
}
return true; return true;
} }
}); });
...@@ -370,6 +380,26 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -370,6 +380,26 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
} }
} }
}); });
// Acción para volver a la ventana de login
deleteButton.setOnLongClickListener(new AdapterView.OnLongClickListener(){
@Override
public boolean onLongClick(View v) {
Log.d(LOG_TAG, "DELETE LONGCLICK...");
count_deletelong++;
if (count_deletelong >= 3){
Log.d(LOG_TAG, "SALTO A LOGIN");
// Paso un parámetro a la SerialActivity, para controlar de dónde viene
Intent serialActivity = new Intent(getBaseContext(), SerialActivity.class);
serialActivity.putExtra("activity_name","PictogramActivity");
startActivity(serialActivity);
// ....
}
return false;
}
});
} }
@Override @Override
......
...@@ -94,12 +94,20 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -94,12 +94,20 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_serial); setContentView(R.layout.activity_serial);
Intent intent=getIntent();
String activityName=intent.getStringExtra("activity_name");
mSerialViewMail = (EditText) findViewById(R.id.serialmail); mSerialViewMail = (EditText) findViewById(R.id.serialmail);
mSerialViewPass = (EditText) findViewById(R.id.serialpass); mSerialViewPass = (EditText) findViewById(R.id.serialpass);
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
username = settings.getString("username", ""); username = settings.getString("username", "");
if (activityName.equals("MainActivity")){
password = settings.getString("password", ""); password = settings.getString("password", "");
} else{
password = "";
}
// Escribo los últimos valores indicados // Escribo los últimos valores indicados
mSerialViewMail.setText(username); mSerialViewMail.setText(username);
......
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