Example usage for android.view KeyEvent KEYCODE_HOME

List of usage examples for android.view KeyEvent KEYCODE_HOME

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_HOME.

Prototype

int KEYCODE_HOME

To view the source code for android.view KeyEvent KEYCODE_HOME.

Click Source Link

Document

Key code constant: Home key.

Usage

From source file:com.example.android.home.Home.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Toast.makeText(this, "onKeyDown", Toast.LENGTH_LONG).show();
    if ((keyCode == KeyEvent.KEYCODE_HOME)) {
        Toast.makeText(this, "You pressed the home button!", Toast.LENGTH_LONG).show();
        return true;
    }//w w  w.java  2s. co  m
    return super.onKeyDown(keyCode, event);
}

From source file:cn.com.incito.driver.UI.detailDialog.PCCFragmentActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_HOME) {
        finish();//from   w  w  w .j a v  a 2 s.  c  o m
    }
    return super.onKeyDown(keyCode, event);
}

From source file:org.wso2.iot.agent.activities.AlreadyRegisteredActivity.java

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override/*from   ww w  .ja  v a  2 s .  c  o  m*/
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        loadHomeScreen();
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        loadHomeScreen();
        return true;
    } else {
        return super.onKeyDown(keyCode, event);
    }
}

From source file:com.example.android.bluepayandroidsdk.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK || KeyEvent.KEYCODE_HOME == keyCode
            || KeyEvent.KEYCODE_SEARCH == keyCode)) {
        return false;
    }//from w ww.  j a  v  a 2 s.com
    return super.onKeyDown(keyCode, event);
}

From source file:com.example.android.bluepayandroidsdk.MainActivity.java

@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK || KeyEvent.KEYCODE_HOME == keyCode
            || KeyEvent.KEYCODE_SEARCH == keyCode)) {

        return false;
    }//from  ww w .  ja v a  2s .c o m
    return super.onKeyMultiple(keyCode, repeatCount, event);
}

From source file:com.example.android.bluepayandroidsdk.MainActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK || KeyEvent.KEYCODE_HOME == keyCode
            || KeyEvent.KEYCODE_SEARCH == keyCode)) {
        return false;
    }//w  w  w .j  a  va2 s .com
    return super.onKeyUp(keyCode, event);
}

From source file:org.wso2.cdm.agent.AuthenticationActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        Intent i = new Intent();
        i.setAction(Intent.ACTION_MAIN);
        i.addCategory(Intent.CATEGORY_HOME);
        this.startActivity(i);
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        this.finish();
        return true;
    }/*  w ww  .  j a  va 2s. c  o m*/
    return super.onKeyDown(keyCode, event);
}

From source file:org.de.jmg.learn.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (mPager.getCurrentItem() == fragFileChooser.fragID) {
        boolean res = this.fPA.fragChooser.onKeyDown(keyCode, event);
        if (!res)
            return false;
    } else if (mPager.getCurrentItem() == _MainActivity.fragID) {
        this.fPA.fragMain.removeCallbacks();
    }//from   ww  w.  jav  a  2  s  . com
    if (keyCode == KeyEvent.KEYCODE_HOME) {
        try {
            saveVok(false);
        } catch (Exception e) {

            lib.ShowException(this, e);
            return true;
        }
    } else if (keyCode == KeyEvent.KEYCODE_BACK && mPager.getCurrentItem() == 0) {
        try {
            if (_backPressed > 0 || saveVokAsync(false, false)) {
                handlerbackpressed.removeCallbacks(rSetBackPressedFalse);
            } else {
                return true;
            }

        } catch (Exception e) {

            Log.e("onBackPressed", e.getMessage(), e);
            lib.ShowException(this, e);
            return true;
        }
    }

    return super.onKeyDown(keyCode, event);

}

From source file:com.fvd.nimbus.BrowseActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
            return true;
        }/*from ww w .  ja va 2  s  .c om*/
        if (floatMenu.isExpanded()) {
            //toggleTools();
            floatMenu.collapse();
            return true;
        }
        if (isInSelectionMode()) {
            wv.endSelectionMode();
            //wv.loadUrl("javascript:android.clearSelection();");
            return true;
        }
        /*if (wv.canGoBack()){
           wv.goBack();
           return true;
        }*/
        //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
        overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
        overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out);
        finish();
    }
    return super.onKeyDown(keyCode, event);
}

From source file:flex.android.magiccube.activity.ActivityBattleMode.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        dialog2 = new DialogSetting(this, settinghandler);
        dialog2.show();//  w  w  w.j a va  2 s .  c o m
        return false;
    } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
        showExitGameAlert();
        return false;
    }
    return super.onKeyDown(keyCode, event);
    // return super.onKeyDown(keyCode, event);
}