Ejemplo n.º 1
1
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.Edit_Contact:
        Button b = (Button) findViewById(R.id.button1);
        b.setVisibility(View.VISIBLE);
        name.setEnabled(true);
        name.setFocusableInTouchMode(true);
        name.setClickable(true);

        phone.setEnabled(true);
        phone.setFocusableInTouchMode(true);
        phone.setClickable(true);

        email.setEnabled(true);
        email.setFocusableInTouchMode(true);
        email.setClickable(true);

        street.setEnabled(true);
        street.setFocusableInTouchMode(true);
        street.setClickable(true);

        place.setEnabled(true);
        place.setFocusableInTouchMode(true);
        place.setClickable(true);

        return true;
      case R.id.Delete_Contact:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setMessage(R.string.deleteContact)
            .setPositiveButton(
                R.string.yes,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    mydb.deleteContact(id_To_Update);
                    Toast.makeText(
                            getApplicationContext(), "Deleted Successfully", Toast.LENGTH_SHORT)
                        .show();
                    Intent intent =
                        new Intent(getApplicationContext(), com.example.myapp.MainActivity.class);
                    startActivity(intent);
                  }
                })
            .setNegativeButton(
                R.string.no,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    // User cancelled the dialog
                  }
                });
        AlertDialog d = builder.create();
        d.setTitle("Are you sure");
        d.show();

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
    public View create(
        Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
      willCreate();

      View v =
          (convertView != null)
              ? convertView
              : inflater.inflate(R.layout.global_actions_item, parent, false);

      ImageView icon = (ImageView) v.findViewById(R.id.icon);
      TextView messageView = (TextView) v.findViewById(R.id.message);
      TextView statusView = (TextView) v.findViewById(R.id.status);

      messageView.setText(mMessageResId);

      boolean on = ((mState == State.On) || (mState == State.TurningOn));
      icon.setImageDrawable(
          context.getResources().getDrawable((on ? mEnabledIconResId : mDisabledIconResid)));
      statusView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId);
      statusView.setVisibility(View.VISIBLE);

      final boolean enabled = isEnabled();
      messageView.setEnabled(enabled);
      statusView.setEnabled(enabled);
      icon.setEnabled(enabled);
      v.setEnabled(enabled);

      return v;
    }
Ejemplo n.º 3
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (!data.moveToFirst()) {
      return;
    }

    final String surveyName = data.getString(ResponseQuery.SURVEY_TITLE);
    final Long completedDate = data.getLong(ResponseQuery.TIME);

    mHeadertext.setText(surveyName);
    mSubtext.setText(data.getString(ResponseQuery.CAMPAIGN_NAME));
    SimpleDateFormat df = new SimpleDateFormat();
    mNotetext.setText(df.format(new Date(completedDate)));

    final String iconUrl = data.getString(ResponseQuery.CAMPAIGN_ICON);
    if (iconUrl == null
        || mImageLoader.bind(mIconView, iconUrl, null) != ImageLoader.BindResult.OK) {
      mIconView.setImageResource(R.drawable.apple_logo);
    }

    mEntityHeader.setVisibility(View.VISIBLE);

    // Make the map view button status aware so it can provide some useful info about the gps state
    if (data.getInt(ResponseQuery.STATUS) == Response.STATUS_WAITING_FOR_LOCATION) {
      mapViewButton.setText("Waiting for Location");
      mapViewButton.setEnabled(false);
    } else if (!(SurveyGeotagService.LOCATION_VALID.equals(
        data.getString(ResponseQuery.LOCATION_STATUS)))) {
      mapViewButton.setText("Location Not Available");
      mapViewButton.setEnabled(false);
    } else {
      mapViewButton.setText("View Map");
      mapViewButton.setEnabled(true);
    }
  }
Ejemplo n.º 4
0
 @Override
 public void handleMessage(Message msg) {
   if (isDetached()) {
     return;
   }
   switch (msg.what) {
     case MSG_UPDATE_TIME:
       MSG_TOTAL_TIME--;
       if (MSG_TOTAL_TIME > 0) {
         getCode.setText(
             String.format(
                 getResources().getString(R.string.has_minuter, MSG_TOTAL_TIME + "")));
         Message message = obtainMessage();
         message.what = MSG_UPDATE_TIME;
         sendMessageDelayed(message, 1000);
       } else if (MSG_TOTAL_TIME < -10) {
         getCode.setText(R.string.addcode_resend);
         getCode.setEnabled(true);
       } else {
         getCode.setText(R.string.addcode_code);
         getCode.setEnabled(true);
       }
       break;
     default:
       break;
   }
 }
 public void setRollMode(RollMode rollMode) {
   switch (rollMode) {
     case SINGLE:
       m_rollMode = RollMode.SINGLE;
       m_resetButton.setEnabled(false);
       m_dieQuantitySpinner.setEnabled(false);
       m_dieQuantityTv.setEnabled(false);
       m_rollSumTv.setVisibility(View.INVISIBLE);
       m_rollResultList.setVisibility(View.GONE);
       break;
     case XDY:
       m_rollMode = RollMode.XDY;
       m_resetButton.setEnabled(true);
       m_dieQuantitySpinner.setEnabled(true);
       m_dieQuantityTv.setEnabled(true);
       m_rollSumTv.setVisibility(View.INVISIBLE);
       m_rollResultList.setVisibility(View.VISIBLE);
       break;
     case CUMULATIVE:
       m_rollMode = RollMode.CUMULATIVE;
       m_resetButton.setEnabled(true);
       m_dieQuantitySpinner.setEnabled(true);
       m_dieQuantityTv.setEnabled(true);
       m_rollSumTv.setVisibility(View.VISIBLE);
       m_rollResultList.setVisibility(View.VISIBLE);
       break;
   }
 }
Ejemplo n.º 6
0
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
    RideCursor c = (RideCursor) cursor;

    // Title (name / date)
    TextView txtTitle = ViewHolder.get(view, R.id.txtTitle);
    String name = c.getName();
    long createdDateLong = c.getCreatedDate().getTime();
    String createdDateTimeStr =
        DateUtils.formatDateTime(
            context, createdDateLong, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME);
    if (name == null) {
      txtTitle.setText(createdDateTimeStr);
    } else {
      txtTitle.setText(name + "\n" + createdDateTimeStr);
    }

    // Summary
    TextView txtSummary = ViewHolder.get(view, R.id.txtSummary);
    CharSequence details = null;
    Animator animator = (Animator) view.getTag(R.id.animator);
    // Cancel the animation / reset the alpha in any case
    if (animator != null) animator.cancel();
    txtSummary.setAlpha(1);
    RideState rideState = c.getState();
    switch (rideState) {
      case CREATED:
        details = context.getString(R.string.ride_list_notStarted);
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(false);
        break;

      case ACTIVE:
        details = context.getString(R.string.ride_list_active);
        if (animator == null) {
          animator = AnimatorInflater.loadAnimator(context, R.animator.blink);
          animator.setTarget(txtSummary);
          view.setTag(R.id.animator, animator);
        }
        animator.start();
        txtSummary.setTextColor(mColorActive);
        txtSummary.setEnabled(true);
        break;

      case PAUSED:
        // Distance
        float distance = c.getDistance();
        details = TextUtils.concat(UnitUtil.formatDistance(distance, true, .85f, false), "  -  ");

        // Duration
        long duration = c.getDuration();
        details = TextUtils.concat(details, DateTimeUtil.formatDuration(context, duration));
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(true);
        break;
    }
    txtSummary.setText(details);
  }
Ejemplo n.º 7
0
 private void initSearchHistory() {
   List<String> list = SharedPreferencesUtil.getInstance().getObject("searchHistory", List.class);
   mHisAdapter.clear();
   if (list != null && list.size() > 0) {
     tvClear.setEnabled(true);
     mHisAdapter.addAll(list);
   } else {
     tvClear.setEnabled(false);
   }
   mHisAdapter.notifyDataSetChanged();
 }
