Search in sources :

Example 16 with LayoutParams

use of android.widget.RelativeLayout.LayoutParams in project SmartMesh_Android by SmartMeshFoundation.

the class SelectGroupMemberListUI method showSearch.

private void showSearch() {
    isSearch = true;
    final int initialHeight = mTitleRela.getHeight();
    Animation anim = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
            } else {
                RelativeLayout.LayoutParams lp = (LayoutParams) mTitleRela.getLayoutParams();
                lp.setMargins(0, -(int) (initialHeight * interpolatedTime), 0, 0);
                mTitleRela.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };
    anim.setDuration(300);
    anim.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            RelativeLayout.LayoutParams lp = (LayoutParams) mTitleRela.getLayoutParams();
            lp.setMargins(0, -initialHeight, 0, 0);
            mTitleRela.requestLayout();
            searchResultLayout.setVisibility(View.VISIBLE);
            mTitleRela.setVisibility(View.GONE);
            mInputSearchLayout.setVisibility(View.VISIBLE);
            mInTextView.setVisibility(View.INVISIBLE);
            mInputSearch.setFocusable(true);
            mInputSearch.setFocusableInTouchMode(true);
            mInputSearch.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(mInputSearch, InputMethodManager.SHOW_FORCED);
        }
    });
    mTitleRela.startAnimation(anim);
    mSearchAdapter = new SelectGroupMemberListAdapter(friendFilterList, this);
    mSearchListView.setAdapter(mSearchAdapter);
}
Also used : Transformation(android.view.animation.Transformation) LayoutParams(android.widget.RelativeLayout.LayoutParams) RelativeLayout(android.widget.RelativeLayout) Animation(android.view.animation.Animation) InputMethodManager(android.view.inputmethod.InputMethodManager) AnimationListener(android.view.animation.Animation.AnimationListener) SelectGroupMemberListAdapter(com.lingtuan.firefly.contact.adapter.SelectGroupMemberListAdapter) LayoutParams(android.widget.RelativeLayout.LayoutParams)

Example 17 with LayoutParams

use of android.widget.RelativeLayout.LayoutParams in project SmartMesh_Android by SmartMeshFoundation.

the class SelectGroupMemberListUI method hideSearch.

private void hideSearch() {
    mInputSearch.setText("");
    isSearch = false;
    mTitleRela.setVisibility(View.VISIBLE);
    mInputSearchLayout.setVisibility(View.GONE);
    searchResultLayout.setVisibility(View.GONE);
    mInTextView.setVisibility(View.VISIBLE);
    final int initialHeight = mTitleRela.getHeight();
    Animation anim = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1) {
            } else {
                RelativeLayout.LayoutParams lp = (LayoutParams) mTitleRela.getLayoutParams();
                lp.setMargins(0, -initialHeight + (int) (initialHeight * interpolatedTime), 0, 0);
                mTitleRela.requestLayout();
            }
        }

        @Override
        public boolean willChangeBounds() {
            return false;
        }
    };
    anim.setDuration(300);
    anim.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            RelativeLayout.LayoutParams lp = (LayoutParams) mTitleRela.getLayoutParams();
            lp.setMargins(0, 0, 0, 0);
            mTitleRela.requestLayout();
            InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mInputSearch.getWindowToken(), 0);
        }
    });
    mTitleRela.startAnimation(anim);
}
Also used : Transformation(android.view.animation.Transformation) LayoutParams(android.widget.RelativeLayout.LayoutParams) RelativeLayout(android.widget.RelativeLayout) Animation(android.view.animation.Animation) InputMethodManager(android.view.inputmethod.InputMethodManager) AnimationListener(android.view.animation.Animation.AnimationListener) LayoutParams(android.widget.RelativeLayout.LayoutParams)

Example 18 with LayoutParams

use of android.widget.RelativeLayout.LayoutParams in project AndroidChromium by JackyAndroid.

the class PasswordGenerationAdapter method getViewForType.

/**
 * Builds the view of this type.
 * @param type The type of view to build.
 * @return The view for this viewType.
 */
