List of usage examples for android.graphics.drawable StateListDrawable getCurrent
@Override
public Drawable getCurrent()
From source file:com.landenlabs.all_devtool.IconBaseFragment.java
/** * Show a 'StateListDrawable' information * * @param imageView//from w w w . j av a 2 s.c o m * @param row1 * @param row2 * @param stateListDrawable * @param state * @param desc * @param stateIcons */ private void showStateIcon(final ImageView imageView, TableRow row1, TableRow row2, StateListDrawable stateListDrawable, int state, String desc, Set<Drawable> stateIcons) { stateListDrawable.setState(new int[] { state }); Drawable stateD = stateListDrawable.getCurrent(); if (stateD != null && !stateIcons.contains(stateD)) { stateIcons.add(stateD); ImageButton stateImageView = new ImageButton(imageView.getContext()); Drawable[] drawables = new Drawable[] { stateD, getResources().getDrawable(R.drawable.button_border_sel) }; LayerDrawable layerDrawable = new LayerDrawable(drawables); stateImageView.setImageDrawable(layerDrawable); // stateImageView.setBackgroundResource(R.drawable.button_border_sel); stateImageView.setPadding(10, 10, 10, 10); stateImageView.setMinimumHeight(8); stateImageView.setMinimumWidth(8); stateImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.setImageDrawable(((ImageView) v).getDrawable()); } }); TextView stateTextView = new TextView(imageView.getContext()); stateTextView.setText(desc); stateTextView.setTextSize(12); stateTextView.setGravity(Gravity.CENTER); row1.addView(stateTextView); row2.addView(stateImageView); } }
From source file:pct.droid.fragments.BeamPlayerFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/*from w w w . ja va 2 s . c o m*/ public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mActivity = (BeamPlayerActivity) getActivity(); mActivity.setSupportActionBar(mToolbar); mLoadingDialog = LoadingBeamingDialogFragment.newInstance(); mLoadingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { closePlayer(); } }); mLoadingDialog.show(getChildFragmentManager(), "overlay_fragment"); mStreamInfo = mActivity.getInfo(); if (mStreamInfo.isShow()) { mMedia = mStreamInfo.getShow(); } else { mMedia = mStreamInfo.getMedia(); } if (mMedia == null) { mMedia = new Media(null, null); mMedia.color = getResources().getColor(R.color.primary); } LayerDrawable progressDrawable; LayerDrawable volumeDrawable; if (!VersionUtils.isLollipop()) { progressDrawable = (LayerDrawable) getResources() .getDrawable(R.drawable.scrubber_progress_horizontal_bigtrack); volumeDrawable = (LayerDrawable) getResources().getDrawable(R.drawable.scrubber_progress_horizontal); } else { if (mVolumeBar.getProgressDrawable() instanceof StateListDrawable) { StateListDrawable stateListDrawable = (StateListDrawable) mVolumeBar.getProgressDrawable(); volumeDrawable = (LayerDrawable) stateListDrawable.getCurrent(); } else { volumeDrawable = (LayerDrawable) mVolumeBar.getProgressDrawable(); } progressDrawable = (LayerDrawable) getResources().getDrawable(R.drawable.progress_horizontal_material); } if (volumeDrawable == null) { volumeDrawable = (LayerDrawable) progressDrawable.mutate(); } progressDrawable.findDrawableByLayerId(android.R.id.background) .setColorFilter(getResources().getColor(R.color.beamplayer_seekbar_track), PorterDuff.Mode.SRC_IN); progressDrawable.findDrawableByLayerId(android.R.id.progress).setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); progressDrawable.findDrawableByLayerId(android.R.id.secondaryProgress).setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.background) .setColorFilter(getResources().getColor(R.color.beamplayer_seekbar_track), PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.progress).setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.secondaryProgress).setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); mSeekBar.setProgressDrawable(progressDrawable); mSeekBar.getThumbDrawable().setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); mVolumeBar.setProgressDrawable(volumeDrawable); mVolumeBar.getThumbDrawable().setColorFilter(mMedia.color, PorterDuff.Mode.SRC_IN); if (!VersionUtils.isJellyBean()) { mPlayButton.setBackgroundDrawable(PixelUtils.changeDrawableColor(mPlayButton.getContext(), R.drawable.play_button_circle, mMedia.color)); } else { mPlayButton.setBackground(PixelUtils.changeDrawableColor(mPlayButton.getContext(), R.drawable.play_button_circle, mMedia.color)); } if (mMedia.image != null && !mMedia.image.equals("")) { Picasso.with(mCoverImage.getContext()).load(mMedia.image).into(mCoverImage, new Callback() { @Override public void onSuccess() { AnimUtils.fadeIn(mCoverImage); } @Override public void onError() { } }); } mActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); mActivity.getSupportActionBar().setTitle(""); try { if (!mBeamManager.getConnectedDevice().hasCapability(MediaControl.Position) || !mBeamManager.getConnectedDevice().hasCapability(MediaControl.Seek) || !mBeamManager.getConnectedDevice().hasCapability(MediaControl.Duration)) { mHasSeekControl = false; mSeekBar.setVisibility(View.INVISIBLE); } if (!mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Get) || !mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Set) || !mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Subscribe)) { mHasVolumeControl = false; mPanel.setEnabled(false); mPanel.setTouchEnabled(false); } if (!mBeamManager.getConnectedDevice().hasCapability(MediaControl.Pause)) { mPlayButton.setEnabled(false); } startVideo(); } catch (Exception e) { Toast.makeText(getActivity(), R.string.unknown_error, Toast.LENGTH_SHORT); getActivity().finish(); } }
From source file:butter.droid.fragments.BeamPlayerFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//from w w w .java2 s. co m public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mActivity = (BeamPlayerActivity) getActivity(); mActivity.setSupportActionBar(mToolbar); mLoadingDialog = LoadingBeamingDialogFragment.newInstance(); mLoadingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { closePlayer(); } }); mLoadingDialog.show(getChildFragmentManager(), "overlay_fragment"); mResumePosition = mActivity.getResumePosition(); mStreamInfo = mActivity.getInfo(); int paletteColor = mStreamInfo.getPaletteColor(); if (paletteColor == -1) { paletteColor = getResources().getColor(R.color.primary); } LayerDrawable progressDrawable; LayerDrawable volumeDrawable; if (!VersionUtils.isLollipop()) { progressDrawable = (LayerDrawable) getResources() .getDrawable(R.drawable.scrubber_progress_horizontal_bigtrack); volumeDrawable = (LayerDrawable) getResources().getDrawable(R.drawable.scrubber_progress_horizontal); } else { if (mVolumeBar.getProgressDrawable() instanceof StateListDrawable) { StateListDrawable stateListDrawable = (StateListDrawable) mVolumeBar.getProgressDrawable(); volumeDrawable = (LayerDrawable) stateListDrawable.getCurrent(); } else { volumeDrawable = (LayerDrawable) mVolumeBar.getProgressDrawable(); } progressDrawable = (LayerDrawable) getResources().getDrawable(R.drawable.progress_horizontal_material); } if (volumeDrawable == null) { volumeDrawable = (LayerDrawable) progressDrawable.mutate(); } progressDrawable.findDrawableByLayerId(android.R.id.background) .setColorFilter(getResources().getColor(R.color.beamplayer_seekbar_track), PorterDuff.Mode.SRC_IN); progressDrawable.findDrawableByLayerId(android.R.id.progress).setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); progressDrawable.findDrawableByLayerId(android.R.id.secondaryProgress).setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.background) .setColorFilter(getResources().getColor(R.color.beamplayer_seekbar_track), PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.progress).setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); volumeDrawable.findDrawableByLayerId(android.R.id.secondaryProgress).setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); mSeekBar.setProgressDrawable(progressDrawable); mSeekBar.getThumbDrawable().setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); mVolumeBar.setProgressDrawable(volumeDrawable); mVolumeBar.getThumbDrawable().setColorFilter(paletteColor, PorterDuff.Mode.SRC_IN); if (!VersionUtils.isJellyBean()) { mPlayButton.setBackgroundDrawable(PixelUtils.changeDrawableColor(mPlayButton.getContext(), R.drawable.play_button_circle, paletteColor)); } else { mPlayButton.setBackground(PixelUtils.changeDrawableColor(mPlayButton.getContext(), R.drawable.play_button_circle, paletteColor)); } if (mStreamInfo.getImageUrl() != null && !mStreamInfo.getImageUrl().equals("")) { Picasso.with(mCoverImage.getContext()).load(mStreamInfo.getImageUrl()).into(mCoverImage, new Callback() { @Override public void onSuccess() { AnimUtils.fadeIn(mCoverImage); } @Override public void onError() { } }); } mActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); mActivity.getSupportActionBar().setTitle(""); try { if (!mBeamManager.getConnectedDevice().hasCapability(MediaControl.Position) || !mBeamManager.getConnectedDevice().hasCapability(MediaControl.Seek) || !mBeamManager.getConnectedDevice().hasCapability(MediaControl.Duration)) { mHasSeekControl = false; mSeekBar.setVisibility(View.INVISIBLE); } if (!mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Get) || !mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Set) || !mBeamManager.getConnectedDevice().hasCapability(VolumeControl.Volume_Subscribe)) { mHasVolumeControl = false; mPanel.setEnabled(false); mPanel.setTouchEnabled(false); } if (!mBeamManager.getConnectedDevice().hasCapability(MediaControl.Pause)) { mPlayButton.setEnabled(false); } startVideo(); } catch (Exception e) { Snackbar.make(mRootView, R.string.unknown_error, Snackbar.LENGTH_SHORT).show(); getActivity().finish(); } Intent intent = new Intent(getActivity(), BeamPlayerNotificationService.class); intent.setAction(mIsPlaying ? BeamPlayerNotificationService.ACTION_PLAY : BeamPlayerNotificationService.ACTION_PAUSE); getActivity().startService(intent); }
From source file:pct.droid.fragments.VideoPlayerFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//from w ww . j av a 2s. c o m public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return onTouchEvent(event); } }); ButterKnife.bind(this, view); if (LocaleUtils.isRTL(LocaleUtils.getCurrent())) { Drawable forward = mForwardButton.getDrawable(); Drawable rewind = mRewindButton.getDrawable(); mRewindButton.setImageDrawable(forward); mForwardButton.setImageDrawable(rewind); } int color = getResources().getColor(R.color.primary); LayerDrawable progressDrawable; if (!VersionUtils.isLollipop()) { progressDrawable = (LayerDrawable) getResources().getDrawable(R.drawable.scrubber_progress_horizontal); } else { if (mControlBar.getProgressDrawable() instanceof StateListDrawable) { StateListDrawable stateListDrawable = (StateListDrawable) mControlBar.getProgressDrawable(); progressDrawable = (LayerDrawable) stateListDrawable.getCurrent(); } else { progressDrawable = (LayerDrawable) mControlBar.getProgressDrawable(); } } progressDrawable.findDrawableByLayerId(android.R.id.progress).setColorFilter(color, PorterDuff.Mode.SRC_IN); progressDrawable.findDrawableByLayerId(android.R.id.secondaryProgress).setColorFilter(color, PorterDuff.Mode.SRC_IN); mControlBar.setProgressDrawable(progressDrawable); mControlBar.getThumbDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); }
From source file:org.zywx.wbpalmstar.plugin.inputtextfieldview.ACEInputTextFieldView.java
private void initKeyboardParams(JSONObject json) { try {// w w w. jav a 2s.c o m // EmojiconsXmlPath mEmojiconswgtResXmlPath = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_EMOJICONS); initEmojicons(); mEmojiconsPager.setAdapter(new EmotjiconsPagerAdapter()); // placeHold if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_PLACEHOLD)) { String placehold = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_PLACEHOLD); mEditText.setHint(placehold); } // sendBtn text if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT)) { String sendBtnText = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT); mBtnSend.setText(sendBtnText); } // sendBtn text size if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT_SIZE)) { String sendBtnTextSize = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT_SIZE); try { mBtnSend.setTextSize(Float.parseFloat(sendBtnTextSize)); } catch (Exception e) { e.printStackTrace(); } } // sendBtn text color if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT_COLOR)) { String btnTextColor = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_TEXT_COLOR); mBtnSend.setTextColor(BUtility.parseColor(btnTextColor)); } // Selector need StateListDrawable StateListDrawable myGrad = (StateListDrawable) mBtnSend.getBackground(); // sendBtn color normal if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_COLOR)) { String btnColor = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_COLOR); if (!TextUtils.isEmpty(btnColor)) { GradientDrawable drawable = (GradientDrawable) myGrad.getCurrent(); drawable.setColor(BUtility.parseColor(btnColor)); } } // sendBtn color pressed if (json.has(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_COLOR_DOWN)) { String sendBtnbgColorDown = json .getString(EInputTextFieldViewUtils.INPUTTEXTFIELDVIEW_PARAMS_JSON_KEY_BTN_COLOR_DOWN); if (!TextUtils.isEmpty(sendBtnbgColorDown)) { mBtnSend.setPressed(true); GradientDrawable drawable = (GradientDrawable) myGrad.getCurrent(); drawable.setColor(BUtility.parseColor(sendBtnbgColorDown)); mBtnSend.setPressed(false); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleTimetableFragment.java
void checkSelectedDays(View rootView, boolean[] days) { Log.d(TAG, "Checking selected days: " + Arrays.toString(days)); schedule.setDays(days);/*w w w. j a v a 2s . co m*/ TextView mo = ((TextView) rootView.findViewById(R.id.day_mo)); TextView tu = ((TextView) rootView.findViewById(R.id.day_tu)); TextView we = ((TextView) rootView.findViewById(R.id.day_we)); TextView th = ((TextView) rootView.findViewById(R.id.day_th)); TextView fr = ((TextView) rootView.findViewById(R.id.day_fr)); TextView sa = ((TextView) rootView.findViewById(R.id.day_sa)); TextView su = ((TextView) rootView.findViewById(R.id.day_su)); TextView[] daysTvs = new TextView[] { mo, tu, we, th, fr, sa, su }; for (int i = 0; i < daysTvs.length; i++) { boolean isSelected = days[i]; StateListDrawable sld = (StateListDrawable) daysTvs[i].getBackground(); GradientDrawable shape = (GradientDrawable) sld.getCurrent(); shape.setColor(isSelected ? color : Color.WHITE); daysTvs[i].setTypeface(null, isSelected ? Typeface.BOLD : Typeface.NORMAL); daysTvs[i].setTextColor(isSelected ? Color.WHITE : Color.BLACK); } }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleTimetableFragment.java
private void updateColors(View rootView) { int color = DB.patients().getActive(getActivity()).color(); ((TextView) rootView.findViewById(R.id.textView3)).setTextColor(color); ((TextView) rootView.findViewById(R.id.textView2)).setTextColor(color); (rootView.findViewById(R.id.imageView)).setBackgroundColor(color); (rootView.findViewById(R.id.imageView1)).setBackgroundColor(color); StateListDrawable sld = (StateListDrawable) rootView.findViewById(R.id.text_container).getBackground(); GradientDrawable shape = (GradientDrawable) sld.getCurrent(); shape.setColor(Color.parseColor("#ececec")); hourlyIntervalEditText.setTextColor(color); hourlyIntervalFrom.setTextColor(color); hourlyIntervalRepeatDose.setTextColor(color); buttonScheduleStart.setTextColor(color); buttonScheduleEnd.setTextColor(color); periodValue.setTextColor(color);//from w ww.j a v a 2 s .co m periodRest.setTextColor(color); }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleTimetableFragment.java
void setupDaySelectionListeners(final View rootView) { View.OnClickListener listener = new View.OnClickListener() { @Override/*ww w . j a v a 2s . c o m*/ public void onClick(View view) { TextView text = ((TextView) view); int index; switch (text.getId()) { case R.id.day_mo: schedule.toggleSelectedDay(0); index = 0; break; case R.id.day_tu: schedule.toggleSelectedDay(1); index = 1; break; case R.id.day_we: schedule.toggleSelectedDay(2); index = 2; break; case R.id.day_th: index = 3; schedule.toggleSelectedDay(3); break; case R.id.day_fr: schedule.toggleSelectedDay(4); index = 4; break; case R.id.day_sa: schedule.toggleSelectedDay(5); index = 5; break; case R.id.day_su: schedule.toggleSelectedDay(6); index = 6; break; default: return; } boolean daySelected = schedule.days()[index]; StateListDrawable sld = (StateListDrawable) text.getBackground(); GradientDrawable shape = (GradientDrawable) sld.getCurrent(); shape.setColor(daySelected ? color : Color.WHITE); text.setTypeface(null, daySelected ? Typeface.BOLD : Typeface.NORMAL); text.setTextColor(daySelected ? Color.WHITE : Color.BLACK); boolean allDaysSelected = schedule.allDaysSelected(); if (schedule.type() == Schedule.SCHEDULE_TYPE_EVERYDAY && !allDaysSelected) { setRepeatType(Schedule.SCHEDULE_TYPE_SOMEDAYS, rootView, false); ignoreNextEvent = true; repeatTypeSpinner.setSelection(1); } else if (schedule.type() == Schedule.SCHEDULE_TYPE_SOMEDAYS && allDaysSelected) { repeatTypeSpinner.setSelection(0); schedule.setType(Schedule.SCHEDULE_TYPE_EVERYDAY); } Log.d(TAG, "All days selected: " + allDaysSelected + ", repeatType: " + schedule.type()); } }; rootView.findViewById(R.id.day_mo).setOnClickListener(listener); rootView.findViewById(R.id.day_tu).setOnClickListener(listener); rootView.findViewById(R.id.day_we).setOnClickListener(listener); rootView.findViewById(R.id.day_th).setOnClickListener(listener); rootView.findViewById(R.id.day_fr).setOnClickListener(listener); rootView.findViewById(R.id.day_sa).setOnClickListener(listener); rootView.findViewById(R.id.day_su).setOnClickListener(listener); }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleImportFragment.java
void checkSelectedDays(View rootView, boolean[] days) { Log.d(TAG, "Checking selected days: " + Arrays.toString(days)); schedule.setDays(days);/*from w w w . java 2 s . com*/ TextView mo = ((TextView) rootView.findViewById(R.id.day_mo)); TextView tu = ((TextView) rootView.findViewById(R.id.day_tu)); TextView we = ((TextView) rootView.findViewById(R.id.day_we)); TextView th = ((TextView) rootView.findViewById(R.id.day_th)); TextView fr = ((TextView) rootView.findViewById(R.id.day_fr)); TextView sa = ((TextView) rootView.findViewById(R.id.day_sa)); TextView su = ((TextView) rootView.findViewById(R.id.day_su)); TextView[] daysTvs = new TextView[] { mo, tu, we, th, fr, sa, su }; for (int i = 0; i < daysTvs.length; i++) { boolean isSelected = days[i]; StateListDrawable sld = (StateListDrawable) daysTvs[i].getBackground(); GradientDrawable shape = (GradientDrawable) sld.getCurrent(); shape.setColor(isSelected ? color : Color.WHITE); daysTvs[i].setTextColor(isSelected ? Color.WHITE : color); daysTvs[i].setTypeface(null, isSelected ? Typeface.BOLD : Typeface.NORMAL); } }
From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java
private void initKeyboardParams(JSONObject json) { try {/* w ww . ja v a 2 s .c o m*/ // mRecordTipsLayout init DisplayMetrics dm = getResources().getDisplayMetrics(); mRecordTipsLayout.getLayoutParams().height = dm.heightPixels / 2; // EmojiconsXmlPath mEmojiconsXmlPath = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_EMOJICONS); initEmojicons(); mEmojiconsPager.setAdapter(new EmotjiconsPagerAdapter()); // mSharesXmlPath mSharesXmlPath = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SHARES); initShares(); mSharesPager.setAdapter(new SharesPagerAdapter()); // placeHold @see placeholder if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_PLACEHOLD)) { String placeholder = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_PLACEHOLD); mEditText.setHint(placeholder); } // placeholder if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_PLACEHOLDER)) { String placeholder = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_PLACEHOLDER); mEditText.setHint(placeholder); } // touchDownImg if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TOUCHDOWNIMG)) { String touchDownImg = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TOUCHDOWNIMG); touchDownImg = touchDownImg.substring(BUtility.F_Widget_RES_SCHEMA.length()); touchDownImg = BUtility.F_Widget_RES_path + touchDownImg; Bitmap mTouchDownImgBitmap = mUexBaseObj.getBitmap(touchDownImg); if (mTouchDownImgBitmap != null) { mTouchDownImg = new BitmapDrawable(getResources(), mTouchDownImgBitmap); } } if (mTouchDownImg != null) { mRecordTipsImage.setImageDrawable(mTouchDownImg); } else { mTouchDownImgDefaule = getResources().getDrawable(CRes.plugin_chatkeyboard_voice_recording); if (mTouchDownImgDefaule != null) { mRecordTipsImage.setImageDrawable(mTouchDownImgDefaule); } } // dragOutsideImg if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_DRAGOUTSIDEIMG)) { String dragOutsideImg = json .getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_DRAGOUTSIDEIMG); dragOutsideImg = dragOutsideImg.substring(BUtility.F_Widget_RES_SCHEMA.length()); dragOutsideImg = BUtility.F_Widget_RES_path + dragOutsideImg; Bitmap mDragOutsideImgBitmap = mUexBaseObj.getBitmap(dragOutsideImg); if (mDragOutsideImgBitmap != null) { mDragOutsideImg = new BitmapDrawable(getResources(), mDragOutsideImgBitmap); } } if (mDragOutsideImg == null) { mDragOutsideImgDefaule = getResources().getDrawable(CRes.plugin_chatkeyboard_voice_cancle); } // textColor EditText if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_INPUTTEXTCOLOR)) { String textColor = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_INPUTTEXTCOLOR); mEditText.setTextColor(BUtility.parseColor(textColor)); } // textColor mRecordTimes if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TEXTCOLOR)) { String textColor = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TEXTCOLOR); mRecordTimes.setTextColor(BUtility.parseColor(textColor)); } // textSize mRecordTimes if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TEXTSIZE)) { String textSize = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_TEXTSIZE); try { mRecordTimes.setTextSize(Float.parseFloat(textSize)); } catch (Exception e) { e.printStackTrace(); } } // sendBtnText if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXT)) { String sendBtnText = json.getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXT); mBtnSend.setText(sendBtnText); } // sendBtnTextSize if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXTSIZE)) { String sendBtnTextSize = json .getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXTSIZE); try { mBtnSend.setTextSize(Float.parseFloat(sendBtnTextSize)); } catch (Exception e) { e.printStackTrace(); } } // sendBtnTextColor if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXTCOLOR)) { String sendBtnTextColor = json .getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_TEXTCOLOR); mBtnSend.setTextColor(BUtility.parseColor(sendBtnTextColor)); } // sendBtn Color Set try { // Selector need StateListDrawable StateListDrawable myGrad = (StateListDrawable) mBtnSend.getBackground(); // sendBtn Color Normal if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_BG_COLOR_UP)) { String sendBtnbgColorUp = json .getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_BG_COLOR_UP); GradientDrawable drawable = (GradientDrawable) myGrad.getCurrent(); drawable.setColor(BUtility.parseColor(sendBtnbgColorUp)); } // sendBtn Color Pressed if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_BG_COLOR_DOWN)) { String sendBtnbgColorDown = json .getString(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_SEND_BTN_BG_COLOR_DOWN); mBtnSend.setPressed(true); GradientDrawable drawable = (GradientDrawable) myGrad.getCurrent(); drawable.setColor(BUtility.parseColor(sendBtnbgColorDown)); mBtnSend.setPressed(false); } } catch (Exception e) { e.printStackTrace(); } // inputMode 0:Text 1:voice if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_INPUT_MODE)) { mInputMode = json.getInt(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_INPUT_MODE); } // keywords if (json.has(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_KEYWORDS)) { JSONArray keywordArray = json .getJSONArray(EChatKeyboardUtils.CHATKEYBOARD_PARAMS_JSON_KEY_KEYWORDS); for (int i = 0; i < keywordArray.length(); i++) { keywords.add(keywordArray.getString(i)); } } } catch (Exception e) { e.printStackTrace(); } }