This algorithm, from an array like this;
example = [["there"], ["is"], ["", "no"], ["urf level"]]
creates the output of; "there is urf level" and "there is no urf level".
Warning
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> | |
<uses-permission android:name="android.permission.INTERNET"></uses-permission> |
public class SomeFragment extends Fragment { | |
MapView mapView; | |
GoogleMap map; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View v = inflater.inflate(R.layout.some_layout, container, false); | |
@Override | |
public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
// notifying nested fragments (support library bug fix) | |
final FragmentManager childFragmentManager = getChildFragmentManager(); | |
if (childFragmentManager != null) { | |
final List<Fragment> nestedFragments = childFragmentManager.getFragments(); |
buildscript { | |
repositories { | |
mavenCentral() | |
maven { | |
url 'https://oss.sonatype.org/content/repositories/snapshots/' | |
} | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.9.+' | |
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT' |
public static final float BYTES_IN_MB = 1024.0f * 1024.0f; | |
public static float megabytesFree() { | |
final Runtime rt = Runtime.getRuntime(); | |
final float bytesUsed = rt.totalMemory(); | |
final float mbUsed = bytesUsed/BYTES_IN_MB; | |
final float mbFree = megabytesAvailable() - mbUsed; | |
return mbFree; | |
} |
package com.company; | |
import retrofit.RestAdapter; | |
import retrofit.http.GET; | |
import retrofit.http.Path; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.functions.Action1; | |
import rx.functions.Func1; | |
import rx.functions.Func2; |
package org.cnii.layoutloader.ui; | |
import android.content.Context; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; | |
import android.view.View; | |
/** | |
* Special thanks to Daniel López Lacalle for his response | |
* (http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content/20784791#20784791) |
/** | |
* ValueAnimator can be type of: ofInt, ofFloat, ofObject, etc... | |
* Check for more info: http://developer.android.com/reference/android/animation/ValueAnimator.html | |
* and http://developer.android.com/guide/topics/graphics/prop-animation.html | |
*/ | |
public ValueAnimator va = ValueAnimator.ofInt(0, 300); | |
public int mDuration = 3000; //in millis | |
va.setDuration(mDuration); | |
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | |
public void onAnimationUpdate(ValueAnimator animation) { |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
int firstVisibleItem, visibleItemCount, totalItemCount; |