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:org.wso2.cdm.agent.RegistrationActivity.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);
        finish();//from  ww  w .  j  av  a 2s.  c  o m
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        finish();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:org.wso2.mdm.agent.AlreadyRegisteredActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        loadHomeScreen();//  w  w  w .ja  v a2  s .c o  m
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        loadHomeScreen();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.launcher.silverfish.launcher.LauncherActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    // Override the functionality of back and home key
    if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) && event.isTracking()
            && !event.isCanceled()) {
        mViewPager.setCurrentItem(1);/*from   w  ww  . jav a  2s  .  c o m*/
        return true;
    }
    return super.onKeyUp(keyCode, event);
}

From source file:co.taqat.call.CallIncomingActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (LinphoneManager.isInstanciated()
            && (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
        LinphoneManager.getLc().terminateCall(mCall);
        finish();//from  w ww  .ja  v  a 2  s .c om
    }
    return super.onKeyDown(keyCode, event);
}

From source file:freed.cam.ActivityFreeDcamMain.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (activityIsResumed) {
        Log.d(TAG, "KeyCode Pressed:" + keyCode);
        int appSettingsKeyShutter = 0;

        if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER).equals(StringUtils.VoLP))
            appSettingsKeyShutter = KeyEvent.KEYCODE_VOLUME_UP;
        else if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER)
                .equals(StringUtils.VoLM))
            appSettingsKeyShutter = KeyEvent.KEYCODE_VOLUME_DOWN;
        else if (getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER)
                .equals(StringUtils.Hook)
                || getAppSettings().getApiString(AppSettingsManager.SETTING_EXTERNALSHUTTER).equals(""))
            appSettingsKeyShutter = KeyEvent.KEYCODE_HEADSETHOOK;

        if (keyCode == KeyEvent.KEYCODE_3D_MODE || keyCode == KeyEvent.KEYCODE_POWER
                || keyCode == appSettingsKeyShutter || keyCode == KeyEvent.KEYCODE_UNKNOWN
                || keyCode == KeyEvent.KEYCODE_CAMERA) {
            cameraFragment.GetModuleHandler().DoWork();
            return true;
        }//from  w w w.  ja v  a2  s  . c o  m
        if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
            closeActivity();
            return true;
        }
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.cleveroad.audiowidget.AudioWidget.java

private boolean hasNavigationBar() {
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);
    int id = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
    return !hasBackKey && !hasHomeKey || id > 0 && context.getResources().getBoolean(id);
}

From source file:com.android.tv.settings.accessories.AddAccessoryActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
        if (mPairingBluetooth && !mDone) {
            cancelBtPairing();//from ww w  .j a  va  2 s.co  m
        }
    }
    return super.onKeyUp(keyCode, event);
}

From source file:am.hour.beebird.Activity.MainActivity.java

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        recent_fragment_number = -1;//from  www  . ja va 2 s .  c  o m

    } else if (keyCode == KeyEvent.KEYCODE_MENU) {

    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        // 

    }
    return super.onKeyDown(keyCode, event);
}

From source file:org.wso2.app.catalog.AppListActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        loadHomeScreen();//from   ww w  . j  a va  2s  . co m
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        loadHomeScreen();
        return true;
    } else {
        return super.onKeyDown(keyCode, event);
    }
}

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

@SuppressLint({ "NewApi", "NewApi" })
@Override/*from   w w w.  java 2 s. com*/
public boolean dispatchKeyEvent(KeyEvent event) {
    Toast.makeText(getApplicationContext(), "dispatchKeyEvent", Toast.LENGTH_SHORT).show();

    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_BACK:
            mBackDown = true;
            Toast.makeText(getApplicationContext(), "BACK 1", Toast.LENGTH_SHORT).show();
            myPager.setCurrentItem(HomePagerAdapter.SCREEN_CENTER);
            return true;
        case KeyEvent.KEYCODE_HOME:
            mHomeDown = true;
            //myPager.setCurrentItem(HomePagerAdapter.SCREEN_CENTER); 
            //myPager.invalidate();
            Toast.makeText(getApplicationContext(), "HOME", Toast.LENGTH_SHORT).show();
            Log.e("PUSH", "Home 2");
            return true;
        }
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
        switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_BACK:
            if (!event.isCanceled()) {
                // Do BACK behavior.
                Toast.makeText(getApplicationContext(), "BACK 2", Toast.LENGTH_SHORT).show();
            }
            mBackDown = true;
            return true;
        case KeyEvent.KEYCODE_HOME:
            Toast.makeText(getApplicationContext(), "HOME", Toast.LENGTH_SHORT).show();
            Log.e("PUSH", "Home 2");
            if (!event.isCanceled()) {
                // Do HOME behavior.
                //myPager.setCurrentItem(HomePagerAdapter.SCREEN_CENTER); 
                Toast.makeText(getApplicationContext(), "HOME", Toast.LENGTH_SHORT).show();
                Log.e("PUSH", "Home 2");
            }
            mHomeDown = true;
            return true;
        }
    }

    return super.dispatchKeyEvent(event);
}