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);
}
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();
}
});
}
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;
}
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;
}
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;
}
}
Aggregations