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);
}
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);
}
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;
}
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);
}
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;
}
Aggregations