简体   繁体   中英

How to make a swipe up on home button open a sliding drawer

I am working on a app that when you swipe up on the home button the app opens. I have everything else done bet the code to accomplish the open on swipe up on home button part. How do I do this? Any help would be amazing.

Here's my java code if needed:

package com.d4a.toolbelt;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class QuickLaunch extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quick_launch);
    }

     /** Called when the user clicks the  music button */
     public void music(View view) {
         Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");
         startActivity(intent);


     }





/** Called when the user clicks the play button */
public void play(View view) {
    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    startActivity(launchIntent);
    }



/** Called when the user clicks the web button */
public void web(View view) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/"));
      startActivity(browserIntent);

}

       /** Called when the user clicks the email button */
public void email(View view) {
     Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email");
     startActivity(intent);

} 

/** Called when the user clicks the sms button */
public void chat(View view) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
 intent.setComponent(new ComponentName("com.d4a.sms","de.ub0r.android.smsdroid.ConversationListActivity"));
 intent.putExtra("grace", "Hi");
 startActivity(intent);


}


/** Called when the user clicks the settings button */
public void settings(View view) {
     Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings");
     startActivity(intent);

}




/** Called when the user clicks the camara button */
public void cam(View view) {
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    startActivityForResult(intent, 0);

}

/** Called when the user clicks the video camara button */
public void video_cam(View view) {
    Intent intent = new Intent("android.media.action.VIDEO_CAPTURE");
    startActivityForResult(intent, 0);

}
}

Thanks a million in advance guys!

I figured it out you need this line of code in the manifest:

 <intent-filter>
            <action android:name="android.intent.action.ASSIST" />
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>

Thanks to home launcher being open source I got my answer I hope this helps out anyone else who is in my shoes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM