Exemple #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    mShort = (EditText) findViewById(R.id.short_et);
    mLong = (EditText) findViewById(R.id.long_et);
    mSaveButton = (Button) findViewById(R.id.save_item_button);

    mSaveButton.setOnClickListener(this);
    setupToolbar(toolbar);

    // получили переданное значение
    mode = getIntent().getIntExtra(ConstantManager.MODE_RECORD, -1);
    if ((mode == ConstantManager.MODE_EDIT_RECORD) || (mode == ConstantManager.MODE_VIEW_RECORD)) {
      mShort.setText(getIntent().getStringExtra(ConstantManager.RECORD_HEADER));
      mLong.setText(getIntent().getStringExtra(ConstantManager.RECORD_BODY));
      mRecID = getIntent().getIntExtra(ConstantManager.RECORD_ID, -1);
    }
    if (mode == ConstantManager.MODE_VIEW_RECORD) {
      mShort.setFocusable(false);
      mShort.setLongClickable(false);
      mShort.setCursorVisible(false);
      mLong.setFocusable(false);
      mLong.setLongClickable(false);
      mLong.setCursorVisible(false);
      mSaveButton.setText(R.string.close_button_txt);
    }
  }
 private boolean isValidInput() {
   if (TextUtils.isEmpty(usernameEditText.getText().toString().trim())) {
     usernameEditText.setFocusable(true);
     usernameEditText.setCursorVisible(true);
     usernameEditText.setError(getString(R.string.empty_username_txt));
     return false;
   }
   if (TextUtils.isEmpty(passwordEditText.getText().toString().trim())) {
     passwordEditText.setFocusable(true);
     passwordEditText.setCursorVisible(true);
     passwordEditText.setError(getString(R.string.empty_password_txt));
     return false;
   }
   return true;
 }
Exemple #3
0
 @Override
 public void onClick(View v) {
   int viewId = v.getId();
   if (viewId == R.id.opendrawer_or_back) {
     if (isBackBtnAsDrawer) {
       ((IDrawerView) mMapsFragment).openDrawer();
       return;
     }
     if (getOnlySearchBox()) {
       showOnlySearchBox();
     } else {
       finish();
     }
   } else if (viewId == R.id.edit_text_clear) {
     // 只有mSearchResultContainer不可见时允许回调
     if (!isResultContainerVisible()) {
       mMapsFragment.onClearSearchText();
     }
     mSearchEditText.setText("");
   } else if (viewId == R.id.search_edittext) {
     if (isResultContainerVisible()) return;
     mSearchEditText.setCursorVisible(true);
     mMapsFragment.setMapViewVisibility(View.INVISIBLE);
     setResultContainerVisible(true);
     isBackBtnAsDrawer = false;
     mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back));
   } else if (viewId == R.id.search_choose_on_map) {
     ChooseOnMap chooseOnMap = new ChooseOnMap(mMapsFragment);
     startLiteFragmentForResult(SEARCHBOX_REQUEST_CODE, chooseOnMap, null);
   } else if (viewId == R.id.choose_from_favorites) {
     Favorites favorites = new Favorites(mMapsFragment);
     startLiteFragmentForResult(SEARCHBOX_REQUEST_CODE, favorites, null);
   }
 }
