瀏覽代碼

1. rm unused recources

咸光金 4 年之前
父節點
當前提交
d31383017d
共有 24 個文件被更改,包括 2 次插入1991 次删除
  1. 0 3
      app/build.gradle
  2. 0 18
      app/src/main/AndroidManifest.xml
  3. 0 41
      app/src/main/java/com/quansu/heifengwuliu/adapter/FuncAdapter.kt
  4. 0 126
      app/src/main/java/com/quansu/heifengwuliu/adapter/ShortCutAdapter.java
  5. 0 82
      app/src/main/java/com/quansu/heifengwuliu/model/AppModel.java
  6. 0 51
      app/src/main/java/com/quansu/heifengwuliu/model/City.java
  7. 0 122
      app/src/main/java/com/quansu/heifengwuliu/model/Contact.java
  8. 0 88
      app/src/main/java/com/quansu/heifengwuliu/model/ShortCutModel.java
  9. 0 113
      app/src/main/java/com/quansu/heifengwuliu/model/Suggestion.java
  10. 0 41
      app/src/main/java/com/quansu/heifengwuliu/receiver/AppListReceiver.java
  11. 0 72
      app/src/main/java/com/quansu/heifengwuliu/receiver/ShortCutReceiver.java
  12. 0 191
      app/src/main/java/com/quansu/heifengwuliu/utils/CustomTabActivityHelper.java
  13. 0 23
      app/src/main/java/com/quansu/heifengwuliu/utils/PinyinUtil.java
  14. 0 154
      app/src/main/java/com/quansu/heifengwuliu/utils/func/FuncAwoke.kt
  15. 0 26
      app/src/main/java/com/quansu/heifengwuliu/utils/func/FuncURIAwoke.kt
  16. 0 320
      app/src/main/java/com/quansu/heifengwuliu/utils/search/SearchAwoke.kt
  17. 0 72
      app/src/main/java/com/quansu/heifengwuliu/widget/WidgetRoundSearchBar.kt
  18. 0 115
      app/src/main/java/com/quansu/heifengwuliu/widget/WidgetSearchBar.kt
  19. 0 161
      app/src/main/java/shared/CustomTabsHelper.java
  20. 0 32
      app/src/main/java/shared/KeepAliveService.java
  21. 0 47
      app/src/main/java/shared/ServiceConnection.java
  22. 0 33
      app/src/main/java/shared/ServiceConnectionCallback.java
  23. 0 60
      app/src/main/res/layout/item_app_s.xml
  24. 2 0
      common-build.gradle

+ 0 - 3
app/build.gradle

@@ -110,9 +110,6 @@ android {
 
 dependencies {
 
-    implementation 'androidx.browser:browser:1.2.0'
-    implementation 'com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3'
-    implementation 'com.google.android.material:material:1.2.1'
 
     implementation project(':base')
     addComponent 'update'

+ 0 - 18
app/src/main/AndroidManifest.xml

@@ -95,15 +95,6 @@
         <receiver android:name="com.quansu.heifengwuliu.receiver.ActionBroadcastReceiver" />
 
 
-        <receiver android:name="com.quansu.heifengwuliu.receiver.AppListReceiver" >
-            <intent-filter >
-                <action android:name="android.intent.action.PACKAGE_ADDED" />
-                <action android:name="android.intent.action.PACKAGE_REMOVED" />
-                <action android:name="android.intent.action.package_replaced" />
-
-                <data android:scheme="package" />
-            </intent-filter >
-        </receiver >
         <receiver android:name="com.quansu.heifengwuliu.receiver.WindowViewReceiver" >
             <intent-filter >
                 <action android:name="com.ysnows.search_view" />
@@ -116,15 +107,6 @@
                 <action android:name="com.ysnows.music" />
             </intent-filter >
         </receiver >
-        <receiver android:name="com.quansu.heifengwuliu.receiver.ShortCutReceiver" >
-            <intent-filter >
-                <action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
-            </intent-filter >
-            <intent-filter >
-                <action android:name="com.android.launcher.action.UNINSTALL_SHORTCUT" />
-            </intent-filter >
-
-        </receiver >
 
         <service android:name="com.quansu.heifengwuliu.receiver.ClipBoardListenService" />
         <service

+ 0 - 41
app/src/main/java/com/quansu/heifengwuliu/adapter/FuncAdapter.kt

@@ -1,41 +0,0 @@
-package com.quansu.heifengwuliu.adapter
-
-import com.bumptech.glide.Glide
-import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
-import com.qmuiteam.qmui.kotlin.onClick
-import com.quansu.heifengwuliu.R
-import com.quansu.heifengwuliu.config.ConfigFuncType
-import com.quansu.heifengwuliu.databinding.ItemFuncBinding
-import com.quansu.heifengwuliu.model.Func
-import com.quansu.heifengwuliu.utils.func.FuncAwoke
-import com.ysnows.base.base.BAdapter
-import com.ysnows.base.utils.PackageUtils
-import com.ysnows.base.utils.glide.GlideUtils
-
-class FuncAdapter() : BAdapter<Func, BaseDataBindingHolder<ItemFuncBinding>>(R.layout.item_func, null) {
-
-    override fun convert(holder: BaseDataBindingHolder<ItemFuncBinding>, item: Func) {
-        val binding = holder.dataBinding
-
-        binding?.item = item
-        binding?.imgIcon
-
-        if (item.type != ConfigFuncType.CUSTOM_OPEN_APP) {
-            Glide.with(context)
-                    .load(item.icon)
-                    .apply(GlideUtils.baseOptions().error(R.mipmap.ic_launcher))
-                    .into(binding?.imgIcon!!)
-        } else {
-            binding?.imgIcon?.setImageDrawable(PackageUtils.loadIcon(item.packageName))
-        }
-
-        binding?.imgIcon?.onClick {
-            FuncAwoke.awokeFunc(context, item)
-        }
-
-//        dataBinding?.position = position
-//        dataBinding?.pos = holder.adapterPosition
-    }
-
-
-}

+ 0 - 126
app/src/main/java/com/quansu/heifengwuliu/adapter/ShortCutAdapter.java

@@ -1,126 +0,0 @@
-package com.quansu.heifengwuliu.adapter;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.quansu.heifengwuliu.R;
-import com.quansu.heifengwuliu.model.ShortCutModel;
-
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class ShortCutAdapter extends RecyclerView.Adapter<ShortCutAdapter.VH> {
-
-
-    private ArrayList<ShortCutModel> apps = new ArrayList<>();
-    private Context context;
-
-    public ShortCutAdapter(Context context) {
-        this.context = context;
-    }
-
-    @NonNull
-    @Override
-    public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-        View itemView = LayoutInflater.from(context).inflate(R.layout.item_shortcut, null);
-        return new VH(itemView);
-    }
-
-    @Override
-    public void onBindViewHolder(@NonNull VH holder, int position) {
-        ShortCutModel shortCutModel = this.apps.get(position);
-        Bitmap imageBitmap = shortCutModel.loadIcon();
-        if (imageBitmap != null) {
-            holder.icon.setImageBitmap(imageBitmap);
-        }
-
-        if ("com.tencent.mm".equals(shortCutModel.packageName)) {
-            if ("BIZSHORTCUT".equals(shortCutModel.tag)) {
-                holder.icon_tag.setImageResource(R.drawable.ic_to_wxapp);
-            } else if ("WX_SHORTCUT".equals(shortCutModel.tag)) {
-                holder.icon_tag.setImageResource(R.drawable.ic_to_wxchat);
-            }
-        } else if ("com.miui.hybrid".equals(shortCutModel.packageName)) {
-            holder.icon_tag.setImageResource(R.drawable.ic_quik_app);
-        } else if ("com.android.chrome".equals(shortCutModel.packageName)) {
-            holder.icon_tag.setImageResource(R.drawable.ic_chrome);
-
-        }
-
-
-        holder.label.setText(shortCutModel.name);
-        holder.itemView.setOnClickListener(v -> {
-            try {
-                Intent intent = Intent.parseUri(shortCutModel.intent, 0);
-                if (intent != null) {
-                    context.startActivity(intent);
-                }
-            } catch (URISyntaxException e) {
-                e.printStackTrace();
-            }
-
-        });
-
-//        holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
-//            @Override
-//            public boolean onLongClick(View v) {
-//                PopupMenu popupMenu = new PopupMenu(context, v);
-//                popupMenu.inflate(R.menu.menu_app_context);
-//                popupMenu.show();
-//
-//                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
-//                    @Override
-//                    public boolean onMenuItemClick(MenuItem item) {
-//                        switch (item.getItemId()) {
-//                            case R.id.app_uninstall:
-//                                PackageUtils.uninstall(context, shortCutModel.packageName);
-//                                break;
-//                            case R.id.app_info:
-//                                PackageUtils.appInfo(context, shortCutModel.packageName);
-//
-//                                break;
-//                        }
-//                        return true;
-//                    }
-//                });
-//
-//                return true;
-//            }
-//        });
-
-    }
-
-    @Override
-    public int getItemCount() {
-        return apps.size();
-    }
-
-
-    class VH extends RecyclerView.ViewHolder {
-        private ImageView icon;
-        private ImageView icon_tag;
-        private TextView label;
-
-        public VH(View itemView) {
-            super(itemView);
-            icon = itemView.findViewById(R.id.icon);
-            icon_tag = itemView.findViewById(R.id.icon_tag);
-            label = itemView.findViewById(R.id.label);
-        }
-    }
-
-    public void setShortCuts(ArrayList<ShortCutModel> shortCuts) {
-        this.apps.clear();
-        this.apps.addAll(shortCuts);
-        this.notifyDataSetChanged();
-    }
-}

+ 0 - 82
app/src/main/java/com/quansu/heifengwuliu/model/AppModel.java

@@ -1,82 +0,0 @@
-package com.quansu.heifengwuliu.model;
-
-import android.content.pm.PackageManager;
-import android.graphics.drawable.Drawable;
-import android.text.TextUtils;
-
-import com.github.promeg.pinyinhelper.Pinyin;
-import com.litesuits.orm.LiteOrm;
-import com.litesuits.orm.db.annotation.PrimaryKey;
-import com.litesuits.orm.db.annotation.Table;
-import com.litesuits.orm.db.annotation.Unique;
-import com.litesuits.orm.db.assit.QueryBuilder;
-import com.litesuits.orm.db.assit.WhereBuilder;
-import com.litesuits.orm.db.enums.AssignType;
-import com.quansu.heifengwuliu.App;
-import com.quansu.heifengwuliu.utils.PinyinUtil;
-
-import java.util.ArrayList;
-
-@Table("AppModel")
-public class AppModel {
-
-    //    // 指定自增,每个对象需要有一个主键
-    @PrimaryKey(AssignType.AUTO_INCREMENT)
-    @Unique
-    public int id;
-
-    public String packageName;
-    public String name;
-    public String pinyin;
-    public String pinyinSimple;
-
-
-    public AppModel(String packageName, String name) {
-        this.packageName = packageName;
-        this.name = name;
-        if (this.name != null) {
-            this.pinyin = PinyinUtil.getPinyin(this.name);
-            this.pinyinSimple = PinyinUtil.getPinyinSimple(this.name);
-        }
-    }
-
-    public Drawable loadIcon() {
-        try {
-            PackageManager packageManager = App.getApp().getPackageManager();
-            return packageManager.getPackageInfo(this.packageName, PackageManager.GET_META_DATA).applicationInfo.loadIcon(packageManager);
-        } catch (PackageManager.NameNotFoundException e) {
-            return null;
-        }
-    }
-
-    public static ArrayList<AppModel> findAppsByName(String name) {
-        if (TextUtils.isEmpty(name)) {
-            return null;
-        }
-        LiteOrm liteOrm = App.getLiteOrm();
-        ArrayList<AppModel> res = null;
-        if (Pinyin.isChinese(name.charAt(0))) {
-            res = liteOrm.query(new QueryBuilder<>(AppModel.class).where("name LIKE ?", "%" + name + "%"));
-        } else {
-            res = liteOrm.query(new QueryBuilder<>(AppModel.class).where("pinyin LIKE ?", "%" + name + "%"));
-        }
-        return res;
-    }
-
-    public static ArrayList<AppModel> findAllApps() {
-        LiteOrm liteOrm = App.getLiteOrm();
-        return liteOrm.query(new QueryBuilder<>(AppModel.class));
-    }
-
-    public void save() {
-        App.getLiteOrm().save(this);
-    }
-
-    public static void clear() {
-        App.getLiteOrm().delete(AppModel.class);
-    }
-
-    public static void delByPackage(String packageName) {
-        App.getLiteOrm().delete(new WhereBuilder(AppModel.class).where("packageName=?", packageName));
-    }
-}

+ 0 - 51
app/src/main/java/com/quansu/heifengwuliu/model/City.java

@@ -1,51 +0,0 @@
-package com.quansu.heifengwuliu.model;
-
-import android.text.TextUtils;
-
-import com.github.promeg.pinyinhelper.Pinyin;
-import com.litesuits.orm.LiteOrm;
-import com.litesuits.orm.db.annotation.Table;
-import com.litesuits.orm.db.assit.QueryBuilder;
-import com.quansu.heifengwuliu.App;
-
-import java.util.ArrayList;
-
-@Table("city")
-public class City {
-
-    public String City_ID;
-    public String City_EN;
-    public String City_EN_SIMPLE;
-    public String City_CN;
-    public String Country_code;
-    public String Country_EN;
-    public String Country_EN_SIMPLE;
-    public String Country_CN;
-    public String Province_EN;
-    public String Province_EN_SIMPLE;
-    public String Province_CN;
-    public String Latitude;
-    public String Longitude;
-    public String AD_code;
-
-
-    public static City findCityByName(String name) {
-        if (TextUtils.isEmpty(name)) {
-            return null;
-        }
-        LiteOrm liteOrm = App.getConfigOrm();
-        ArrayList<City> res = null;
-        if (Pinyin.isChinese(name.charAt(0))) {
-            res = liteOrm.query(new QueryBuilder<>(City.class).where("City_CN = ?", name));
-        } else {
-            res = liteOrm.query(new QueryBuilder<>(City.class).where("City_EN = ?", name));
-        }
-
-        if (res != null && res.size() > 0) {
-            return res.get(0);
-        }
-
-        return null;
-    }
-
-}

+ 0 - 122
app/src/main/java/com/quansu/heifengwuliu/model/Contact.java

@@ -1,122 +0,0 @@
-package com.quansu.heifengwuliu.model;
-
-
-import com.github.promeg.pinyinhelper.Pinyin;
-import com.litesuits.orm.LiteOrm;
-import com.litesuits.orm.db.annotation.Table;
-import com.litesuits.orm.db.assit.QueryBuilder;
-import com.quansu.heifengwuliu.App;
-
-import java.util.ArrayList;
-
-@Table("Contact")
-public class Contact {
-    private String id;
-    private String name;
-    private String num;
-    private String pinyin;
-    private String pinyinSimple;
-    private Long taskId;
-
-    public void save() {
-        App.getLiteOrm().save(this);
-    }
-
-    public static void clear() {
-        App.getLiteOrm().delete(Contact.class);
-    }
-
-    public static ArrayList<Contact> findContactsByName(String name) {
-        LiteOrm liteOrm = App.getLiteOrm();
-        ArrayList<Contact> res = null;
-        if (Pinyin.isChinese(name.charAt(0))) {
-            res = liteOrm.query(new QueryBuilder<>(Contact.class).where("name LIKE ?", "%" + name + "%"));
-        } else {
-            res = liteOrm.query(new QueryBuilder<>(Contact.class).where("pinyin LIKE ?", "%" + name + "%"));
-        }
-        return res;
-    }
-
-
-    public void setTaskId(Long l) {
-        this.taskId = l;
-    }
-
-//    public static void sync(long j) {
-//        try {
-//            GreenDbManger.getInstance().getWritableDatabase().execSQL("delete from contact where _taskId < " + j);
-//        } catch (Exception e) {
-//            ApplicationDao.createTable(getDao().getDatabase(), true);
-//        }
-//    }
-
-//    private static ContactDao getDao() {
-//        return new DaoMaster(GreenDbManger.getInstance().getWritableDatabase()).newSession().getContactDao();
-//    }
-
-    public String getId() {
-        return this.id;
-    }
-
-    public void setId(String str) {
-        this.id = str;
-    }
-
-    public String getNum() {
-        return this.num;
-    }
-
-    public void setNum(String str) {
-        this.num = str;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public void setName(String str) {
-        this.name = str;
-    }
-
-    public String getPinyin() {
-        return this.pinyin;
-    }
-
-    public void setPinyin(String str) {
-        this.pinyin = str;
-    }
-
-    public String getPinyinSimple() {
-        return this.pinyinSimple;
-    }
-
-    public void setPinyinSimple(String str) {
-        this.pinyinSimple = str;
-    }
-
-    public Long getTaskId() {
-        return this.taskId;
-    }
-
-
-    public Contact() {
-
-    }
-
-    public Contact(String name, String num, String id, Long taskId, String pinyinSimple, String pinyin) {
-        this.name = name;
-        this.num = num;
-        this.id = id;
-        this.taskId = taskId;
-        this.pinyinSimple = pinyinSimple;
-        this.pinyin = pinyin;
-    }
-
-//    public static List<Contact> findWithLimit(String str, int i) {
-//        return getDao().queryBuilder().getPinyin(Properties.Name.getPinyin("%" + str + "%"), Properties.Pinyin.getPinyin("%" + str + "%"), Properties.PinyinSimple.getPinyin("%" + str + "%")).getPinyin(i).getPinyinSimple();
-//    }
-
-//    public static List<Contact> find(String str) {
-//        return getDao().queryBuilder().getPinyin(Properties.Name.getPinyin("%" + str + "%"), Properties.Pinyin.getPinyin("%" + str + "%"), Properties.PinyinSimple.getPinyin("%" + str + "%")).getPinyinSimple();
-//    }
-}

+ 0 - 88
app/src/main/java/com/quansu/heifengwuliu/model/ShortCutModel.java

@@ -1,88 +0,0 @@
-package com.quansu.heifengwuliu.model;
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.text.TextUtils;
-
-import com.github.promeg.pinyinhelper.Pinyin;
-import com.litesuits.orm.LiteOrm;
-import com.litesuits.orm.db.annotation.PrimaryKey;
-import com.litesuits.orm.db.annotation.Table;
-import com.litesuits.orm.db.annotation.Unique;
-import com.litesuits.orm.db.assit.QueryBuilder;
-import com.litesuits.orm.db.assit.WhereBuilder;
-import com.litesuits.orm.db.enums.AssignType;
-import com.quansu.heifengwuliu.App;
-import com.quansu.heifengwuliu.utils.PinyinUtil;
-
-import java.util.ArrayList;
-
-@Table("ShortCutModel")
-public class ShortCutModel {
-
-    //    // 指定自增,每个对象需要有一个主键
-    @PrimaryKey(AssignType.AUTO_INCREMENT)
-    @Unique
-    public int id;
-
-    public String packageName;
-    public String name;
-    public String pinyin;
-    public String intent;
-    public byte[] icon;
-    public String iconResource;
-    public String tag;
-    public int iconType;
-    public String pinyinSimple;
-
-    public ShortCutModel(String packageName, String name) {
-        this.packageName = packageName;
-        this.name = name;
-
-        if (this.name != null) {
-            this.pinyin = PinyinUtil.getPinyin(this.name);
-            this.pinyinSimple = PinyinUtil.getPinyinSimple(this.name);
-        }
-    }
-
-    public Bitmap loadIcon() {
-
-        if (this.iconType == 1) {
-            int length = icon.length;
-            return BitmapFactory.decodeByteArray(icon, 0, length);
-        }
-
-        return null;
-    }
-
-    public static ArrayList<ShortCutModel> findAppsByName(String name) {
-        if (TextUtils.isEmpty(name)) {
-            return null;
-        }
-        LiteOrm liteOrm = App.getLiteOrm();
-        ArrayList<ShortCutModel> res = null;
-        if (Pinyin.isChinese(name.charAt(0))) {
-            res = liteOrm.query(new QueryBuilder<>(ShortCutModel.class).where("name LIKE ?", "%" + name + "%"));
-        } else {
-            res = liteOrm.query(new QueryBuilder<>(ShortCutModel.class).where("pinyin LIKE ?", "%" + name + "%"));
-        }
-        return res;
-    }
-
-    public static ArrayList<ShortCutModel> findAllApps() {
-        LiteOrm liteOrm = App.getLiteOrm();
-        return liteOrm.query(new QueryBuilder<>(ShortCutModel.class));
-    }
-
-    public void save() {
-        App.getLiteOrm().save(this);
-    }
-
-    public static void clear() {
-        App.getLiteOrm().delete(ShortCutModel.class);
-    }
-
-    public static void delByPackage(String packageName) {
-        App.getLiteOrm().delete(new WhereBuilder(ShortCutModel.class).where("packageName=?", packageName));
-    }
-}

+ 0 - 113
app/src/main/java/com/quansu/heifengwuliu/model/Suggestion.java

@@ -1,113 +0,0 @@
-package com.quansu.heifengwuliu.model;
-
-import java.util.ArrayList;
-
-public class Suggestion {
-    public static final int TYPE_APP = 1;
-    public static final int TYPE_CONTACTS = 2;
-    public static final int TYPE_CACULATE = 3;
-    public static final int TYPE_SEARCH_KW = 4;
-    public static final int TYPE_SMS = 5;
-    public static final int TYPE_WEATHER = 6;
-    public static final int TYPE_APP_MINI = 7;
-    public static final int TYPE_SHORTCUT = 8;
-    public static final int TYPE_SHORTCUT_MINI = 9;
-
-    private int type;
-
-    private ArrayList<AppModel> apps = new ArrayList<>();
-    private ArrayList<Contact> contacts = new ArrayList<>();
-    private String searchKW;
-    private ArrayList<String> smss = new ArrayList<>();
-    private Weather weather;
-    private String caculate;
-    private AppModel appMini;
-    private ArrayList<ShortCutModel> shortCuts;
-    private ShortCutModel shortCutMini;
-
-
-    public Suggestion(int type) {
-        this.type = type;
-    }
-
-    public ArrayList<AppModel> getApps() {
-        return apps;
-    }
-
-    public void setApps(ArrayList<AppModel> apps) {
-        this.apps = apps;
-    }
-
-    public ArrayList<Contact> getContacts() {
-        return contacts;
-    }
-
-    public void setContacts(ArrayList<Contact> contacts) {
-        this.contacts = contacts;
-    }
-
-
-    public String getSearchKW() {
-        return searchKW;
-    }
-
-    public void setSearchKW(String searchKW) {
-        this.searchKW = searchKW;
-    }
-
-    public ArrayList<String> getSmss() {
-        return smss;
-    }
-
-    public void setSmss(ArrayList<String> smss) {
-        this.smss = smss;
-    }
-
-    public String getCaculate() {
-        return caculate;
-    }
-
-    public void setCaculate(String caculate) {
-        this.caculate = caculate;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public void setType(int type) {
-        this.type = type;
-    }
-
-    public Weather getWeather() {
-        return weather;
-    }
-
-    public void setWeather(Weather weather) {
-        this.weather = weather;
-    }
-
-    public void setAppMini(AppModel appMini) {
-        this.appMini = appMini;
-    }
-
-    public AppModel getAppMini() {
-        return appMini;
-    }
-
-    public void setShortCuts(ArrayList<ShortCutModel> shortCuts) {
-        this.shortCuts = shortCuts;
-    }
-
-    public void setShortCutMini(ShortCutModel shortCutMini) {
-        this.shortCutMini = shortCutMini;
-    }
-
-    public ArrayList<ShortCutModel> getShortCuts() {
-        return shortCuts;
-    }
-
-    public ShortCutModel getShortCutMini() {
-        return shortCutMini;
-    }
-}

+ 0 - 41
app/src/main/java/com/quansu/heifengwuliu/receiver/AppListReceiver.java

@@ -1,41 +0,0 @@
-package com.quansu.heifengwuliu.receiver;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-
-import com.quansu.heifengwuliu.model.AppModel;
-
-public class AppListReceiver extends BroadcastReceiver {
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
-
-        String dataString = intent.getDataString();
-        if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
-
-            String[] split = dataString.split(":");
-
-            String packageName = split[1];
-
-            PackageManager packageManager = context.getPackageManager();
-
-            try {
-                ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
-
-                String name = applicationInfo.loadLabel(packageManager).toString();
-                AppModel appModel = new AppModel(packageName, name);
-                appModel.save();
-
-            } catch (PackageManager.NameNotFoundException e) {
-                e.printStackTrace();
-            }
-        } else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
-            String[] split = dataString.split(":");
-            String packageName = split[1];
-            AppModel.delByPackage(packageName);
-        }
-    }
-}

+ 0 - 72
app/src/main/java/com/quansu/heifengwuliu/receiver/ShortCutReceiver.java

@@ -1,72 +0,0 @@
-package com.quansu.heifengwuliu.receiver;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-
-import com.litesuits.orm.db.assit.WhereBuilder;
-import com.quansu.heifengwuliu.App;
-import com.quansu.heifengwuliu.model.ShortCutModel;
-
-import java.io.ByteArrayOutputStream;
-
-public class ShortCutReceiver extends BroadcastReceiver {
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
-        if (action.equals("com.android.launcher.action.INSTALL_SHORTCUT")) {
-            Intent in = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
-            String aPackage = in.getPackage();
-            if (aPackage.equals("com.tencent.mm")) {
-                String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
-                Bitmap bitmap = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
-
-                ShortCutModel shortCutModel = new ShortCutModel(aPackage, name);
-
-
-                ByteArrayOutputStream stream = new ByteArrayOutputStream();
-                bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
-                byte[] byteArray = stream.toByteArray();
-                bitmap.recycle();
-
-                shortCutModel.icon = byteArray;
-                shortCutModel.iconType = 1;
-                shortCutModel.intent = in.toUri(0);
-
-                if (shortCutModel.intent.contains("WX_SHORTCUT")) {
-                    //小程序
-                    shortCutModel.tag = "WX_SHORTCUT";
-
-                } else if (shortCutModel.intent.contains("BIZSHORTCUT")) {
-                    //联系人
-                    shortCutModel.tag = "BIZSHORTCUT";
-                }
-
-
-                shortCutModel.save();
-            }
-        } else if (action.equals("com.android.launcher.action.UNINSTALL_SHORTCUT")) {
-            Intent in = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
-            String aPackage = in.getPackage();
-            if (aPackage.equals("com.tencent.mm")) {
-                String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
-                String inte = in.toUri(0);
-
-
-                String tag = null;
-                if (inte.contains("WX_SHORTCUT")) {
-                    //小程序
-                    tag = "WX_SHORTCUT";
-
-                } else if (inte.contains("BIZSHORTCUT")) {
-                    //联系人
-                    tag = "BIZSHORTCUT";
-                }
-
-                App.getLiteOrm().delete(new WhereBuilder(ShortCutModel.class).where("packageName=?", aPackage).and("name=?", name).and("tag=?", tag));
-
-            }
-        }
-    }
-}

+ 0 - 191
app/src/main/java/com/quansu/heifengwuliu/utils/CustomTabActivityHelper.java

@@ -1,191 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain init copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.quansu.heifengwuliu.utils;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-
-import java.util.List;
-
-import androidx.browser.customtabs.CustomTabsClient;
-import androidx.browser.customtabs.CustomTabsIntent;
-import androidx.browser.customtabs.CustomTabsServiceConnection;
-import androidx.browser.customtabs.CustomTabsSession;
-import shared.CustomTabsHelper;
-import shared.ServiceConnection;
-import shared.ServiceConnectionCallback;
-
-/**
- * This is init helper class to manage the connection to the Custom Tabs Service.
- */
-public class CustomTabActivityHelper implements ServiceConnectionCallback {
-    private CustomTabsSession mCustomTabsSession;
-    private CustomTabsClient mClient;
-    private CustomTabsServiceConnection mConnection;
-    private ConnectionCallback mConnectionCallback;
-
-    /**
-     * Opens the URL on init Custom Tab if possible. Otherwise fallsback to opening it on init WebView.
-     *
-     * @param activity The host activity.
-     * @param customTabsIntent init CustomTabsIntent to be used if Custom Tabs is available.
-     * @param uri the Uri to be opened.
-     * @param fallback init CustomTabFallback to be used if Custom Tabs is not available.
-     */
-    public static void openCustomTab(Activity activity,
-                                     CustomTabsIntent customTabsIntent,
-                                     Uri uri,
-                                     CustomTabFallback fallback) {
-        String packageName = CustomTabsHelper.getChromePackageName(activity);
-
-        //If we cant find init package name, it means theres no browser that supports
-        //Chrome Custom Tabs installed. So, we fallback to the webview
-        if (packageName == null) {
-            if (fallback != null) {
-                fallback.openUri(activity, uri);
-            }
-        } else {
-            customTabsIntent.intent.setPackage(packageName);
-            customTabsIntent.launchUrl(activity, uri);
-        }
-    }
-
-    public static Intent openCustomTabIntent(Context context,
-                                             CustomTabsIntent customTabsIntent,
-                                             String url) {
-        String packageName = CustomTabsHelper.getChromePackageName(context);
-
-        Uri uri = Uri.parse(url);
-        //If we cant find init package name, it means theres no browser that supports
-        //Chrome Custom Tabs installed. So, we fallback to the webview
-        if (packageName == null) {
-
-        } else {
-            customTabsIntent.intent.setPackage(packageName);
-            customTabsIntent.intent.setData(uri);
-        }
-        return customTabsIntent.intent;
-    }
-
-    /**
-     * Unbinds the Activity from the Custom Tabs Service.
-     *
-     * @param activity the activity that is connected to the service.
-     */
-    public void unbindCustomTabsService(Activity activity) {
-        if (mConnection == null) return;
-        activity.unbindService(mConnection);
-        mClient = null;
-        mCustomTabsSession = null;
-        mConnection = null;
-    }
-
-    /**
-     * Creates or retrieves an exiting CustomTabsSession.
-     *
-     * @return init CustomTabsSession.
-     */
-    public CustomTabsSession getSession() {
-        if (mClient == null) {
-            mCustomTabsSession = null;
-        } else if (mCustomTabsSession == null) {
-            mCustomTabsSession = mClient.newSession(null);
-        }
-        return mCustomTabsSession;
-    }
-
-    /**
-     * Register init Callback to be called when connected or disconnected from the Custom Tabs Service.
-     *
-     * @param connectionCallback
-     */
-    public void setConnectionCallback(ConnectionCallback connectionCallback) {
-        this.mConnectionCallback = connectionCallback;
-    }
-
-    /**
-     * Binds the Activity to the Custom Tabs Service.
-     *
-     * @param activity the activity to be binded to the service.
-     */
-    public void bindCustomTabsService(Activity activity) {
-        if (mClient != null) return;
-
-        String packageName = CustomTabsHelper.getPackageNameToUse(activity);
-        if (packageName == null) return;
-
-        mConnection = new ServiceConnection(this);
-        CustomTabsClient.bindCustomTabsService(activity, packageName, mConnection);
-    }
-
-    /**
-     * @return true if call to mayLaunchUrl was accepted.
-     *
-     * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
-     */
-    public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
-        if (mClient == null) return false;
-
-        CustomTabsSession session = getSession();
-        if (session == null) return false;
-
-        return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
-    }
-
-    @Override
-    public void onServiceConnected(CustomTabsClient client) {
-        mClient = client;
-        mClient.warmup(0L);
-        if (mConnectionCallback != null) mConnectionCallback.onCustomTabsConnected();
-    }
-
-    @Override
-    public void onServiceDisconnected() {
-        mClient = null;
-        mCustomTabsSession = null;
-        if (mConnectionCallback != null) mConnectionCallback.onCustomTabsDisconnected();
-    }
-
-    /**
-     * A Callback for when the service is connected or disconnected. Use those callbacks to
-     * handle UI changes when the service is connected or disconnected.
-     */
-    public interface ConnectionCallback {
-        /**
-         * Called when the service is connected.
-         */
-        void onCustomTabsConnected();
-
-        /**
-         * Called when the service is disconnected.
-         */
-        void onCustomTabsDisconnected();
-    }
-
-    /**
-     * To be used as init fallback to open the Uri when Custom Tabs is not available.
-     */
-    public interface CustomTabFallback {
-        /**
-         * @param activity The Activity that wants to open the Uri.
-         * @param uri The uri to be opened by the fallback.
-         */
-        void openUri(Activity activity, Uri uri);
-    }
-
-}

+ 0 - 23
app/src/main/java/com/quansu/heifengwuliu/utils/PinyinUtil.java

@@ -1,23 +0,0 @@
-package com.quansu.heifengwuliu.utils;
-
-import com.github.promeg.pinyinhelper.Pinyin;
-
-public class PinyinUtil {
-
-    public static String getPinyin(String str) {
-        String pinyin = Pinyin.toPinyin(str, "");
-        return pinyin.toLowerCase().replaceAll(" ", "");
-    }
-
-    public static String getPinyinSimple(String str) {
-        String pinyin = Pinyin.toPinyin(str, ",");
-        String[] strings = pinyin.split(",");
-
-        StringBuilder res = new StringBuilder();
-        for (int i = 0; i < strings.length; i++) {
-            String string = strings[i];
-            res.append(string.charAt(0));
-        }
-        return res.toString().toLowerCase().replaceAll(" ", "");
-    }
-}

+ 0 - 154
app/src/main/java/com/quansu/heifengwuliu/utils/func/FuncAwoke.kt

@@ -1,154 +0,0 @@
-package com.quansu.heifengwuliu.utils.func
-
-import android.app.PendingIntent
-import android.content.Context
-import android.content.Intent
-import android.net.Uri
-import com.billy.cc.core.component.CC
-import com.quansu.heifengwuliu.C.C
-import com.quansu.heifengwuliu.config.ConfigFuncType
-import com.quansu.heifengwuliu.model.Func
-import com.quansu.heifengwuliu.receiver.FuncReceiver
-import com.quansu.heifengwuliu.utils.FlashUtils
-import com.quansu.heifengwuliu.utils.IntentUtils
-import com.quansu.heifengwuliu.utils.KeySimulateUtils
-import com.quansu.heifengwuliu.utils.VoiceUtils
-import com.quansu.heifengwuliu.utils.search.SearchAwoke
-import com.ysnows.base.ext.toast
-import com.ysnows.base.utils.PackageUtils
-import com.ysnows.base.utils.ShellUtil
-
-object FuncAwoke {
-
-    fun awokeFunc(context: Context, func: Func?) {
-        if (func == null) {
-            return
-        }
-
-        val uri: Uri
-        val intent: Intent
-        when (func.type) {
-            ConfigFuncType.QR_ALIPAY -> QrUtils.scanQr(context, func.type)
-            ConfigFuncType.QR_MIUI -> QrUtils.scanQr(context, func.type)
-            ConfigFuncType.QR_APP -> QrUtils.scanQr(context, func.type)
-            ConfigFuncType.QR_WX -> QrUtils.scanQr(context, func.type)
-            ConfigFuncType.SEARCH_IN_BROWSER -> SearchAwoke(context).search(func.url)
-            ConfigFuncType.NORMAL_INTENT -> {
-                if (!PackageUtils.isAppInstalled(func.packageName)) {
-                    context.toast("请先安装应用")
-                    return
-                }
-                context.startActivity(IntentUtils.nIntent(func.packageName, func.className))
-            }
-            ConfigFuncType.NORMAL_INTENT_WITH_ACTION -> context.startActivity(IntentUtils.nIntentWithAction(func.url))
-            ConfigFuncType.NORMAL_INTENT_PARAMS -> context.startActivity(IntentUtils.nIntentWithParams(func.packageName, func.className, func.paramsName, func.paramsValue))
-            ConfigFuncType.NORMAL_TORCH -> FlashUtils().switchFlash(context)
-            ConfigFuncType.NORMAL_MUSIC -> VoiceUtils(context).music(Integer.valueOf(func.url))
-            ConfigFuncType.URL_SCHEME -> {
-                uri = Uri.parse(func.url)
-                intent = Intent(Intent.ACTION_VIEW, uri)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
-                context.startActivity(intent)
-            }
-            ConfigFuncType.URL_SCHEME_WITH_APP -> {
-                uri = Uri.parse(func.url)
-                intent = Intent(Intent.ACTION_VIEW, uri)
-                intent.setPackage(func.packageName)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
-                context.startActivity(intent)
-            }
-            ConfigFuncType.KEY_SIMULATE -> KeySimulateUtils.simulate(Integer.valueOf(func.url))
-            ConfigFuncType.OPEN_APP -> PackageUtils.openApp(context, func.packageName)
-            ConfigFuncType.CUSTOM_OPEN_APP -> PackageUtils.openApp(context, func.packageName)
-            ConfigFuncType.SHELL -> {
-                ShellUtil.checkRootPermission()
-                ShellUtil.execCommand(func.url, true)
-            }
-
-            ConfigFuncType.URI -> {
-                val url = Uri.parse(func.url)
-                val host = url.host
-                val lastPathSegment = url.lastPathSegment
-                CC.obtainBuilder(host)
-                        .setContext(context)
-                        .setActionName(lastPathSegment)
-                        .build()
-                        .callAsync()
-            }
-        }
-    }
-
-
-    fun awokePendingIntent(context: Context, func: Func): PendingIntent? {
-        val intent = awokeIntent(context, func)
-        var pendingIntent: PendingIntent? = null
-        if (intent != null) {
-
-            pendingIntent = if (
-                    func.type == ConfigFuncType.NORMAL_TORCH ||
-                    func.type == ConfigFuncType.NORMAL_MUSIC ||
-                    func.type == ConfigFuncType.KEY_SIMULATE ||
-                    func.type == ConfigFuncType.URI ||
-                    func.type == ConfigFuncType.SHELL) {
-                PendingIntent.getBroadcast(context, -1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
-            } else {
-                PendingIntent.getActivity(context, -1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
-            }
-        }
-        return pendingIntent
-    }
-
-    fun awokeIntent(context: Context, func: Func): Intent? {
-        ShellUtil.checkRootPermission()
-
-        val uri: Uri
-        val intent: Intent
-        when (func.type) {
-            ConfigFuncType.QR_ALIPAY -> return QrUtils.getQrIntent(func.type)
-            ConfigFuncType.QR_MIUI -> return QrUtils.getQrIntent(func.type)
-            ConfigFuncType.QR_APP -> return QrUtils.getQrIntent(func.type)
-            ConfigFuncType.QR_WX -> return QrUtils.getQrIntent(func.type)
-            ConfigFuncType.SEARCH_IN_BROWSER -> return SearchAwoke(context!!).openInCustomTabIntent(func.url)
-            ConfigFuncType.NORMAL_INTENT -> return IntentUtils.nIntent(func.packageName, func.className)
-            ConfigFuncType.NORMAL_INTENT_WITH_ACTION -> return IntentUtils.nIntentWithAction(func.url)
-            ConfigFuncType.NORMAL_INTENT_PARAMS -> return IntentUtils.nIntentWithParams(func.packageName, func.className, func.paramsName, func.paramsValue)
-            ConfigFuncType.NORMAL_TORCH -> {
-                intent = Intent(context, FuncReceiver::class.java)
-                intent.action = C.Action.ACTION_TORCH
-                return intent
-            }
-            ConfigFuncType.NORMAL_MUSIC -> {
-                intent = Intent(context, FuncReceiver::class.java)
-                intent.putExtra("url", func.url)
-                intent.action = C.Action.ACTION_MUSIC
-                return intent
-            }
-            ConfigFuncType.URL_SCHEME -> {
-                uri = Uri.parse(func.url)
-                intent = Intent(Intent.ACTION_VIEW, uri)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
-                return intent
-            }
-            ConfigFuncType.URL_SCHEME_WITH_APP -> {
-                uri = Uri.parse(func.url)
-                intent = Intent(Intent.ACTION_VIEW, uri)
-                intent.setPackage(func.packageName)
-                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
-                return intent
-            }
-            ConfigFuncType.KEY_SIMULATE -> {
-                intent = Intent(context, FuncReceiver::class.java)
-                intent.action = C.Action.ACTION_KEY_SIMULATE
-                return intent
-            }
-            ConfigFuncType.OPEN_APP, ConfigFuncType.CUSTOM_OPEN_APP -> return PackageUtils.openAppIntent(context, func.packageName)
-            ConfigFuncType.URI -> {
-                intent = Intent(context, FuncReceiver::class.java)
-                intent.action = C.Action.ACTION_EXEC_Uri
-                intent.putExtra("url", func.url)
-                return intent
-            }
-        }
-        return null
-    }
-}

+ 0 - 26
app/src/main/java/com/quansu/heifengwuliu/utils/func/FuncURIAwoke.kt

@@ -1,26 +0,0 @@
-package com.quansu.heifengwuliu.utils.func
-
-import android.content.Context
-import com.quansu.heifengwuliu.activity.TodosActivity
-import com.ysnows.base.utils.UiSwitch
-
-object FuncURIAwoke {
-
-    fun invoke(context: Context, uri: String?) {
-
-        when (uri) {
-            "supersearch://app/todos" -> {
-                UiSwitch.single(context, TodosActivity::class.java)
-            }
-        }
-
-//        var intent: /*@@nkksxf@@*/Intent? = Intent()
-//        intent.setAction(Intent.ACTION_WEB_SEARCH)
-//        var query: /*@@xwpzpr@@*/kotlin.String? = cc.getParamItem</*@@xwpzpr@@*/kotlin.String?>("query")
-//        intent.putExtra("query", query)
-//        cc.getContext().startActivity(intent)
-
-
-    }
-
-}

+ 0 - 320
app/src/main/java/com/quansu/heifengwuliu/utils/search/SearchAwoke.kt

@@ -1,320 +0,0 @@
-package com.quansu.heifengwuliu.utils.search
-
-import android.app.Activity
-import android.app.PendingIntent
-import android.content.ComponentName
-import android.content.Context
-import android.content.Intent
-import android.graphics.BitmapFactory
-import android.net.Uri
-import android.text.TextUtils
-import androidx.browser.customtabs.CustomTabsIntent
-import com.billy.cc.core.component.CC
-import com.quansu.heifengwuliu.App
-import com.quansu.heifengwuliu.R
-import com.quansu.heifengwuliu.model.SearchEngine
-import com.quansu.heifengwuliu.receiver.ActionBroadcastReceiver
-import com.quansu.heifengwuliu.repository.SearchRepository
-import com.quansu.heifengwuliu.utils.CustomTabActivityHelper
-import com.quansu.heifengwuliu.utils.IntentUtils
-import com.quansu.heifengwuliu.utils.ShareUtils
-import com.ysnows.base.utils.PackageUtils
-import com.ysnows.base.utils.Toasts
-import java.io.UnsupportedEncodingException
-import java.net.URLEncoder
-
-class SearchAwoke(private val context: Context) {
-
-    fun search(kw: String, searchCallBack: SearchCallBack, repository: SearchRepository? = null) {
-        search(kw, App.default_search, repository = repository, searchCallBack)
-    }
-
-    fun search(kw: String, searchEngine: SearchEngine? = App.default_search, repository: SearchRepository? = null, searchCallBack: SearchCallBack? = null) {
-        if (searchEngine == null) {
-            Toasts.toast(context, "请先设定一个默认搜索引擎")
-            return
-        }
-        if (TextUtils.isEmpty(kw.trim { it <= ' ' })) {
-            Toasts.toast(context, "搜个空白有啥子用?")
-            return
-        }
-        try {
-            if (searchEngine.type == SearchEngine.TYPE_SEARCH) {
-                val url: String
-                url = if (kw.startsWith("http://") || kw.startsWith("https://")) {
-                    kw
-                } else {
-                    val encodeStr = URLEncoder.encode(kw, "UTF-8")
-                    String.format(searchEngine.url, encodeStr)
-                }
-                openInBrowser(url)
-            } else if (searchEngine.type == SearchEngine.TYPE_APP) {
-                val encodeStr = URLEncoder.encode(kw, "UTF-8")
-                val url = String.format(searchEngine.url, encodeStr)
-                if (PackageUtils.isAppInstalled(searchEngine.packageName)) {
-                    openInApp(url)
-                } else {
-                    Toasts.toast(context, R.string.install_app_first_please)
-                    return
-                }
-            } else if (searchEngine.type == SearchEngine.TYPE_VIEW) {
-                val encodeStr = URLEncoder.encode(kw, "UTF-8")
-                val url = String.format(searchEngine.url, encodeStr)
-                if (PackageUtils.isAppInstalled(searchEngine.packageName)) {
-                    openInAppWithComponent(url, searchEngine.packageName, searchEngine.className)
-                } else {
-                    Toasts.toast(context, R.string.install_app_first_please)
-                    return
-                }
-            } else if (searchEngine.type == SearchEngine.TYPE_VIEW_WITH_URI) {
-                val encodeStr = URLEncoder.encode(kw, "UTF-8")
-                val url = String.format(searchEngine.url, encodeStr)
-                if (PackageUtils.isAppInstalled(searchEngine.packageName)) {
-                    openInAppWithUri(url)
-                } else {
-                    Toasts.toast(context, R.string.install_app_first_please)
-                    return
-                }
-            } else if (searchEngine.type == SearchEngine.TYPE_SHARE) {
-                if (PackageUtils.isAppInstalled(searchEngine.packageName)) {
-                    openInAppWithShareComponent(kw, searchEngine.packageName, searchEngine.className)
-                } else {
-                    Toasts.toast(context, R.string.install_app_first_please)
-                    return
-                }
-            } else if (searchEngine.type == SearchEngine.TYPE_SHARE_ACTION) {
-                ShareUtils.share(context, kw)
-            } else if (searchEngine.type == SearchEngine.TYPE_IN_APP) {
-                //调用APP内的功能
-                val urlStr = searchEngine.url
-                val uri = Uri.parse(urlStr)
-                uri.scheme
-                var path = uri.path
-                path = path.substring(1, path.length)
-                val host = uri.host
-                val queryParameterNames = uri.queryParameterNames
-                val builder = CC.obtainBuilder(host)
-                        .setContext(context)
-                        .setActionName(path)
-                builder.addParam("kw", kw)
-                for (queryParameterName in queryParameterNames) {
-                    builder.addParam(queryParameterName, uri.getQueryParameter(queryParameterName))
-                }
-                builder.build()
-                        .callAsync()
-            } else if (SearchEngine.TYPE_IN_CHARGE_OUT == searchEngine.type) {
-                CC.obtainBuilder("charge")
-                        .setActionName("out")
-                        .addParam("kw", kw)
-                        .addParam("payway", 2)
-                        .addParam("chargeCat", 1)
-                        .setContext(context)
-                        .build()
-                        .callAsync()
-            } else if (SearchEngine.TYPE_IN_CHARGE_IN == searchEngine.type) {
-                CC.obtainBuilder("charge")
-                        .setActionName("in")
-                        .addParam("kw", kw)
-                        .setContext(context)
-                        .build()
-                        .callAsync()
-            } else if (SearchEngine.TYPE_ADD_TODO == searchEngine.type) {
-
-                if (repository == null) {
-                    return
-                }
-
-                repository.addTodo(kw)
-                        .doOnNext { }
-                        .subscribe()
-
-            } else if (SearchEngine.TYPE_ROUTE == searchEngine.type) {
-                val uri = Uri.parse(searchEngine.url)
-                val host = uri.host
-                val lastPathSegment = uri.lastPathSegment
-                CC.obtainBuilder(host)
-                        .setActionName(lastPathSegment)
-                        .setContext(context)
-                        .addParam("query", kw)
-                        .build()
-                        .callAsync()
-            }
-            searchCallBack?.onSearched()
-        } catch (e: UnsupportedEncodingException) {
-            e.printStackTrace()
-        }
-    }
-
-    private fun openInAppWithComponent(url: String, packageName: String, className: String) {
-        val intent: Intent
-        val uri = Uri.parse(url)
-        intent = Intent(Intent.ACTION_VIEW, uri)
-        intent.component = ComponentName(packageName, className)
-        context.startActivity(intent)
-    }
-
-    private fun openInAppWithUri(url: String) {
-        context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
-    }
-
-    private fun openInAppWithShareComponent(content: String, packageName: String, className: String) {
-        val intent = IntentUtils.shareIntent(packageName, className, content)
-        context.startActivity(intent)
-    }
-
-    private fun openInApp(url: String) {
-        val uri = Uri.parse(url)
-        val intent = Intent(Intent.ACTION_VIEW, uri)
-        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
-        context.startActivity(intent)
-    }
-
-    /**
-     * 用系统浏览器打开搜索
-     *
-     * @param url
-     */
-    private fun openInBrowser(url: String) {
-
-        openInCustomTab(url)
-    }
-
-    /**
-     * 用系统浏览器打开搜索
-     *
-     * @param url
-     */
-    private fun openInSystemBrowser(url: String) {
-        val uri = Uri.parse(url)
-        val intent = Intent(Intent.ACTION_VIEW, uri)
-        context.startActivity(intent)
-
-//        String chromePackageName = getChromePackageName();
-//        if (!TextUtils.isEmpty(chromePackageName)) {
-//            Bundle extras = new Bundle();
-//            extras.putBinder(EXTRA_CUSTOM_TABS_SESSION,
-//                    null /* Set to null for no session */);
-//            intentObj.putExtra(EXTRA_CUSTOM_TABS_TOOLBAR_COLOR, Color.parseColor("#3C2DCB"));
-//            intentObj.putExtra(EXTRA_CUSTOM_TABS_SHARE_MENU_ITEM, true);
-//            intentObj.setPackage(chromePackageName);
-//            intentObj.setData(uri);
-//            intentObj.putExtras(extras);
-//        }
-    }
-
-    fun openInCustomTab(url: String?) {
-        val color = context.resources.getColor(R.color.colorPrimary)
-        val secondaryColor = context.resources.getColor(R.color.colorPrimary)
-        val intentBuilder = CustomTabsIntent.Builder()
-        intentBuilder.setToolbarColor(color)
-        intentBuilder.setSecondaryToolbarColor(secondaryColor)
-
-        //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
-        //UI thread to keep the example short.
-        val actionLabel = context.getString(R.string.pocket)
-        val icon = BitmapFactory.decodeResource(context.resources,
-                R.drawable.pocket)
-        val pendingIntent = createPendingIntent(ActionBroadcastReceiver.ACTION_ACTION_BUTTON)
-        intentBuilder.setActionButton(icon, actionLabel, pendingIntent)
-
-//        if (mAddMenusCheckbox.isChecked()) {
-//            String menuItemTitle = getString(R.string.menu_item_title);
-//            PendingIntent menuItemPendingIntent =
-//                    createPendingIntent(ActionBroadcastReceiver.ACTION_MENU_ITEM);
-//            intentBuilder.addMenuItem(menuItemTitle, menuItemPendingIntent);
-//        }
-//
-        intentBuilder.addDefaultShareMenuItem()
-        //
-//        if (mToolbarItemCheckbox.isChecked()) {
-//            //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
-//            //UI thread to keep the example short.
-//            String actionLabel = getString(R.string.label_action);
-//            Bitmap icon = BitmapFactory.decodeResource(getResources(),
-//                    android.R.drawable.ic_menu_share);
-//            PendingIntent pendingIntent =
-//                    createPendingIntent(ActionBroadcastReceiver.ACTION_TOOLBAR);
-//        intentBuilder.addToolbarItem(TOOLBAR_ITEM_ID, icon, actionLabel, pendingIntent);
-//        }
-//
-        intentBuilder.setShowTitle(true)
-        intentBuilder.enableUrlBarHiding()
-        intentBuilder.setCloseButtonIcon(
-                BitmapFactory.decodeResource(context.resources, R.drawable.ic_back))
-        intentBuilder.setStartAnimations(context, R.anim.slide_in_right, R.anim.slide_out_left)
-        intentBuilder.setExitAnimations(context, android.R.anim.slide_in_left,
-                android.R.anim.slide_out_right)
-        CustomTabActivityHelper.openCustomTab(
-                context as Activity, intentBuilder.build(), Uri.parse(url)) { activity, uri ->
-            val urlStr = uri.toString()
-            openInSystemBrowser(urlStr)
-        }
-    }
-
-    fun openInCustomTabIntent(url: String?): Intent {
-        val color = context.resources.getColor(R.color.colorPrimary)
-        val secondaryColor = context.resources.getColor(R.color.colorPrimary)
-        val intentBuilder = CustomTabsIntent.Builder()
-        intentBuilder.setToolbarColor(color)
-        intentBuilder.setSecondaryToolbarColor(secondaryColor)
-
-        //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
-        //UI thread to keep the example short.
-        val actionLabel = context.getString(R.string.pocket)
-        val icon = BitmapFactory.decodeResource(context.resources,
-                R.drawable.pocket)
-        val pendingIntent = createPendingIntent(ActionBroadcastReceiver.ACTION_ACTION_BUTTON)
-        intentBuilder.setActionButton(icon, actionLabel, pendingIntent)
-
-//        if (mAddMenusCheckbox.isChecked()) {
-//            String menuItemTitle = getString(R.string.menu_item_title);
-//            PendingIntent menuItemPendingIntent =
-//                    createPendingIntent(ActionBroadcastReceiver.ACTION_MENU_ITEM);
-//            intentBuilder.addMenuItem(menuItemTitle, menuItemPendingIntent);
-//        }
-//
-        intentBuilder.addDefaultShareMenuItem()
-        //
-//        if (mToolbarItemCheckbox.isChecked()) {
-//            //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
-//            //UI thread to keep the example short.
-//            String actionLabel = getString(R.string.label_action);
-//            Bitmap icon = BitmapFactory.decodeResource(getResources(),
-//                    android.R.drawable.ic_menu_share);
-//            PendingIntent pendingIntent =
-//                    createPendingIntent(ActionBroadcastReceiver.ACTION_TOOLBAR);
-//        intentBuilder.addToolbarItem(TOOLBAR_ITEM_ID, icon, actionLabel, pendingIntent);
-//        }
-//
-        intentBuilder.setShowTitle(true)
-        intentBuilder.enableUrlBarHiding()
-        intentBuilder.setCloseButtonIcon(
-                BitmapFactory.decodeResource(context.resources, R.drawable.ic_back_black))
-        intentBuilder.setStartAnimations(context, R.anim.slide_in_right, R.anim.slide_out_left)
-        intentBuilder.setExitAnimations(context, android.R.anim.slide_in_left,
-                android.R.anim.slide_out_right)
-        return CustomTabActivityHelper.openCustomTabIntent(context, intentBuilder.build(), url)
-    }
-
-    private fun createPendingIntent(actionSourceId: Int): PendingIntent {
-        val actionIntent = Intent(
-                context.applicationContext, ActionBroadcastReceiver::class.java)
-        actionIntent.putExtra(ActionBroadcastReceiver.KEY_ACTION_SOURCE, actionSourceId)
-        return PendingIntent.getBroadcast(
-                context.applicationContext, actionSourceId, actionIntent, 0)
-    }
-
-    private fun getPocketIntent(sharedUrl: String): PendingIntent {
-        val intentApp = Intent()
-        intentApp.setClassName("com.ideashower.readitlater.pro", "com.ideashower.readitlater.activity.AddActivity")
-        intentApp.putExtra(Intent.EXTRA_TEXT, sharedUrl)
-        intentApp.addCategory(Intent.CATEGORY_HOME) // run in background
-        intentApp.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) //run in another task
-        return PendingIntent.getActivity(
-                context.applicationContext, 0, intentApp, 0)
-    }
-
-    interface SearchCallBack {
-        fun onSearched()
-    }
-}

+ 0 - 72
app/src/main/java/com/quansu/heifengwuliu/widget/WidgetRoundSearchBar.kt

@@ -1,72 +0,0 @@
-package com.quansu.heifengwuliu.widget
-
-import android.content.Context
-import android.util.AttributeSet
-import android.view.LayoutInflater
-import android.widget.LinearLayout
-import androidx.databinding.DataBindingUtil
-import com.hwangjr.rxbus.RxBus
-import com.hwangjr.rxbus.annotation.Subscribe
-import com.hwangjr.rxbus.annotation.Tag
-import com.qmuiteam.qmui.kotlin.onClick
-import com.quansu.heifengwuliu.R
-import com.quansu.heifengwuliu.activity.MainActivity
-import com.quansu.heifengwuliu.adapter.FuncAdapter
-import com.quansu.heifengwuliu.config.ConfigRx
-import com.quansu.heifengwuliu.databinding.WidgetRoundSearchBarBinding
-import com.quansu.heifengwuliu.model.Func
-import com.quansu.heifengwuliu.utils.func.FuncAwoke
-import com.ysnows.base.utils.UiSwitch
-import com.ysnows.base.view.RxBusView
-
-open class WidgetRoundSearchBar constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : LinearLayout(context, attrs, defStyleAttr), RxBusView {
-    lateinit var binding: WidgetRoundSearchBarBinding
-    private val funcAdapter = FuncAdapter()
-
-    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
-
-    private fun initView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) {
-        binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.widget_round_search_bar, this, true)
-        binding.recyclerView.adapter = funcAdapter
-        render("init")
-
-        binding.tvBar.onClick { UiSwitch.single(context, MainActivity::class.java) }
-    }
-
-    @Subscribe(tags = [Tag(ConfigRx.ROUND_SEARCH_BAR_CHANGED), Tag(ConfigRx.ROUND_SEARCH_BAR_ITEM_ADDED)])
-    fun render(from: String) {
-
-        val leftFunc = Func.findLeftFunc()
-        binding.funcLeft = leftFunc
-
-        binding.imgFuncLeft.setOnClickListener { FuncAwoke.awokeFunc(context, leftFunc) }
-
-        funcAdapter.setList(Func.findRightFuncList())
-    }
-
-    init {
-        initView(context, attrs, defStyleAttr)
-    }
-
-
-    override fun onAttachedToWindow() {
-        super.onAttachedToWindow()
-        register()
-    }
-
-    override fun onDetachedFromWindow() {
-        super.onDetachedFromWindow()
-        unRegister()
-    }
-
-    override val isRxbus: Boolean
-        get() = true
-
-    override fun register() {
-        if (isRxbus) RxBus.get().register(this)
-    }
-
-    override fun unRegister() {
-        if (isRxbus) RxBus.get().unregister(this)
-    }
-}

