diff --git a/app/src/main/java/leszcz_team/wulkanowy/activity/main/Login.java b/app/src/main/java/leszcz_team/wulkanowy/activity/main/Login.java new file mode 100644 index 000000000..08bc0d6ab --- /dev/null +++ b/app/src/main/java/leszcz_team/wulkanowy/activity/main/Login.java @@ -0,0 +1,41 @@ +package leszcz_team.wulkanowy.activity.main; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.AsyncTask; + +import leszcz_team.wulkanowy.R; + +public class Login extends AsyncTask { + + String email; + String password; + String county; + Activity activity; + + public Login(String emailT, String passwordT, String countyT, Activity mainAC){ + + email = emailT; + password = passwordT; + county = "powiat" + countyT; + activity = mainAC; + } + + @Override + protected Void doInBackground(Void... params) { + return null; + } + + protected void onPostExecute(Void result) { + super.onPostExecute(result); + new AlertDialog.Builder(activity) + .setTitle(R.string.warning_label) + .setMessage(R.string.error_feature_text) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) {} + }) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); + } +} diff --git a/app/src/main/java/leszcz_team/wulkanowy/activity/main/MainActivity.java b/app/src/main/java/leszcz_team/wulkanowy/activity/main/MainActivity.java index 71a2d1d2a..d6f326125 100644 --- a/app/src/main/java/leszcz_team/wulkanowy/activity/main/MainActivity.java +++ b/app/src/main/java/leszcz_team/wulkanowy/activity/main/MainActivity.java @@ -4,15 +4,18 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; +import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; +import android.widget.EditText; +import android.widget.Toast; import leszcz_team.wulkanowy.R; public class MainActivity extends Activity { private static final String[] COUNTRIES = new String[] { - "Jarosławski", "Przeworski" + "Powiat jarosławski", "Powiat przeworski" }; @Override @@ -38,8 +41,25 @@ public class MainActivity extends Activity { ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES); AutoCompleteTextView textView = (AutoCompleteTextView) - findViewById(R.id.county_text); + findViewById(R.id.countyText); textView.setAdapter(adapter); } + + public void login(View a){ + EditText adressEmail = (EditText)findViewById(R.id.emailText); + EditText passwordText = (EditText)findViewById(R.id.passwordText); + EditText countyText = (EditText)findViewById(R.id.countyText); + String password = passwordText.getText().toString(); + String email = adressEmail.getText().toString(); + String county = countyText.getText().toString(); + + if (password.isEmpty()|| email.isEmpty() || county.isEmpty()){ + Toast.makeText(this, R.string.data_text, Toast.LENGTH_SHORT).show(); + } + else{ + new Login(email, password, county, this).execute(); + } + + } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7a8b3b5b7..8e078dc10 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -67,10 +67,11 @@ tools:layout_constraintLeft_creator="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.712" /> + app:layout_constraintVertical_bias="0.712" + android:onClick="login"/> Powiat 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ść. Ostrzeżenie + Brak danych logowania + Funkcja którą chciałeś urucThe function you wanted to run does not workhomić nie działa \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 61cd925ed..8765bcea6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8,4 +8,6 @@ County This application is not complete, so there may be a variety of errors or features that will not work. Please be patient and understanding. Warning + No login data + The function you wanted to run does not work