當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。