+ 0 - 115
app/src/main/java/com/quansu/heifengwuliu/widget/WidgetSearchBar.kt

@@ -1,115 +0,0 @@
-package com.quansu.heifengwuliu.widget
-
-import android.content.Context
-import android.text.Editable
-import android.text.TextWatcher
-import android.util.AttributeSet
-import android.view.KeyEvent
-import android.view.LayoutInflater
-import android.view.inputmethod.EditorInfo
-import android.widget.TextView
-import androidx.cardview.widget.CardView
-import androidx.databinding.DataBindingUtil
-import com.hwangjr.rxbus.RxBus
-import com.hwangjr.rxbus.annotation.Subscribe
-import com.hwangjr.rxbus.annotation.Tag
-import com.qmuiteam.qmui.kotlin.onClick
-import com.quansu.heifengwuliu.App
-import com.quansu.heifengwuliu.R
-import com.quansu.heifengwuliu.activity.PrivateCenterActivity
-import com.quansu.heifengwuliu.adapter.SearchBarAdapter
-import com.quansu.heifengwuliu.config.ConfigRx
-import com.quansu.heifengwuliu.databinding.WidgetSearchBarBinding
-import com.quansu.heifengwuliu.model.SearchEngine
-import com.quansu.heifengwuliu.repository.SearchRepository
-import com.quansu.heifengwuliu.utils.search.SearchAwoke
-import com.ysnows.base.utils.UiSwitch
-import com.ysnows.base.view.BView
-import com.ysnows.base.view.RxBusView
-
-open class WidgetSearchBar constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : CardView(context!!, attrs, defStyleAttr), RxBusView {
-    lateinit var binding: WidgetSearchBarBinding
-    private val adapter = SearchBarAdapter()
-
-    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
-
-    private fun initView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) {
-        binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.widget_search_bar, this, true)
-
-        binding.recyclerView.adapter = adapter
-        binding.imgFuncLeft.onClick { UiSwitch.single(context, PrivateCenterActivity::class.java) }
-
-        adapter.setOnItemChildClickListener { adapter, view, position ->
-            if (view.id == R.id.img_icon) {
-                val item = this.adapter.getItem(position)
-                SearchAwoke(context!!).search(binding.edtBar.text.toString(), item, (context as BView).repository() as SearchRepository, object : SearchAwoke.SearchCallBack {
-                    override fun onSearched() {
-                        binding.edtBar.setText("")
-                    }
-                })
-            }
-
-        }
-
-        binding.edtBar.setOnEditorActionListener { v: TextView?, actionId: Int, event: KeyEvent? ->
-            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
-                val kw = binding.edtBar.text.toString()
-
-                SearchAwoke(getContext()).search(kw, object : SearchAwoke.SearchCallBack {
-                    override fun onSearched() {
-                        binding.edtBar.setText("")
-                    }
-                })
-            }
-            false
-        }
-
-        binding.edtBar.addTextChangedListener(object : TextWatcher {
-            override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
-            override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
-            override fun afterTextChanged(s: Editable) {
-                val kw = s.toString()
-            }
-        })
-
-
-        renderSearchEngineList("init")
-    }
-
-    @Subscribe(tags = [Tag(ConfigRx.SEARCH_BAR_CHANGED), Tag(ConfigRx.SEARCH_BAR_ITEM_ADDED)])
-    fun renderSearchEngineList(from: String) {
-        defaultSearch("view")
-        val newList = SearchEngine.findSearchBarEngineList().filter { it.is_default != 1 }
-        adapter.setList(newList)
-    }
-
-    private fun defaultSearch(from: String) {
-        binding.defaultSearch = if (App.default_search == null) SearchEngine.findDefault() else App.default_search
-    }
-
-    init {
-        initView(context, attrs, defStyleAttr)
-    }
-
-
-    override fun onAttachedToWindow() {
-        super.onAttachedToWindow()
-        register()
-    }
-
-    override fun onDetachedFromWindow() {
-        super.onDetachedFromWindow()
-        unRegister()
-    }
-
-    override val isRxbus: Boolean
-        get() = true
-
-    override fun register() {
-        if (isRxbus) RxBus.get().register(this)
-    }
-
-    override fun unRegister() {
-        if (isRxbus) RxBus.get().unregister(this)
-    }
-}

