Search in sources :

Example 76 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project vlayout by alibaba.

the class StaggeredGridLayoutHelper method recycleFromEnd.

private void recycleFromEnd(RecyclerView.Recycler recycler, int line, LayoutManagerHelper helper) {
    final OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();
    final int childCount = helper.getChildCount();
    int i;
    for (i = childCount - 1; i >= 0; i--) {
        View child = helper.getChildAt(i);
        if (child != null && orientationHelper.getDecoratedStart(child) > line) {
            LayoutParams lp = (LayoutParams) child.getLayoutParams();
            int position = lp.getViewPosition();
            Span span = findSpan(position, child, false);
            if (span != null) {
                span.popEnd(orientationHelper);
                helper.removeChildView(child);
                recycler.recycleView(child);
            }
        } else {
            // done
            return;
        }
    }
}
Also used : LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams) OrientationHelperEx(com.alibaba.android.vlayout.OrientationHelperEx) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 77 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project PhotoNoter by yydcdut.

the class DetailActivity method initToolBar.

private void initToolBar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setBackgroundColor(Color.TRANSPARENT);
    toolbar.setTitle(" ");
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    if (AppCompat.AFTER_LOLLIPOP) {
        int size = getStatusBarSize();
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) toolbar.getLayoutParams();
        layoutParams.setMargins(0, size, 0, 0);
    }
}
Also used : FrameLayout(android.widget.FrameLayout) Point(android.graphics.Point) Toolbar(android.support.v7.widget.Toolbar)

Example 78 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project EasyRecyclerView by Jude95.

the class RecyclerArrayAdapter method createSpViewByType.

private View createSpViewByType(ViewGroup parent, int viewType) {
    for (ItemView headerView : headers) {
        if (headerView.hashCode() == viewType) {
            View view = headerView.onCreateView(parent);
            StaggeredGridLayoutManager.LayoutParams layoutParams;
            if (view.getLayoutParams() != null)
                layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.getLayoutParams());
            else
                layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            layoutParams.setFullSpan(true);
            view.setLayoutParams(layoutParams);
            return view;
        }
    }
    for (ItemView footerview : footers) {
        if (footerview.hashCode() == viewType) {
            View view = footerview.onCreateView(parent);
            StaggeredGridLayoutManager.LayoutParams layoutParams;
            if (view.getLayoutParams() != null)
                layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.getLayoutParams());
            else
                layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            layoutParams.setFullSpan(true);
            view.setLayoutParams(layoutParams);
            return view;
        }
    }
    return null;
}
Also used : StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) EasyRecyclerView(com.jude.easyrecyclerview.EasyRecyclerView) View(android.view.View)

Example 79 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project LeafPic by HoraApps.

the class AlertDialogsHelper method getInsertTextDialog.

public static AlertDialog getInsertTextDialog(final ThemedActivity activity, AlertDialog.Builder dialogBuilder, EditText editText, @StringRes int title) {
    View dialogLayout = activity.getLayoutInflater().inflate(org.horaapps.leafpic.R.layout.dialog_insert_text, null);
    TextView textViewTitle = (TextView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.rename_title);
    ((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.dialog_chose_provider_title)).setCardBackgroundColor(activity.getCardBackgroundColor());
    textViewTitle.setBackgroundColor(activity.getPrimaryColor());
    textViewTitle.setText(title);
    ThemeHelper.setCursorDrawableColor(editText, activity.getTextColor());
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    editText.setLayoutParams(layoutParams);
    editText.setSingleLine(true);
    editText.getBackground().mutate().setColorFilter(activity.getTextColor(), PorterDuff.Mode.SRC_IN);
    editText.setTextColor(activity.getTextColor());
    try {
        Field f = TextView.class.getDeclaredField("mCursorDrawableRes");
        f.setAccessible(true);
        f.set(editText, null);
    } catch (Exception ignored) {
    }
    ((RelativeLayout) dialogLayout.findViewById(org.horaapps.leafpic.R.id.container_edit_text)).addView(editText);
    dialogBuilder.setView(dialogLayout);
    return dialogBuilder.create();
}
Also used : Field(java.lang.reflect.Field) FrameLayout(android.widget.FrameLayout) CardView(android.support.v7.widget.CardView) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView)

Example 80 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project LeafPic by HoraApps.

the class SelectAlbumBottomSheet method setupDialog.

@Override
public void setupDialog(Dialog dialog, int style) {
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.select_folder_bottom_sheet, null);
    theme = new ThemeHelper(getContext());
    RecyclerView mRecyclerView = (RecyclerView) contentView.findViewById(R.id.folders);
    mRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
    adapter = new BottomSheetAlbumsAdapter();
    mRecyclerView.setAdapter(adapter);
    exploreModePanel = (LinearLayout) contentView.findViewById(R.id.explore_mode_panel);
    currentFolderPath = (TextView) contentView.findViewById(R.id.bottom_sheet_sub_title);
    imgExploreMode = (IconicsImageView) contentView.findViewById(R.id.toggle_hidden_icon);
    imgExploreMode.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleExplorerMode(!exploreMode);
        }
    });
    toggleExplorerMode(false);
    /**
     *SET UP THEME*
     */
    theme.setColorScrollBarDrawable(ContextCompat.getDrawable(dialog.getContext(), R.drawable.ic_scrollbar));
    contentView.findViewById(R.id.ll_bottom_sheet_title).setBackgroundColor(theme.getPrimaryColor());
    contentView.findViewById(R.id.ll_select_folder).setBackgroundColor(theme.getCardBackgroundColor());
    ((TextView) contentView.findViewById(R.id.bottom_sheet_title)).setText(title);
    ((IconicsImageView) contentView.findViewById(R.id.create_new_folder)).setColor(theme.getIconColor());
    ((TextView) contentView.findViewById(R.id.create_new_folder_text)).setTextColor(theme.getSubTextColor());
    ((IconicsImageView) contentView.findViewById(R.id.done)).setColor(theme.getIconColor());
    contentView.findViewById(R.id.done).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            selectAlbumInterface.folderSelected(currentFolderPath.getText().toString());
        }
    });
    contentView.findViewById(R.id.ll_create_new_folder).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final EditText editText = new EditText(getContext());
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), theme.getDialogStyle());
            AlertDialogsHelper.getInsertTextDialog(((ThemedActivity) getActivity()), builder, editText, R.string.new_folder);
            builder.setPositiveButton(R.string.ok_action, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    File folderPath = new File(currentFolderPath.getText().toString() + File.separator + editText.getText().toString());
                    if (folderPath.mkdir())
                        displayContentFolder(folderPath);
                }
            });
            builder.show();
        }
    });
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = layoutParams.getBehavior();
    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        ((BottomSheetBehavior) behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }
    adapter.notifyDataSetChanged();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) ThemeHelper(org.horaapps.leafpic.util.ThemeHelper) DialogInterface(android.content.DialogInterface) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) File(java.io.File)

Aggregations

View (android.view.View)140 RecyclerView (android.support.v7.widget.RecyclerView)127 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)38 ViewGroup (android.view.ViewGroup)33 LinearLayout (android.widget.LinearLayout)27 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)17 Paint (android.graphics.Paint)15 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)15 FrameLayout (android.widget.FrameLayout)15 BindView (butterknife.BindView)12 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 Toolbar (android.support.v7.widget.Toolbar)11 Rect (android.graphics.Rect)9 EditText (android.widget.EditText)9 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)9 AdapterView (android.widget.AdapterView)8 RelativeLayout (android.widget.RelativeLayout)8 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7