Android Open Source - ZShaolin introscreen






From Project

Back to project page ZShaolin.

License

The source code is released under:

GNU General Public License

If you think the Android project ZShaolin listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.dyne.zshaolin.startup;
import org.dyne.zshaolin.R;
/*from w w w .j a v a2s .c  o  m*/
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;

import com.spartacusrex.spartacuside.Term;
import com.spartacusrex.spartacuside.TermService;

/**
 *
 * @author Spartacus Rex
 */
public class introscreen extends Activity implements OnClickListener{

    Dialog mConfirmDialog;
    Dialog mInstallDialog;
    Intent mTSIntent;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        setContentView(R.layout.main);

        //Start the Service..
        mTSIntent = new Intent(this, TermService.class);
        startService(mTSIntent);

        Button but = (Button)findViewById(R.id.main_start);
        but.setOnClickListener(this);
        but = (Button)findViewById(R.id.main_stop);
        but.setOnClickListener(this);
        but = (Button)findViewById(R.id.main_keyboard);
        but.setOnClickListener(this);
        but = (Button)findViewById(R.id.main_install);
        but.setOnClickListener(this);
        but = (Button)findViewById(R.id.main_help);
        but.setOnClickListener(this);
        but = (Button)findViewById(R.id.main_options);
        but.setOnClickListener(this);

        AlertDialog.Builder build = new AlertDialog.Builder(this);
        build.setTitle("Confirm");
        build.setMessage("Shutdown all terminals ?");
        build.setCancelable(true);
        build.setPositiveButton("Shutdown", new android.content.DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                stopService(mTSIntent);

                finish();

                mConfirmDialog.dismiss();
            }
        });
        build.setNegativeButton("Cancel", new android.content.DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                mConfirmDialog.dismiss();
            }
        });
        mConfirmDialog = build.create();

        build = new AlertDialog.Builder(this);
        build.setTitle("New System");
        build.setMessage("There is a newer system for you to install.");
        build.setCancelable(true);
        build.setPositiveButton("Show me", new android.content.DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                //Install the system
                startActivity(new Intent(introscreen.this, installer.class));
                
                mConfirmDialog.dismiss();
            }
        });
        build.setNegativeButton("Later", new android.content.DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                //Start the Terminal
                startActivity(new Intent(introscreen.this, Term.class));

                mConfirmDialog.dismiss();
            }
        });
        mInstallDialog = build.create();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    public void onClick(View zButton) {
        if(zButton == findViewById(R.id.main_start)){
            //Check system version
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
            String current    =  prefs.getString("CURRENT_SYSTEM", "no system installed");
            int    currentnum =  prefs.getInt("CURRENT_SYSTEM_NUM", -1);

            if(currentnum < installer.CURRENT_INSTALL_SYSTEM_NUM){
                mInstallDialog.show();
            }else{
                //Start the Terminal
                startActivity(new Intent(introscreen.this, Term.class));
            }

        }else if(zButton == findViewById(R.id.main_stop)){
            mConfirmDialog.show();
            
        }else if(zButton == findViewById(R.id.main_keyboard)){
            //Show Keyboard Picker
            InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showInputMethodPicker();

        }else if(zButton == findViewById(R.id.main_install)){
            //Install the system
            startActivity(new Intent(this, installer.class));

        }else if(zButton == findViewById(R.id.main_help)){
            //Open the Help Section
          String url = "http://www.zshaolin.org";
          Intent i = new Intent(Intent.ACTION_VIEW);
          i.setData(Uri.parse(url));
          startActivity(i);
          
        }else if(zButton == findViewById(R.id.main_options)){
            //Show the Options..
            startActivity(new Intent(this, TerminalIDEPrefs.class));
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Log.v("ZShaolin","IntroScreen onConfigurationChanged!!!!");
    }
}




Java Source Code List

com.spartacusrex.spartacuside.EmulatorView.java
com.spartacusrex.spartacuside.Exec.java
com.spartacusrex.spartacuside.TermDebug.java
com.spartacusrex.spartacuside.TermPreferences.java
com.spartacusrex.spartacuside.TermService.java
com.spartacusrex.spartacuside.TermViewFlipper.java
com.spartacusrex.spartacuside.Term.java
com.spartacusrex.spartacuside.WindowList.java
com.spartacusrex.spartacuside.keyboard.CandidateView.java
com.spartacusrex.spartacuside.keyboard.KeyboardPrefs.java
com.spartacusrex.spartacuside.keyboard.KeyboardSwitcher.java
com.spartacusrex.spartacuside.keyboard.LatinKeyboardView.java
com.spartacusrex.spartacuside.keyboard.LatinKeyboard.java
com.spartacusrex.spartacuside.keyboard.MyKeyboardView.java
com.spartacusrex.spartacuside.keyboard.TerminalKeyboard.java
com.spartacusrex.spartacuside.model.Screen.java
com.spartacusrex.spartacuside.model.TextRenderer.java
com.spartacusrex.spartacuside.model.UpdateCallback.java
com.spartacusrex.spartacuside.session.TermSession.java
com.spartacusrex.spartacuside.session.TerminalEmulator.java
com.spartacusrex.spartacuside.session.TranscriptScreen.java
com.spartacusrex.spartacuside.util.ByteQueue.java
com.spartacusrex.spartacuside.util.ServiceForegroundCompat.java
com.spartacusrex.spartacuside.util.TermSettings.java
com.spartacusrex.spartacuside.util.dialogpref.java
com.spartacusrex.spartacuside.util.hardkeymappings.java
com.spartacusrex.spartacuside.util.keydata.java
com.spartacusrex.spartacuside.web.sockethandler.java
com.spartacusrex.spartacuside.web.webserver.java
org.dyne.zshaolin.Start.java
org.dyne.zshaolin.startup.TerminalIDEPrefs.java
org.dyne.zshaolin.startup.setup.assetextract.java
org.dyne.zshaolin.startup.setup.filemanager.java
org.dyne.zshaolin.startup.installer.java
org.dyne.zshaolin.startup.introscreen.java