Search in sources :

Example 91 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project AdMoney by ErnestoGonAr.

the class Ingresos method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragmefnt
    View rootView = inflater.inflate(R.layout.fragment_ingresos, container, false);
    rootView.setTag(TAG);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_ingresos);
    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());
    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);
    mAdapter = new CustomAdapter_Ingresos(mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 92 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project AdMoney by ErnestoGonAr.

the class Deudas method setRecyclerViewLayoutManager.

public void setRecyclerViewLayoutManager(LayoutManagerType layoutManagerType) {
    int scrollPosition = 0;
    // If a layout manager has already been set, get current scroll position.
    if (mRecyclerView.getLayoutManager() != null) {
        scrollPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
    }
    switch(layoutManagerType) {
        case GRID_LAYOUT_MANAGER:
            mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT);
            mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;
            break;
        case LINEAR_LAYOUT_MANAGER:
            mLayoutManager = new LinearLayoutManager(getActivity());
            mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
            break;
        default:
            mLayoutManager = new LinearLayoutManager(getActivity());
            mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
    }
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.scrollToPosition(scrollPosition);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 93 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project AdMoney by ErnestoGonAr.

the class Gastos method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_gastos, container, false);
    rootView.setTag(TAG);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_gastos);
    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());
    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);
    mAdapter = new CustomAdapter(mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 94 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project AdMoney by ErnestoGonAr.

the class Saldo method setRecyclerViewLayoutManager.

public void setRecyclerViewLayoutManager(LayoutManagerType layoutManagerType) {
    int scrollPosition = 0;
    // If a layout manager has already been set, get current scroll position.
    if (mRecyclerView.getLayoutManager() != null) {
        scrollPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
    }
    switch(layoutManagerType) {
        case GRID_LAYOUT_MANAGER:
            mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT);
            mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;
            break;
        case LINEAR_LAYOUT_MANAGER:
            mLayoutManager = new LinearLayoutManager(getActivity());
            mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
            break;
        default:
            mLayoutManager = new LinearLayoutManager(getActivity());
            mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
    }
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.scrollToPosition(scrollPosition);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 95 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project Rashr by DsLNeXuS.

the class InformationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_information_list, container, false);
    // Set the adapter
    if (view instanceof RecyclerView) {
        final Context context = view.getContext();
        RecyclerView recyclerView = (RecyclerView) view;
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        ArrayList<InformationItem> items = new ArrayList<>();
        items.add(new InformationItem("Device Name", RashrApp.DEVICE.getName()));
        items.add(new InformationItem("Manufacture", RashrApp.DEVICE.getManufacture()));
        String recoveryType = "";
        boolean recoveryWithPath = false;
        boolean recoveryWithBS = false;
        switch(RashrApp.DEVICE.getRecoveryType()) {
            case Device.PARTITION_TYPE_DD:
                recoveryType = "DD";
                recoveryWithPath = true;
                recoveryWithBS = RashrApp.DEVICE.getRecoveryBlocksize() > 0;
                break;
            case Device.PARTITION_TYPE_MTD:
                recoveryType = "MTD";
                break;
            case Device.PARTITION_TYPE_RECOVERY:
                recoveryType = "Flash over current Recovery";
                break;
            case Device.PARTITION_TYPE_NOT_SUPPORTED:
                recoveryType = "Not supported";
                break;
        }
        String kernelType = "";
        boolean kernelWithPath = false;
        boolean kernelWithBS = false;
        switch(RashrApp.DEVICE.getKernelType()) {
            case Device.PARTITION_TYPE_DD:
                kernelType = "DD";
                kernelWithPath = true;
                kernelWithBS = RashrApp.DEVICE.getKernelBlocksize() > 0;
                break;
            case Device.PARTITION_TYPE_MTD:
                kernelType = "MTD";
                break;
            case Device.PARTITION_TYPE_RECOVERY:
                kernelType = "Flash over current Recovery";
                break;
            case Device.PARTITION_TYPE_NOT_SUPPORTED:
                kernelType = "Not supported";
        }
        items.add(new InformationItem(getString(R.string.recovery_type), recoveryType));
        if (recoveryWithPath)
            items.add(new InformationItem("Recovery Path", RashrApp.DEVICE.getRecoveryPath()));
        if (recoveryWithBS)
            items.add(new InformationItem("Recovery Blocksize", String.valueOf(RashrApp.DEVICE.getRecoveryBlocksize())));
        items.add(new InformationItem("Kernel Partition Type", kernelType));
        if (kernelWithPath)
            items.add(new InformationItem("Kernel Path", RashrApp.DEVICE.getKernelPath()));
        if (kernelWithBS)
            items.add(new InformationItem("Kernel Blocksize", String.valueOf(RashrApp.DEVICE.getKernelBlocksize())));
        int total = 0;
        if (RashrApp.DEVICE.isCwmRecoverySupported()) {
            int tmp = RashrApp.DEVICE.getCwmRecoveryVersions().size();
            items.add(new InformationItem(getString(R.string.sCWM), String.valueOf(tmp)));
            total += tmp;
        }
        if (RashrApp.DEVICE.isTwrpRecoverySupported()) {
            int tmp = RashrApp.DEVICE.getTwrpRecoveryVersions().size();
            items.add(new InformationItem("TWRP Images", String.valueOf(tmp)));
            total += tmp;
        }
        if (RashrApp.DEVICE.isPhilzRecoverySupported()) {
            int tmp = RashrApp.DEVICE.getPhilzRecoveryVersions().size();
            items.add(new InformationItem("Philz Images", String.valueOf(tmp)));
            total += tmp;
        }
        if (RashrApp.DEVICE.isXZDualRecoverySupported()) {
            int tmp = RashrApp.DEVICE.getXZDualRecoveryVersions().size();
            items.add(new InformationItem("XZDual Images", String.valueOf(tmp)));
            total += tmp;
        }
        if (RashrApp.DEVICE.isStockRecoverySupported()) {
            int tmp = RashrApp.DEVICE.getStockRecoveryVersions().size();
            items.add(new InformationItem(getString(R.string.stock_recovery), String.valueOf(tmp)));
            total += tmp;
        }
        if (RashrApp.DEVICE.isStockKernelSupported()) {
            int tmp = RashrApp.DEVICE.getStockKernelVersions().size();
            items.add(new InformationItem(getString(R.string.stock_kernel), String.valueOf(tmp)));
            total += tmp;
        }
        items.add(new InformationItem(getString(R.string.total_images), String.valueOf(total)));
        for (String err : RashrApp.ERRORS) {
            items.add(new InformationItem("Error:", err));
        }
        recyclerView.setAdapter(new InformationRecyclerViewAdapter(items));
    }
    return view;
}
Also used : Context(android.content.Context) ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1976 RecyclerView (android.support.v7.widget.RecyclerView)1085 View (android.view.View)822 TextView (android.widget.TextView)352 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)235 ArrayList (java.util.ArrayList)204 ImageView (android.widget.ImageView)186 Intent (android.content.Intent)150 Toolbar (android.support.v7.widget.Toolbar)134 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)131 GridLayoutManager (android.support.v7.widget.GridLayoutManager)125 BindView (butterknife.BindView)124 Bundle (android.os.Bundle)109 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)105 Nullable (android.support.annotation.Nullable)98 ViewGroup (android.view.ViewGroup)82 Context (android.content.Context)81 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)80 AdapterView (android.widget.AdapterView)70 List (java.util.List)69