shevchovski / adw-launcher-android

Automatically exported from code.google.com/p/adw-launcher-android
0 stars 0 forks source link

Open second latest launched application with home button #268

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This would allow to quickly switch between two applications with home button 
double click. Particularly useful on devices with physical home button.

Original issue reported on code.google.com by giulio.m...@gmail.com on 15 Nov 2010 at 3:24

GoogleCodeExporter commented 8 years ago
You can test this functionality by assigning your home key to the attached app. 
Source code follows.

---

package it.ivlivs.scambio;

import java.util.List;

import android.app.Activity;
import android.app.ActivityManager;
import android.os.Bundle;

public class scambio extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
        int j = 0;
        int n = 5;
        List<ActivityManager.RecentTaskInfo> l = am.getRecentTasks(n, 0);
        ActivityManager.RecentTaskInfo rti;
        String s;
        if (l.size() >= 2) for (int i = 0; i < n; i++) {
            s = l.get(i).baseIntent.getComponent().getPackageName();
            if (! s.equals("org.adw.launcher") && ! s.equals("com.google.android.googlequicksearchbox") && ! s.equals("com.google.android.voicesearch")) j += 1;
            if (j == 2) {
                startActivity(l.get(i).baseIntent);
                break;
            }
        }
        this.finish();
    }
}

Original comment by giulio.m...@gmail.com on 11 Dec 2010 at 11:35

Attachments:

GoogleCodeExporter commented 8 years ago
If this functionality could be included as an option in the settings (say, 
General Behaviour, Home button binding, Switch to Previous App) that would be 
great!

The provided apk is designed to work as a home replacement, which demonstrates 
the functionality but isn't useful as is, as it then replaces the launcher.  
For it to be used in General Behaviour, Home button binding, Open App... it 
would need to be modified to open the previous to previous app instead. 

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 5:21

GoogleCodeExporter commented 8 years ago
Actually, this could be a little smarter:  if the launcher has been active for 
a while (just a regular home-button tap from within the launcher) then switch 
to the previous app, but if the launcher hasn't been active for long (a home 
button double tap from another app) then switch to the previous to previous app 
(i.e. the app previous to the one being used when double-tapping).

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 5:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, actually it is not intended to replace the launcher, but to be bound to the 
home button within the launcher. It works decently and already does what you 
are asking in #3, but is not perfect as you can still see that another 
application is launched before switching. Would be great it it could be 
integrated.

Original comment by giulio.m...@gmail.com on 12 Mar 2012 at 7:27

GoogleCodeExporter commented 8 years ago
Thanks for your program and your comment.  Maybe I'm missing something, but 
this is what seems to be going on:

There are 2 separate behaviours I've mentioned:

1) In the launcher, tap home, and switch back to what you were doing before you 
were in the launcher.

2) In some app, double-tap home, and switch back to the previous app.  Repeat 
to toggle back and forth.

Your app does 1), but your description "quickly switch between two applications 
with home button double click", and what I've personally been searching for, is 
2).  Your app could be modified to do 2) if it found the app previous to the 
previous app instead of the previous app.  Currently, it just switches back to 
the current app.

Thanks!

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 7:46

GoogleCodeExporter commented 8 years ago
just changing 2 to 3 would do it I guess...

0: scambio
1: org.adw.launcher
2: previous app (being used at time of home double-tap)
3: previous to previous app (the one we want to switch back to)

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 7:52

GoogleCodeExporter commented 8 years ago
Sorry, I did not pay enough attention. Really it is intended to do only 2), and 
it does it on my phone... Are you maybe using ADW Launcher EX?

Original comment by giulio.m...@gmail.com on 12 Mar 2012 at 7:55

GoogleCodeExporter commented 8 years ago
I'm using Version 1.3.6 System CM 1.1, as supplied with CM7.1.

When I double-tap home, it takes me back to the current app.  

Thanks!

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 8:01

GoogleCodeExporter commented 8 years ago
Does it have the same activity name "org.adw.launcher"? As you can see, we need 
to exclude the launcher from the activities to be ignored when switching. As of 
now this is just an example to the developers of ADW, but I could include a 
list of the other major launchers if useful.

Original comment by giulio.m...@gmail.com on 12 Mar 2012 at 8:11

GoogleCodeExporter commented 8 years ago
Sorry, I should have checked that!  The package name is com.android.launcher.  
If you wouldn't mind including that too it would be very much appreciated, as 
I've been searching for this functionality for a while!  Of course it would be 
best if it could be built-in, but this is a nice work-around in the mean time, 
and also gives users a chance to try out this behaviour and see how useful it 
is!

Thanks again!   

Original comment by fugouna...@gmail.com on 12 Mar 2012 at 8:25

GoogleCodeExporter commented 8 years ago
You are very welcome :-) I will try to fix it this evening.

Original comment by giulio.m...@gmail.com on 12 Mar 2012 at 8:31

GoogleCodeExporter commented 8 years ago
Please try this one.

Original comment by giulio.m...@gmail.com on 12 Mar 2012 at 10:39

Attachments:

GoogleCodeExporter commented 8 years ago
That works perfectly!  Thanks so much!  It's a huge usability improvement!

Original comment by fugouna...@gmail.com on 13 Mar 2012 at 1:58

GoogleCodeExporter commented 8 years ago
I am glad you like it. I have managed to further improve it by removing the 
blinking window and making it compatible also with GO. As this is not any more 
specific to ADW, I have moved the discussion on XDA forums:

http://forum.xda-developers.com/showthread.php?p=23725397#post23725397

Original comment by giulio.m...@gmail.com on 17 Mar 2012 at 4:29