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

parent e8951017
......@@ -46,6 +46,7 @@ public class MainActivity extends Activity {
// Nota magc: al pasar ya siempre por serial no tiene sentido tener main ¿no?
Intent serialActivity = new Intent(this, SerialActivity.class);
serialActivity.putExtra("activity_name","MainActivity");
startActivity(serialActivity);
}
......
......@@ -79,11 +79,15 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
// String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
private int count_deletelong = 0;
/*
float xAxis = 0f;
float yAxis = 0f;
float lastXAxis = 0f;
float lastYAxis = 0f;
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -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
count_deletelong = 0;
// Singleton getInstance
//pcb = PCBcontext.getInstance();
......@@ -137,6 +143,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tapeGridView.getLayoutParams().width = width - 120;
tapeGridView.requestLayout();
/*
tapeGridView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
......@@ -173,6 +180,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
return true;
}
});
*/
final GridView panelGridView = (GridView) findViewById(R.id.panel_grid_view);
final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete);
......@@ -286,19 +294,21 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
Picto p = panelAdapter.getItem(position);
// 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() < 8) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
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);
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() < 8) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
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);
}
}
return true;
}
......@@ -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
......
......@@ -94,12 +94,20 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_serial);
Intent intent=getIntent();
String activityName=intent.getStringExtra("activity_name");
mSerialViewMail = (EditText) findViewById(R.id.serialmail);
mSerialViewPass = (EditText) findViewById(R.id.serialpass);
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
username = settings.getString("username", "");
password = settings.getString("password", "");
if (activityName.equals("MainActivity")){
password = settings.getString("password", "");
} else{
password = "";
}
// Escribo los últimos valores indicados
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