当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.KEYCODE_BACK属性代码示例

本文整理汇总了Java中android.view.KeyEvent.KEYCODE_BACK属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_BACK属性的具体用法?Java KeyEvent.KEYCODE_BACK怎么用?Java KeyEvent.KEYCODE_BACK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.KEYCODE_BACK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (KeyEvent.KEYCODE_BACK == event.getKeyCode()) {
        if (fragment != null && !fragment.onBackPressed()) {
            if (isFromPush) {
                isFromPush = false;
                startActivity(new Intent(this, MainActivity.class));
                SealAppContext.getInstance().popAllActivity();
            } else {
                if (fragment.isLocationSharing()) {
                    fragment.showQuitLocationSharingDialog(this);
                    return true;
                }
                if (mConversationType.equals(Conversation.ConversationType.CHATROOM)
                        || mConversationType.equals(Conversation.ConversationType.CUSTOMER_SERVICE)) {
                    SealAppContext.getInstance().popActivity(this);
                } else {
                    SealAppContext.getInstance().popAllActivity();
                }
            }
        }
    }
    return false;
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:24,代码来源:ConversationActivity.java

示例2: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
    if(keyCode == KeyEvent.KEYCODE_BACK) {
        Intent i = new Intent(this, Calculator.class);
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        return true;
    }
    return super.onKeyDown(keyCode, keyEvent);
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:10,代码来源:About.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (isEdit) {
            clearEditMode();
        } else if (mNewColumnFieldList == null || mNewColumnFieldList.size() == 0) {
            showExitTipDialog();
        } else {
            finish();
        }
        return true;
    } else {
        return super.onKeyDown(keyCode, event);
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:16,代码来源:SqlCreateTableActivity.java

示例4: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    if ((keyCode == KeyEvent.KEYCODE_BACK))
    { //Back key pressed
        //Things to Do
        if(player!= null)
        {
            player.stop();
            player=null;
        }
        finish();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:adarshgumashta,项目名称:Facebook-Video-Downloader,代码行数:16,代码来源:VideoPlayerActivity.java

示例5: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {

        if (mWebChromeClient.inCustomView()) {//全屏播放退出全屏
            hideCustomView();
            return true;
        } else if (webView.canGoBack()) {//返回网页上一页
            webView.goBack();
            return true;
        } else {//退出网页
            webView.loadUrl("about:blank");
            finish();
        }
    }
    return false;
}
 
开发者ID:jutao,项目名称:GankReader,代码行数:17,代码来源:WebViewActivity.java

示例6: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    if(keyCode == KeyEvent.KEYCODE_BACK)
    {
        return false;
    }
    return false;
}
 
开发者ID:de-crypto,项目名称:ChatShala,代码行数:9,代码来源:MainActivity.java

示例7: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
	if (keyCode == KeyEvent.KEYCODE_BACK)
	{
		if (webView.canGoBack())
		{
			webView.goBack();
			return true;
		}
	}
	return super.onKeyDown(keyCode, event);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:13,代码来源:HelpActivity.java

示例8: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	// TODO Auto-generated method stub
	if (keyCode == KeyEvent.KEYCODE_BACK) {
		exitEditVideo();
		return true;
	}
	return super.onKeyDown(keyCode, event);
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:9,代码来源:EditorVideo.java

示例9: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && contentWebView.canGoBack()) {
        contentWebView.goBack();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:struggledhard,项目名称:USay,代码行数:8,代码来源:WebViewActivity.java

示例10: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (mAmeVoiceInput.isRecording()) {
            new CommonDialog(MemoEditActivity.this, "温馨提示", "离开编辑页面前,请先关闭录音识别哦!", "知道了").show();
            return true;
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:10,代码来源:MemoEditActivity.java

示例11: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    if (KeyEvent.KEYCODE_DPAD_CENTER == keyCode || KeyEvent.KEYCODE_ENTER == keyCode)
    {
        if (videoList.getVisibility() != View.VISIBLE)
        {
            videoList.setVisibility(View.VISIBLE);
            tips.setVisibility(View.INVISIBLE);
            mRecyclerViewBridge.setVisibleWidget(false);
            videoList.requestFocus();
        }
    }
    else if (KeyEvent.KEYCODE_BACK == keyCode)
    {
        if (videoList.getVisibility() == View.VISIBLE)
        {
            videoList.setVisibility(View.INVISIBLE);
            tips.setVisibility(View.VISIBLE);
            mRecyclerViewBridge.setVisibleWidget(true);
            return true;
        }
    }
    else if (KeyEvent.KEYCODE_MENU == keyCode)
    {
        if (videoList.getVisibility() != View.VISIBLE)
        {
            videoList.setVisibility(View.VISIBLE);
            tips.setVisibility(View.INVISIBLE);
            videoList.requestFocus();
            mRecyclerViewBridge.setVisibleWidget(false);
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:Dreamxiaoxuan,项目名称:AndroidTvDemo,代码行数:35,代码来源:LiveVideoActivity.java

示例12: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {

  int keyCode = event.getKeyCode();
  if (event.getRepeatCount() == 0
      && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
      || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
    doPauseResume();
    show(sDefaultTimeout);
    if (mPauseButton != null && mTvPlay != null) {
      mPauseButton.requestFocus();
      mTvPlay.requestFocus();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
    if (mPlayer.isPlaying()) {
      mPlayer.pause();
      updatePausePlay();
    }
    return true;
  } else if (keyCode == KeyEvent.KEYCODE_BACK
      || keyCode == KeyEvent.KEYCODE_MENU) {
    hide();
    return true;
  } else {
    show(sDefaultTimeout);
  }
  return super.dispatchKeyEvent(event);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:29,代码来源:MediaController.java

示例13: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == event.ACTION_DOWN) {
        if ((System.currentTimeMillis() - exitTimeMillis) > 2000) {
            exitTimeMillis = System.currentTimeMillis();
            Snackbar.make(mRecyclerView, "再按一次退出~~", Snackbar.LENGTH_SHORT).show();
        } else {
            finish();
        }
        return true;
    }
    return false;
}
 
开发者ID:jianesrq0724,项目名称:MaterialDesign,代码行数:13,代码来源:MainActivity.java

示例14: onKeyDown

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK) && wvTechContent.canGoBack()) {
        wvTechContent.goBack();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:TechDetailActivity.java

示例15: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        ULog.i("KEYCODE_BACK");
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:WillFlower,项目名称:BluetoothCtrl,代码行数:7,代码来源:MainActivity.java


注:本文中的android.view.KeyEvent.KEYCODE_BACK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。