stanipintjuk / Silverfish

A simple and lightweight launcher for Android.
GNU General Public License v3.0
44 stars 17 forks source link

Automatically sort applications in their corresponding tabs #15

Closed Lonami closed 8 years ago

Lonami commented 8 years ago

Status

Lonami commented 8 years ago

I wanted to discuss this with you first. What do you think? I tried making use of the official API, but it's a pain, so I just look into Google Play's HTML to find the applications' respective categories. It seems to work fine, and it really finds the right category for many apps.

Lonami commented 8 years ago

Current usage example:

PackageInfo packageInfo = new PackageInfo();

String[] packages = packageInfo.getInstalledPackages(getContext());

packageInfo.getPackagesCategoryAsync(new PackageInfo.PackageCategoryListener() {
    @Override
    public void onPackageCategory(String pkg, String category) {
        Log.d("PackageInfo example",
                String.format("Found category «%s» for package «%s»", category, pkg));
    }
}, PackageInfo.ENGINE_FDROID, packages);
stanipintjuk commented 8 years ago

I have though about this a lot. It would be nice to have the apps automatically categorized, but there are concerns about non free services in the FLOSS community. And sure we could simply ask the user "do you want to use google play to automatically categorize your apps?" but I still do not want this app to be associated with non free services at all.

But there is something we could do, and that is to create an extension that people, who really want to categorize their apps automatically, could install on top of Silverfish. This extension would talk to google and categorize the apps. This would separate the code that communicates with google from the actual app, and people wouldn't be forced to download it if they don't want to.

Or... we could just forget about the auto categorizing stuff and simply make it easer for the user to categorize their apps by e.g. letting them select multiple apps and drag them all at the same time to a tab.

Lonami commented 8 years ago

I also thought of maintaining a list of applications and their categories, we could just query that. But of course, there are millions of applications...

What about querying F-Droid repositories then?

Lonami commented 8 years ago

Something else we could do would be making a directory/file in the project, keeping track of applications and their category. People then would be able to collaborate. This however would be hard (writing the packages by hand), so maybe an option to export some file (for example, file containing a list of package.name=category=app title) would make it easy for people to collaborate.

Edit: Or perhaps even as a separate repository, so everybody could benefit! Edit 2: The app title should be added so we can tell if the category is right or not :)

stanipintjuk commented 8 years ago

What about querying F-Droid repositories then?

Do they have an API for that? It is a good idea, but then we only would be able to categorize the opensource apps.

Something else we could do would be making a directory/file in the project, keeping track of applications and their category. People then would be able to collaborate.

If a lot of people would collaborate and add a lot of apps then this options would have the same problem as this option:

I also thought of maintaining a list of applications and their categories, we could just query that. But of course, there are millions of applications...

stanipintjuk commented 8 years ago

A feel that this feature is important and we really should come up with a way to add it, but I just want to talk through all off the options and don't think that we should rush it, so I am going to add this to the "somtime after realese 1.0 Milestone"

Lonami commented 8 years ago

Do they have an API for that? It is a good idea, but then we only would be able to categorize the opensource apps.

I couldn't quite see anything like "API", but since it's open source, it would be matter of looking into their code and see how they access to the repository. And yes, we would only categorize open source apps, thus applying some kind of penalization for those who are not using them ;)

this options would have the same problem as this option

But in this case, at least the most well-known applications would be sorted, hence saving some precious time

and don't think that we should rush it

Okay! No need to rush, hopefully more people will suggest more options/ideas. Closing this then.

Lonami commented 8 years ago

Wait perhaps I shouldn't have closed this? May I undo? Can I even undo? 😓

Teyro commented 8 years ago

Good idea...In my opinion maybe use f-droid apps first and maybe create a local database for popular apps ? PlayStore should be low priority

Lonami commented 8 years ago

If you approve, this is ready to be merged @stanipintjuk

Lonami commented 8 years ago

Still I have another question. Currently, the method used for sorting is a static final Map, hence it's loaded in memory for the whole app lifetime, even if the apps are already sorted. The only way to solve this would be to either move the Map from static final inside the getCategory method (and so, it should only load when called), or use a external file.