use of android.view.ViewGroup.LayoutParams in project Anki-Android by Ramblurr.
the class StyledProgressDialog method show.
public static StyledProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminable, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
final StyledProgressDialog dialog = new StyledProgressDialog(context);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.styled_progress_dialog, null);
dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
// set title
if (title != null && title.length() > 0) {
((TextView) layout.findViewById(R.id.alertTitle)).setText(title);
// if (icon != 0) {
// ((ImageView) layout.findViewById(R.id.icon)).setImageResource(icon);
// } else {
// layout.findViewById(R.id.icon).setVisibility(View.GONE);
// }
} else {
layout.findViewById(R.id.topPanel).setVisibility(View.GONE);
layout.findViewById(R.id.titleDivider).setVisibility(View.GONE);
}
// set the message
if (message != null) {
TextView tv = (TextView) layout.findViewById(R.id.message);
tv.setText(message);
// if (messageSize != 0) {
// tv.setTextSize(messageSize * context.getResources().getDisplayMetrics().scaledDensity);
// }
}
// set background
try {
Themes.setStyledProgressDialogDialogBackgrounds(layout);
} catch (OutOfMemoryError e) {
Log.e(AnkiDroidApp.TAG, "StyledDialog - Dialog could not be created: " + e);
Themes.showThemedToast(context, context.getResources().getString(R.string.error_insufficient_memory), false);
return null;
}
dialog.setContentView(layout);
dialog.setCancelable(cancelable);
dialog.setOnCancelListener(cancelListener);
if (animationEnabled(context)) {
dialog.show();
}
return dialog;
}
use of android.view.ViewGroup.LayoutParams in project storymaker by StoryMaker.
the class ProjectTagFragment method displayTag.
/**
* Display a tag with text equal to "#" + tag, and View#tag equal
* to tag's String value.
*
* Does not add tag to the Project represented by this Fragment
*/
private void displayTag(String tag) {
Button btnTag = new Button(getActivity());
btnTag.setEnabled(mEditable);
btnTag.setText("#" + tag);
btnTag.setTag(tag);
btnTag.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
btnTag.setOnClickListener(mInternalOnTagClickListener);
if (mSpecialMessageTv != null) {
mContainerProjectTagsView.removeView(mSpecialMessageTv);
}
mContainerProjectTagsView.addView(btnTag, 0);
}
use of android.view.ViewGroup.LayoutParams in project storymaker by StoryMaker.
the class ProjectTagFragment method displayMessage.
/**
* Display a message in a view that spans the entire
* tag pool
*/
private void displayMessage(String message) {
TextView textView = new TextView(getActivity());
textView.setText(message);
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mSpecialMessageTv = textView;
mContainerProjectTagsView.addView(textView, 0);
}
use of android.view.ViewGroup.LayoutParams in project GT by Tencent.
the class GTLogFragment method cancelFilterMsgInput.
private void cancelFilterMsgInput(View v) {
btn_msg_input_cancel.setVisibility(View.GONE);
btn_level.setVisibility(View.VISIBLE);
btn_tag.setVisibility(View.VISIBLE);
btn_level_toast.setVisibility(View.VISIBLE);
btn_tag_toast.setVisibility(View.VISIBLE);
LayoutParams laParams = (LayoutParams) et_Msg.getLayoutParams();
laParams.width = (int) (displayWidth / 2.74);
et_Msg.setLayoutParams(laParams);
InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
}
use of android.view.ViewGroup.LayoutParams in project GT by Tencent.
the class GTLogFragment method filterMsgInput.
private void filterMsgInput() {
LayoutParams laParams = (LayoutParams) et_Msg.getLayoutParams();
// 4.737);
laParams.width = (int) (displayWidth - displayWidth / 4.0f);
et_Msg.setLayoutParams(laParams);
btn_msg_input_cancel.setVisibility(View.VISIBLE);
btn_level.setVisibility(View.INVISIBLE);
btn_tag.setVisibility(View.INVISIBLE);
btn_level_toast.setVisibility(View.INVISIBLE);
btn_tag_toast.setVisibility(View.INVISIBLE);
}
Aggregations