package com.tasomaniac.openwith.resolver;

import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.IntentFilter;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
import android.service.chooser.ChooserTarget;
import android.service.chooser.ChooserTargetService;

import com.tasomaniac.openwith.App;
import com.tasomaniac.openwith.R;
import com.tasomaniac.openwith.ShareToOpenWith;

import java.util.ArrayList;
import java.util.List;

@TargetApi(Build.VERSION_CODES.M)
public class ResolverChooserTargetService extends ChooserTargetService {

    @Override
    public List<ChooserTarget> onGetChooserTargets(ComponentName targetActivityName,
                                                   IntentFilter matchedFilter) {
        sendAnalyticsEvent();

        ComponentName componentName = new ComponentName(getPackageName(),
                ShareToOpenWith.class.getCanonicalName());

        ArrayList<ChooserTarget> targets = new ArrayList<>();
        targets.add(new ChooserTarget(
                getString(R.string.open_with),
                Icon.createWithResource(this, R.mipmap.ic_launcher),
                0.2f,
                componentName,
                createBundleExtra()
        ));
        return targets;
    }

    private Bundle createBundleExtra() {
        Bundle extras = new Bundle(1);
        extras.putBoolean(ShareToOpenWith.EXTRA_FROM_DIRECT_SHARE, true);
        return extras;
    }

    private void sendAnalyticsEvent() {
        App.getApp(this).getAnalytics().sendEvent(
                "Direct Share",
                "Shown",
                "true"
        );
    }
}

@@ -474,25 +474,27 @@
 va.util.
-ArrayList
+Collections
 ;%0Aimport
@@ -890,167 +890,80 @@
 ame(
-getPackageName(),%0A                ShareToOpenWith.class.getCanonicalName());%0A%0A        ArrayList%3CChooserTarget%3E targets = new ArrayList%3C%3E();%0A        targets.add
+ this, ShareToOpenWith.class);%0A%0A        return Collections.singletonList
 (new
@@ -1199,32 +1199,8 @@
 ));%0A
-        return targets;%0A
     
@@ -1214,16 +1214,23 @@
 private 
+static 
 Bundle c

Improve ResolverChooserTargetService