Exemple #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pie_chart);
    // getActionBar().setDisplayHomeAsUpEnabled(true);

    final Context mContext = this;
    mRenderer.setApplyBackgroundColor(true);
    // mRenderer.setBackgroundColor(Color.argb(100, 80, 80, 50));
    mRenderer.setChartTitleTextSize(15);
    mRenderer.setLabelsTextSize(20);
    mRenderer.setLabelsColor(color.black);
    mRenderer.setDisplayValues(true);
    mRenderer.setLabelsColor(Color.BLACK);
    mRenderer.setLegendTextSize(20);
    mRenderer.setShowLabels(true);
    mRenderer.setMargins(new int[] {20, 30, 15, 0});
    mRenderer.setZoomButtonsVisible(true);
    mRenderer.setStartAngle(180);

    Calendar d = new GregorianCalendar();

    int yr = d.get(Calendar.YEAR);

    if (yr > 99) {
      mdate = d.get(Calendar.DATE) + "/" + d.get(Calendar.MONTH) + "/20" + (yr % 100);
    } else {
      mdate = d.get(Calendar.DATE) + "/" + d.get(Calendar.DAY_OF_MONTH) + "/19" + (yr % 100);
    }
    System.out.println("date is " + mdate);
    drawPieForSpecificDate();
    editText_specificDate = (EditText) this.findViewById(R.id.editText_specificDate);
    editText_specificDate.setCursorVisible(false);
    editText_specificDate.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // custom dialog
            flag = 1;

            final Calendar c = Calendar.getInstance();
            year = c.get(Calendar.YEAR);
            month = c.get(Calendar.MONTH);
            day = c.get(Calendar.DAY_OF_MONTH);
            DatePickerDialog datePickerDialog =
                new DatePickerDialog(mContext, PieChart_lower.this, year, month, day);

            datePickerDialog.show();
            flag = 1;
          }
        }); // button_specificDate setListener

    if (flag == 1) drawPieForSpecificDate();

    Button button_specificMonth = (Button) this.findViewById(R.id.button_specificMonth);
    alert = new AlertDialog.Builder(this);

    button_specificMonth.setVisibility(View.GONE);
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    numEditText.setCursorVisible(false);
    numEditText.setFocusableInTouchMode(false);
    numEditText.clearFocus();
    String num = numEditText.getText().toString();
    if (TextUtils.isEmpty(num.trim())) {
      Toast.makeText(getActivity(), "号码不能为空", 0).show();
      return;
    }
    if (!checkNumber(num)) {
      Toast.makeText(getActivity(), "号码格式不正确!", 0).show();
      return;
    }
    if (!CommonUtil.checkNetState(getActivity())) {
      Toast.makeText(getActivity(), "对不起,您的网络不可用....", 0).show();
      return;
    }
    if (address == null) {
      getAddressFromServer(num.trim());
      Toast.makeText(getActivity(), "稍等,正在获取号码归属地......", 0).show();
      return;
    }
    view.setBackgroundColor(Color.YELLOW);
    ImageView selectedImageView =
        (ImageView) view.findViewById(R.id.recharge_gridview_item_im_selected);
    TextView cardTextView = (TextView) view.findViewById(R.id.recharge_gridview_item_tv);
    card = cardTextView.getText().toString();
    selectedImageView.setVisibility(View.VISIBLE);
    int childSize = rechargeItmes.getChildCount();
    for (int i = 0; i < childSize; i++) {
      View child = rechargeItmes.getChildAt(i);
      if (!(child != null && child == view)) {
        child.setBackgroundColor(Color.WHITE);
        ImageView selected =
            (ImageView) child.findViewById(R.id.recharge_gridview_item_im_selected);
        selected.setVisibility(View.GONE);
      }
    }
    // q = 归属地 +card;

    String subaddress = address.substring(0, 3);
    String mobile = "";
    if (address.contains("电信")) {
      mobile = "电信";
    }
    if (address.contains("移动")) {
      mobile = "移动";
    }
    if (address.contains("联通")) {
      mobile = "联通";
    }
    q = subaddress + mobile + " 充值" + " " + card;
    String sort = "price_asc";
    if (resultMap == null || resultMap.get(q) == null) {
      seachTaobaokeFromKeyWord(q, sort, true, false, 1);
    }
  }
Exemple #6
0
 private void showOnlySearchBox() {
   setResultContainerVisible(false);
   CommonUtils.hideKeyboard(mSearchEditText);
   mMapsFragment.setMapViewVisibility(View.VISIBLE);
   if (getBackBtnAsDrawer()) {
     isBackBtnAsDrawer = true;
     mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_menu));
   } else {
     isBackBtnAsDrawer = false;
     mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back));
   }
   mSearchEditText.setCursorVisible(false);
 }
