android.support.v7.widget.LinearLayoutCompat Java Examples

The following examples show how to use android.support.v7.widget.LinearLayoutCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewMaker.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
static View makeHeaderTextView(String text) {

        EmojiTextViewE textView = new EmojiTextViewE(context);

//        if (G.isDarkTheme) {
//            textView.setTextColor(Color.BLACK);
//        } else {
        textView.setTextColor(Color.parseColor(G.textBubble));
//        }

        textView.setBackgroundResource(R.drawable.rect_radios_top_gray);
        textView.setId(R.id.messageSenderName);
        textView.setGravity(LEFT);
        textView.setPadding(20, 0, 20, 5);
        //textView.setMinimumWidth((int) G.context.getResources().getDimension(R.dimen.dp220));
        textView.setSingleLine(true);
        textView.setTypeface(G.typeface_IRANSansMobile);
        textView.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
        textView.setText(text);
        setTextSize(textView, R.dimen.dp12);

        return textView;
    }
 
Example #2
Source File: ProductActivity.java    From product-catalogue-android with MIT License 5 votes vote down vote up
private void generateThumbnail(String url, final int position, int size) {
  ImageView imageView = new ImageView(this);
  imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(size, size));
  imageView.setBackgroundResource(R.drawable.thumbnail_bg);
  Picasso.with(this).load(url).fit().centerInside().into(imageView);
  imageView.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      imagesPager.setCurrentItem(position, true);
    }
  });
  thumbnails.addView(imageView);
}
 
Example #3
Source File: HorizontalPicker.java    From MyBlogDemo with Apache License 2.0 5 votes vote down vote up
public HorizontalPicker(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setOrientation(VERTICAL);
    header = new LinearLayout(context);
    header.setOrientation(LinearLayout.HORIZONTAL);
    float density = getResources().getDisplayMetrics().density;
    addView(header, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (density * 56)));
    mDetailContainer = new FrameLayout(context);
    addView(mDetailContainer, new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
 
Example #4
Source File: FloatingToolbar.java    From FloatingToolbar with Apache License 2.0 5 votes vote down vote up
private void createMenuLayout() {
    mMenuLayout = new LinearLayoutCompat(getContext());

    LayoutParams layoutParams
            = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    mMenuLayout.setId(genViewId());
    addView(mMenuLayout, layoutParams);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mMenuLayout.setPaddingRelative(0, 0, 0, 0);
    } else {
        mMenuLayout.setPadding(0, 0, 0, 0);
    }
}
 
Example #5
Source File: AvlDirectCall.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
private View makeHeaderTextView(Context context) {

        TextView textView = new TextView(context);
        textView.setTextColor(Color.parseColor("#ffffff"));
        textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.dp16));
        LinearLayoutCompat.LayoutParams lp = new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        textView.setLayoutParams(lp);
        textView.setPadding(0, -(ViewMaker.i_Dp(R.dimen.dp6)), 0, -(ViewMaker.i_Dp(R.dimen.dp6)));
        textView.setText(R.string.md_expand_arrow);
        textView.setVisibility(INVISIBLE);
        textView.setTypeface(G.typeface_Fontico);


        return textView;
    }
 
Example #6
Source File: BackgroundProgress.java    From BackgroundProgress with Apache License 2.0 5 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BackgroundProgress);
    try {
        showTxt = typedArray.getString(R.styleable.BackgroundProgress_showTxt);
        isGradient = typedArray.getBoolean(R.styleable.BackgroundProgress_isGradient, true);
    } catch (Exception e) {
        showTxt = null;
        isGradient = true;
    }

    typedArray.recycle();

    View view = LayoutInflater.from(context).inflate(R.layout.bp, null);

    backgroundProgressView = (BackgroundProgressView) view.findViewById(R.id.progress);
    tv = (TextView) view.findViewById(R.id.tv);

    if (TextUtils.isEmpty(showTxt)) {
        tv.setVisibility(GONE);
    } else {
        tv.setText(showTxt);
    }

    backgroundProgressView.set_isGradient(isGradient);


    ViewGroup.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(view, layoutParams);
}
 
Example #7
Source File: CategoryAdapter.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called to create the ViewHolder at the given position.
 *
 * @param parent   parent to assign the newly created view to
 * @param viewType ignored
 */
@Override
public CategoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_category, parent, false);
    v.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT));

    return new CategoryViewHolder(v, mListener);
}
 
Example #8
Source File: StatisticsAdapter.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called to create the ViewHolder at the given position.
 *
 * @param parent   parent to assign the newly created view to
 * @param viewType ignored
 */
@Override
public StatisticViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v;
    int layout;

    Context parentContext = parent.getContext();

    if (viewType == StatisticViewHolder.TYPE_LARGE) {
        layout = R.layout.list_item_statistic_most_played;

    } else if (viewType == StatisticViewHolder.TYPE_SMALL) {
        layout = R.layout.list_item_statistic_pie_chart;
    } else {
        throw new RuntimeException("Invalid view type!");
    }

    v = LayoutInflater.from(parentContext).inflate(layout, parent, false);

    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(
            LinearLayoutCompat.LayoutParams.MATCH_PARENT,
            LinearLayoutCompat.LayoutParams.WRAP_CONTENT);

    v.setLayoutParams(layoutParams);

    return new StatisticViewHolder(v, mUserLogicFactory, mChallengeDataSource, mApplication,
            mUser, mCategoryId);
}
 
