forked from github/wulkanowy-mirror
Add county and alert dialog
This commit is contained in:
parent
4950d71cad
commit
ad4c539584
@ -1,15 +1,45 @@
|
||||
package leszcz_team.wulkanowy.activity.main;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
|
||||
import leszcz_team.wulkanowy.R;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private static final String[] COUNTRIES = new String[] {
|
||||
"Jarosławski", "Przeworski"
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,18 +9,33 @@
|
||||
tools:layout_editor_absoluteX="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:id="@+id/appName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="426dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="40dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="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_constraintRight_creator="1" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.241" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordText"
|
||||
@ -38,24 +53,8 @@
|
||||
tools:layout_constraintRight_creator="1"
|
||||
tools:layout_constraintBottom_creator="1"
|
||||
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"
|
||||
android:layout_marginBottom="45dp" />
|
||||
app:layout_constraintVertical_bias="0.391" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/agreeButton"
|
||||
@ -64,10 +63,22 @@
|
||||
android:text="@string/login_button"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:layout_constraintTop_creator="1"
|
||||
tools:layout_constraintRight_creator="1"
|
||||
android:layout_marginTop="58dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/passwordText"
|
||||
tools:layout_constraintLeft_creator="1" />
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
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>
|
||||
|
@ -6,4 +6,7 @@
|
||||
<string name="pass_hint">Hasło</string>
|
||||
<string name="email_hint">E-mail</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>
|
@ -5,4 +5,7 @@
|
||||
<string name="pass_hint">Password</string>
|
||||
<string name="email_hint">E-mail</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>
|
||||
|
Loading…
Reference in New Issue
Block a user