Exemple #7
0
  @Override
  protected void onStart() {
    super.onStart();
    if (hasResult()) {
      finish();
      return;
    }

    hidePoiWithoutLoc = getHidePoiWithoutLoc();
    if (getOnlySearchBox()) {
      setSearchBoxVisible(true);
      mSearchEditText.setCursorVisible(false);
      mMapsFragment.setMapViewVisibility(View.VISIBLE);
    } else {
      mMapsFragment.setMapViewVisibility(View.INVISIBLE);
      setSearchBoxVisible(true);
      setResultContainerVisible(true);
      mSearchEditText.setCursorVisible(true);

      ((IDrawerView) mMapsFragment).enableDrawer(false);
    }
    if (getBackBtnAsDrawer()) {
      isBackBtnAsDrawer = true;
      mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_menu));
    } else {
      isBackBtnAsDrawer = false;
      mBackBtn.setImageDrawable(getContext().getDrawable(R.drawable.ic_arrow_back));
    }
    if (getChooseOnMap()) {
      mChooseOnMapBtn.setVisibility(View.VISIBLE);
    } else {
      mChooseOnMapBtn.setVisibility(View.GONE);
    }
    if (getChooseFromFav()) {
      mChooseFromFavBtn.setVisibility(View.VISIBLE);
    } else {
      mChooseFromFavBtn.setVisibility(View.GONE);
    }
  }
