Search in sources :

Example 11 with Context

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;
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) Resources(android.content.res.Resources) MenuBuilder(com.actionbarsherlock.internal.view.menu.MenuBuilder) TypedValue(android.util.TypedValue)

Example 12 with Context

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;
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) TypedValue(android.util.TypedValue)

Example 13 with 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;
}
Also used : Context(android.content.Context) LayoutInflater(android.view.LayoutInflater) LinearLayout(android.widget.LinearLayout)

Example 14 with Context

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");
        }
    };
}
Also used : ContentValues(android.content.ContentValues) Context(android.content.Context) File(java.io.File) Uri(android.net.Uri) Before(org.junit.Before)

Example 15 with Context

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());
}
Also used : Context(android.content.Context) Test(org.junit.Test)

Aggregations

Context (android.content.Context)7516 Test (org.junit.Test)1645 Intent (android.content.Intent)1356 View (android.view.View)797 TextView (android.widget.TextView)549 BroadcastReceiver (android.content.BroadcastReceiver)497 IntentFilter (android.content.IntentFilter)485 PackageManager (android.content.pm.PackageManager)383 Resources (android.content.res.Resources)369 ArrayList (java.util.ArrayList)358 Bundle (android.os.Bundle)292 PendingIntent (android.app.PendingIntent)281 File (java.io.File)280 LayoutInflater (android.view.LayoutInflater)279 ImageView (android.widget.ImageView)263 Drawable (android.graphics.drawable.Drawable)256 IOException (java.io.IOException)248 Uri (android.net.Uri)247 RecyclerView (android.support.v7.widget.RecyclerView)200 Activity (android.app.Activity)198