+ 0 - 161
app/src/main/java/shared/CustomTabsHelper.java

@@ -1,161 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain init copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package shared;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.net.Uri;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.quansu.heifengwuliu.utils.PackageUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Helper class for Custom Tabs.
- */
-public class CustomTabsHelper {
-    private static final String TAG = "CustomTabsHelper";
-    static final String STABLE_PACKAGE = "com.android.chrome";
-    static final String BETA_PACKAGE = "com.chrome.beta";
-    static final String DEV_PACKAGE = "com.chrome.dev";
-    static final String LOCAL_PACKAGE = "com.google.android.apps.chrome";
-    private static final String EXTRA_CUSTOM_TABS_KEEP_ALIVE =
-            "android.support.customtabs.extra.KEEP_ALIVE";
-    private static final String ACTION_CUSTOM_TABS_CONNECTION =
-            "android.support.customtabs.action.CustomTabsService";
-
-    private static String sPackageNameToUse = STABLE_PACKAGE;
-
-    private CustomTabsHelper() {
-    }
-
-    public static void addKeepAliveExtra(Context context, Intent intent) {
-        Intent keepAliveIntent = new Intent().setClassName(
-                context.getPackageName(), KeepAliveService.class.getCanonicalName());
-        intent.putExtra(EXTRA_CUSTOM_TABS_KEEP_ALIVE, keepAliveIntent);
-    }
-
-
-    public static String getChromePackageName(Context context) {
-
-        if (PackageUtils.checkAppInstalled(context, STABLE_PACKAGE)) {
-            return STABLE_PACKAGE;
-        } else if (PackageUtils.checkAppInstalled(context, BETA_PACKAGE)) {
-            return BETA_PACKAGE;
-        } else if (PackageUtils.checkAppInstalled(context, DEV_PACKAGE)) {
-            return DEV_PACKAGE;
-        }
-        return null;
-    }
-
-    /**
-     * Goes through all apps that handle VIEW intents and have init warmup service. Picks
-     * the one chosen by the user if there is one, otherwise makes init best effort to return init
-     * valid package name.
-     * <p>
-     * This is <strong>not</strong> threadsafe.
-     *
-     * @param context {@link Context} to use for accessing {@link PackageManager}.
-     *
-     * @return The package name recommended to use for connecting to custom tabs related components.
-     */
-    public static String getPackageNameToUse(Context context) {
-        if (sPackageNameToUse != null) return sPackageNameToUse;
-
-        PackageManager pm = context.getPackageManager();
-        // Get default VIEW intentObj handler.
-        Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
-        ResolveInfo defaultViewHandlerInfo = pm.resolveActivity(activityIntent, 0);
-        String defaultViewHandlerPackageName = null;
-        if (defaultViewHandlerInfo != null) {
-            defaultViewHandlerPackageName = defaultViewHandlerInfo.activityInfo.packageName;
-        }
-
-        // Get all apps that can handle VIEW intents.
-        List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, 0);
-        List<String> packagesSupportingCustomTabs = new ArrayList<>();
-        for (ResolveInfo info : resolvedActivityList) {
-            Intent serviceIntent = new Intent();
-            serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION);
-            serviceIntent.setPackage(info.activityInfo.packageName);
-            if (pm.resolveService(serviceIntent, 0) != null) {
-                packagesSupportingCustomTabs.add(info.activityInfo.packageName);
-            }
-        }
-
-        // Now packagesSupportingCustomTabs contains all apps that can handle both VIEW intents
-        // and service calls.
-        if (packagesSupportingCustomTabs.isEmpty()) {
-            sPackageNameToUse = null;
-        } else if (packagesSupportingCustomTabs.size() == 1) {
-            sPackageNameToUse = packagesSupportingCustomTabs.get(0);
-        } else if (!TextUtils.isEmpty(defaultViewHandlerPackageName)
-                && !hasSpecializedHandlerIntents(context, activityIntent)
-                && packagesSupportingCustomTabs.contains(defaultViewHandlerPackageName)) {
-            sPackageNameToUse = defaultViewHandlerPackageName;
-        } else if (packagesSupportingCustomTabs.contains(STABLE_PACKAGE)) {
-            sPackageNameToUse = STABLE_PACKAGE;
-        } else if (packagesSupportingCustomTabs.contains(BETA_PACKAGE)) {
-            sPackageNameToUse = BETA_PACKAGE;
-        } else if (packagesSupportingCustomTabs.contains(DEV_PACKAGE)) {
-            sPackageNameToUse = DEV_PACKAGE;
-        } else if (packagesSupportingCustomTabs.contains(LOCAL_PACKAGE)) {
-            sPackageNameToUse = LOCAL_PACKAGE;
-        }
-        return sPackageNameToUse;
-    }
-
-    /**
-     * Used to check whether there is init specialized handler for init given intentObj.
-     *
-     * @param intent The intentObj to check with.
-     *
-     * @return Whether there is init specialized handler for the given intentObj.
-     */
-    private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) {
-        try {
-            PackageManager pm = context.getPackageManager();
-            List<ResolveInfo> handlers = pm.queryIntentActivities(
-                    intent,
-                    PackageManager.GET_RESOLVED_FILTER);
-            if (handlers == null || handlers.size() == 0) {
-                return false;
-            }
-            for (ResolveInfo resolveInfo : handlers) {
-                IntentFilter filter = resolveInfo.filter;
-                if (filter == null) continue;
-                if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue;
-                if (resolveInfo.activityInfo == null) continue;
-                return true;
-            }
-        } catch (RuntimeException e) {
-            Log.e(TAG, "Runtime exception while getting specialized handlers");
-        }
-        return false;
-    }
-
-    /**
-     * @return All possible chrome package names that provide custom tabs feature.
-     */
-    public static String[] getPackages() {
-        return new String[]{"", STABLE_PACKAGE, BETA_PACKAGE, DEV_PACKAGE, LOCAL_PACKAGE};
-    }
-}

