@Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    //
    //	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main_login);

    mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount);
    mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword);
    mBtnLogin = (Button) findViewById(R.id.mainLoginBtn);
    mBtnRegister = (Button) findViewById(R.id.main_btn_register);

    /* this is to render the password edittext font to be default */
    mEtPassword.setTypeface(Typeface.DEFAULT);
    mEtPassword.setTransformationMethod(new PasswordTransformationMethod());

    mBtnLogin.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            MainActivity.this.tryLogin();
          }
        });

    mBtnRegister.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class);
            startActivity(intent0);
          }
        });
  }
Ejemplo n.º 2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_showdialog);

    Button btn = (Button) findViewById(R.id.call);
    btn.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(SampleDialog);
          }
        });
    Button btn2 = (Button) findViewById(R.id.call2);
    btn2.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(QuestionDialog);
          }
        });
  }
 public void setNextButton() {
   Button meatButton = (Button) findViewById(R.id.meatToppingsButton);
   meatButton.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(MeatToppingsActivity.this, NameActivity.class);
           intent.putExtra("size", size);
           intent.putExtra("numVeggieToppings", numVeggieToppings);
           intent.putExtra("numMeatToppings", numMeatToppings);
           startActivity(intent);
         }
       });
 }
  @SuppressWarnings("deprecation")
  private void inflateTitleBar(ViewGroup view) {
    ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub);
    if (stub != null) {
      View titleBar = stub.inflate();

      final RelativeLayout.LayoutParams layoutParams =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
      layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar);
      listView.setLayoutParams(layoutParams);

      if (titleBarBackground != null) {
        titleBar.setBackgroundDrawable(titleBarBackground);
      }

      doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button);
      if (doneButton != null) {
        doneButton.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                logAppEvents(true);
                appEventsLogged = true;

                if (onDoneButtonClickedListener != null) {
                  onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this);
                }
              }
            });

        if (getDoneButtonText() != null) {
          doneButton.setText(getDoneButtonText());
        }

        if (doneButtonBackground != null) {
          doneButton.setBackgroundDrawable(doneButtonBackground);
        }
      }

      titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
      if (titleTextView != null) {
        if (getTitleText() != null) {
          titleTextView.setText(getTitleText());
        }
      }
    }
  }
Ejemplo n.º 5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    c = this;
    preferences = PreferenceManager.getDefaultSharedPreferences(c);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gpu_sgx540);

    gpuCurrent = readFile(Constants.GPU_SGX540);
    seekGpu = (SeekBar) findViewById(R.id.seek_gpu);

    gpu = Arrays.asList(153, 307, 384);
    seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent));

    /*else{
    seekGpu.setEnabled(false);
    seekIva.setEnabled(false);
    TextView ns = (TextView)findViewById(R.id.not_supported);
    ns.setVisibility(View.VISIBLE);
    }*/
    preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    curGpuTxt = (TextView) findViewById(R.id.current_gpu);
    maxGpuTxt = (TextView) findViewById(R.id.max_gpu);
    minGpuTxt = (TextView) findViewById(R.id.min_gpu);

    mhz = getResources().getString(R.string.mhz);
    current = getResources().getString(R.string.current);
    max = getResources().getString(R.string._max);
    min = getResources().getString(R.string._min);
    curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz);
    maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz);
    minGpuTxt.setText(min + ": " + gpu.get(0) + mhz);

    Button cancel = (Button) findViewById(R.id.cancel);
    cancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
  }
Ejemplo n.º 6
0
        public void onServiceConnected(ComponentName name, IBinder service) {
          loggingService = ((GpsLoggingService.GpsLoggingBinder) service).getService();
          GpsLoggingService.SetServiceClient(GpsMainActivity.this);

          Button buttonSinglePoint = (Button) findViewById(R.id.buttonSinglePoint);

          buttonSinglePoint.setOnClickListener(GpsMainActivity.this);

          if (Session.isStarted()) {
            if (Session.isSinglePointMode()) {
              SetMainButtonEnabled(false);
            } else {
              SetMainButtonChecked(true);
              SetSinglePointButtonEnabled(false);
            }

            DisplayLocationInfo(Session.getCurrentLocationInfo());
          }

          // Form setup - toggle button, display existing location info
          ToggleButton buttonOnOff = (ToggleButton) findViewById(R.id.buttonOnOff);
          buttonOnOff.setOnCheckedChangeListener(GpsMainActivity.this);
        }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile);
    findViews();
    /*Select Category work */
    final String[] categories = getIntent().getStringArrayExtra("Options");
    ArrayAdapter<String> catadapt;
    catadapt = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
    mCatSpin.setAdapter(catadapt);
    mCatSpin.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) {
            mChosenCategory = categories[pos];
          }

          public void onNothingSelected(AdapterView<?> parent) {}
        });
    /*Availability selection work*/
    mAvail = (Button) findViewById(R.id.editavail);
    mAvail.setOnClickListener(this);
    /*Submit/Back button work*/
    mSub = (Button) findViewById(R.id.submitbutton);
    mSub.setOnClickListener(this);
    mBack.setOnClickListener(this);
    /*Web View & Camera uploader work*/
    openCam.setOnClickListener(this);
    openWeb.setOnClickListener(this);
    web.getSettings().setJavaScriptEnabled(true);
    web.loadUrl("http://www.monkbananas.com/uploader/index.php");
    // ------Everything below this line was found on StackOverflow--------------------
    web.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView v, String url) {
            web.loadUrl(url);
            return true;
          }
          // The undocumented magic method override
          // Eclipse will swear at you if you try to put @Override here
          // For Android 3.0+
          public void openFileChooser(ValueCallback<Uri> uploadMsg) {

            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("image/*");
            startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
          }

          // For Android 3.0+
          public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("*/*");
            startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
          }

          // For Android 4.1
          public void openFileChooser(
              ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("image/*");
            startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
          }
        });
  }
Ejemplo n.º 8
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      if (view == null) {
        LayoutInflater inflater =
            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.content_list_item, null);
      }
      TextView titleTextView = (TextView) view.findViewById(R.id.list_item_title);
      TextView stateTextView = (TextView) view.findViewById(R.id.list_item_state);
      TextView downTextView = (TextView) view.findViewById(R.id.list_item_downbar);
      Button downloadButton = (Button) view.findViewById(R.id.list_item_download_button);
      Button uploadButton = (Button) view.findViewById(R.id.list_item_upload_button);

      LocationInfo info = mInfoList.get(position);
      String titleText = info.title;
      String stateText = "";

      if (titleText.length() > 30) titleText = titleText.substring(0, 28) + "...";

      synchronized (mLoaderMap) {
        if (mLoaderMap.containsKey(info.title)) {
          LoaderState loader = mLoaderMap.get(info.title);
          if (loader.state < 100) stateText = String.format(Locale.ENGLISH, "%d%%", loader.state);
          else if (loader.state == 100) stateText = String.format(Locale.ENGLISH, "Done!");
          else stateText = String.format(Locale.ENGLISH, "Failed!");
        }
      }

      if (info.localVersion < 0) titleText += " (?)";
      else {
        if (info.localModified)
          titleText += String.format(Locale.ENGLISH, " (v. %d+)", info.localVersion);
        else titleText += String.format(Locale.ENGLISH, " (v. %d)", info.localVersion);
      }

      String mapFile = NavigineApp.Settings.getString("map_file", "");
      if (mapFile.equals(info.archiveFile)) {
        titleTextView.setTypeface(null, Typeface.BOLD);
        view.setBackgroundColor(Color.parseColor("#590E0E"));
      } else {
        titleTextView.setTypeface(null, Typeface.NORMAL);
        view.setBackgroundColor(Color.BLACK);
      }

      titleTextView.setText(titleText);
      stateTextView.setText(stateText);

      if (info.localModified) {
        downloadButton.setVisibility(View.GONE);
        uploadButton.setVisibility(View.VISIBLE);
        downTextView.setText("Version is modified. Upload?");
      } else if (info.serverVersion > info.localVersion) {
        downloadButton.setVisibility(View.VISIBLE);
        uploadButton.setVisibility(View.GONE);
        String downText =
            String.format(Locale.ENGLISH, "Version available: %d", info.serverVersion);
        downTextView.setText(downText);
      } else {
        downloadButton.setVisibility(View.INVISIBLE);
        uploadButton.setVisibility(View.GONE);
        downTextView.setText("Version is up to date");
      }

      downloadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startDownload(position);
            }
          });

      uploadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startUpload(position);
            }
          });

      return view;
    }
