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
//This is in the inistantiateItem() method of my PagerAdapter. | |
//View view is my inflated layout, and SharedPreferences prefs contains my backing data. | |
final SeekBar seekBar = (SeekBar) view.findViewById(R.id.transparency_seekbar); | |
seekBar.setMax(80); | |
seekBar.setProgress(prefs.getInt(seekBar.getContext().getString(R.string.pref_transparency), | |
0)); | |
seekBar.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { | |
private IntentFilter mTransparencyFilter = new IntentFilter( |
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 ContentListFragment extends ListFragment implements LoaderCallbacks<List<Content>>{ | |
@Override | |
public void onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ | |
return inflater.inflate(R.layout.layout, container, false); | |
} | |
@Override | |
public void onViewCreated(View view, Bundle savedInstanceState){ | |
super.onViewCreated(view, savedInstanceState); | |
getLoaderManager().initLoader(0, null, this); |
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.support.v4.app.Fragment; | |
public class FragmentUtils { | |
/** | |
* @param fragment | |
* The Fragment whose parent is to be found | |
* @param parentClass | |
* The interface that the parent should implement | |
* @return The parent of fragment that implements parentClass, |
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.content.Context; | |
import android.support.v4.content.AsyncTaskLoader; | |
public abstract class CachedLoader<D> extends AsyncTaskLoader<D> { | |
private D mResult; | |
public CachedLoader(Context context) { | |
super(context); | |
} |
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.net.MalformedURLException; | |
import java.net.URL; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import android.os.Parcel; | |
import android.os.Parcelable; |
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
<!-- Replace 111222 with your secret code --> | |
<receiver android:name=".receiver.DiagnoserReceiver"> | |
<intent-filter> | |
<action android:name="android.provider.Telephony.SECRET_CODE"/> | |
<data android:scheme="android_secret_code" android:host="111222"/> | |
</intent-filter> | |
</receiver> |
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 StylableString extends SpannableString { | |
public StylableString(CharSequence source) { | |
super(source); | |
} | |
public StylableString setForegroundColor(int color) { | |
ForegroundColorSpan colorSpan = new ForegroundColorSpan(color); | |
setSpan(colorSpan, 0, length(), 0); | |
return this; |
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 Util { | |
public static String buildConcatString(String delimeter, String... strings) { | |
StringBuilder builder = new StringBuilder(); | |
boolean isFirst = true; | |
for (String string : strings) { | |
if (TextUtils.isEmpty(string)) { | |
continue; | |
} | |
if (!isFirst) { |
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.content.Context; | |
import android.content.res.Resources; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.graphics.drawable.LayerDrawable; | |
import android.net.Uri; | |
import android.util.Log; | |
import com.squareup.picasso.Picasso; |
OlderNewer