Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package by.english.exams;
- import android.app.Activity;
- import android.app.AlertDialog;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.os.Bundle;
- import android.text.Layout;
- import android.util.Log;
- import android.view.View;
- import android.webkit.WebView;
- import android.webkit.WebViewClient;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.Toast;
- import java.util.Scanner;
- public class ActivityMain extends Activity {
- private String tag = "ActivityMain";
- WebView webView;
- EditText in;
- Button ok;
- String data;
- @Override
- public void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Log.i(tag, "start");
- setupClickHandlers();
- }
- private void setupClickHandlers() {
- findViewById(R.id.btn_tickets).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- openTickets(
- new String[]{
- "ticket_1",
- "ticket_2",
- "ticket_3",
- "ticket_4",
- "ticket_5",
- "ticket_6",
- "ticket_7",
- "ticket_8",
- "ticket_9",
- "ticket_10",
- "ticket_11",
- "ticket_12",
- "ticket_13",
- "ticket_14",
- "ticket_15",
- "ticket_16",
- "ticket_17",
- "ticket_18",
- "ticket_19",
- "ticket_20",
- "ticket_21",
- "ticket_22",
- "ticket_23",
- "ticket_24",
- "ticket_25",
- },
- new String[]{
- "1. Family",
- "2. Family traditions",
- "3. Family relationship",
- "4. Friendship & relationship",
- "5. Education",
- "6. Studing at school",
- "7. School traditions",
- "8. Choosing a career",
- "9. Life in the city and country",
- "10. Different types of houses",
- "11. Belarussian national cuisine",
- "12. National cuisine of English country",
- "13. Shopping",
- "14. Leisure time",
- "15. Belarussian customs & traditions",
- "16. Customs & traditions an England",
- "17. Modern means of communication",
- "18. Healthy way of life",
- "19. Sport",
- "20. Fashion",
- "21. Travelling & tourism",
- "22. Environment",
- "23. Weather & climate",
- "24. The Republic of Belarus",
- "25. Great Britain",
- });
- }
- });
- findViewById(R.id.btn_tickets_2).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- openTickets(
- new String[]{
- "ticket_audir_1",
- "ticket_audir_2",
- "ticket_audir_3",
- "ticket_audir_4",
- "ticket_audir_5",
- "ticket_audir_6",
- "ticket_audir_7",
- "ticket_audir_8",
- "ticket_audir_9",
- "ticket_audir_10",
- "ticket_audir_11",
- "ticket_audir_12",
- "ticket_audir_13",
- "ticket_audir_14",
- "ticket_audir_15",
- "ticket_audir_16",
- "ticket_audir_17",
- "ticket_audir_18",
- "ticket_audir_19",
- "ticket_audir_20",
- "ticket_audir_21",
- "ticket_audir_22",
- "ticket_audir_23",
- "ticket_audir_24",
- "ticket_audir_25",
- },
- new String[]{
- "Билет 1",
- "Билет 2",
- "Билет 3",
- "Билет 4",
- "Билет 5",
- "Билет 6",
- "Билет 7",
- "Билет 8",
- "Билет 9",
- "Билет 10",
- "Билет 11",
- "Билет 12",
- "Билет 13",
- "Билет 14",
- "Билет 15",
- "Билет 16",
- "Билет 17",
- "Билет 18",
- "Билет 19",
- "Билет 20",
- "Билет 21",
- "Билет 22",
- "Билет 23",
- "Билет 24",
- "Билет 25",
- });
- }
- });
- findViewById(R.id.btn_tickets_3).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- openTickets(
- new String[]{
- "ticket_textwork_1",
- "ticket_textwork_2",
- "ticket_textwork_3",
- "ticket_textwork_4",
- "ticket_textwork_5",
- "ticket_textwork_6",
- "ticket_textwork_7",
- "ticket_textwork_8",
- "ticket_textwork_9",
- "ticket_textwork_10",
- "ticket_textwork_11",
- "ticket_textwork_12",
- "ticket_textwork_13",
- "ticket_textwork_14",
- "ticket_textwork_15",
- "ticket_textwork_16",
- "ticket_textwork_17",
- "ticket_textwork_18",
- "ticket_textwork_19",
- "ticket_textwork_20",
- "ticket_textwork_21",
- "ticket_textwork_22",
- "ticket_textwork_23",
- "ticket_textwork_24",
- "ticket_textwork_25",
- },
- new String[]{
- "1. CAN CHEATING BE STOPPED?",
- "2. Books in never ending motion",
- "3. Friendship in the modern world",
- "4. ACCORDING TO LAWS OF HOSPITALITY",
- "5. UNKNOWN ARTHUR CONAN DOYLE",
- "6. HAND MADE CHOCOLATES",
- "7. Mysterious Disappearance",
- "8. PABLO PICASSO",
- "9. Good news for chocolate lovers",
- "10. Do very clever children need help?",
- "11. FAMILY HISTORY",
- "12. BULLYING AGAIN?",
- "13. SHAKESPEARE’S PORTRAIT?",
- "14. Shopping in London",
- "15. University celebrates",
- "16. WORLD DIGITAL LIBRARY OPENS",
- "17. Special request to educational minister",
- "18. The most difficult language?",
- "19. Mobile phones",
- "20. How I got to the top",
- "21. Haloween",
- "22. Felt boots are feast for the eyes",
- "23. Village with history of a city",
- "Билет 24",
- "Билет 25",
- });
- }
- });
- findViewById(R.id.btn_other).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(getApplicationContext(),
- "Здесь пока пусто!", Toast.LENGTH_LONG)
- .show();
- }
- });
- }
- public void openTickets(String[] tickets, String[] names) {
- if (tickets.length != names.length) {
- throw new RuntimeException("tickets.length != names.length");
- }
- Intent intent = new Intent(ActivityMain.this, ActivityTickets.class);
- intent.putExtra(ActivityTickets.DATA_TICKETS_LIST, tickets);
- intent.putExtra(ActivityTickets.DATA_TICKETS_LIST_NAMES, names);
- startActivity(intent);
- }
- public void onBackPressed() {
- // TODO Auto-generated method stub
- // super.onBackPressed();
- openQuitDialog();
- }
- private void openQuitDialog() {
- AlertDialog.Builder quitDialog = new AlertDialog.Builder(
- ActivityMain.this);
- quitDialog.setTitle("Точно выйти?");
- quitDialog.setPositiveButton("Выход", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- finish();
- }
- });
- quitDialog.setNegativeButton("Нет", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- });
- quitDialog.show();
- }
- public void imageButton(View view) {
- Toast toast = Toast.makeText(getApplicationContext(),
- "перестань нажимать",
- Toast.LENGTH_SHORT);
- // toast.setGravity(Gravity.CENTER, 0, 0);
- toast.show();
- }
- public void settings(View view) {
- Intent intent = new Intent(ActivityMain.this, SettingsActivity.class);
- startActivity(intent);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement