Ejemplo n.º 1
0
Archivo: Login.java Proyecto: xz58/tie
  // Implement the OnClickListener callback
  public void onClick(View v) {

    if (v.equals(btn_moods)) {
      // Switch to Moods activity
      // Intent myIntent = new Intent(v.getContext(), Moods.class);
      // startActivityForResult(myIntent, 0);
    } else if (v.equals(btn_friends)) {
      // Switch to Friends activity
      // Intent myIntent = new Intent(v.getContext(), Friends.class);
      // startActivityForResult(myIntent, 0);
    } else if (v.equals(btn_matching)) {
      // Switch to Matching activity
      // Intent myIntent = new Intent(v.getContext(), Matching.class);
      // startActivityForResult(myIntent, 0);
    } else if (v.equals(btn_logout)) {
      // Switch to Login activity
      // Intent myIntent = new Intent(v.getContext(), Login.class);
      // startActivityForResult(myIntent, 0);
    } else if (v.equals(btn_submit)) {
      // Login
      Master master = Master.instance();

      master.host = "http://app.limlabs.com/tie";
      master.uname = edt_uname.getText().toString();
      master.upass = edt_upass.getText().toString();
      if (master.login()) {
        // Switch to Moods activity
        Intent myIntent = new Intent(v.getContext(), Moods.class);
        startActivityForResult(myIntent, 0);
      }
    }
  }
 @Override
 public void onClick(View arg0) {
   // TODO Auto-generated method stub
   if (arg0.equals(btnSure)) {
     if (etPasswd.getText().toString().trim().equals("666666")) {
       ly.removeAllViews();
       ly.addView(view);
       bPasswdOk = true;
     } else {
       AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
       b.setMessage(R.string.passwd_error);
       b.setPositiveButton(R.string.btn_sure, null);
       b.show();
     }
   } else if (arg0.equals(btnSaveIP)) {
     editor.putString(CONTROLLER_10_IP, etController10IP.getText().toString().trim());
     editor.putString(CONTROLLER_9_IP, etController9IP.getText().toString().trim());
     editor.putString(CONTROLLER_8_IP, etController8IP.getText().toString().trim());
     editor.putString(CONTROLLER_7_IP, etController7IP.getText().toString().trim());
     editor.putString(CONTROLLER_6_IP, etController6IP.getText().toString().trim());
     editor.putString(CONTROLLER_5_IP, etController5IP.getText().toString().trim());
     editor.putString(CONTROLLER_4_IP, etController4IP.getText().toString().trim());
     editor.putString(CONTROLLER_3_IP, etController3IP.getText().toString().trim());
     editor.putString(CONTROLLER_2_IP, etController2IP.getText().toString().trim());
     editor.putString(CONTROLLER_1_IP, etController1IP.getText().toString().trim());
     editor.commit();
     AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
     b.setMessage(R.string.save_ok);
     b.setPositiveButton(R.string.btn_sure, null);
     b.show();
   }
 }
 @Override
 public void onClick(View v) {
   if (v.equals(mUndoBtn)) {
     mSCanvas.undo();
   } else if (v.equals(mRedoBtn)) {
     mSCanvas.redo();
   }
 }
 public void onClick(View view) {
   if (view.equals(cancelButton)) {
     dismiss();
   }
   if (view.equals(okButton)) {
     new CompatibleFileOpen(mContext, fileType, filePath, fileName);
     dismiss();
   }
 }
 @Override
 public void onClick(View view) {
   if (view.equals(plusButton)) {
     callBack.journalMenuClicked(PLUS);
   } else if (view.equals(removeButton)) {
     callBack.journalMenuClicked(REMOVE);
   } else if (view.equals(editButton)) {
     callBack.journalMenuClicked(EDIT);
   }
 }
 @Override
 public void onClick(View v) {
   if (v.equals(mUndoBtn)) {
     mSCanvas.undo();
   } else if (v.equals(mRedoBtn)) {
     mSCanvas.redo();
   }
   mUndoBtn.setEnabled(mSCanvas.isUndoable());
   mRedoBtn.setEnabled(mSCanvas.isRedoable());
 }
Ejemplo n.º 7
0
 @Override
 public void onClick(final View v) {
   if (v.equals(btnToggle)) {
     if (gifImageView.isAnimating()) gifImageView.stopAnimation();
     else gifImageView.startAnimation();
   } else if (v.equals(btnBlur)) {
     shouldBlur = !shouldBlur;
   } else {
     gifImageView.clear();
   }
 }
Ejemplo n.º 8
0
 @Override
 public void onClick(View v) {
   if (v.equals(btn1)) {
     showLayout(PAGE_LAYOUT_1);
   } else if (v.equals(btn2)) {
     showLayout(PAGE_LAYOUT_2);
   } else if (v.equals(btn3)) {
     showLayout(PAGE_LAYOUT_3);
   } else if (v.equals(btn4)) {
     showLayout(PAGE_LAYOUT_4);
   }
 }
Ejemplo n.º 9
0
  public void onClick(View v) {
    if (v.equals(llTitle.getBtnBack())) {
      Platform plat = null;
      for (int i = 0; i < views.length; i++) {
        if (views[i].getVisibility() == View.INVISIBLE) {
          plat = platformList[i];
          break;
        }
      }

      // a statistics of Cancel-sharing
      if (plat != null) {
        ShareSDK.logDemoEvent(5, plat);
      }
      finish();
      return;
    }

    if (v.equals(llTitle.getBtnRight())) {
      String text = etContent.getText().toString();
      shareParamMap.put("text", text);

      platforms.clear();
      for (int i = 0; i < views.length; i++) {
        if (views[i].getVisibility() != View.VISIBLE) {
          platforms.add(platformList[i]);
        }
      }

      if (platforms.size() > 0) {
        setResultAndFinish();
      } else {
        int resId = getStringRes(activity, "select_one_plat_at_least");
        if (resId > 0) {
          Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
        }
      }
      return;
    }

    if (v instanceof FrameLayout) {
      ((FrameLayout) v).getChildAt(1).performClick();
      return;
    }

    if (v.getVisibility() == View.INVISIBLE) {
      v.setVisibility(View.VISIBLE);
    } else {
      v.setVisibility(View.INVISIBLE);
    }
  }
Ejemplo n.º 10
0
 @Override
 public void onClick(View v) {
   if (v.equals(ivStart)) {
     start();
     return;
   }
   if (v.equals(ivStop)) {
     stop();
     return;
   }
   if (v.equals(ivPause)) {
     pause();
     return;
   }
 }
Ejemplo n.º 11
0
 @Override
 public void onClick(View v) {
   if (v.equals(okButton)) {
     String code = codeField.getText().toString();
     HashMap<String, String> dataMap = new HashMap<String, String>();
     dataMap.put("special_code", code);
     dataMap.put("facebook_id", app.getFacebookId());
     String postData = NetworkUtil.createPostData(dataMap);
     NetworkThreadUtil.getRawData(
         app.getConfig().get(USE_SPECIAL_CODE_URL).toString(), postData, this);
   } else if (v.equals(cancelButton)) {
     this.setResult(Activity.RESULT_CANCELED);
     this.finish();
   }
 }
Ejemplo n.º 12
0
  private void findOccupiedCells(int xCount, int yCount, boolean[][] occupied, View ignoreView) {
    for (int x = 0; x < xCount; x++) {
      for (int y = 0; y < yCount; y++) {
        occupied[x][y] = false;
      }
    }

    int count = getChildCount();
    for (int i = 0; i < count; i++) {
      View child = getChildAt(i);
      if (child.equals(ignoreView)) {
        continue;
      }
      /*  if (child instanceof Folder || child.equals(ignoreView)) {
          continue;
      }*/
      // folder编译不过
      LayoutParams lp = (LayoutParams) child.getLayoutParams();

      for (int x = lp.cellX; x < lp.cellX + lp.cellHSpan && x < xCount; x++) {
        for (int y = lp.cellY; y < lp.cellY + lp.cellVSpan && y < yCount; y++) {
          occupied[x][y] = true;
        }
      }
    }
  }
  /*
   * Adjust visibility and size to make it appear as though an item is being
   * dragged around and other items are making room for it: If dropping the
   * item would result in it still being in the same place, then make the
   * dragged listitem's size normal, but make the item invisible. Otherwise,
   * if the dragged listitem is still on screen, make it as small as possible
   * and expand the item below the insert point. If the dragged item is not on
   * screen, only expand the item below the current insertpoint.
   */
  private void doExpansion() {
    int childnum = mDragPos - getFirstVisiblePosition();
    if (mDragPos > mFirstDragPos) {
      childnum++;
    }

    View first = getChildAt(mFirstDragPos - getFirstVisiblePosition());

    for (int i = 0; ; i++) {
      View vv = getChildAt(i);
      if (vv == null) {
        break;
      }
      int height = mItemHeightNormal;
      int visibility = View.VISIBLE;
      if (vv.equals(first)) {
        // processing the item that is being dragged
        if (mDragPos == mFirstDragPos) {
          // hovering over the original location
          visibility = View.INVISIBLE;
        } else {
          // not hovering over it
          height = 1;
        }
      } else if (i == childnum) {
        if (mDragPos < getCount() - 1) {
          height = mItemHeightExpanded;
        }
      }
      ViewGroup.LayoutParams params = vv.getLayoutParams();
      params.height = height;
      vv.setLayoutParams(params);
      vv.setVisibility(visibility);
    }
  }
Ejemplo n.º 14
0
 @Override
 public void onClick(View v) {
   if (v.equals(holder.getBtnAddGroup())) {
     AddGroup addGroup = new AddGroup();
     addGroup.show(getFragmentManager(), getTag());
   }
 }
Ejemplo n.º 15
0
 @Override
 public void onClick(View view) {
   if (view.equals(btnLogin)) {
     LoginService loginService = new LoginService(getApplicationContext(), Constants.URL_LOGIN);
     loginService.execute("", login.getText().toString(), password.getText().toString());
   }
 }
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   if (v.equals(headerView)) {
     headerView.showProgress();
     loadNewerTweets();
   } else if (v.equals(footerView)) {
     footerView.showProgress();
     loadOlderTweets();
   } else {
     // Watch out! Doesn't account for header/footer! -> Status status = adapter.getItem(position);
     Status status = (Status) getListView().getItemAtPosition(position);
     Intent intent = new Intent(this, StatusDetailActivity.class);
     intent.putExtra(StatusDetailActivity.STATUS, status);
     startActivity(intent);
   }
 }
Ejemplo n.º 17
0
  /**
   * Waits for a given view.
   *
   * @param view the view to wait for
   * @param timeout the amount of time in milliseconds to wait
   * @param scroll {@code true} if scrolling should be performed
   * @param checkIsShown {@code true} if view.isShown() should be used
   * @return {@code true} if view is shown and {@code false} if it is not shown before the timeout
   */
  public View waitForView(View view, int timeout, boolean scroll, boolean checkIsShown) {
    long endTime = SystemClock.uptimeMillis() + timeout;
    int retry = 0;

    if (view == null) return null;

    while (SystemClock.uptimeMillis() < endTime) {

      final boolean foundAnyMatchingView = searcher.searchFor(view);

      if (checkIsShown && foundAnyMatchingView && !view.isShown()) {
        sleeper.sleepMini();
        retry++;

        View identicalView = viewFetcher.getIdenticalView(view);
        if (identicalView != null && !view.equals(identicalView)) {
          view = identicalView;
        }

        if (retry > 5) {
          return view;
        }
        continue;
      }

      if (foundAnyMatchingView) {
        return view;
      }

      if (scroll) scroller.scrollDown();

      sleeper.sleep();
    }
    return view;
  }
  /* Adjust visibility and size to make it appear as though
   * an item is being dragged around and other items are making
   * room for it:
   * If dropping the item would result in it still being in the
   * same place, then make the dragged listitem's size normal,
   * but make the item invisible.
   * Otherwise, if the dragged listitem is still on screen, make
   * it as small as possible and expand the item below the insert
   * point.
   * If the dragged item is not on screen, only expand the item
   * below the current insertpoint.
   */
  private void doExpansion() {
    int childnum = mDragPos - getFirstVisiblePosition();
    if (mDragPos > mSrcDragPos) {
      childnum++;
    }
    int numheaders = getHeaderViewsCount();

    View first = getChildAt(mSrcDragPos - getFirstVisiblePosition());
    for (int i = 0; ; i++) {
      View vv = getChildAt(i);
      if (vv == null) {
        break;
      }

      int height = mItemHeightNormal;
      int visibility = View.VISIBLE;
      if (mDragPos < numheaders && i == numheaders) {
        // dragging on top of the header item, so adjust the item below
        // instead
        if (vv.equals(first)) {
          visibility = View.INVISIBLE;
        } else {
          height = mItemHeightExpanded;
        }
      } else if (vv.equals(first)) {
        // processing the item that is being dragged
        if (mDragPos == mSrcDragPos || getPositionForView(vv) == getCount() - 1) {
          // hovering over the original location
          visibility = View.INVISIBLE;
        } else {
          // not hovering over it
          // Ideally the item would be completely gone, but neither
          // setting its size to 0 nor settings visibility to GONE
          // has the desired effect.
          height = 1;
        }
      } else if (i == childnum) {
        if (mDragPos >= numheaders && mDragPos < getCount() - 1) {
          height = mItemHeightExpanded;
        }
      }
      ViewGroup.LayoutParams params = vv.getLayoutParams();
      params.height = height;
      vv.setLayoutParams(params);
      vv.setVisibility(visibility);
    }
  }
  @Override
  public void onClick(View view) {
    if (view.equals(Register)) {
      try {

        if (Email.getText().length() < 1
            || Password.getText().length() < 1
            || Name.getText().length() < 1) {
          // Did not enter email address or password
          registerFailed.setText("Enter your name, email address and password");
          registerFailed.setTextColor(Color.BLUE);
          Email.requestFocus();

        } else if (!Password.getText().toString().equals(ConfirmPassword.getText().toString())) {
          registerFailed.setText("The password entered does not match ");
          registerFailed.setTextColor(Color.BLUE);
          Password.requestFocus();

        } else {
          // Now go and login async
          new RegisterNow()
              .execute(
                  Name.getText().toString(),
                  Email.getText().toString(),
                  Password.getText().toString());
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else if (view.equals(Clear)) {
      registerFailed.setText("");
      Name.setText("");
      Email.setText("");
      Password.setText("");
      ConfirmPassword.setText("");

    } else if (view.equals(Name)) {

      Name.setText("");

    } else if (view.equals(btnBack)) {

      CloseFragment();
    }
    // Do something
  }
 @Override
 public void onClick(View v) {
   if (v.equals(load)) {
     toView();
   } else {
     toPreference();
   }
 }
        @Override
        public void onClick(View v) {
          if (v.equals(mDoneBtn)) {

            File file = saveCanvasImage();
            if (file != null) {
              Intent attachIntent = new Intent();
              attachIntent.setData(Uri.fromFile(file));
              setResult(RESULT_OK, attachIntent);

              finish();
            }

          } else if (v.equals(mCancelBtn)) {
            finish();
          }
        }
 @Override
 public void onClick(View v) {
   if (v.equals(mColorPickerBtn)) {
     // Toggle
     boolean bIsColorPickerMode = !mSCanvas.isColorPickerMode();
     mSCanvas.setColorPickerMode(bIsColorPickerMode);
     mColorPickerBtn.setSelected(bIsColorPickerMode);
   }
 }
Ejemplo n.º 23
0
 public void onClick(View paramView) {
   if (MallHotPromoAgent.this.mHotPromoList != null) {
     paramView = MallHotPromoAgent.this.mHotPromoList.getString("Url");
     if ((paramView != null) && (!paramView.equals(""))) {
       Intent localIntent = new Intent("android.intent.action.VIEW");
       localIntent.setData(Uri.parse(paramView));
       MallHotPromoAgent.this.startActivity(localIntent);
     }
   }
 }
Ejemplo n.º 24
0
 private void ensureTarget() {
   if (this.mTarget == null)
     for (int i = 0; i < getChildCount(); i++) {
       View child = getChildAt(i);
       if (!child.equals(this.mCircleView)) {
         this.mTarget = child;
         break;
       }
     }
 }
Ejemplo n.º 25
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
   if (v.equals(findViewById(R.id.phone_main))) {
     menu.clear();
     int pos = 0;
     for (String title : getHomeFragment().getAdapter().getTitles()) {
       menu.add(MAIN_ACTIVITY_CONTEXT_GROUP, pos++, (pos - 1), title);
     }
   }
 }
 @Override
 public void onClick(View v) {
   if (v.equals(statusImage)) {
     if (!binder.isServerUp()) {
       binder.startServer();
     } else {
       binder.stopServer();
     }
   }
 }
Ejemplo n.º 27
0
 public void onClick(View view) {
   if (view.equals(takePhotoButton)) {
     dismiss();
     if (messageController == null) fileActionDialog._documentActionAdapter.initCamera();
     else messageController.initCamera();
   }
   // Start the native album photo
   if (view.equals(libraryButton)) {
     dismiss();
     Intent intent =
         new Intent(
             Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
     intent.setType(ExoConstants.PHOTO_ALBUM_IMAGE_TYPE);
     mContext.startActivityForResult(intent, ExoConstants.REQUEST_ADD_PHOTO);
   }
   if (view.equals(cancelButton)) {
     dismiss();
   }
 }
Ejemplo n.º 28
0
  public void onClick(View view) {
    if (view.equals(btnSwitch)) {
      // Get index of selected item in the "to" Spinner,
      // set it as the index in the "from" Spinner
      // and visa versa.
      int iTo = cmbBoxTo.getSelectedItemPosition();
      int iFrom = cmbBoxFrom.getSelectedItemPosition();
      cmbBoxTo.setSelection(iFrom, true);
      cmbBoxFrom.setSelection(iTo, true);
    } else if (view.equals(btnSpeech)) {
      startVoiceRecognitionActivity();
    } else if (view.equals(btnTranslate)) {
      try {
        String translatedText = "";
        String to;
        String from;

        // Set Language objects by inspecting strings selected in Spinners
        to = LanguageValidator.getLanguageString(cmbBoxTo.getSelectedItem().toString());
        from = LanguageValidator.getLanguageString(cmbBoxFrom.getSelectedItem().toString());

        // Call API function to translate text
        translatedText =
            LanguageValidator.translateString(from, to, txtBoxInput.getText().toString());

        // Display
        Intent intent = new Intent(this, TranslatedItemView.class);
        intent.putExtra("origText", txtBoxInput.getText().toString());
        intent.putExtra("transText", translatedText);
        intent.putExtra("langFrom", cmbBoxFrom.getSelectedItem().toString());
        intent.putExtra("langTo", cmbBoxTo.getSelectedItem().toString());
        intent.putExtra("version", "new");
        startActivity(intent);
      } catch (Exception e) {
        Toast.makeText(
            this.getApplicationContext(),
            "Could not run translation.  See log.",
            Toast.LENGTH_LONG);
        Log.e("failed translation", e.getMessage());
      }
    }
  }
 public void onClick(View v) {
   if (v.equals(mChecked)) {
     long value = mChecked.isChecked() == true ? 0xFFFFFFFFL : 0;
     mBtTest = new BtTest();
     mBtTest.setFWDump(value);
     // SystemProperties.set(KEY_DEBUG_FEATURE, Long.toString(value));
     Toast.makeText(this, "The change will be valid after you restart phone", Toast.LENGTH_LONG)
         .show();
     Xlog.v(TAG, "DebugFeature isChecked--" + mChecked.isChecked());
   }
 }
Ejemplo n.º 30
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   if (v.equals(getListView())) {
     AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
     menu.setHeaderTitle(((User) getListAdapter().getItem(info.position)).getName());
     String[] menuItems = getResources().getStringArray(R.array.katmenu);
     for (int i = 0; i < menuItems.length; i++) {
       menu.add(Menu.NONE, i, i, menuItems[i]);
     }
   }
 }