Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    temperatureTextView = (TextView) findViewById(R.id.temperature_textview);
  }
Exemplo n.º 2
0
  @Override
  protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    // Trigger the initial hide() shortly after the activity has been
    // created, to briefly hint to the user that UI controls
    // are available.
    delayedHide(100);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    textView_ = (TextView) findViewById(R.id.TextView);
    seekBar_ = (SeekBar) findViewById(R.id.SeekBar);
    toggleButton_ = (ToggleButton) findViewById(R.id.ToggleButton);
    toggleButton2_ =
        (ToggleButton)
            findViewById(R.id.toggleButton2); // variable is instantiated with actual integer value
    // associated with toggle switch
    enableUi(false);
  }
Exemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_securo_bot_main);

    t1 = new TTSEngine(this);

    final View controlsView = findViewById(R.id.fullscreen_content_controls);
    // left
    leftEye = (ImageView) findViewById(R.id.leftEye);
    lEResource = R.drawable.blueeyesopenleft;
    leftEye.setImageResource(lEResource);
    // right
    rightEye = (ImageView) findViewById(R.id.rightEye);
    rEResource = R.drawable.blueeyesopenright;
    rightEye.setImageResource(rEResource);
    final View contentView = findViewById(R.id.eyes);

    // Set up an instance of SystemUiHider to control the system UI for
    // this activity.
    mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS);
    mSystemUiHider.setup();
    mSystemUiHider.setOnVisibilityChangeListener(
        new SystemUiHider.OnVisibilityChangeListener() {
          // Cached values.
          int mControlsHeight;
          int mShortAnimTime;

          @Override
          @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
          public void onVisibilityChange(boolean visible) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
              // If the ViewPropertyAnimator API is available
              // (Honeycomb MR2 and later), use it to animate the
              // in-layout UI controls at the bottom of the
              // screen.
              if (mControlsHeight == 0) {
                mControlsHeight = controlsView.getHeight();
              }
              if (mShortAnimTime == 0) {
                mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
              }
              controlsView
                  .animate()
                  .translationY(visible ? 0 : mControlsHeight)
                  .setDuration(mShortAnimTime);
            } else {
              // If the ViewPropertyAnimator APIs aren't
              // available, simply show or hide the in-layout UI
              // controls.
              controlsView.setVisibility(visible ? View.VISIBLE : View.GONE);
            }

            if (visible && AUTO_HIDE) {
              // Schedule a hide().
              delayedHide(AUTO_HIDE_DELAY_MILLIS);
            }
          }
        });

    // Set up the user interaction to manually show or hide the system UI.
    contentView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Log.d("TouchEvent", "Content view on click listener called");
            if (TOGGLE_ON_CLICK) {
              mSystemUiHider.toggle();
            } else {
              mSystemUiHider.show();
            }
          }
        });

    webPageView = (WebView) findViewById(R.id.webview);
    WebSettings webPageSettings = webPageView.getSettings();
    webPageSettings.setJavaScriptEnabled(true);
    webPageView.setVisibility(View.INVISIBLE);

    webPageView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            Log.d("Timer", "Webpage view touched");
            if (!actionEnable) { // reset the interaction timer if we are displaying stuff
              mHandler.removeCallbacks(interactionTimer);
              mHandler.removeCallbacks(timerInterrupt);
              interactionTimer.run();
              Log.d("Timer", "Touch sensed. Timer was reset.");
            }
            return false;
          }
        });

    action = new ActionEngine(t1);
    mHandler = new Handler();

    startRepeatingTask();
  }