Example #9
Source File: AllSlotInfoDialogFragment.java    From Android-nRF-Beacon-for-Eddystone with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
    alertDialogBuilder.setTitle("All Slot Information");
    alertDialogBuilder.setMessage("Following slots have been configured in the beacon");

    final View alertDialogView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_all_slot_info, null);
    final LinearLayout slotTitleContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_title_container);
    final LinearLayout slotInfoContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_info_container);
    LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    for(int i = 0; i < mAllSlotInfo.size(); i++) {
        TextView slotTitle = new TextView(getActivity());
        slotTitle.setLayoutParams(lParams);
        slotTitle.setText("Slot " + i + ":");
        slotTitleContainer.addView(slotTitle);

        TextView slotInfo = new TextView(getActivity());
        slotInfo.setLayoutParams(lParams);
        slotInfo.setText(mAllSlotInfo.get(i));
        slotInfoContainer.addView(slotInfo);

        if(i > 0){
            lParams.setMargins(0, 10, 0, 0);
        }

    }

    final AlertDialog alertDialog = alertDialogBuilder.setView(alertDialogView).setPositiveButton(getString(R.string.ok), null).show();
    alertDialog.setCanceledOnTouchOutside(false);

    alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                dismiss();
        }
    });



    return alertDialog;
}
 
Example #10
Source File: LinearLayoutCompatAssert.java    From assertj-android with Apache License 2.0 4 votes vote down vote up
public LinearLayoutCompatAssert(LinearLayoutCompat actual) {
  super(actual, LinearLayoutCompatAssert.class);
}
 
Example #11
Source File: AppCompatv7DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void linearLayoutCompat(Anvil.Renderable r) {
  return BaseDSL.v(LinearLayoutCompat.class, r);
}
 
Example #12
Source File: AppCompatv7DSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult linearLayoutCompat() {
  return BaseDSL.v(LinearLayoutCompat.class);
}
 
Example #13
Source File: StepperLayout.java    From android-material-stepper with Apache License 2.0 4 votes vote down vote up
@Override
public final void setOrientation(@LinearLayoutCompat.OrientationMode int orientation) {
    //only vertical orientation is supported
    super.setOrientation(VERTICAL);
}
 
Example #14
Source File: ViewMaker.java    From iGap-Android with GNU Affero General Public License v3.0 4 votes vote down vote up
static View makeTextViewMessage(int maxsize, boolean hasEmoji, boolean hasLink) {

        if (hasEmoji) {
            EmojiTextViewE emojiTextViewE = new EmojiTextViewE(context);
            emojiTextViewE.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//            if (G.isDarkTheme) {
            emojiTextViewE.setTextColor(Color.parseColor(G.textBubble));
//            } else {
//                emojiTextViewE.setTextColor(Color.parseColor("#333333"));
//            }

            emojiTextViewE.setId(R.id.messageSenderTextMessage);
            emojiTextViewE.setPadding(10, 4, 10, 4);
            emojiTextViewE.setTypeface(G.typeface_IRANSansMobile);
            setTextSizeDirect(emojiTextViewE, G.userTextSize);
            emojiTextViewE.setEmojiSize(i_Dp(R.dimen.dp18));
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                emojiTextViewE.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
            }
            setLayoutDirection(emojiTextViewE, View.LAYOUT_DIRECTION_LOCALE);
            if (hasLink) {
                emojiTextViewE.setMovementMethod(LinkMovementMethod.getInstance());
            }

            if (maxsize > 0) {
                emojiTextViewE.setMaxWidth(maxsize);
            }

            return emojiTextViewE;
        } else {
            TextView textView = new TextView(context);
            textView.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//            if (G.isDarkTheme) {
            textView.setTextColor(Color.parseColor(G.textBubble));
//            } else {
//                textView.setTextColor(Color.parseColor("#333333"));
//            }

            textView.setId(R.id.messageSenderTextMessage);
            textView.setPadding(10, 0, 10, 0);
            textView.setTypeface(G.typeface_IRANSansMobile);
            setTextSizeDirect(textView, G.userTextSize);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                textView.setTextDirection(View.TEXT_DIRECTION_FIRST_STRONG);
            }
            setLayoutDirection(textView, View.LAYOUT_DIRECTION_LOCALE);
            if (hasLink) {
                textView.setMovementMethod(LinkMovementMethod.getInstance());
            }
            if (maxsize > 0) {
                textView.setMaxWidth(maxsize);
            }

            return textView;
        }
    }
 
Example #15
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 4 votes vote down vote up
public void end(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_END);
}
 
Example #16
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 4 votes vote down vote up
public void middle(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_MIDDLE);
}
 
Example #17
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 4 votes vote down vote up
public void beginning(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_BEGINNING);
}
 
Example #18
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_linear_layout_compat);
    mLlc = (LinearLayoutCompat) findViewById(R.id.llc);
}
 
Example #19
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 2 votes vote down vote up
public void end_middle(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_MIDDLE | LinearLayoutCompat.SHOW_DIVIDER_END);

}
 
Example #20
Source File: LinearLayoutCompatActivity.java    From MaterialDesignDemo with MIT License 2 votes vote down vote up
public void beginning_middle(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_BEGINNING | LinearLayoutCompat.SHOW_DIVIDER_MIDDLE);

}