Search in sources :

Example 11 with LayoutParams

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;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 12 with LayoutParams

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) Button(android.widget.Button)

Example 13 with LayoutParams

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TextView(android.widget.TextView)

Example 14 with LayoutParams

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 15 with LayoutParams

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams)

Aggregations

LayoutParams (android.view.ViewGroup.LayoutParams)263 TextView (android.widget.TextView)54 View (android.view.View)50 ViewGroup (android.view.ViewGroup)50 FrameLayout (android.widget.FrameLayout)35 LinearLayout (android.widget.LinearLayout)32 ImageView (android.widget.ImageView)30 Test (org.junit.Test)26 ListView (android.widget.ListView)22 ScrollView (android.widget.ScrollView)22 Paint (android.graphics.Paint)21 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)19 Context (android.content.Context)18 AdapterView (android.widget.AdapterView)17 RelativeLayout (android.widget.RelativeLayout)14 DisplayMetrics (android.util.DisplayMetrics)12 CheckedTextView (android.widget.CheckedTextView)12 Rect (android.graphics.Rect)9 ViewParent (android.view.ViewParent)9 TypedArray (android.content.res.TypedArray)8