Ejemplo n.º 9
0
  @Override
  public void onCreate(
      Bundle savedInstanceState) { // this is the first method to be loaded when the
    super.onCreate(savedInstanceState); // app runs.This shows the main screen
    setContentView(R.layout.activity_userlogin);
    TabHost th = (TabHost) findViewById(R.id.tabhost);
    th.setup();
    TabSpec spec1 =
        th.newTabSpec("t1"); // 3 tabs are created.one for new user,existing user and an admin
    spec1.setContent(R.id.tab1);

    spec1.setIndicator("Sign in");
    th.addTab(spec1);

    TabSpec spec2 = th.newTabSpec("t2");
    spec2.setContent(R.id.tab2);
    spec2.setIndicator("sign up");
    th.addTab(spec2);

    TabSpec spec3 = th.newTabSpec("t3");
    spec3.setContent(R.id.tab3);
    spec3.setIndicator("Admin");
    th.addTab(spec3);
    Log.i("tag", "i should be here 1st");

    username =
        (EditText)
            findViewById(
                R.id.editText1); // getting the textbox values entered by the user on the mai page
    password = (EditText) findViewById(R.id.editText2); // id attribute is defined in the xml file
    signin = (Button) findViewById(R.id.button1);

    // event handler for click on the signin button
    signin.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v1) {
            // TODO Auto-generated method stub
            // Toast.makeText(this, "hello", 1000).show();
            uid = username.getText().toString();
            pass = password.getText().toString();
            // System.out.println("button");
            tno = "1"; // a unique identifier to differentiate the tabs on the main screen
            // check if the user has entered the credentials.display error if not.
            Log.i("tag", "i should be here 2nd");
            if (uid.equals("") || pass.equals("")) {
              Toast.makeText(getBaseContext(), "oops!you have not provided credentials", 1000000)
                  .show();
            } else {

              String[] params = new String[20];
              params[0] = tno;
              params[1] = uid;
              params[2] = pass;
              Networkclass netclass = new Networkclass(Userlogin.this);
              Log.i("tag", "i should be here middle"); // a new thread is created for
              // making the http connection to server
              // StringBuffer responseString = new StringBuffer("");
              netclass.execute(params);
              Log.i("tag", "i should be here 3rd");
              try {
                StringBuffer str = netclass.get();
                Log.i("tag", "i should be here 4th");
                String str1 = str.toString();
                Log.i("tag", "i should be here 5th");
                // check if the user has provided the valid credentials
                if (str1.equals("N")) {
                  Toast.makeText(getBaseContext(), "Invalid username/password", 1000000000).show();
                } else {
                  // if credentials are correct a new activity with a welcome page is created
                  Intent intent = new Intent(v1.getContext(), MenuActivity.class);
                  Bundle b = new Bundle();
                  b.putString("message", str1);
                  b.putString("sessionid", uid);
                  intent.putExtras(b);
                  // intent.putExtra("message", str1);
                  // intent.putExtra("sesionid", uid);
                  startActivityForResult(intent, 0);
                }
              } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (ExecutionException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });

    // this credentials are for the admin
    // get the credentials entered by the admin.(from an xml file)
    adminId = (EditText) findViewById(R.id.editText10);
    adminpass = (EditText) findViewById(R.id.editText11);
    signinadmin = (Button) findViewById(R.id.button4);

    // event handler for sign in button for admin
    signinadmin.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v1) {

            aid = adminId.getText().toString();
            apass = adminpass.getText().toString();
            tno = "2"; // a unique identifier to differentiate the tabs on the main screen
            // check if the admin has provided the valid credentials
            if (aid.equals("") || apass.equals("")) {
              Toast.makeText(getBaseContext(), "oops!you have not provided credentials", 10).show();
            } else {
              String[] params1 = new String[20];
              params1[0] = tno;
              params1[1] = aid;
              params1[2] = apass;

              Networkclass netclass =
                  new Networkclass(Userlogin.this); // async task for making http connections
              netclass.execute(params1);

              try {

                StringBuffer str = netclass.get();
                String str1 = str.toString();
                // transfer control to the next activity(welcome page for admin)
                Intent intent = new Intent(v1.getContext(), AdminloginActivity.class);
                Bundle b = new Bundle();
                b.putString("message", str1);
                b.putString("sessionid", aid);
                intent.putExtras(b);
                // intent.putExtra("message", str1);
                // intent.putExtra("sesionid", uid);
                startActivityForResult(intent, 0);
              } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (ExecutionException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });

    // get values from the user for new registration

    fname = (EditText) findViewById(R.id.editText3);
    email = (EditText) findViewById(R.id.editText4);
    address = (EditText) findViewById(R.id.editText5);
    phone = (EditText) findViewById(R.id.editText12);
    usname = (EditText) findViewById(R.id.username);
    npassword = (EditText) findViewById(R.id.editText6);
    con_password = (EditText) findViewById(R.id.editText8);
    signup = (Button) findViewById(R.id.button3);
    PopupWindow popup;
    TextView tv;
    Button bt;

    // event handler for the sign up button
    signup.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v1) {

            fnam = fname.getText().toString();
            e_mail = email.getText().toString();
            add = address.getText().toString();
            usname1 = usname.getText().toString();
            phone_num = phone.getText().toString();
            npass = npassword.getText().toString();
            cpass = con_password.getText().toString();

            tno = "3";

            if (!(npass.equals(cpass))) // check if password and confirm password matches
            {
              Toast.makeText(getBaseContext(), "password and confirm password does not match", 10)
                  .show();
            }
            // check if all the fields are entered
            if (fnam.equals("")
                || e_mail.equals("")
                || phone_num.equals("")
                || npass.equals("")
                || cpass.equals("")) {
              Toast.makeText(getBaseContext(), "You have not entered a mandatory value", 10).show();
            } else {
              String[] params2 = new String[20];
              params2[0] = tno;
              params2[1] = fnam;
              params2[2] = e_mail;
              params2[3] = add;
              params2[4] = phone_num;
              params2[5] = usname1;
              params2[6] = npass;
              // params2[7] = cpass;

              // call async task to make http connection to the server
              Networkclass_nuser netclass = new Networkclass_nuser(Userlogin.this);
              netclass.execute(params2);

              try {

                StringBuffer str = netclass.get();
                String str1 = str.toString();

                // popup message displaying the userid and an acknowledgement message
                AlertDialog.Builder alertbox = new AlertDialog.Builder(v1.getContext());
                alertbox.setMessage(str1);

                // add a neutral button to the alert box and assign a click listener
                alertbox.setNeutralButton(
                    "Ok",
                    new DialogInterface.OnClickListener() {

                      // click listener on the alert box
                      public void onClick(DialogInterface arg0, int arg1) {
                        // the button was clicked

                      }
                    });

                // show it
                alertbox.show();

              } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (ExecutionException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });
  }
  private void InitViews() {
    edSubject = (TouchEdit) findViewById(R.id.edAppointmentSubject);
    edSubject.setOnOpenKeyboard(
        new TouchEdit.OnOpenKeyboard() {
          public void OnOpenKeyboardEvent() {
            KeyboardWidget.Open(ActivityAppointment.this, edSubject.getText().toString());
          }
        });

    btnStartDate = (Button) findViewById(R.id.btnAppointmentStartDate);
    btnStartTime = (Button) findViewById(R.id.btnAppointmentStartTime);
    chkAllDay = (CheckBox) findViewById(R.id.chkAppointmentAllDay);
    chkAlarm = (CheckBox) findViewById(R.id.chkAppointmentAlarm);

    btnRepeatSelect = (Button) findViewById(R.id.btnRepeatSelect);
    btnRepeatSelect.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            OpenRepeatDialog();
          }
        });

    btnSave = (ImageButton) findViewById(R.id.btnAppointmentSave);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            SaveData();
          }
        });

    btnDelete = (ImageButton) findViewById(R.id.btnAppointmentDelete);
    btnDelete.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            DeleteData();
          }
        });

    btnStartDate.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            DateWidget.Open(ActivityAppointment.this, false, dateStart, prefs.iFirstDayOfWeek);
          }
        });

    btnStartTime.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {

            TimeWidget.Open(
                ActivityAppointment.this,
                false,
                prefs.b24HourMode,
                dateStart.get(Calendar.HOUR_OF_DAY),
                dateStart.get(Calendar.MINUTE));
          }
        });

    chkAllDay.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            UpdateStartDateTimeView();
          }
        });
  }
  public void showOrder(Order order) {
    currentOrder = order;
    valueList = currentOrder.getOrderValues();
    editFields = new ArrayList<EditText>();

    if (mainLayout != null) {

      Button saveButton = (Button) getActivity().findViewById(R.id.saveButton);
      saveButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              saveOrder(currentOrder);
              fragmentListener.saveOrderButtonClicked();
            }
          });

      CheckBox execStateCheckBox = (CheckBox) getActivity().findViewById(R.id.execStateCheckBox);
      execStateCheckBox.setChecked(currentOrder.getExecState());
      execStateCheckBox.setOnCheckedChangeListener(
          new CheckBox.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              currentOrder.setExecState(isChecked);
              valueList.put("execState", isChecked);
            }
          });

      EditText clientNameEdit = (EditText) mainLayout.findViewById(R.id.clientNameEdit);
      clientNameEdit.setOnKeyListener(onTextChanged);
      clientNameEdit.setOnFocusChangeListener(onFocusLost);
      clientNameEdit.setText(currentOrder.getClientName());
      clientNameEdit.setTag("clientName");
      editFields.add(clientNameEdit);

      EditText clientPhoneEdit = (EditText) mainLayout.findViewById(R.id.clientPhoneEdit);
      clientPhoneEdit.setOnKeyListener(onTextChanged);
      clientPhoneEdit.setOnFocusChangeListener(onFocusLost);
      clientPhoneEdit.setText(currentOrder.getClientPhone());
      clientPhoneEdit.setTag("clientPhone");
      editFields.add(clientPhoneEdit);

      EditText carMakerEdit = (EditText) mainLayout.findViewById(R.id.carMakerEdit);
      carMakerEdit.setOnKeyListener(onTextChanged);
      carMakerEdit.setOnFocusChangeListener(onFocusLost);
      carMakerEdit.setText(currentOrder.getCarMaker());
      carMakerEdit.setTag("carMaker");
      editFields.add(carMakerEdit);

      EditText colorCodeEdit = (EditText) mainLayout.findViewById(R.id.colorCodeEdit);
      colorCodeEdit.setOnKeyListener(onTextChanged);
      colorCodeEdit.setOnFocusChangeListener(onFocusLost);
      colorCodeEdit.setText(currentOrder.getColorCode());
      colorCodeEdit.setTag("colorCode");
      editFields.add(colorCodeEdit);

      EditText volumeBaseEdit = (EditText) mainLayout.findViewById(R.id.volumeBaseEdit);
      volumeBaseEdit.setOnKeyListener(onTextChanged);
      volumeBaseEdit.setOnFocusChangeListener(onFocusLost);
      volumeBaseEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeBaseEdit.setText(currentOrder.getVolumeBase().toString());
      volumeBaseEdit.setTag("volumeBase");
      editFields.add(volumeBaseEdit);

      EditText volumeAdditionEdit = (EditText) mainLayout.findViewById(R.id.volumeAdditionEdit);
      volumeAdditionEdit.setOnKeyListener(onTextChanged);
      volumeAdditionEdit.setOnFocusChangeListener(onFocusLost);
      volumeAdditionEdit.setFilters(new InputFilter[] {new RealNumberInputFilter()});
      volumeAdditionEdit.setText(currentOrder.getVolumeAddition().toString());
      volumeAdditionEdit.setTag("volumeAddition");
      editFields.add(volumeAdditionEdit);

      EditText orderDateEdit = (EditText) mainLayout.findViewById(R.id.orderDateEdit);
      orderDateEdit.setOnKeyListener(onTextChanged);
      orderDateEdit.setOnFocusChangeListener(onFocusLost);
      orderDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      orderDateEdit.setText(currentOrder.getOrderDate().toString());
      orderDateEdit.setTag("orderDate");
      editFields.add(orderDateEdit);

      EditText execDateEdit = (EditText) mainLayout.findViewById(R.id.execDateEdit);
      execDateEdit.setOnKeyListener(onTextChanged);
      execDateEdit.setOnFocusChangeListener(onFocusLost);
      execDateEdit.setFilters(new InputFilter[] {new DateInputFilter()});
      execDateEdit.setText(currentOrder.getExecDate().toString());
      execDateEdit.setTag("execDate");
      editFields.add(execDateEdit);

      NumberKeyListener realKeyListener =
          new NumberKeyListener() {
            @Override
            protected char[] getAcceptedChars() {
              return new char[] {'.', ',', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
            }

            @Override
            public int getInputType() {
              return TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL;
            }
          };
      volumeBaseEdit.setKeyListener(realKeyListener);
      volumeAdditionEdit.setKeyListener(realKeyListener);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.matchview);

    progressDialog = UIFactory.getDefaultProgressDialog(this);

    TextView nameField = (TextView) findViewById(R.id.nameField);
    TextView genderField = (TextView) findViewById(R.id.genderField);
    TextView ageField = (TextView) findViewById(R.id.ageField);
    ImageView avatarImage = (ImageView) findViewById(R.id.avatarImage);
    ImageView genderImage = (ImageView) findViewById(R.id.genderImage);
    matchPercentField = (TextView) findViewById(R.id.matchPercents);
    foodMatchValue = (TextView) findViewById(R.id.foodMatchValue);
    foodProgressBar = (ProgressBar) findViewById(R.id.foodProgressBar);
    musicMatchValue = (TextView) findViewById(R.id.musicMatchValue);
    musicProgressBar = (ProgressBar) findViewById(R.id.musicProgressBar);
    hobbiesMatchValue = (TextView) findViewById(R.id.hobbiesMatchValue);
    hobbiesProgressBar = (ProgressBar) findViewById(R.id.hobbiesProgressBar);
    travelMatchValue = (TextView) findViewById(R.id.travelMatchValue);
    travelProgressBar = (ProgressBar) findViewById(R.id.travelProgressBar);

    currentUserGeoPoint =
        (GeoPoint) getIntent().getSerializableExtra(Defaults.CURRENT_USER_GEO_POINT_BUNDLE_TAG);
    targetUserGeoPoint =
        (GeoPoint) getIntent().getSerializableExtra(Defaults.TARGET_USER_GEO_POINT_BUNDLE_TAG);
    triger = getIntent().getStringExtra(Defaults.TRIGER);

    String targetUserEmail = targetUserGeoPoint.getMetadata(BackendlessUser.EMAIL_KEY);
    targetUserName = targetUserGeoPoint.getMetadata(Defaults.NAME_PROPERTY);
    Gender targetUserGender =
        Gender.valueOf(targetUserGeoPoint.getMetadata(Defaults.GENDER_PROPERTY));
    targetUserDeviceRegistrationId =
        targetUserGeoPoint.getMetadata(Defaults.DEVICE_REGISTRATION_ID_PROPERTY);

    Date userBirthDate;
    try {
      userBirthDate =
          Defaults.DEFAULT_DATE_FORMATTER.parse(
              targetUserGeoPoint.getMetadata(Defaults.BIRTH_DATE_PROPERTY));
    } catch (ParseException e) {
      progressDialog.cancel();
      Log.logLine(e);

      return;
    }

    Button actionButton = (Button) findViewById(R.id.actionButton);

    if (!targetUserGeoPoint
            .getMetadata()
            .containsKey(Backendless.UserService.CurrentUser().getEmail())
        || !currentUserGeoPoint.getMetadata().containsKey(targetUserEmail)) {
      actionButton.setText(getResources().getText(R.string.button_match_ping));
      actionButton.setOnClickListener(pingUserListener);
    } else {
      actionButton.setText(getResources().getText(R.string.button_sendmessage));
      actionButton.setOnClickListener(sendMessageListener);
    }

    nameField.setText(targetUserName);
    genderField.setText(targetUserGender.name());

    if (targetUserGender == Gender.male) {
      avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_male));
      genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_male));
    } else {
      avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_female));
      genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_female));
    }

    ageField.setText(String.valueOf(SimpleMath.getAgeFromDate(userBirthDate)));

    // Food
    Map<String, String> metaDataFood = new HashMap<String, String>();
    metaDataFood.put("Asian", foodName);
    metaDataFood.put("Caribean", foodName);
    metaDataFood.put("Bar food", foodName);
    metaDataFood.put("French", foodName);
    metaDataFood.put("Mediterranean", foodName);
    metaDataFood.put("Greek", foodName);
    metaDataFood.put("Spanish", foodName);
    metaDataFood.put("Mexican", foodName);
    metaDataFood.put("Thai", foodName);
    int maxPoints = 10;
    BackendlessGeoQuery backendlessGeoQuery = new BackendlessGeoQuery(metaDataFood, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    food = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotFoodCallback);
    // Music
    Map<String, String> metaDataMusic = new HashMap<String, String>();
    metaDataMusic.put("Classical", musicName);
    metaDataMusic.put("Jazz", musicName);
    metaDataMusic.put("Hip-hop", musicName);
    metaDataMusic.put("Reggae", musicName);
    metaDataMusic.put("Blues", musicName);
    metaDataMusic.put("Trance", musicName);
    metaDataMusic.put("House", musicName);
    metaDataMusic.put("Rock", musicName);
    metaDataMusic.put("Folk", musicName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataMusic, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    music = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotMusicCallback);
    // Hobbies
    Map<String, String> metaDataHobbies = new HashMap<String, String>();
    metaDataHobbies.put("Fishing", hobbiesName);
    metaDataHobbies.put("Diving", hobbiesName);
    metaDataHobbies.put("Rock climbing", hobbiesName);
    metaDataHobbies.put("Hiking", hobbiesName);
    metaDataHobbies.put("Reading", hobbiesName);
    metaDataHobbies.put("Dancing", hobbiesName);
    metaDataHobbies.put("Cooking", hobbiesName);
    metaDataHobbies.put("Surfing", hobbiesName);
    metaDataHobbies.put("Photography", hobbiesName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataHobbies, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    hobbies = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotHobbiesCallback);
    // Travel
    Map<String, String> metaDataTravel = new HashMap<String, String>();
    metaDataTravel.put("Cruise", travelName);
    metaDataTravel.put("B&B", travelName);
    metaDataTravel.put("Europe", travelName);
    metaDataTravel.put("Asia", travelName);
    metaDataTravel.put("Caribean", travelName);
    metaDataTravel.put("Mountains", travelName);
    metaDataTravel.put("Whale watching", travelName);
    metaDataTravel.put("Active travel", travelName);
    metaDataTravel.put("Passive travel", travelName);
    backendlessGeoQuery = new BackendlessGeoQuery(metaDataTravel, maxPoints);
    backendlessGeoQuery.setPageSize(50);
    backendlessGeoQuery.setIncludeMeta(true);
    travel = false;
    Backendless.Geo.relativeFind(backendlessGeoQuery, gotTravelCallback);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // locks the screen in portrait mode
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.downloader);
    mtext = (TextView) findViewById(R.id.mtext);
    progress_text = (TextView) findViewById(R.id.progress_text);
    progress_download = (ProgressBar) findViewById(R.id.progress_download);
    // resume capability

    paused = false;
    resume_pause = (Button) findViewById(R.id.resume);

    // Create and launch the download thread
    downloadThread = new DownloadThread(this);
    downloadThread.start();

    // Create the Handler. It will implicitly bind to the Looper
    // that is internally created for this thread (since it is the UI thread)
    handler = new Handler();

    resume_pause.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            if (!paused) {
              paused = true;
              resume_pause.setText("Resume");
              // writeProgress(completed_downloads,total_files_to_download);
              downloadThread.requestStop();
              downloadThread = null;

            } else {
              resume_pause.setText("Pause");
              paused = false;

              initial_value = readProgress()[0];
              final_value = links.size();

              for (int i = initial_value; i < links.size(); i++) {
                downloadThread = new DownloadThread(download_photos.this);
                downloadThread.start();
                downloadThread.enqueueDownload(
                    new DownloadTask(
                        links.get(i), path, i + 1, links.size(), download_photos.this));
              }
            }
          }
        });

    // load preferences for this activity
    mPrefs = getSharedPreferences("COMMON", MODE_PRIVATE);

    // This declaration is solely meant for reading the checkbox preference for downloading high res
    // pics.
    SharedPreferences dl_prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    // The global variable is set after reading the  checkbox preference.
    dl_high_res_pics = dl_prefs.getBoolean("download_high_res", false);

    // load fb access token and its expiry values
    String access_token = mPrefs.getString("access_token", null);
    long expires = mPrefs.getLong("access_expires", 0);

    if (access_token != null) {
      facebook.setAccessToken(access_token);
    }
    if (expires != 0) {
      facebook.setAccessExpires(expires);
    }

    // get friend_name and album_name from the intent which started this activity
    Intent starting_intent = getIntent();
    album_id = starting_intent.getStringExtra("id");
    album_name = starting_intent.getStringExtra("name");
    friend_name = starting_intent.getStringExtra("friend_name");

    // real album and friend name may contain characters not suitable for file names.
    // regex pattern includes most of the invalid characters in file names
    legal_album_name = album_name.replaceAll("[.\\\\/:*?\"<>|]?[\\\\/:*?\"<>|]*", "");
    legal_friend_name = friend_name.replaceAll("[.\\\\/:*?\"<>|]?[\\\\/:*?\"<>|]*", "");

    // initialise the directory structure for download
    path =
        new File(
            Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
                + "/"
                + getText(R.string.app_name)
                + "/"
                + legal_friend_name
                + "/"
                + legal_album_name);
    if (dl_high_res_pics)
      path = new File(path.toString() + "/" + getText(R.string.folder_name_high_res));

    resume_file = new File(path, "resume.txt");
    // implements actions to done after receiving json object
    class meRequestListener extends BaseRequestListener {
      @Override
      public void onComplete(String response, Object state) {
        try {
          Log.i(TAG, response);
          json = Util.parseJson(response);

          // photos are in the form of a json array
          child = json.getJSONArray("data");

          int total = child.length();

          // contains links to photos
          links = new ArrayList<String>(total);

          // adds link to each photo to our list after replacing the "https" from url
          // DownloadManager does not support https in gingerbread
          for (int i = 0; i < total; i++) {
            photo_json = child.getJSONObject(i);

            if (dl_high_res_pics) {
              JSONArray image_set = photo_json.getJSONArray("images");

              // highest resolution picture has the index zero in the images jsonarray
              JSONObject highest_res_pic = image_set.getJSONObject(0);
              String http_replaced =
                  highest_res_pic.getString("source").replaceFirst("https", "http");
              links.add(i, http_replaced);
            } else {
              // source property of the json object points to the photo's link
              String http_replaced = photo_json.getString("source").replaceFirst("https", "http");
              links.add(i, http_replaced);
            }
          }

          download_photos.this.runOnUiThread(
              new Runnable() {
                public void run() {
                  //	mytask = new DownloadImageTask();
                  //	mytask.execute(links);
                  // start downloading using asynctask
                  // new DownloadImageTask().execute(links);
                  // downloadThread.setPath(path);
                  // downloadThread.setWholeTasks(links.size());
                  if (resume_file.exists()) {

                    initial_value = readProgress()[0];
                    final_value = links.size();
                    // case if the task is already completed
                    if (initial_value == final_value) {
                      completed = true;
                      resume_pause.setVisibility(View.GONE);

                      progress_download.setMax(final_value);
                      progress_download.setProgress(0); // bug in progress bar
                      progress_download.setProgress(initial_value);

                      progress_text.setText("Completed.");
                      mtext.setText(
                          getText(R.string.download_textview_message_1)
                              + " "
                              + path.toString()
                              + ". ");

                    }

                    // case if some of the photos are already downloaded
                    else {
                      progress_download.setMax(links.size());
                      // progress_download.setProgress(0);	//bug in progress bar
                      progress_download.setProgress(initial_value);

                      // N.B if i= initial_value -1, then one image will be downloaded again. so to
                      // save cost we start with i = initial_value
                      for (int i = initial_value; i < links.size(); i++) {
                        mtext.setText(
                            getText(R.string.download_textview_message_1)
                                + " "
                                + path.toString()
                                + ". ");
                        // downloadThread.setRunningTask(i + 1);
                        downloadThread.enqueueDownload(
                            new DownloadTask(
                                links.get(i), path, i + 1, final_value, download_photos.this));
                      }
                    }
                  }

                  // case if the task is entirely new task
                  else {
                    for (int i = 0; i < links.size(); i++) {
                      mtext.setText(
                          getText(R.string.download_textview_message_1)
                              + " "
                              + path.toString()
                              + ". ");
                      // downloadThread.setRunningTask(i + 1);
                      downloadThread.enqueueDownload(
                          new DownloadTask(
                              links.get(i), path, i + 1, links.size(), download_photos.this));
                    }
                  }
                }
              });
        } catch (JSONException ex) {
          Log.e(TAG, "JSONEXception : " + ex.getMessage());
        }
      }
    }

    // makes asynchronous request to facebook graph api
    // the actions to be performed after receiving json response is implemented above

    Bundle parameters = new Bundle();

    // facebook returns only 25 photos when limit is not specified.
    parameters.putString("limit", max_photos_in_album);
    if (!completed) mAsyncRunner.request(album_id + "/photos", parameters, new meRequestListener());

    if (!facebook.isSessionValid()) {
      facebook.authorize(
          this,
          permissions,
          new DialogListener() {

            // save fb access token and its expiry values to prefernces of this activity
            @Override
            public void onComplete(Bundle values) {
              SharedPreferences.Editor editor = mPrefs.edit();
              editor.putString("access_token", facebook.getAccessToken());
              editor.putLong("access_expires", facebook.getAccessExpires());
              editor.commit();
            }

            @Override
            public void onFacebookError(FacebookError error) {
              Log.e(TAG, "Facebook Error : " + error.getMessage());
            }

            @Override
            public void onError(DialogError e) {
              Log.e(TAG, e.getMessage());
            }

            @Override
            public void onCancel() {
              // do nothing LOL :-)
            }
          });
    }
  }