仿iphone的滑动开机按钮如图




public class Conditions extends Activity{

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);

        // Close the menu
        if (Intent.ACTION_MAIN.equals(intent.getAction())) {
            getWindow().closeAllPanels();
        }
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        requestWindowFeature(Window.FEATURE_NO_TITLE);
//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
        stopService(new Intent(this, SleepListenService.class));
        final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
        boolean terms = settings.getBoolean("terms", true);
        if(!terms){
            startActivity(new Intent(this, SlideUnlocker.class));
            finish();
        }else{
            setContentView(R.layout.terms);
            Button yes = (Button) findViewById(R.id.yes);
            Button no = (Button) findViewById(R.id.no);
            
            WebView wv = (WebView) findViewById(R.id.gpl3);
            try {
                wv.loadData(IOUtils.toString(getResources().openRawResource(R.raw.gpl)).toString(), "text/html", "utf-8");
            } catch (Exception e) {
                throw new RuntimeException("Blowup");
            }
            
            showMessage("This project is under GPL3, you must agree to the terms and conditions before proceeding");
            
            
            yes.setOnClickListener(new OnClickListener(){
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(TermsConditions.this, SlideUnlocker.class));
                    Editor editor = settings.edit();
                    editor.putBoolean("terms", false);
                    editor.commit();
                    finish();
                }
            });
            
            no.setOnClickListener(new OnClickListener(){
                @Override
                public void onClick(View v) {
                    finish();
                }
            });
            yes.setVisibility(View.VISIBLE);
            no.setVisibility(View.VISIBLE);
        }

    }
    
    
    private void showMessage(String errorString) {
      Toast text = Toast.makeText(this, 
              errorString, Toast.LENGTH_LONG);
      text.show();
    }
}


http://download.csdn.net/detail/sun6223508/5780687


评论 25
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值