android.support.v4.app.FragmentActivity#getSystemService ( )源码实例Demo

下面列出了android.support.v4.app.FragmentActivity#getSystemService ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Anti-recall   文件: SettingsFragment.java
private void sendNotification() {
    FragmentActivity activity = getActivity();
    if (activity == null)
        return;
    NotificationManager manager = (NotificationManager) activity.getSystemService(Context.NOTIFICATION_SERVICE);
    if (manager == null)
        return;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        NotificationChannel channel = new NotificationChannel("1", "1", NotificationManager.IMPORTANCE_DEFAULT);
        manager.createNotificationChannel(channel);
    }

    Notification notification = new NotificationCompat.Builder(activity, "1")
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle("title")
            .setContentText("test")
            .setDefaults(Notification.FLAG_ONLY_ALERT_ONCE)
            .build();

    manager.notify(12, notification);
}
 
源代码2 项目: browser   文件: CCPActivityBase.java
/**
 *
 */
public void displaySoftKeyboard() {
    final FragmentActivity activity = mActionBarActivity;
    // Display the soft keyboard
    InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (inputMethodManager != null) {
        View localView = activity.getCurrentFocus();
        if (localView != null && localView.getWindowToken() != null) {
            inputMethodManager.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }
}
 
源代码3 项目: Anti-recall   文件: SettingsFragment.java
private boolean isNotificationListenerWork() {
    Log.d(TAG, "isNotificationListenerWork: clickTime: " + (new Date().getTime() - App.timeCheckNotificationListenerServiceIsWorking));

    FragmentActivity activity = getActivity();
    if (activity == null)
        return false;
    NotificationManager manager = (NotificationManager) activity.getSystemService(Context.NOTIFICATION_SERVICE);
    if (manager == null)
        return false;
    manager.cancel(12);

    return (new Date().getTime() - App.timeCheckNotificationListenerServiceIsWorking) < 5000;
}
 
源代码4 项目: android-discourse   文件: PortalAdapter.java
public PortalAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    new InitManager(context, new Runnable() {
        @Override
        public void run() {
            configLoaded = true;
            notifyDataSetChanged();
            loadForum();
            loadTopics();
        }
    }).init();
}
 
源代码5 项目: uservoice-android-sdk   文件: PortalAdapter.java
public PortalAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    new InitManager(context, new Runnable() {
        @Override
        public void run() {
            configLoaded = true;
            notifyDataSetChanged();
            loadForum();
            loadTopics();
        }
    }).init();
}
 
源代码6 项目: android-discourse   文件: InstantAnswersAdapter.java
public InstantAnswersAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
源代码7 项目: android-discourse   文件: MixedSearchAdapter.java
public MixedSearchAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
public KnockSequenceListAdapter(FragmentActivity activity, KnockSequence sequence) {
    this.activity = new WeakReference<FragmentActivity>(activity);
    this.sequence = sequence;
    this.inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
public InstantAnswersAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
源代码10 项目: uservoice-android-sdk   文件: MixedSearchAdapter.java
public MixedSearchAdapter(FragmentActivity context) {
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}