Exemple #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setContentView(R.layout.tget); // Layouts xmls exist for both landscape or portrait modes

    Intent intent = getIntent();
    String title = intent.getStringExtra(TITLE);
    if (title != null) setTitle(title);
    ArrayList<String> consoleText = intent.getStringArrayListExtra(CONSOLE_TEXT);
    if (theText == null) theText = "";

    lockReleased = false;

    theTextView = (EditText) findViewById(R.id.the_text); // The text display area

    int count = consoleText.size();
    for (int i = 0; i < count; ++i) {
      theText = theText + consoleText.get(i) + '\n';
    }

    theText = theText + Run.TextInputString;
    PromptIndex = theText.length();

    theTextView.setText(theText); // The Editor's display text
    theTextView.setTypeface(Typeface.MONOSPACE);
    theTextView.setSelection(theText.length());

    Basic.TextStyle style = Basic.defaultTextStyle; // Get text color from Settings
    theTextView.setTextColor(style.mTextColor);
    theTextView.setBackgroundColor(style.mBackgroundColor);
    theTextView.setCursorVisible(true);

    theTextView.setTextSize(1, Settings.getFont(this));

    theTextView.addTextChangedListener(inputTextWatcher);

    theTextView.setOnKeyListener(
        new OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            // If the event is a key-down event on the "enter" button
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && (keyCode == KeyEvent.KEYCODE_ENTER)) {
              handleEOL();
              return true;
            }
            return false;
          }
        });
  }
  // disable edittext fields editable after updating the profile
  public void setEditableOff(EditText et) {
    et.setLongClickable(false);
    et.setClickable(false);
    et.setCursorVisible(false);
    et.setTextColor(Color.parseColor("#000000"));
    et.setFocusable(false);
    et.setClickable(false);
    et.setEnabled(false);
    et.setFocusable(false);
    et.setFocusableInTouchMode(false);
    et.setBackgroundColor(Color.parseColor("#FEFEEB"));
    et.requestFocus();

    findViewById(R.id.labelSection).setLayoutParams(new LinearLayout.LayoutParams(0, 0, 0f));
    findViewById(R.id.editSection)
        .setLayoutParams(
            new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 0.7f));
  }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle SavedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_new_photo, parent, false);
    header = (ViewGroup) inflater.inflate(R.layout.item_header, postHashtags, false);

    photoFile = null;
    videoFile = null;

    postHashtags = (ListView) v.findViewById(R.id.post_hashtags);

    postTags = (RelativeLayout) v.findViewById(R.id.post_tags);
    postVisual = (RelativeLayout) v.findViewById(R.id.post_visual);
    postImage = (ImageView) v.findViewById(R.id.post_image);
    postDeny = (ImageButton) v.findViewById(R.id.post_deny);
    postAccept = (ImageButton) v.findViewById(R.id.post_accept);

    adapter =
        new PostAdapter<String>(
            getActivity().getApplicationContext(),
            R.layout.item_list_hashtags,
            R.id.text1,
            hashtags,
            this);
    try {
      postHashtags.addHeaderView(header, null, false);
    } catch (Exception e) {
    }
    postHashtags.setAdapter(adapter);

    adapter.notifyDataSetChanged();

    cautionHeader = (LinearLayout) header.findViewById(R.id.post_caution_container);
    cautionHeader.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            removeAllBadHashtags();
          }
        });

    int[] rainbow =
        getActivity().getApplicationContext().getResources().getIntArray(R.array.colorPicker);
    Random rn = new Random();
    int picker = rn.nextInt(rainbow.length);

    /**
     * suggestedHeader = (RelativeLayout) header.findViewById(R.id.post_suggested);
     * suggestedHeader.setBackgroundColor(rainbow[rn.nextInt(rainbow.length)]);
     * suggestedHeader.setOnClickListener(new View.OnClickListener() { @Override public void
     * onClick(View v) {
     *
     * <p>hideKeyboard(); mCallback.onSuggestions(); } });*
     */

    // yep
    // Accept or deny photo
    Drawable dDeny = getResources().getDrawable(R.drawable.icon_exit_c);
    dDeny.setColorFilter(rainbow[picker], PorterDuff.Mode.SRC_ATOP);
    postDeny.setImageDrawable(dDeny);
    postDeny.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {

            mCallback.onTransitionFromPostion(getArguments().getBoolean("from_camera", true));
            photoFile = null;
            videoFile = null;
          }
        });

    Drawable dAccept = getResources().getDrawable(R.drawable.icon_checkmark_c);
    dAccept.setColorFilter(rainbow[picker], PorterDuff.Mode.SRC_ATOP);
    postAccept.setImageDrawable(dAccept);
    postAccept.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {

            Bitmap data = getArguments().getParcelable("image");
            String videoPath = getArguments().getString("video", null);
            if (data != null) {
              saveScaledPhoto(data, videoPath);
              hideImage();
            }
          }
        });

    postCancel = (Button) v.findViewById(R.id.post_cancel);
    postCancel.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            showImage();
          }
        });

    // Hashtags
    postText = ((EditText) v.findViewById(R.id.post_text));
    postText.setBackgroundColor(rainbow[picker]);
    postText.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void afterTextChanged(Editable s) {

            if (postText.length() > 0 && s.toString().contains(" ")) {
              String hashing = String.valueOf(postText.getText());
              postText.setText("");
              checkHashtag(hashing);
            }
          }
        });
    postText.setOnEditorActionListener(
        new EditText.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
              if (postText.length() > 0) {
                String hashing = String.valueOf(postText.getText());
                postText.setText("");
                checkHashtag(hashing);
                return true;
              }
            }
            return false;
          }
        });

    postText.setFocusableInTouchMode(true);
    postText.requestFocus();
    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(postText, InputMethodManager.SHOW_IMPLICIT);
    postText.setCursorVisible(true);

    int[] rainbowa =
        getActivity().getApplicationContext().getResources().getIntArray(R.array.colorPicker);
    Random rna = new Random();
    int pickera = rn.nextInt(rainbow.length);

    postDoneContainer = ((LinearLayout) header.findViewById(R.id.post_done_container));
    postDoneContainer.setBackgroundColor(rainbow[rn.nextInt(rainbow.length)]);
    postDoneContainer.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            postDoneContainer.setEnabled(false);
            String hashing = String.valueOf(postText.getText());
            postText.setText("");
            checkHashtag(hashing);

            // Saving Hashtags
            ArrayList<String> cleanHashtags = cleanHashtags(hashtags);

            Hashtag hashtag = new Hashtag();

            for (int i = 0; i < cleanHashtags.size(); i++) {
              String hash = (String) cleanHashtags.get(i);
              hashtag.saveHashtag(hash); //
            }

            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(postText.getWindowToken(), 0);

            // Saving Selfie
            Selfie selfie = new Selfie();

            ParseObject location = ParseUser.getCurrentUser().getParseObject("location");

            if (photoFile == null) {
              Toast.makeText(
                      getActivity(), "Error saving: Not going to save properly", Toast.LENGTH_LONG)
                  .show();
            }

            if (videoFile != null) {
              selfie.setNewSelfie(
                  photoFile, ParseUser.getCurrentUser(), location, cleanHashtags, videoFile);
            } else {
              selfie.setNewSelfie(
                  photoFile, ParseUser.getCurrentUser(), location, cleanHashtags, null);
            }

            // Save the meal and return
            selfie.saveInBackground(
                new SaveCallback() {

                  @Override
                  public void done(ParseException e) {
                    if (e == null) {
                    } else {
                      Log.d("Error saving: ", e.getMessage());
                    }
                  }
                });
            postDoneContainer.setEnabled(true);
            mCallback.onHideFragment();
          }
        });

    postHashtags.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(postText.getWindowToken(), 0);
            postText.setCursorVisible(false);
            String hashing = String.valueOf(postText.getText());
            postText.setText("");
            checkHashtag(hashing);

            return false;
          }
        });

    v.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(postText.getWindowToken(), 0);
            postText.setCursorVisible(false);
            String hashing = String.valueOf(postText.getText());
            postText.setText("");
            checkHashtag(hashing);
            return false;
          }
        });

    adapter.registerDataSetObserver(
        new DataSetObserver() {
          @Override
          public void onChanged() {
            super.onChanged();
            setPlaceholder();
          }
        });

    checkHeader();

    return v;
  }