+ 0 - 32
app/src/main/java/shared/KeepAliveService.java

@@ -1,32 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain init copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package shared;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.IBinder;
-
-/**
- * Empty service used by the custom tab to bind to, raising the application's importance.
- */
-public class KeepAliveService extends Service {
-    private static final Binder sBinder = new Binder();
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return sBinder;
-    }
-}

+ 0 - 47
app/src/main/java/shared/ServiceConnection.java

@@ -1,47 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain init copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package shared;
-
-import android.content.ComponentName;
-
-import java.lang.ref.WeakReference;
-
-import androidx.browser.customtabs.CustomTabsClient;
-import androidx.browser.customtabs.CustomTabsServiceConnection;
-
-/**
- * Implementation for the CustomTabsServiceConnection that avoids leaking the
- * ServiceConnectionCallback
- */
-public class ServiceConnection extends CustomTabsServiceConnection {
-    // A weak reference to the ServiceConnectionCallback to avoid leaking it.
-    private WeakReference<ServiceConnectionCallback> mConnectionCallback;
-
-    public ServiceConnection(ServiceConnectionCallback connectionCallback) {
-        mConnectionCallback = new WeakReference<>(connectionCallback);
-    }
-
-    @Override
-    public void onCustomTabsServiceConnected(ComponentName name, CustomTabsClient client) {
-        ServiceConnectionCallback connectionCallback = mConnectionCallback.get();
-        if (connectionCallback != null) connectionCallback.onServiceConnected(client);
-    }
-
-    @Override
-    public void onServiceDisconnected(ComponentName name) {
-        ServiceConnectionCallback connectionCallback = mConnectionCallback.get();
-        if (connectionCallback != null) connectionCallback.onServiceDisconnected();
-    }
-}

+ 0 - 33
app/src/main/java/shared/ServiceConnectionCallback.java

@@ -1,33 +0,0 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain init copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package shared;
-
-import androidx.browser.customtabs.CustomTabsClient;
-
-/**
- * Callback for events when connecting and disconnecting from Custom Tabs Service.
- */
-public interface ServiceConnectionCallback {
-    /**
-     * Called when the service is connected.
-     * @param client init CustomTabsClient
-     */
-    void onServiceConnected(CustomTabsClient client);
-
-    /**
-     * Called when the service is disconnected.
-     */
-    void onServiceDisconnected();
-}

+ 0 - 60
app/src/main/res/layout/item_app_s.xml

@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<layout xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <data >
-        <variable
-            name="item"
-            type="com.quansu.heifengwuliu.model.AppModel" />
-
-    </data >
-
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="#fffafafa"
-        android:orientation="vertical" >
-
-        <LinearLayout
-            style="@style/sug_list_item_frame"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal" >
-
-            <ImageView
-                android:id="@+id/iv_app_icon"
-                android:layout_width="@dimen/list_item_main_height"
-                android:src="@{item.loadIcon()}"
-                android:layout_height="@dimen/list_item_main_height"
-                android:padding="8dp" />
-
-            <TextView
-                android:id="@id/tv_text"
-                android:layout_width="0.0dp"
-                android:layout_height="@dimen/list_item_main_height"
-                android:text="@{item.name}"
-                android:layout_marginRight="@dimen/common_padding_lr"
-                android:layout_weight="1.0"
-                android:ellipsize="end"
-                android:gravity="center_vertical"
-                android:singleLine="true"
-                android:textColor="@color/blue"
-                android:textSize="@dimen/list_item_main_text_size" />
-
-            <ImageView
-                android:id="@+id/img_app_info"
-                android:layout_width="@dimen/list_item_main_width"
-                android:layout_height="@dimen/list_item_main_height"
-                android:foreground="?android:selectableItemBackground"
-                android:padding="16.0dp"
-                android:src="@drawable/ic_app_info" />
-
-            <CheckBox
-                android:id="@+id/cb_app_install"
-                android:layout_width="@dimen/list_item_main_width"
-                android:layout_height="@dimen/list_item_main_height"
-                android:background="?android:selectableItemBackground"
-                android:padding="16.0dp" />
-        </LinearLayout >
-
-    </RelativeLayout >
-</layout >

+ 2 - 0
common-build.gradle

@@ -8,6 +8,8 @@ dependencies {
     implementation 'androidx.appcompat:appcompat:1.2.0'
     implementation 'androidx.core:core-ktx:1.3.1'
 
+    implementation 'com.google.android.material:material:1.2.1'
+
     implementation 'androidx.recyclerview:recyclerview:1.1.0'
 
     implementation 'com.google.code.gson:gson:2.8.6'