Ejemplo n.º 8
0
 private void setViewEnabled(boolean b) {
   priceView.setEnabled(b);
   priceView.setTextColor(b ? Color.parseColor("#626262") : Color.parseColor("#cccccc"));
   directionPriceView.setTextColor(
       b
           ? getResources().getColor(R.color.trade_main_color)
           : getResources().getColor(R.color.trade_hint_color));
   linearLayout.setEnabled(b);
   addView.setEnabled(b);
   minusView.setEnabled(b);
 }
    public void setEnabled(boolean enabled) {
      view.setEnabled(enabled);
      selected.setEnabled(enabled);
      mainUserId.setEnabled(enabled);
      mainUserIdRest.setEnabled(enabled);
      creation.setEnabled(enabled);
      statusIcon.setEnabled(enabled);

      // Sorta special: We set an item as clickable to disable it in the ListView. This works
      // because the list item will handle the clicks itself (which is a nop)
      view.setClickable(!enabled);
    }
Ejemplo n.º 10
0
 /**
  * Toggles label buttons from visble to invisible when the button is pressed.
  *
  * @param rootView
  */
 private void toggleLableView(View rootView) {
   if (LABEL_VIEW_TRUE) {
     for (int i = 0; i < label.size(); i++) {
       weightView[i].setEnabled(false);
       weightView[i].setVisibility(drawView.GONE);
       labelButton[i].setEnabled(false);
       labelButton[i].setVisibility(drawView.GONE);
       removeButton[i].setEnabled(false);
       removeButton[i].setVisibility(drawView.GONE);
     }
     qSolution.setEnabled(false);
     grade_increase.setVisibility(View.INVISIBLE);
     grade_decrease.setVisibility(View.INVISIBLE);
     qSolution.setVisibility(drawView.GONE);
     commentsEnter.setEnabled(false);
     commentsEnter.setVisibility(drawView.GONE);
     rootView.findViewById(R.id.process_refresh_labels).setEnabled(false);
     rootView.findViewById(R.id.process_refresh_labels).setVisibility(drawView.GONE);
     Log.d(TAG, "toggleLableView: disabling label view");
     LABEL_VIEW_TRUE = false;
     Log.d(TAG, "dispatchDisplayNextImage: chanigng label view to " + false);
   } else {
     for (int i = 0; i < label.size(); i++) {
       if (Weights.get(i) == 0) {
         weightView[i].setEnabled(false);
         weightView[i].setVisibility(View.VISIBLE);
         labelButton[i].setEnabled(false);
         labelButton[i].setVisibility(View.VISIBLE);
         removeButton[i].setEnabled(false);
         removeButton[i].setVisibility(View.VISIBLE);
         continue;
       }
       grade_increase.setVisibility(View.VISIBLE);
       grade_decrease.setVisibility(View.VISIBLE);
       weightView[i].setEnabled(true);
       weightView[i].setVisibility(View.VISIBLE);
       labelButton[i].setEnabled(true);
       labelButton[i].setVisibility(View.VISIBLE);
       removeButton[i].setEnabled(true);
       removeButton[i].setVisibility(View.VISIBLE);
       Log.d(TAG, "toggleLableView: showing label view");
     }
     qSolution.setEnabled(true);
     qSolution.setVisibility(View.VISIBLE);
     commentsEnter.setEnabled(true);
     commentsEnter.setVisibility(View.VISIBLE);
     rootView.findViewById(R.id.process_refresh_labels).setEnabled(true);
     rootView.findViewById(R.id.process_refresh_labels).setVisibility(View.VISIBLE);
     LABEL_VIEW_TRUE = true;
     Log.d(TAG, "dispatchDisplayNextImage: chanigng label view to " + true);
   }
 }
Ejemplo n.º 11
0
  @Override
  public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    String strEmail = edtEmail.getText().toString().trim();
    String strPassword = edtPassword.getText().toString().trim();
    if (strEmail.equals("") || strPassword.equals("")) {

      btnLogin.setEnabled(false);
      return;
    }

    btnLogin.setEnabled(true);
  }
        public void handleMessage(android.os.Message msg) {

          if (msg.what == STSTE) {
            quxioaTextView.setEnabled(false);
            quxioaTextView.setClickable(false);
            quxioaTextView.setBackgroundResource(R.drawable.focus_n_btn);
            quxioaTextView.setTextColor(getResources().getColor(R.color.gr_color_03));

            kefuTextView.setEnabled(false);
            kefuTextView.setClickable(false);
            kefuTextView.setBackgroundResource(R.drawable.focus_n_btn);
            kefuTextView.setTextColor(getResources().getColor(R.color.gr_color_03));
          }
        };
 private void togglePickerOptions() {
   if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
     mFreqSpinner.setEnabled(false);
     mEndSpinner.setEnabled(false);
     mIntervalPreText.setEnabled(false);
     mInterval.setEnabled(false);
     mIntervalPostText.setEnabled(false);
     mMonthRepeatByRadioGroup.setEnabled(false);
     mEndCount.setEnabled(false);
     mPostEndCount.setEnabled(false);
     mEndDateTextView.setEnabled(false);
     mRepeatMonthlyByNthDayOfWeek.setEnabled(false);
     mRepeatMonthlyByNthDayOfMonth.setEnabled(false);
     for (Button button : mWeekByDayButtons) {
       button.setEnabled(false);
     }
   } else {
     mView.findViewById(R.id.options).setEnabled(true);
     mFreqSpinner.setEnabled(true);
     mEndSpinner.setEnabled(true);
     mIntervalPreText.setEnabled(true);
     mInterval.setEnabled(true);
     mIntervalPostText.setEnabled(true);
     mMonthRepeatByRadioGroup.setEnabled(true);
     mEndCount.setEnabled(true);
     mPostEndCount.setEnabled(true);
     mEndDateTextView.setEnabled(true);
     mRepeatMonthlyByNthDayOfWeek.setEnabled(true);
     mRepeatMonthlyByNthDayOfMonth.setEnabled(true);
     for (Button button : mWeekByDayButtons) {
       button.setEnabled(true);
     }
   }
   updateDoneButtonState();
 }
Ejemplo n.º 14
0
  private void viewPatient(final Patients p) {
    Dialog info = new Dialog(getActivity());
    info.setTitle("Patient Details");
    info.setContentView(R.layout.patient_list_item_details_fragment);

    TextView fname = (TextView) info.findViewById(R.id.first_name_info);
    TextView mname = (TextView) info.findViewById(R.id.middle_name_info);
    TextView lname = (TextView) info.findViewById(R.id.last_name_info);
    TextView age = (TextView) info.findViewById(R.id.age);
    TextView status = (TextView) info.findViewById(R.id.status_info);
    TextView address = (TextView) info.findViewById(R.id.address_info);
    TextView hosp_name = (TextView) info.findViewById(R.id.hosp_name_info);
    TextView hosp_room = (TextView) info.findViewById(R.id.hosp_room_info);

    Button see_diag_info = (Button) info.findViewById(R.id.button1);
    see_diag_info.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            Dialog details = new Dialog(getActivity());
            details.setTitle("Medical History");
            TextView history = new TextView(getActivity());
            history.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
            history.setText(p.getMed_history());
            details.setContentView(history);
            details.show();
          }
        });

    fname.setText(p.getFname());
    mname.setText(p.getMi());
    lname.setText(p.getLname());
    age.setText(Integer.toString(p.getAge()));
    if (p.getPat_status() == 1) {
      status.setText("In-Patient");
      hosp_name.setText(p.getHosp_name());
      hosp_room.setText(p.getHosp_room());
    }

    if (p.getPat_status() == 2) {
      status.setText("Out-Patient");
      hosp_name.setText("None..");
      hosp_room.setText("None..");
      hosp_name.setEnabled(false);
      hosp_room.setEnabled(false);
    }

    address.setText(p.getAddr());
    info.show();
  }