Exemple #11
0
 private void disableEditText(EditText editText) {
   editText.setFocusable(false);
   editText.setCursorVisible(false);
   editText.setKeyListener(null);
   editText.setTextColor(Color.DKGRAY);
 }
 @Override
 public void onBackPressed() {
   editText.setCursorVisible(false);
   super.onBackPressed();
 }
 @OnClick({2131558601})
 protected void attemptToSubmitAddress() {
   this.mSaveAddress.post(
       new Runnable() {
         public void run() {
           if ((AddressFormFragment.this.getActivity() == null)
               || (AddressFormFragment.this.mFirstName == null)) {
             return;
           }
           ((InputMethodManager)
                   AddressFormFragment.this.getActivity().getSystemService("input_method"))
               .hideSoftInputFromWindow(AddressFormFragment.this.mFirstName.getWindowToken(), 0);
         }
       });
   this.mFirstName.setError(null);
   this.mLastName.setError(null);
   this.mStreetAddress.setError(null);
   this.mStreetAddress2.setError(null);
   this.mSubDistrictText.setError(null);
   this.mPhoneNumber.setError(null);
   this.mInstruction.setError(null);
   this.mSubDistrictTaipei.setError(null);
   this.mNoTaipei.setError(null);
   this.mFloorTaipei.setError(null);
   Object localObject2 = null;
   String str8 = this.mFirstName.getText().toString();
   String str7 = this.mLastName.getText().toString();
   String str6 = this.mStreetAddress.getText().toString();
   String str5 = this.mSubDistrictText.getText().toString();
   String str1 = this.mPhoneNumber.getText().toString();
   String str4 = this.mSubDistrictTaipei.getText().toString();
   String str3 = this.mNoTaipei.getText().toString();
   String str2 = this.mFloorTaipei.getText().toString();
   int j = 0;
   int i = j;
   Object localObject1 = localObject2;
   if (0 == 0) {
     i = j;
     localObject1 = localObject2;
     if (TextUtils.isEmpty(str8)) {
       this.mFirstName.setError(getString(2131165379));
       localObject1 = this.mFirstName;
       i = 1;
     }
   }
   j = i;
   localObject2 = localObject1;
   if (i == 0) {
     j = i;
     localObject2 = localObject1;
     if (TextUtils.isEmpty(str7)) {
       this.mLastName.setError(getString(2131165379));
       localObject2 = this.mLastName;
       j = 1;
     }
   }
   i = j;
   localObject1 = localObject2;
   if (j == 0) {
     i = j;
     localObject1 = localObject2;
     if (!this.mIsCountryTaiwan) {
       i = j;
       localObject1 = localObject2;
       if (TextUtils.isEmpty(str6)) {
         this.mStreetAddress.setError(getString(2131165379));
         localObject1 = this.mStreetAddress;
         i = 1;
       }
     }
   }
   j = i;
   localObject2 = localObject1;
   if (i == 0) {
     j = i;
     localObject2 = localObject1;
     if (!this.mIsCountryTaiwan) {
       j = i;
       localObject2 = localObject1;
       if (TextUtils.isEmpty(str5)) {
         this.mSubDistrictText.setError(getString(2131165379));
         localObject2 = this.mSubDistrictText;
         j = 1;
       }
     }
   }
   i = j;
   localObject1 = localObject2;
   if (j == 0) {
     i = j;
     localObject1 = localObject2;
     if (this.mIsCountryTaiwan) {
       i = j;
       localObject1 = localObject2;
       if (TextUtils.isEmpty(str4)) {
         this.mSubDistrictTaipei.setError(getString(2131165379));
         localObject1 = this.mSubDistrictTaipei;
         i = 1;
       }
     }
   }
   j = i;
   localObject2 = localObject1;
   if (i == 0) {
     j = i;
     localObject2 = localObject1;
     if (this.mIsCountryTaiwan) {
       j = i;
       localObject2 = localObject1;
       if (TextUtils.isEmpty(str3)) {
         this.mNoTaipei.setError(getString(2131165379));
         localObject2 = this.mNoTaipei;
         j = 1;
       }
     }
   }
   i = j;
   localObject1 = localObject2;
   if (j == 0) {
     i = j;
     localObject1 = localObject2;
     if (this.mIsCountryTaiwan) {
       i = j;
       localObject1 = localObject2;
       if (TextUtils.isEmpty(str2)) {
         this.mFloorTaipei.setError(getString(2131165379));
         localObject1 = this.mFloorTaipei;
         i = 1;
       }
     }
   }
   if ((i == 0) && (TextUtils.isEmpty(str1))) {
     this.mPhoneNumber.setError(getString(2131165379));
     localObject1 = this.mPhoneNumber;
     i = 1;
   }
   for (; ; ) {
     j = i;
     localObject2 = localObject1;
     if (i == 0) {
       j = i;
       localObject2 = localObject1;
       if (this.mPhoneNumber.getText().toString().length() > 17) {
         this.mPhoneNumber.setError(getString(2131165474));
         localObject2 = this.mPhoneNumber;
         j = 1;
       }
     }
     if (j == 0) {
       break;
     }
     ((View) localObject2).requestFocus();
     if (localObject2.getClass().equals(EditText.class)) {
       ((EditText) localObject2).setCursorVisible(true);
     }
     return;
     this.mPhoneNumber.setText(
         PhoneNumberUtil.convertPhoneNumber(
             str1, getApplication().getSharedPreferencesManager().getStockLocationCountryCode()));
   }
   doSubmit();
 }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.head_tv_go_menu:
        if (getActivity() instanceof ViewPagerActivity) {
          ViewPagerActivity viewPagerActivity = (ViewPagerActivity) getActivity();
          viewPagerActivity.showMenu();
        }

        break;
      case R.id.recharge_et_phoneNum:
        numEditText.setCursorVisible(true);
        numEditText.setFocusableInTouchMode(true);
        numEditText.requestFocus();
        break;
      case R.id.recharge_btm_buy:
        String phoneNum = numEditText.getText().toString().trim();
        if (!CommonUtil.checkNetState(getActivity())) {
          v.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.shake));
          Toast.makeText(getActivity(), "网络不给力,检查网络", 0).show();
          return;
        }
        if (TextUtils.isEmpty(phoneNum.trim())) {
          Toast.makeText(getActivity(), "号码不能为空", 0).show();
          return;
        }
        if (!checkNumber(phoneNum)) {
          Toast.makeText(getActivity(), "号码位数或者格式不对!!", 0).show();
          return;
        }
        if (TextUtils.isEmpty(card)) {
          Toast.makeText(getActivity(), "请选择充值面额!", 0).show();
          return;
        }
        if (TextUtils.isEmpty(address)) {
          Toast.makeText(getActivity(), "请重新输入号码或重新选择", 0).show();
        }
        Editor edit = sharedPreferences.edit();
        edit.putString("phoneNum", phoneNum);
        edit.commit();
        if (resultMap != null && resultMap.get(q) != null) {
          SearchItem searchItem = resultMap.get(q);
          if (searchItem != null) {
            userId = sharedPreferences.getLong("userId", 0l);
            AccessToken accessToken = TopConfig.client.getAccessToken(userId);
            //					String tql = "";
            //					if (accessToken == null || userId == 0l) {
            //						Toast t = Toast.makeText(getActivity(), "请先授权",
            //								Toast.LENGTH_SHORT);
            //						t.show();
            //						TopConfig.client.authorize(getActivity());
            //						return;
            //					}
            Intent intent = new Intent();
            if (searchItem.num_iid != null) {
              String uri =
                  CommonUtil.generateTopClickUri(
                      searchItem.getClick_url(), getActivity(), accessToken);
              LogUtil.i(TAG, uri);
              intent.putExtra(BrowserActivity.BROWSERACTIVITY_NUM_IID, searchItem.num_iid);
              intent.setAction(BrowserActivity.BROWSERACTIVITY_ACTION);
              getActivity().startActivity(intent);
            }
          }
        } else {
          Toast.makeText(getActivity(), "正在获取价格信息, 请稍候...", 0).show();
        }
        break;
      default:
        break;
    }
  }
Exemple #15
0
  @Override
  protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
    super.onCreateView(inflater, container);
    ViewGroup searchBox = (ViewGroup) inflater.inflate(R.layout.search_box, container, false);
    mSearchBox = searchBox;

    ImageButton btn = (ImageButton) searchBox.findViewById(R.id.opendrawer_or_back);
    mBackBtn = btn;
    btn.setOnClickListener(this);

    final ImageButton editTextClearBtn = (ImageButton) searchBox.findViewById(R.id.edit_text_clear);
    editTextClearBtn.setOnClickListener(this);

    EditText searchEditText = (EditText) searchBox.findViewById(R.id.search_edittext);
    mSearchEditText = searchEditText;
    searchEditText.setCursorVisible(false);
    searchEditText.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void afterTextChanged(Editable s) {
            if (s.length() > 0) {
              editTextClearBtn.setVisibility(View.VISIBLE);
            } else {
              editTextClearBtn.setVisibility(View.INVISIBLE);
            }
            if (enableTextTip) {
              String str = s.toString().trim();
              mSearchBoxPresenter.requestInputTips(str, "");
            }
          }
        });
    searchEditText.setOnClickListener(this);
    searchEditText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            String s = v.getText().toString();
            if (CommonUtils.isStringEmpty(s)) {
              return false;
            }
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
              Tip tip = getTipFromKeyword(s);
              tip.setID(""); // prevent null value
              returnResult(tip);
              return true;
            }
            return false;
          }
        });

    ViewGroup searchResultContainer =
        (ViewGroup) inflater.inflate(R.layout.search_result, container, false);
    mSearchResultContainer = searchResultContainer;

    ViewGroup chooseOnMapBtn =
        (ViewGroup) searchResultContainer.findViewById(R.id.search_choose_on_map);
    mChooseOnMapBtn = chooseOnMapBtn;
    chooseOnMapBtn.setOnClickListener(this);
    ViewGroup chooseFromFavBtn =
        (ViewGroup) searchResultContainer.findViewById(R.id.choose_from_favorites);
    mChooseFromFavBtn = chooseFromFavBtn;
    chooseFromFavBtn.setOnClickListener(this);

    RecyclerView resultListView =
        (RecyclerView) searchResultContainer.findViewById(R.id.result_listview);
    SearchTipsAdapter searchTipsAdapter = new SearchTipsAdapter(getContext());
    mResultAdapter = searchTipsAdapter;
    resultListView.setAdapter(searchTipsAdapter);
    searchTipsAdapter.setOnViewClickListener(
        new OnViewClickListener() {
          @Override
          public void onClick(View v, Object data) {
            final Tip tip = (Tip) data;
            if (getOnlySearchBox()) {
              enableTextTip = false;
              mSearchEditText.setText(tip.getName());
              enableTextTip = true;
            }
            returnResult(tip);
          }
        });
    setOnStartAnimation(R.animator.slide_in_top);
    setOnStopAnimation(R.animator.slide_out_top);
    setViewToAnimate(searchBox);
  }
