Skip to content

Instantly share code, notes, and snippets.

@gvr23
gvr23 / fragments.java
Created February 2, 2018 23:40
number of fragments
ANDROID
==================================================================================================================================
xml
==================================================================================================================================
<FrameLayout
android:id="@+id/flPlaceHolder"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="7"/>
=================================================================================================================================
@gvr23
gvr23 / CustomViewPager.java
Created January 24, 2018 20:42
eliminate the touch event from the View Pager
package dsbmobile.com.drokasa.liquidacion.activity;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* Created by giova on 1/24/2018.
*/
ANDROID
===================================================================================================================================
In the Manifest
=================================================================================================================================
compile 'com.tubb.smrv:swipemenu-recyclerview:3.0.4'
=================================================================================================================================
In the Activity
===================================================================================================================================
private void preLoad() {
clientAdapter = new ClientAdapter(new ArrayList<ClienteBean>());
@gvr23
gvr23 / spinnersimpleadapter.java
Created January 23, 2018 22:58
add a simple apinner adapter
bankList.add(0, new BancoBean("000", "Seleccione Banco"));
ArrayAdapter<BancoBean> dataAdapter = new ArrayAdapter<BancoBean>(getBaseContext(), android.R.layout.simple_spinner_item, bankList);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
spBanks.setAdapter(dataAdapter);
class implements AdapterView.OnItemSelectedListener
@gvr23
gvr23 / spinnerlayerlist.java
Created January 23, 2018 22:56
change the background and the image from wtihin a spinner
ANDROID
===================================================================================================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="8dp" android:bottom="8dp">
<shape>
<solid android:color="@android:color/white" />
<stroke
android:width="0.1dp"
android:color="@color/color_primary" />
@gvr23
gvr23 / DatePickerFragment.java
Created January 18, 2018 22:51
date picker pop up and implementation
ANDROID
==================================================================================================================================
package dsbmobile.com.drokasa.ui.dialog;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
@gvr23
gvr23 / fragmentAtoFragmentB.java
Created January 16, 2018 23:27
pass from one fragment to an activity, to another fragment
ANDROID
=================================================================================================================================
=================================================================================================================================
FRAGMENT ADAPTER
=================================================================================================================================
package dsbmobile.com.drokasa.liquidacion.adapter;
import android.content.Context;
import android.content.res.Resources;
ANDROID
===================================================================================================================================
ADAPTER
===================================================================================================================================
public class DocumentAdapter extends RecyclerView.Adapter<DocumentAdapter.ViewHolder>{
private List<DocumentoBean> items;
public DocumentAdapter(List<DocumentoBean> items){
@gvr23
gvr23 / tabs.java
Created January 13, 2018 02:08
setear tabs en un activity
ANDROID
===================================================================================================================================
viewpager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager(), getBaseContext()));
slidingTabs.setupWithViewPager(viewpager);
===================================================================================================================================
xml
===================================================================================================================================
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
@gvr23
gvr23 / toolbar.java
Created January 13, 2018 02:01
manera para setear un toolbar
ANDROID
===================================================================================================================================
setSupportActionBar(tbDocumento);
ActionBar actBar = getSupportActionBar();
if (actBar != null) {
actBar.setDisplayHomeAsUpEnabled(true);
actBar.setIcon(R.drawable.ic_shopping_cart);
actBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back);
actBar.setTitle("Editar Documento");