Skip to content

Instantly share code, notes, and snippets.

View rivancic's full-sized avatar
:shipit:
I'm shipping it

Renato Ivancic rivancic

:shipit:
I'm shipping it
View GitHub Profile
@rivancic
rivancic / FragmentFactory.java
Last active December 15, 2015 16:40
Android Fragment Factory metnod for passing in arguments
public static final String ARGUMENT_ARG = "ARGUMENT_ARG";
private String argumentValue;
/**
* Factory method for passing arguments.
*/
public static Fragment getFragment(String argumentValue) {
Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
@rivancic
rivancic / SwipeTabsAndroid.java
Created December 15, 2015 17:35
Android Tabs and Swipable Fragments stub
public class TabActivity extends Activity {
TabPageAdapter tabPageAdapter;
ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
tabPageAdapter = new TabPageAdapter(getSupportFragmentManager(), fragments);
@rivancic
rivancic / AndroidActivityArgumentFactory.java
Last active December 21, 2015 13:06
Android Activity Factory metnod for passing in arguments
public static final String ARGUMENT_ARG = "ARGUMENT_ARG";
private String argumentValue;
public class ArgumentActivity extends Activity {
/**
* Factory method for passing arguments.
*/
public static Intent getIntent(String argumentValue) {
@rivancic
rivancic / AdapterSort.java
Last active December 21, 2015 13:06
Sorting Android Adapter data
public class CustomAdapter extends ArrayAdapter<Model> {
/**
* Sort should be enabled so the items are always consistently displayed.
* First disable notifying of the list because sort method does it internally therefore we can end up in loop.
* After sorting is done, enable notifying.
*/
@Override
public void notifyDataSetChanged() {
@rivancic
rivancic / StubAdapter.java
Created March 6, 2016 15:37
Stub class for Android view Adapter
package com.rivancic.adapters;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
@rivancic
rivancic / dimens.xml
Last active March 9, 2016 23:24
Default sizes for Android keylines and dimensions, and text
<resources>
<!-- Taken from https://www.google.com/design -->
<!--Default metrics-->
<dimen name="dimen_8">8dp</dimen>
<dimen name="dimen_16">16dp</dimen>
<dimen name="dimen_24">24dp</dimen>
<dimen name="dimen_32">32dp</dimen>
<dimen name="dimen_48">48dp</dimen>
# show the attached device
adb devices
# install application
adb install thisIsTheAPKName.apk
# unistall app
adb uninstall <package name>
@rivancic
rivancic / ModelParcelable.java
Created March 19, 2016 18:17
Parcelable Model Wrapper
package com.zensound.parcelable;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;
/**
* The Parcelable wrapper for Model that enables Model to be passed as an parameter to Activities
@rivancic
rivancic / AndroidManifest.xml
Last active March 22, 2016 16:36
Android Blank Activity
<activity
android:name=".activities.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar">
</activity>
@rivancic
rivancic / Elastic-Spring-Data.md
Last active July 12, 2018 05:27
Elastic Springdata Docker

ElasticSearch

Springdata

Reference

Compatible only with version 2.4. Enough for simple data storage functionality.

Dependencies: