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
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){ | |
FrameLayout frameLayout = new FrameLayout(getActivity()); | |
frameLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent)); | |
((ViewGroup) v).addView(frameLayout, | |
new ViewGroup.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT)); | |
} |
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
getApplicationContext().getPackageManager().setComponentEnabledSetting(new ComponentName(AboutActivity.this, VergeDaydream.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); |
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 String introduction(){ | |
return getString(R.string.hello_world); | |
} |
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
String json = "[{\"id\":5,\"name\":\"Action\"},{\"id\":6,\"name\":\"Adventure\"}]"; | |
@Test | |
public void testJsonArray() throws Exception { | |
parseJson(); | |
} | |
void parseJson(){ | |
Type t = new TypeToken<List<Result>>(){}.getType(); | |
List<Result> result = new Gson().fromJson(json, t); | |
Assert.assertEquals(2, result.size()); |
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
SpannableString s = new SpannableString(title); | |
s.setSpan(new FontTypefaceSpan(this, "Roboto-Light.ttf"), 0, s.length(), | |
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
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
int pagerWidth = size.x - getResources().getDimensionPixelSize(R.dimen.hero_pager_margins); | |
pager.setLayoutParams(new RelativeLayout.LayoutParams(Math.max(pagerWidth, 1), getResources().getDimensionPixelSize(R.dimen.hero_pager_height))); | |
pager.setClipChildren(false); | |
pager.setPageMargin(-getResources().getDimensionPixelSize(R.dimen.hero_pager_margins)); |
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
OkHttpClient providesOkHttpClient() { | |
OkHttpClient httpClient = new OkHttpClient(); | |
SSLContext sslContext; | |
try { | |
sslContext = SSLContext.getInstance("TLS"); | |
sslContext.init(null, null, null); | |
} catch (GeneralSecurityException e) { | |
throw new AssertionError(); // The system has no TLS. Just give up. | |
} | |
httpClient.setSslSocketFactory(sslContext.getSocketFactory()); |
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 SampleLoader extends AsyncTaskLoader<List<SampleItem>> { | |
// We hold a reference to the Loader’s data here. | |
private List<SampleItem> mData; | |
public SampleLoader(Context ctx) { | |
// Loaders may be used across multiple Activitys (assuming they aren't | |
// bound to the LoaderManager), so NEVER hold a reference to the context | |
// directly. Doing so will cause you to leak an entire Activity's context. | |
// The superclass constructor will store a reference to the Application |
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
<oak.widget.TextViewWithFont | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:oak="http://oak/oak/schema" | |
oak:font="Font.ttf"/> |
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
<oak.widget.TextViewWithFont | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:res="http://schemas.android.com/apk/res-auto" | |
res:oakFont="Font.ttf"/> |