Ejemplo n.º 15
0
 /**
  * Update the hours, minutes, and AM/PM displays with the typed times. If the typedTimes is empty,
  * either show an empty display (filled with the placeholder text), or update from the
  * timepicker's values.
  *
  * @param allowEmptyDisplay if true, then if the typedTimes is empty, use the placeholder text.
  *     Otherwise, revert to the timepicker's values.
  */
 private void updateDisplay(boolean allowEmptyDisplay) {
   if (!allowEmptyDisplay && mTypedTimes.isEmpty()) {
     int hour = mTimePicker.getHours();
     int minute = mTimePicker.getMinutes();
     setHour(hour, true);
     setMinute(minute);
     if (!mIs24HourMode) {
       updateAmPmDisplay(hour < 12 ? AM : PM);
     }
     setCurrentItemShowing(mTimePicker.getCurrentItemShowing(), true, true, true);
     mDoneButton.setEnabled(true);
   } else {
     Boolean[] enteredZeros = {false, false};
     int[] values = getEnteredTime(enteredZeros);
     String hourFormat = enteredZeros[0] ? "%02d" : "%2d";
     String minuteFormat = (enteredZeros[1]) ? "%02d" : "%2d";
     String hourStr =
         (values[0] == -1)
             ? mDoublePlaceholderText
             : String.format(hourFormat, values[0]).replace(' ', mPlaceholderText);
     String minuteStr =
         (values[1] == -1)
             ? mDoublePlaceholderText
             : String.format(minuteFormat, values[1]).replace(' ', mPlaceholderText);
     mHourView.setText(hourStr);
     mHourSpaceView.setText(hourStr);
     mHourView.setTextColor(mUnselectedColor);
     mMinuteView.setText(minuteStr);
     mMinuteSpaceView.setText(minuteStr);
     mMinuteView.setTextColor(mUnselectedColor);
     if (!mIs24HourMode) {
       updateAmPmDisplay(values[2]);
     }
   }
 }
Ejemplo n.º 16
0
 private int deleteLastTypedKey() {
   int deleted = mTypedTimes.remove(mTypedTimes.size() - 1);
   if (!isTypedTimeFullyLegal()) {
     mDoneButton.setEnabled(false);
   }
   return deleted;
 }
Ejemplo n.º 17
0
  private boolean addKeyIfLegal(int keyCode) {
    // If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode,
    // we'll need to see if AM/PM have been typed.
    if ((mIs24HourMode && mTypedTimes.size() == 4) || (!mIs24HourMode && isTypedTimeFullyLegal())) {
      return false;
    }

    mTypedTimes.add(keyCode);
    if (!isTypedTimeLegalSoFar()) {
      deleteLastTypedKey();
      return false;
    }

    int val = getValFromKeyCode(keyCode);
    Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val));
    // Automatically fill in 0's if AM or PM was legally entered.
    if (isTypedTimeFullyLegal()) {
      if (!mIs24HourMode && mTypedTimes.size() <= 3) {
        mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
        mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
      }
      mDoneButton.setEnabled(true);
    }

    return true;
  }
Ejemplo n.º 18
0
 /**
  * Try to start keyboard mode with the specified key, as long as the timepicker is not in the
  * middle of a touch-event.
  *
  * @param keyCode The key to use as the first press. Keyboard mode will not be started if the key
  *     is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting
  *     key.
  */
 private void tryStartingKbMode(int keyCode) {
   if (mTimePicker.trySettingInputEnabled(false) && (keyCode == -1 || addKeyIfLegal(keyCode))) {
     mInKbMode = true;
     mDoneButton.setEnabled(false);
     updateDisplay(false);
   }
 }
Ejemplo n.º 19
0
  private void showResendTip() {

    mTimer = new Timer();
    get_code_tv.setEnabled(false);
    mTimer.schedule(
        new TimerTask() {

          @Override
          public void run() {

            sec--;
            mHandler.post(
                new Runnable() {
                  @Override
                  public void run() {

                    if (sec < 1) {
                      get_code_tv.setEnabled(true);
                      get_code_tv.setText("重新获取");
                      sec = 60;
                      mTimer.cancel();
                    } else {
                      String tipMsg = String.format(mContext.getString(R.string.time_tip), sec);
                      get_code_tv.setText(tipMsg);
                    }
                  }
                });
          }
        },
        0,
        1000);
  }
Ejemplo n.º 20
0
  private void startGame(int start_score) {
    setState(STATE_RUNNING);
    // Set allowed time
    m_allowedTime = m_initial_allowedTime;
    m_allowedTime_millis = m_allowedTime * 1000;
    m_score = start_score;
    m_answers.clear();
    m_Handler.removeCallbacks(mUpdateTimeTask);
    m_Handler.removeCallbacks(mBlinkTimeTask);
    if (mGameMode.equals("demo")) {
      mDemoState = 0;
      m_demo_word_i = 0;
      mBoardGameLogic.startGame("SABONETE");
      m_playboard.setClickable(false);
      m_Handler.postDelayed(mDemoPlayTask, 1000);
    } else {
      mBoardGameLogic.startGame(getRandomWord());
      m_Handler.postDelayed(mUpdateTimeTask, 1000);
      m_playboard.setClickable(true);
      m_word.setClickable(true);
    }

    mScoreText.setText(new Integer(m_score).toString());

    m_text_status.setVisibility(View.INVISIBLE);
    m_start_button.setVisibility(View.INVISIBLE);
    m_word.setText("");
    m_word.setEnabled(false);
    mPlayTime.setVisibility(View.VISIBLE);

    m_playboard.setKeepScreenOn(true);

    mStartTime = System.currentTimeMillis();
  }
Ejemplo n.º 21
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
      if (data != null) {
        if (requestCode == 1) {
          List<String> paths =
              data.getStringArrayListExtra(PhotoPickerActivity.KEY_SELECTED_PHOTOS);
          if (paths == null || paths.size() == 0) return;
          imgs.remove(imgs.size() - 1);
          for (int i = 0; i < paths.size(); i++) {
            if (imgs != null && imgs.size() < 6) {
              imgs.add(paths.get(i));
            } else {
              break;
            }
          }
          if (imgs.size() < 6) {
            tvImgCount.setText(
                "(" + ((imgs == null || imgs.size() == 0) ? 0 : imgs.size()) + "/6)");
            imgs.add("");
          } else {
            tvImgCount.setText("6/6");
          }
          imgAdapter.upDateList(imgs);

          if (imgs != null || imgs.size() > 0) {
            tvEdit.setEnabled(true);
          }
        } else if (requestCode == 2) {

        }
      }
    }
  }
Ejemplo n.º 22
0
 private void enableInput(boolean flag) {
   btnSave.setEnabled(flag);
   et_username.setEnabled(flag);
   et_email.setEnabled(flag);
   et_address.setEnabled(flag);
   et_password.setEnabled(flag);
 }
  // This updates the time bar display (if necessary). It is called by
  // mProgressChecker and also from places where the time bar needs
  // to be updated immediately.
  private int setProgress() {
    mVideoPosition = mVideoView.getCurrentPosition();
    // If the video position is smaller than the starting point of trimming,
    // correct it.
    if (mVideoPosition < mTrimStartTime) {
      mVideoView.seekTo(mTrimStartTime);
      mVideoPosition = mTrimStartTime;
    }
    // If the position is bigger than the end point of trimming, show the
    // replay button and pause.
    if (mVideoPosition >= mTrimEndTime && mTrimEndTime > 0) {
      if (mVideoPosition > mTrimEndTime) {
        mVideoView.seekTo(mTrimEndTime);
        mVideoPosition = mTrimEndTime;
      }
      mController.showEnded();
      mVideoView.pause();
    }

    int duration = mVideoView.getDuration();
    if (duration > 0 && mTrimEndTime == 0) {
      mTrimEndTime = duration;
    }
    mController.setTimes(mVideoPosition, duration, mTrimStartTime, mTrimEndTime);
    // Enable save if there's modifications
    mSaveVideoTextView.setEnabled(isModified());
    return mVideoPosition;
  }
 @Override
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (mGroupList != null) {
     mGroupList.setEnabled(enabled);
   }
 }
