use of android.content.Context in project cw-omnibus by commonsguy.
the class ActionBarSherlockCompat method initializePanelMenu.
private boolean initializePanelMenu() {
//getContext();
Context context = mActivity;
// If we have an action bar, initialize the menu with a context themed for it.
if (wActionBar != null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = context.getTheme();
currentTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0) /*&& context.getThemeResId() != targetThemeRes*/
{
context = new ContextThemeWrapper(context, targetThemeRes);
}
}
mMenu = new MenuBuilder(context);
mMenu.setCallback(this);
return true;
}
use of android.content.Context in project cw-omnibus by commonsguy.
the class ActionBarSherlockNative method getThemedContext.
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}
use of android.content.Context in project cw-omnibus by commonsguy.
the class MenuItemImpl method setActionView.
public MenuItem setActionView(int resId) {
final Context context = mMenu.getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
setActionView(inflater.inflate(resId, new LinearLayout(context), false));
return this;
}
use of android.content.Context in project materialistic by hidroh.
the class FavoriteManagerTest method setUp.
@Before
public void setUp() {
resolver = shadowOf(RuntimeEnvironment.application.getContentResolver());
ContentValues cv = new ContentValues();
cv.put("itemid", "1");
cv.put("title", "title");
cv.put("url", "http://example.com");
cv.put("time", String.valueOf(System.currentTimeMillis()));
resolver.insert(MaterialisticProvider.URI_FAVORITE, cv);
cv = new ContentValues();
cv.put("itemid", "2");
cv.put("title", "ask HN");
cv.put("url", "http://example.com");
cv.put("time", String.valueOf(System.currentTimeMillis()));
resolver.insert(MaterialisticProvider.URI_FAVORITE, cv);
manager = new FavoriteManager(Schedulers.immediate()) {
@Override
protected Uri getUriForFile(Context context, File file) {
return Uri.parse("content://" + FavoriteManager.FILE_AUTHORITY + "/files/saved/materialistic-export.txt");
}
};
}
use of android.content.Context in project android-volley by mcxiaoke.
the class AndroidAuthenticatorTest method publicMethods.
@Test
public void publicMethods() throws Exception {
// Catch-all test to find API-breaking changes.
Context context = mock(Context.class);
new AndroidAuthenticator(context, mAccount, "cooltype");
new AndroidAuthenticator(context, mAccount, "cooltype", true);
Assert.assertSame(mAccount, mAuthenticator.getAccount());
}
Aggregations