Commit 5fc0f8c3 authored by Lucas Braz Cunha's avatar Lucas Braz Cunha

Issue AGILE#152: Initial usage of spinner with hint

Signed-off-by: Lucas Braz Cunha's avatarLucas B. Cunha <lbc16@inf.ufpr.br>
parent ac330f32
......@@ -89,10 +89,11 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
R.color.colorRed, null));
}
else {
if (ConnectionChecker.hasConnection(getBaseContext()))
if (ConnectionChecker.hasConnection(getBaseContext())) {
btn_login.setEnabled(false);
presenter.onLoginClicked(Mask.unmask(et_cpf.getText().toString()),
et_password.getText().toString());
else {
}else {
if (dg_connection_error == null)
dg_connection_error = new ConnectionErrorDialog();
Bundle bundle = new Bundle();
......@@ -162,6 +163,7 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
@Override
public void setWrongPassword(boolean enabled) {
btn_login.setEnabled(true);
TextView textView = (TextView) findViewById(R.id.tv_loginact_error);
if (enabled) {
textView.setText(R.string.loginact_error);
......@@ -177,6 +179,7 @@ public class LoginActivity extends AppCompatActivity implements LoginView {
@Override
public void setNoConnection(boolean enabled) {
if(enabled){
btn_login.setEnabled(true);
Bundle bundle = new Bundle();
if(dg_connection_error == null){
dg_connection_error = new ConnectionErrorDialog();
......
......@@ -53,7 +53,7 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
private ProgressBar pb_scheduling;
private Spinner spnr_citizen;
private Spinner spnr_citizen, spnr_sector, spnr_type, spnr_location;
private LinearLayout ll_fields;
......@@ -87,12 +87,18 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
}
});
ll_fields = (LinearLayout) findViewById(R.id.ll_scheduling_fields);
//pb_scheduling.setVisibility(View.VISIBLE);
//ll_fields.setVisibility(View.INVISIBLE);
spnr_citizen = (Spinner) findViewById(R.id.spnr_scheduling_citizen);
spnr_sector = (Spinner) findViewById(R.id.spnr_scheduling_sector);
spnr_type = (Spinner) findViewById(R.id.spnr_scheduling_type);
spnr_location = (Spinner) findViewById(R.id.spnr_scheduling_location);
osb = ObscuredSharedPreferences.getPrefs(this, "Agendador", Context.MODE_PRIVATE);
String citizenName = osb.getString("name", null);
String citizenCity = osb.getString("city.name", null);
......@@ -133,12 +139,29 @@ public class SchedulingActivity extends AppCompatActivity implements Scheduling
navigationView.setNavigationItemSelectedListener(this);
// TODO: 17/04/17 example on how to set hint to spinner
String[] citizes = {"Lucas","Selecione um cidadão"};
String[] citizens = {"Lucas","Selecione um cidadão"};
HintAdapter hintAdapter= new HintAdapter(this, android.R.layout.simple_list_item_1, citizes);
spnr_citizen.setAdapter(hintAdapter);
HintAdapter hintAdapterCitizen = new HintAdapter(this, android.R.layout.simple_list_item_1, citizens);
spnr_citizen.setAdapter(hintAdapterCitizen);
// show hint
spnr_citizen.setSelection(hintAdapter.getCount());
spnr_citizen.setSelection(hintAdapterCitizen.getCount());
String[] sector = {"Saúde","Selecione um setor"};
HintAdapter hintAdapterSector = new HintAdapter(this, android.R.layout.simple_list_item_1, sector);
spnr_sector.setAdapter(hintAdapterSector);
spnr_sector.setSelection(hintAdapterSector.getCount());
String[] types = {"Texto1","Selecione o tipo"};
HintAdapter hintAdapterType = new HintAdapter(this, android.R.layout.simple_list_item_1, types);
spnr_type.setAdapter(hintAdapterType);
spnr_type.setSelection(hintAdapterType.getCount());
String[] locations = {"Texto1", "Selecione o local"};
HintAdapter hintAdapterLocation = new HintAdapter(this, android.R.layout.simple_list_item_1, locations);
spnr_location.setAdapter(hintAdapterLocation);
spnr_location.setSelection(hintAdapterLocation.getCount());
//end of example
}
......
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 to comment