Ejemplo n.º 25
0
 public void word_OnClick(View v) {
   if (mPlayState == STATE_RUNNING && m_text_status.getVisibility() == View.VISIBLE)
     m_text_status.setVisibility(View.INVISIBLE);
   String current_word = mBoardGameLogic.getWord();
   String lower_current_word = current_word.toLowerCase();
   if (mBoardGameLogic.countSelected() == 2) {
     mBoardGameLogic.swap2();
     m_word.setText("");
     m_word.setEnabled(false);
     m_word.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
     return;
   }
   /* if(m_answers.contains(lower_current_word)) {
   	showResult(current_word, "repetida", 0xAAFFFF00);
   } else */ {
     boolean is_correct = findWord(lower_current_word);
     int play_score = lower_current_word.length();
     int play_time = 20;
     if (lower_current_word.length() > 5) {
       play_score += 10;
       play_time += 30;
     }
     if (is_correct) {
       m_score += play_score;
       m_allowedTime += play_time;
       m_allowedTime_millis = m_allowedTime * 1000;
       m_answers.add(lower_current_word);
       m_must_reset_word = true;
       showResult(current_word, "certa", 0xAA00FF00);
       // if(m_answers.size() == 1)
       //	mPlayTime.setTextColor(0xFF00FF00);
     } else {
       m_score -= play_score;
       /*
       long millis = System.currentTimeMillis() - mStartTime;
       m_allowedTime -= play_time;
       m_allowedTime_millis = m_allowedTime * 1000;
       long remaining = m_allowedTime-millis;
       if(!mTimeIsBlinking && remaining < 10)
       	m_Handler.postDelayed(mUpdateTimeTask, 0); */
       showResult(current_word, "errada", 0xAAFF0000);
     }
   }
   mScoreText.setText(new Integer(m_score).toString());
   m_word.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.check_button_blank, 0);
   m_word.setEnabled(false);
 }
Ejemplo n.º 26
0
    /** {@inheritDoc} */
    @Override
    public final void bindView(final View view, final Context ctxt, final Cursor cursor) {
      final TextView twTitle = ((TextView) view.findViewById(R.id.normtitle));
      twTitle.setText(cursor.getString(DataProvider.Rules.INDEX_NAME));
      boolean active = cursor.getInt(DataProvider.Rules.INDEX_ACTIVE) > 0;
      twTitle.setEnabled(active);

      final TextView twType = ((TextView) view.findViewById(R.id.type));
      String w = "";
      final int t = cursor.getInt(DataProvider.Rules.INDEX_WHAT);
      if (t >= 0 && t < this.types.length) {
        w += this.types[t];
      } else {
        w += "???";
      }
      int i = cursor.getInt(DataProvider.Rules.INDEX_LIMIT_NOT_REACHED);
      if (i == 1) {
        w += " & " + ctxt.getString(R.string.limitnotreached_);
      }
      i = cursor.getInt(DataProvider.Rules.INDEX_ROAMED);
      if (i == 0) {
        w += " & " + ctxt.getString(R.string.roamed_);
      } else if (i == 1) {
        w += " & \u00AC " + ctxt.getString(R.string.roamed_);
      }
      i = cursor.getInt(DataProvider.Rules.INDEX_DIRECTION);
      if (i >= 0 && i < DataProvider.Rules.NO_MATTER) {
        String[] strs;
        final Resources r = ctxt.getResources();
        if (t == DataProvider.TYPE_SMS) {
          strs = r.getStringArray(R.array.direction_sms);
        } else if (t == DataProvider.TYPE_MMS) {
          strs = r.getStringArray(R.array.direction_mms);
        } else if (t == DataProvider.TYPE_DATA) {
          strs = r.getStringArray(R.array.direction_data);
        } else {
          strs = r.getStringArray(R.array.direction_calls);
        }
        w += " & " + strs[i];
      }
      String s = cursor.getString(DataProvider.Rules.INDEX_INHOURS_ID);
      if (s != null && !s.equals("-1")) {
        w += " & " + ctxt.getString(R.string.hourgroup_);
      }
      s = cursor.getString(DataProvider.Rules.INDEX_EXHOURS_ID);
      if (s != null && !s.equals("-1")) {
        w += " & " + ctxt.getString(R.string.exhourgroup_);
      }
      s = cursor.getString(DataProvider.Rules.INDEX_INNUMBERS_ID);
      if (s != null && !s.equals("-1")) {
        w += " & " + ctxt.getString(R.string.numbergroup_);
      }
      s = cursor.getString(DataProvider.Rules.INDEX_EXNUMBERS_ID);
      if (s != null && !s.equals("-1")) {
        w += " & " + ctxt.getString(R.string.exnumbergroup_);
      }
      twType.setText(w);
    }
Ejemplo n.º 27
0
  @OnClick(R.id.txt_next)
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.txt_next:
        // Hide keyboard
        InputMethodManager inputMethodManager =
            (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);

        // Make sure email is lower case
        editEmail.setText(editEmail.getText().toString().trim().toLowerCase());

        // Validate data before requesting an access token
        boolean valid = true;

        // Validate email address
        if (editEmail.getText().toString().isEmpty()) {
          setError(txtEmailError, getString(R.string.error_field_required));
          valid = false;
        } else if (!Patterns.EMAIL_ADDRESS.matcher(editEmail.getText().toString()).matches()) {
          setError(txtEmailError, getString(R.string.error_invalid_email));
          valid = false;
        } else if (AccountUtils.accountExists(
            getActivity(), blogUrl, editEmail.getText().toString())) {
          setError(txtEmailError, getString(R.string.error_email_exists));
          valid = false;
        } else {
          setError(txtEmailError, null);
        }

        // Validate password
        if (editPassword.getText().toString().trim().isEmpty()) {
          setError(txtPasswordError, getString(R.string.error_field_required));
          valid = false;
        } else {
          setError(txtPasswordError, null);
        }

        // If valid request access token
        if (valid) {
          // Disable button to avoid multiple clicks, show progress bar
          txtNext.setEnabled(false);
          progressBar.setVisibility(View.VISIBLE);

          // Get credentials for later
          email = editEmail.getText().toString();
          password = editPassword.getText().toString();

          // Request access token
          Authentication authentication = ghostClient.createAuthentication();
          authentication.getAccessToken(
              ApiConstants.GRANT_TYPE_PASSWORD, ApiConstants.CLIENT_ID, email, password, this);
        }
        break;
    }
  }
Ejemplo n.º 28
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.tvNodata:
       tvNodata.setEnabled(false);
       tvLoading.setVisibility(View.VISIBLE);
       loader.startLoading();
       break;
   }
 }
Ejemplo n.º 29
0
 @Override
 public void initView() {
   assignViews();
   switch (currentAddType) {
     case lookAndSay:
       getToolbar().setBack().setTvTitle("添加动态").setTvR("发表", new OnClick());
       tvCommon.setText("发表动态");
       break;
     case liuCommon:
       getToolbar().setBack().setTvTitle("添加留言").setTvR("发表", new OnClick());
       tvCommon.setText("发表留言");
       break;
     case common:
       getToolbar().setBack().setTvTitle("添加评论").setTvR("发表", new OnClick());
       tvCommon.setText("发表评论");
       break;
   }
   imgAdapter = new ImageAdapter(mAct, tvEdit);
   imgAdapter.upDateList(imgs);
   gvImgs.setAdapter(imgAdapter);
   tvEdit.setEnabled(false);
   //        if (mGoods != null) {
   //            llGoods.setVisibility(View.VISIBLE);
   //            viewLine.setVisibility(View.VISIBLE);
   //            llStar.setVisibility(View.VISIBLE);
   //            changeUIshow(StarType.star5);
   //            tvTitle1.setText(mGoods.getTitle());
   //            tvPrice.setText("¥" + mGoods.getPrice());
   //            Glide.with(mAct).load(NetConstants.IMG_HOST +
   // mGoods.getImgurl()).error(R.drawable.noproduct).into(ivIcon);
   //        } else {
   //            ll_img.setVisibility(View.GONE);
   //        }
   switch (currentAddType) {
     case lookAndSay:
       ll_img.setVisibility(View.VISIBLE);
       break;
     case liuCommon:
       ll_img.setVisibility(View.GONE);
       break;
     case common:
       llGoods.setVisibility(View.VISIBLE);
       viewLine.setVisibility(View.VISIBLE);
       llStar.setVisibility(View.VISIBLE);
       changeUIshow(StarType.star5);
       tvTitle1.setText(mGoods.getTitle());
       tvPrice.setText("¥" + mGoods.getPrice());
       Glide.with(mAct)
           .load(NetConstants.IMG_HOST + mGoods.getImgurl())
           .error(R.drawable.noproduct)
           .into(ivIcon);
       break;
   }
 }
Ejemplo n.º 30
0
 private void aMq()
 {
   izR = false;
   izJ.setEnabled(false);
   izK.setVisibility(0);
   izK.setText(getResources().getQuantityString(a.l.mobileverify_send_code_tip, iwr, new Object[] { Integer.valueOf(iwr) }));
   izJ.setVisibility(8);
   aMp();
   izX.nw(a.iAj);
   h.aN(this, getString(a.n.mobile_code_sended));
 }