This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AbstractFragment extends Fragment { | |
protected <T> T getListener(Class<T> type){ | |
for(Object o : new Object[]{getParentFragment(), getActivity()}){ | |
if(type.instanceOf(o)){ | |
return type.cast(o); | |
} | |
} | |
throw new RuntimeException("Missing listener " + type.getName()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
import android.widget.ImageView; | |
import android.widget.TextView; | |
import org.peekvision.screening.R; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.alexrichards.pocketknife; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.FIELD) | |
public @interface Bind { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleActivity extends AppCompatActivity implements ExampleActivity.FooAdapter.OnFooSelectedListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(); //TODO | |
final ListView foos = findViewById(R.id.view_foos); | |
foos.setAdapter(new FooAdapter(this, getFoos())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int smoothingHead = 0; | |
private final float[] smoothing = new float[12]; | |
/** | |
* @param in New value for smoothing. | |
* @return Average of the last 12 values. | |
*/ | |
private float smoothRadians(final float in) { | |
smoothing[smoothingHead++ % smoothing.length] = in; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WhateverActivity extends Activity { | |
public void onCreate(final Bundle savedInstanceState){ | |
super.onCreate(); | |
final WhateverIntent intent = new WhateverIntent(getIntent()); | |
final String whateverExtra = intent.getWhatever(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.text.*; | |
public class CurrencyTest { | |
private static final Locale[] LOCALES = { | |
Locale.UK, | |
Locale.FRANCE, | |
Locale.US, | |
new Locale("en", "AU"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for F in `ls *.CR2`; do echo "ibase=16;" `xxd -s 0x95D -l 2 -u -p $F` | bc; done |