Search in sources :

Example 41 with Context

use of android.content.Context in project android-oss by kickstarter.

the class DiscoveryToolbar method searchButtonClick.

@OnClick(R.id.search_button)
public void searchButtonClick(@NonNull final View view) {
    final Context context = getContext();
    context.startActivity(new Intent(context, SearchActivity.class));
}
Also used : Context(android.content.Context) Intent(android.content.Intent) SearchActivity(com.kickstarter.ui.activities.SearchActivity) OnClick(butterknife.OnClick)

Example 42 with Context

use of android.content.Context in project android-oss by kickstarter.

the class DiscoveryToolbar method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    if (isInEditMode()) {
        return;
    }
    ButterKnife.bind(this);
    ((KSApplication) getContext().getApplicationContext()).component().inject(this);
    activityFeedButton.setOnClickListener(v -> {
        final Context context = getContext();
        context.startActivity(new Intent(context, ActivityFeedActivity.class));
    });
}
Also used : Context(android.content.Context) Intent(android.content.Intent) ActivityFeedActivity(com.kickstarter.ui.activities.ActivityFeedActivity)

Example 43 with Context

use of android.content.Context in project nmid-headline by miao1007.

the class LollipopUtils method getStatusBarHeight.

public static int getStatusBarHeight(Context context) {
    Context appContext = context.getApplicationContext();
    int result = 0;
    int resourceId = appContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = appContext.getResources().getDimensionPixelSize(resourceId);
    }
    Log.d("ScreenUtils", result + "");
    return result;
}
Also used : Context(android.content.Context)

Example 44 with Context

use of android.content.Context in project k-9 by k9mail.

the class MessageListFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Context appContext = getActivity().getApplicationContext();
    preferences = Preferences.getPreferences(appContext);
    messagingController = MessagingController.getInstance(getActivity().getApplication());
    previewLines = K9.messageListPreviewLines();
    checkboxes = K9.messageListCheckboxes();
    stars = K9.messageListStars();
    if (K9.showContactPicture()) {
        contactsPictureLoader = ContactPicture.getContactPictureLoader(getActivity());
    }
    restoreInstanceState(savedInstanceState);
    decodeArguments();
    createCacheBroadcastReceiver(appContext);
    initialized = true;
}
Also used : Context(android.content.Context)

Example 45 with Context

use of android.content.Context in project k-9 by k9mail.

the class MessageListFragment method createCacheBroadcastReceiver.

private void createCacheBroadcastReceiver(Context appContext) {
    localBroadcastManager = LocalBroadcastManager.getInstance(appContext);
    cacheBroadcastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            adapter.notifyDataSetChanged();
        }
    };
    cacheIntentFilter = new IntentFilter(EmailProviderCache.ACTION_CACHE_UPDATED);
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

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