Back to project page Common-Library.
The source code is released under:
Apache License
If you think the Android project Common-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.morgan.library.app; // www .j a va 2s .c o m import android.os.Bundle; import android.view.KeyEvent; import android.view.ViewGroup.LayoutParams; import com.morgan.library.widget.ScreenShotView; import com.morgan.library.widget.ScreenShotView.OnScreenShotListener; /** * ??????????Activity???? * * @author Morgan.Ji * * @version 1.0 * * @date 2014?7?9? */ public class BaseScreenShotActivity extends BaseActivity { // ?????????? private boolean mAllowDestroy = true; // ????View private ScreenShotView mScreenShotView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } /** * ??????????? */ public void startShotScreen(OnScreenShotListener screenShotListener) { this.mAllowDestroy = false; if (mScreenShotView == null) { mScreenShotView = new ScreenShotView(BaseScreenShotActivity.this, screenShotListener); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); getWindow().addContentView(mScreenShotView, lp); } //this.mScreenShotView. } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // ??????????????????back???????????? if (keyCode == KeyEvent.KEYCODE_BACK && !mAllowDestroy) { this.mScreenShotView.dismiss(); mAllowDestroy = true; return true; } return super.onKeyDown(keyCode, event); } }