Exemple #16
0
  private void populateFields(Bundle savedInstanceState) {

    EditText mTitleText = (EditText) findViewById(R.id.title);
    EditText mBodyText = (EditText) findViewById(R.id.body);
    EditText mBody2Text = (EditText) findViewById(R.id.body2);

    String transPrefs = getString(R.string.prefs_note_trans);
    String transPrefsVal = NotePrefsDb.getStringValue(this, transPrefs, "255");
    int newVal = Integer.valueOf(transPrefsVal);

    if (newVal < 255) {

      int newColor = Color.argb(255, newVal, newVal, newVal);

      mTitleText.getBackground().setColorFilter(newColor, PorterDuff.Mode.MULTIPLY);
      mBodyText.getBackground().setColorFilter(newColor, PorterDuff.Mode.MULTIPLY);
      mBody2Text.getBackground().setColorFilter(newColor, PorterDuff.Mode.MULTIPLY);

      if (newVal <= 127) {
        mTitleText.setTextColor(Color.WHITE);
        mBodyText.setTextColor(Color.WHITE);
        mBody2Text.setTextColor(Color.WHITE);
      }
    }

    // if we're doing an edit note, not a create note
    if (mRowId != null) {

      String linkifyPrefs = getString(R.string.prefs_linkify);
      Boolean linkifyPrefsVal = NotePrefsDb.getBooleanValue(this, linkifyPrefs, true);

      if (linkifyPrefsVal) {
        mBodyText.setAutoLinkMask(Linkify.ALL);
      }

      Note note = NoteHelper.getNote(NoteEdit.this, mRowId);

      if (savedInstanceState == null) {
        mTitleText.setText(note.getTitle());
        mBodyText.setText(note.getBody());
        mBody2Text.setText(note.getBody());
      } else {
        mTitleText.setText((String) savedInstanceState.getSerializable(NoteDb.KEY_TITLE));
        mBodyText.setText((String) savedInstanceState.getSerializable(NoteDb.KEY_BODY));
        mBody2Text.setText((String) savedInstanceState.getSerializable(NoteDb.KEY_BODY));
      }

      if (isEditable == false) {

        mTitleText.setFocusable(false);
        mTitleText.setCursorVisible(false);

        mBodyText.setFocusable(false);
        mBodyText.setCursorVisible(false);

        mBody2Text.setVisibility(View.GONE);

      } else {

        mBodyText.setVisibility(View.GONE);
      }

    } else {

      mBodyText.setFocusable(false);
      mBodyText.setCursorVisible(false);
      mBodyText.setVisibility(View.GONE);
    }

    // length filter
    int maxLength = 40;
    InputFilter[] FilterArray = new InputFilter[1];
    FilterArray[0] = new InputFilter.LengthFilter(maxLength);
    mTitleText.setFilters(FilterArray);
  }