Search in sources :

Example 86 with Adapter

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

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    bd = new BDHandlerAM(this);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
}
Also used : NavigationView(android.support.design.widget.NavigationView) TabLayout(android.support.design.widget.TabLayout) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 87 with Adapter

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

the class CategoriasIngreso method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_categorias_ingreso);
    aceptar = (Button) findViewById(R.id.aceptarin);
    agregar = (ImageButton) findViewById(R.id.agregar_ci);
    bd = new BDHandlerAM(this);
    bandera = false;
    a = bd.spinneringresos();
    RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_ci);
    try {
        String[][] dataSet = bd.obtenerCategoriasi();
        LinearLayoutManager ln = new LinearLayoutManager(this);
        ln.setOrientation(LinearLayoutManager.VERTICAL);
        CustomAdapter_CategoriasI adapter = new CustomAdapter_CategoriasI(dataSet);
        rv.setLayoutManager(ln);
        rv.setAdapter(adapter);
    } catch (ArrayIndexOutOfBoundsException e) {
        Toast toast = Toast.makeText(this, "No hay categorias de Ingresos", Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.show();
        return;
    }
    agregar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(CategoriasIngreso.this);
            View mView = getLayoutInflater().inflate(R.layout.insertar_categoriase, null);
            final EditText insertar = (EditText) mView.findViewById(R.id.insertb);
            final Button iguardar = (Button) mView.findViewById(R.id.insertarguardar);
            final Button icancelar = (Button) mView.findViewById(R.id.insertarcancelar);
            mBuilder.setView(mView);
            AlertDialog dialog = mBuilder.create();
            dialog.show();
            insertar.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(insertar, InputMethodManager.SHOW_IMPLICIT);
            iguardar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    validartexto = insertar.getText().toString();
                    insertar();
                    if (bandera) {
                        bd.insertarCI(primeroMayuscula(insertar.getText().toString()), 7);
                    }
                    onBackPressed2();
                }
            });
            icancelar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    onBackPressed2();
                }
            });
        }
    });
    aceptar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) InputMethodManager(android.view.inputmethod.InputMethodManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Toast(android.widget.Toast) ImageButton(android.widget.ImageButton) Button(android.widget.Button) CustomAdapter_CategoriasI(layout.CustomAdapter_CategoriasI) RecyclerView(android.support.v7.widget.RecyclerView)

Example 88 with Adapter

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

the class CategoriasE method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.activity_categorias_egresos, container, false);
    rootView.setTag(TAG);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_ce);
    // 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_CategoriasE(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 89 with Adapter

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

the class CategoriasI method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.activity_categorias_ingreso, container, false);
    rootView.setTag(TAG);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_ci);
    // 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_CategoriasI(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 90 with Adapter

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

the class Reporte_Prestamos method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reporte__prestamos);
    bd = new BDHandlerAM(this);
    RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_prestamos);
    try {
        String[][] dataSet = bd.obtenerPrestamos();
        LinearLayoutManager ln = new LinearLayoutManager(this);
        ln.setOrientation(LinearLayoutManager.VERTICAL);
        CustomAdapter_Prestamos adapter = new CustomAdapter_Prestamos(dataSet);
        rv.setLayoutManager(ln);
        rv.setAdapter(adapter);
    } catch (ArrayIndexOutOfBoundsException e) {
        Toast toast = Toast.makeText(this, "No hay prestamos", Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.show();
        return;
    }
}
Also used : CustomAdapter_Prestamos(layout.CustomAdapter_Prestamos) Toast(android.widget.Toast) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)688 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)612 View (android.view.View)593 TextView (android.widget.TextView)245 ArrayList (java.util.ArrayList)179 Intent (android.content.Intent)148 ImageView (android.widget.ImageView)132 Toolbar (android.support.v7.widget.Toolbar)118 GridLayoutManager (android.support.v7.widget.GridLayoutManager)111 AdapterView (android.widget.AdapterView)109 ViewGroup (android.view.ViewGroup)97 AlertDialog (android.support.v7.app.AlertDialog)91 Bundle (android.os.Bundle)85 ListView (android.widget.ListView)85 BindView (butterknife.BindView)85 Nullable (android.support.annotation.Nullable)78 DialogInterface (android.content.DialogInterface)71 Context (android.content.Context)65 ArrayAdapter (android.widget.ArrayAdapter)65 LayoutInflater (android.view.LayoutInflater)64