private View getViewForType(int type) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = null;
    switch(type) {
        case SUGGESTION:
            view = inflater.inflate(R.layout.password_generation_popup_suggestion, null);
            ((TextView) view.findViewById(R.id.password_generation_title)).setText(mSuggestionTitle);
            ((TextView) view.findViewById(R.id.password_generation_password)).setText(mPassword);
            break;
        case EXPLANATION:
            view = inflater.inflate(R.layout.password_generation_popup_explanation, null);
            TextView explanation = (TextView) view.findViewById(R.id.password_generation_explanation);
            SpannableString explanationSpan = new SpannableString(mExplanationText);
            explanationSpan.setSpan(new NoUnderlineClickableSpan() {

                @Override
                public void onClick(View view) {
                    mDelegate.onSavedPasswordsLinkClicked();
                }
            }, mExplanationTextLinkRangeStart, mExplanationTextLinkRangeEnd, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
            explanation.setText(explanationSpan);
            explanation.setMovementMethod(LinkMovementMethod.getInstance());
            explanation.setLayoutParams(new LayoutParams(mSuggestionMeasuredWidth, LayoutParams.WRAP_CONTENT));
            break;
        default:
            assert false : "Unknown view type";
            break;
    }
    return view;
}
Also used : SpannableString(android.text.SpannableString) LayoutParams(android.widget.RelativeLayout.LayoutParams) LayoutInflater(android.view.LayoutInflater) NoUnderlineClickableSpan(org.chromium.ui.text.NoUnderlineClickableSpan) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 19 with LayoutParams

use of android.widget.RelativeLayout.LayoutParams in project VideoRecorder by qdrzwd.

the class FFmpegPreviewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ffmpeg_preview);
    cancelBtn = (Button) findViewById(R.id.play_cancel);
    cancelBtn.setOnClickListener(this);
    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    surfaceView = (TextureView) findViewById(R.id.preview_video);
    RelativeLayout previewVideoParent = (RelativeLayout) findViewById(R.id.preview_video_parent);
    LayoutParams layoutParams = (LayoutParams) previewVideoParent.getLayoutParams();
    layoutParams.width = displaymetrics.widthPixels;
    layoutParams.height = displaymetrics.widthPixels;
    previewVideoParent.setLayoutParams(layoutParams);
    surfaceView.setSurfaceTextureListener(this);
    surfaceView.setOnClickListener(this);
    path = getIntent().getStringExtra("path");
    imagePlay = (ImageView) findViewById(R.id.previre_play);
    imagePlay.setOnClickListener(this);
    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnCompletionListener(this);
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) RelativeLayout(android.widget.RelativeLayout) DisplayMetrics(android.util.DisplayMetrics) MediaPlayer(android.media.MediaPlayer)

Example 20 with LayoutParams

use of android.widget.RelativeLayout.LayoutParams in project android-common by Trinea.

the class ViewUtils method getAbsListViewHeightBasedOnChildren.

/**
 * get AbsListView height according to every children
 *
 * @param view
 * @return
 */
public static int getAbsListViewHeightBasedOnChildren(AbsListView view) {
    ListAdapter adapter;
    if (view == null || (adapter = view.getAdapter()) == null) {
        return 0;
    }
    int height = 0;
    for (int i = 0; i < adapter.getCount(); i++) {
        View item = adapter.getView(i, null, view);
        if (item instanceof ViewGroup) {
            item.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        }
        item.measure(0, 0);
        height += item.getMeasuredHeight();
    }
    height += view.getPaddingTop() + view.getPaddingBottom();
    return height;
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) ViewGroup(android.view.ViewGroup) GridView(android.widget.GridView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ListAdapter(android.widget.ListAdapter)

Aggregations

LayoutParams (android.widget.RelativeLayout.LayoutParams)22 RelativeLayout (android.widget.RelativeLayout)8 View (android.view.View)7 ChangeBounds (android.transition.ChangeBounds)4 ViewGroup (android.view.ViewGroup)4 Button (android.widget.Button)4 AbsListView (android.widget.AbsListView)3 ListAdapter (android.widget.ListAdapter)3 ListView (android.widget.ListView)3 TextView (android.widget.TextView)3 Point (android.graphics.Point)2 SpannableString (android.text.SpannableString)2 LayoutInflater (android.view.LayoutInflater)2 Animation (android.view.animation.Animation)2 AnimationListener (android.view.animation.Animation.AnimationListener)2 Transformation (android.view.animation.Transformation)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2 GridView (android.widget.GridView)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1