Add county and alert dialog

This commit is contained in:
RicomenPL 2017-04-04 14:18:44 +02:00 committed by RicomenPL
parent 4950d71cad
commit ad4c539584
4 changed files with 72 additions and 25 deletions

View File

@ -1,15 +1,45 @@
package leszcz_team.wulkanowy.activity.main; package leszcz_team.wulkanowy.activity.main;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import leszcz_team.wulkanowy.R; import leszcz_team.wulkanowy.R;
public class MainActivity extends Activity { public class MainActivity extends Activity {
private static final String[] COUNTRIES = new String[] {
"Jarosławski", "Przeworski"
};
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
new AlertDialog.Builder(this)
.setTitle(R.string.warning_label)
.setMessage(R.string.warning_text)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
autoComplete();
}
private void autoComplete(){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.county_text);
textView.setAdapter(adapter);
} }
} }

View File

@ -9,18 +9,33 @@
tools:layout_editor_absoluteX="0dp"> tools:layout_editor_absoluteX="0dp">
<TextView <TextView
android:id="@+id/textView2" android:id="@+id/appName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="426dp"
android:text="@string/app_name" android:text="@string/app_name"
android:textSize="40dp" android:textSize="40dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintBottom_creator="1" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.071" />
<EditText
android:id="@+id/emailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textEmailAddress"
android:hint="@string/email_hint"
app:layout_constraintVertical_chainStyle="spread_inside"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.502"
tools:layout_constraintRight_creator="1"
tools:layout_constraintLeft_creator="1" tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" /> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.241" />
<EditText <EditText
android:id="@+id/passwordText" android:id="@+id/passwordText"
@ -38,24 +53,8 @@
tools:layout_constraintRight_creator="1" tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1" tools:layout_constraintBottom_creator="1"
app:layout_constraintVertical_chainStyle="spread_inside" app:layout_constraintVertical_chainStyle="spread_inside"
tools:layout_constraintLeft_creator="1" />
<EditText
android:id="@+id/emailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textEmailAddress"
android:hint="@string/email_hint"
app:layout_constraintVertical_chainStyle="spread_inside"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.502"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
app:layout_constraintBottom_toTopOf="@+id/passwordText"
tools:layout_constraintLeft_creator="1" tools:layout_constraintLeft_creator="1"
android:layout_marginBottom="45dp" /> app:layout_constraintVertical_bias="0.391" />
<Button <Button
android:id="@+id/agreeButton" android:id="@+id/agreeButton"
@ -64,10 +63,22 @@
android:text="@string/login_button" android:text="@string/login_button"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintTop_creator="1"
tools:layout_constraintRight_creator="1" tools:layout_constraintRight_creator="1"
android:layout_marginTop="58dp" tools:layout_constraintLeft_creator="1"
app:layout_constraintTop_toBottomOf="@+id/passwordText" app:layout_constraintBottom_toBottomOf="parent"
tools:layout_constraintLeft_creator="1" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.712" />
<AutoCompleteTextView
android:id="@+id/county_text"
android:layout_width="215dp"
android:layout_height="45dp"
android:hint="@string/county_hint"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintVertical_bias="0.536" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -6,4 +6,7 @@
<string name="pass_hint">Hasło</string> <string name="pass_hint">Hasło</string>
<string name="email_hint">E-mail</string> <string name="email_hint">E-mail</string>
<string name="login_button">Zaloguj</string> <string name="login_button">Zaloguj</string>
<string name="county_hint">Powiat</string>
<string name="warning_text">Aplikacja ta nie jest ukończona, więc mogą występować różnego rodzaju błędy lub dane funkcje nie bedą działać. Prosimy o cierpliwość i wyrozumiałość.</string>
<string name="warning_label">Ostrzeżenie</string>
</resources> </resources>

View File

@ -5,4 +5,7 @@
<string name="pass_hint">Password</string> <string name="pass_hint">Password</string>
<string name="email_hint">E-mail</string> <string name="email_hint">E-mail</string>
<string name="login_button">Log in</string> <string name="login_button">Log in</string>
<string name="county_hint">County</string>
<string name="warning_text">This application is not complete, so there may be a variety of errors or features that will not work. Please be patient and understanding.</string>
<string name="warning_label">Warning</string>
</resources> </resources>