/**
   * Instantiates a new SuperCardToast with a type. <br>
   *
   * @param context should be Activity
   * @param type choose from SuperToast.Type <br>
   */
  public SuperCardToast(Context context, Type type) {

    if (context instanceof Activity) {

      this.mContext = context;

      final Activity activity = (Activity) context;

      mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      this.mType = type;

      if (activity.findViewById(R.id.card_container) != null) {

        mViewGroup = (LinearLayout) activity.findViewById(R.id.card_container);

        if (type == Type.BUTTON) {

          mToastView = mLayoutInflater.inflate(R.layout.supercardtoast_button, mViewGroup, false);

          mToastButton = (Button) mToastView.findViewById(R.id.button);

          mDividerView = mToastView.findViewById(R.id.divider);

          mToastButton.setOnTouchListener(mTouchDismissListener);

        } else if (type == Type.PROGRESS) {

          mToastView =
              mLayoutInflater.inflate(R.layout.supercardtoast_progresscircle, mViewGroup, false);

          mProgressBar = (ProgressBar) mToastView.findViewById(R.id.progressBar);

        } else if (type == Type.PROGRESS_HORIZONTAL) {

          mToastView =
              mLayoutInflater.inflate(
                  R.layout.supercardtoast_progresshorizontal, mViewGroup, false);

          mProgressBar = (ProgressBar) mToastView.findViewById(R.id.progressBar);

        } else {

          mToastView = mLayoutInflater.inflate(R.layout.supercardtoast, mViewGroup, false);
        }

        mMessageTextView = (TextView) mToastView.findViewById(R.id.message_textView);

        mRootLayout = (LinearLayout) mToastView.findViewById(R.id.root_layout);

      } else {

        throw new IllegalArgumentException(TAG + ERROR_CONTAINERNULL);
      }

    } else {

      throw new IllegalArgumentException(TAG + ERROR_CONTEXTNOTACTIVITY);
    }
  }
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_no_internet);
    Log.d(TAG, "onCreate");

    // set notification bar color in lollipop and above version
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) {
      Window window = InternetConnectionActivity.this.getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.setStatusBarColor(getResources().getColor(R.color.notification_baf_color));
    }
    // get view of this screen.
    mOk = (Button) findViewById(R.id.btnInternetOk);
    mTryAgain = (Button) findViewById(R.id.btnInternetTryAgain);
    TextView txt1 = (TextView) findViewById(R.id.txtInternet1);
    TextView txt2 = (TextView) findViewById(R.id.txtInternet2);
    // set custom font on all view.
    mOk.setTypeface(Constant.getFontSemiBold(this));
    mTryAgain.setTypeface(Constant.getFontSemiBold(this));
    txt1.setTypeface(Constant.getFontSemiBold(this));
    txt2.setTypeface(Constant.getFontNormal(this));
    // set listener to button
    mOk.setOnClickListener(this);
    mOk.setOnTouchListener(this);
    mTryAgain.setOnClickListener(this);
    mTryAgain.setOnTouchListener(this);
  }
Example #3
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

    mv = new MjpegView(this);
    setContentView(R.layout.stream);
    mv = (MjpegView) findViewById(R.id.mv);
    String URL = "http://" + Constants.IP_ADDRESS + ":8080/?action=stream";
    new DoRead().execute(URL);
    // mv.setSource(MjpegInputStream.read(URL));
    // mv.setDisplayMode(MjpegView.SIZE_FULLSCREEN);
    // mv.showFps(true);

    buttonUP = (Button) findViewById(R.id.buttonUP);
    buttonDOWN = (Button) findViewById(R.id.buttonDOWN);
    buttonRIGHT = (Button) findViewById(R.id.buttonRIGHT);
    buttonLEFT = (Button) findViewById(R.id.buttonLEFT);
    screenshot = (Button) findViewById(R.id.screenshot);
    window = (TextView) findViewById(R.id.textView);

    buttonUP.setOnTouchListener(this);
    buttonDOWN.setOnTouchListener(this);
    buttonRIGHT.setOnTouchListener(this);
    buttonLEFT.setOnTouchListener(this);
    screenshot.setOnTouchListener(this);

    OpenSocket();
  }
Example #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    editTextIPAddress = (EditText) this.findViewById(R.id.editTextIPAddress);
    editTextIPAddress.setText(server);
    imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    textViewStatus = (TextView) this.findViewById(R.id.textViewStatus);
    textViewStatus.setText("TeleOp Client");

    logger = new logger(textViewStatus);

    buttonConnect = (Button) this.findViewById(R.id.buttonConnect);
    buttonClose = (Button) this.findViewById(R.id.buttonClose);
    buttonUp = (Button) this.findViewById(R.id.buttonUp);
    buttonLeftTurn = (Button) this.findViewById(R.id.buttonLeftTurn);
    buttonRightTurn = (Button) this.findViewById(R.id.buttonRightTurn);
    buttonDown = (Button) this.findViewById(R.id.buttonDown);
    buttonStop = (Button) this.findViewById(R.id.buttonStop);

    buttonConnect.setOnClickListener(this);
    buttonClose.setOnClickListener(this);

    buttonUp.setOnTouchListener(this);
    buttonLeftTurn.setOnTouchListener(this);
    buttonRightTurn.setOnTouchListener(this);
    buttonDown.setOnTouchListener(this);

    buttonStop.setOnClickListener(this);
  }
  public void setButtonClick() {

    patientBtn.setOnTouchListener(mTouchListener);
    controlBtn.setOnTouchListener(mTouchListener);
    backIcon.setOnTouchListener(mTouchListener);
    if (HomeActivity.ANALYZER_SW == HomeActivity.DEVEL)
      snapshotBtn.setOnTouchListener(mTouchListener);
  }
Example #6
0
 // Method to (de)activate the Listener for all Buttons
 public void toggleButtonListener(boolean active) {
   if (active) {
     for (Button b : buttonList) {
       b.setOnTouchListener(cTL);
     }
   } else {
     for (Button b : buttonList) {
       b.setOnTouchListener(null);
     }
   }
 }
Example #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainslide);

    // Tham chieu den cac view tuong unng
    btn_lesson = (Button) findViewById(R.id.lesson_ho);
    btn_word_list = (Button) findViewById(R.id.word_list_ho);
    viewFlipper = (ViewFlipper) findViewById(R.id.vfMainFliper1);
    edit_ho = (ImageView) findViewById(R.id.edit_ho);
    previous_up = (Button) findViewById(R.id.previous_up);
    fullname = (TextView) findViewById(R.id.full_name_ho);
    email = (TextView) findViewById(R.id.email_ho);
    learned_ho = (TextView) findViewById(R.id.learned_ho);
    list = (ListView) findViewById(R.id.list_le);
    tt_home = (TextView) findViewById(R.id.tt_home_tt);

    // Set du lieu
    fullname.setText(User.fullname);
    email.setText(User.email);

    tt_home.setTypeface(MainActivity.tf5);
    email.setTypeface(MainActivity.tf6);
    fullname.setTypeface(MainActivity.tf6);
    learned_ho.setTypeface(MainActivity.tf6);

    Lesson.data = new ArrayList<Lesson>();
    adapter = new LessonAdapter(Lesson.data, this);
    list.setAdapter(adapter);

    // Load file Animation
    Lesson a = new Lesson();
    Lesson.go_next_in = AnimationUtils.loadAnimation(this, R.anim.go_next_in);
    Lesson.go_next_out = AnimationUtils.loadAnimation(this, R.anim.go_next_out);
    Lesson.go_prev_in = AnimationUtils.loadAnimation(this, R.anim.go_prev_in);
    Lesson.go_prev_out = AnimationUtils.loadAnimation(this, R.anim.go_prev_out);

    // Set su kien cho cac view
    btn_lesson.setOnTouchListener(onRedBtnLessonClickListener());
    btn_lesson.setOnClickListener(goCategory());
    edit_ho.setOnClickListener(goUpdateProfiles());
    previous_up.setOnClickListener(backHome());
    btn_word_list.setOnTouchListener(onRedBtnLessonClickListener());
    btn_word_list.setOnClickListener(goWordList());
    list.setOnItemClickListener(itemClick());
    btn_word_list.setOnClickListener(goWordList());

    // Load lesson
    new LoadLesson().execute(Category.functions);
  }
  public static Dialog dlg_template_okCancel(
      Activity actv,
      int layoutId,
      int titleStringId,
      int okButtonId,
      int cancelButtonId,
      DialogButtonTags okTag,
      DialogButtonTags cancelTag) {
    /*----------------------------
    * Steps
    * 1. Set up
    * 2. Add listeners => OnTouch
    * 3. Add listeners => OnClick
    ----------------------------*/

    //
    Dialog dlg = new Dialog(actv);

    //
    dlg.setContentView(layoutId);

    // Title
    dlg.setTitle(titleStringId);

    /*----------------------------
    * 2. Add listeners => OnTouch
    ----------------------------*/
    //
    Button btn_ok = (Button) dlg.findViewById(okButtonId);
    Button btn_cancel = (Button) dlg.findViewById(cancelButtonId);

    //
    btn_ok.setTag(okTag);
    btn_cancel.setTag(cancelTag);

    //
    btn_ok.setOnTouchListener(new DialogButtonOnTouchListener(actv, dlg));
    btn_cancel.setOnTouchListener(new DialogButtonOnTouchListener(actv, dlg));

    /*----------------------------
    * 3. Add listeners => OnClick
    ----------------------------*/
    //
    btn_ok.setOnClickListener(new DialogButtonOnClickListener(actv, dlg));
    btn_cancel.setOnClickListener(new DialogButtonOnClickListener(actv, dlg));

    //
    // dlg.show();

    return dlg;
  } // public static Dialog dlg_template_okCancel()
Example #9
0
  @Override
  public void onViewReady(View view, Bundle savedInstanceState, Reason reason) {
    super.onViewReady(view, savedInstanceState, reason);
    ButterKnife.bind(this, view);
    increment.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                startContinuousIncrement();
                break;
              case MotionEvent.ACTION_UP:
              case MotionEvent.ACTION_CANCEL:
                stopContinuousIncrement();
                break;
            }
            return false;
          }
        });

    decrement.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                startContinuousIncrement();
                break;
              case MotionEvent.ACTION_UP:
              case MotionEvent.ACTION_CANCEL:
                stopContinuousIncrement();
                break;
            }
            return false;
          }
        });

    autoIncrement.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            //                    Intent intent = new Intent(getActivity(),Count)
          }
        });

    updateCountDisplay(counterController.getModel().getCount());
  }
 private static void showTip(
     Activity activity,
     String tip,
     View.OnClickListener secondButtonListener,
     String secondButtonTitle) {
   tipTextView.setText(tip);
   final Crouton crouton = Crouton.make(activity, tipView);
   crouton.setConfiguration(CONFIGURATION_INFINITE);
   crouton.show();
   tipButton.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           crouton.hide();
         }
       });
   if (secondButtonListener != null) {
     tipAlternativeButton.setVisibility(View.VISIBLE);
     tipAlternativeButton.setOnClickListener(secondButtonListener);
     tipAlternativeButton.setText(secondButtonTitle);
     tipAlternativeButton.setOnTouchListener(
         new View.OnTouchListener() {
           @Override
           public boolean onTouch(View v, MotionEvent event) {
             crouton.hide();
             return false;
           }
         });
   } else {
     tipAlternativeButton.setVisibility(View.GONE);
   }
 }
Example #11
0
  /**
   * Creates a new ButtonBase component.
   *
   * @param container container, component will be placed in
   */
  public ButtonBase(ComponentContainer container) {
    super(container);
    view = new android.widget.Button(container.$context());

    // Save the default values in case the user wants them back later.
    defaultButtonDrawable = view.getBackground();
    defaultColorStateList = view.getTextColors();

    // Adds the component to its designated container
    container.$add(this);

    // Listen to clicks and focus changes
    view.setOnClickListener(this);
    view.setOnFocusChangeListener(this);
    view.setOnLongClickListener(this);
    view.setOnTouchListener(this);

    // Default property values
    TextAlignment(Component.ALIGNMENT_CENTER);
    // BackgroundColor and Image are dangerous properties:
    // Once either of them is set, the 3D bevel effect for the button is
    // irretrievable, except by reloading defaultButtonDrawable, defined above.
    BackgroundColor(Component.COLOR_DEFAULT);
    Image("");
    Enabled(true);
    fontTypeface = Component.TYPEFACE_DEFAULT;
    TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
    FontSize(Component.FONT_DEFAULT_SIZE);
    Text("");
    TextColor(Component.COLOR_DEFAULT);
    Shape(Component.BUTTON_SHAPE_DEFAULT);
  }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    levelText = (TextView) findViewById(R.id.levelText);

    b1 = (ImageButton) findViewById(R.id.b1);
    b2 = (ImageButton) findViewById(R.id.b2);
    b3 = (ImageButton) findViewById(R.id.b3);
    b4 = (ImageButton) findViewById(R.id.b4);
    startButton = (Button) findViewById(R.id.startButton);

    b1.setOnTouchListener(this);
    b2.setOnTouchListener(this);
    b3.setOnTouchListener(this);
    b4.setOnTouchListener(this);
    startButton.setOnTouchListener(this);

    buttonPlayer = new FXPlayer();

    flashButton = AnimationUtils.loadAnimation(this, R.anim.bflash);

    topTen = new TopScores();
    // String[][] winners = topTen.updatedWinners();

    String fontPath = "fonts/spincycle_ot.ttf";
    Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
    levelText.setTypeface(tf);
    startButton.setTypeface(tf);

    game = new GamePlay();
    updateLevel();
  }
  public void initializeButtons() {
    time_remaining = (TextView) findViewById(R.id.time_remaining);
    clicks = (TextView) findViewById(R.id.clicks);

    button_click_fast = (Button) findViewById(R.id.button_click_fast);
    button_click_fast.setOnTouchListener(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, ToneGenerator.MAX_VOLUME);

    btn = (Button) findViewById(R.id.button);
    btn.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            switch (event.getAction()) {
                // Wenn Button gedrückt
              case MotionEvent.ACTION_DOWN:
                {
                  toneGenerator.startTone(ToneGenerator.TONE_DTMF_D);

                  break;
                }

                // Wenn Button losgelassen
              case MotionEvent.ACTION_UP:
                {
                  toneGenerator.stopTone();

                  break;
                }
            }

            return false;
          }
        });
  }
Example #15
0
  @Override
  protected final void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MainActivityMenu menuView = new MainActivityMenu(this);
    layout_ = menuView.getLayout();

    name_ = (EditText) layout_.findViewById(R.id.name);
    name_.addTextChangedListener(new NameListener(this));

    text_ = (TextView) layout_.findViewById(R.id.text);
    text_.setText("");

    menuButton_ = (ToggleButton) layout_.findViewById(R.id.menuButton);
    menuButton_.setChecked(true);
    menuButton_.setOnClickListener(new MenuButtonListener(layout_, menuButton_));

    validButton_ = (Button) layout_.findViewById(R.id.nameButton);

    // Add an animation on start up
    Animation animation =
        AnimationUtils.loadAnimation(getApplicationContext(), R.anim.view_animation);
    validButton_.startAnimation(animation);

    // Add touch listener
    validButton_.setOnTouchListener(new ValidButtonListener(text_, name_, validButton_));

    // Set keyboard hidden by default
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    // Set theme according to preferences
    setTheme();

    setContentView(layout_);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hi_scores);

    Bundle extras = getIntent().getExtras();
    totalScore = (Score) extras.getSerializable("totalScore");

    initTextFields();
    dbhelper = new DBHelper(this);

    // Check if score is high score
    List<Score> scores_list = getScores();
    checkPlayerScore(scores_list);

    // Update score list again in case. Write scores to the screen.
    List<Score> updated = getScores();
    writeScores(updated);

    Button back_button = (Button) findViewById(R.id.back_button);
    back_button.setOnTouchListener(
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent event) {
            Intent intent = new Intent(v.getContext(), TitleActivity.class);
            startActivity(intent);
            return false;
          }
        });
  }
Example #17
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.activity_question1, container, false);
    e1 = (EditText) rootView.findViewById(R.id.q1);

    //        String a = e1.getText().toString().trim();
    b1 = (Button) rootView.findViewById(R.id.button2);

    //        b1.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                q1 = e1.getText().toString().trim();
    //
    //
    //            }
    //        });
    b1.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            q1 = e1.getText().toString().trim();
            return false;
          }
        });

    return rootView;
  }
Example #18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);

    layout = (RelativeLayout) findViewById(R.id.layout_home);

    helloSound = MediaPlayer.create(getApplicationContext(), R.raw.hello);
    helloSound.setOnCompletionListener(soundCompletionListener);

    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift1, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift2, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift3, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift4, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift5, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift6, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift7, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift8, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift9, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift10, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift11, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift12, 1));
    soundIdList.add(soundPool.load(getApplicationContext(), R.raw.lift13, 1));

    Button btnSingleLift = (Button) this.findViewById(R.id.btn_single_lift);
    btnSingleLift.setOnTouchListener(singleLiftTouchListener);
  }
Example #19
0
 /**
  * 初始化语音布局 @Title: initVoiceView
  *
  * @param
  * @return void
  * @throws
  */
 private void initVoiceView() {
   layout_record = (RelativeLayout) findViewById(R.id.layout_record);
   tv_voice_tips = (TextView) findViewById(R.id.tv_voice_tips);
   iv_record = (ImageView) findViewById(R.id.iv_record);
   btn_speak.setOnTouchListener(new VoiceTouchListen());
   initVoiceAnimRes();
   initRecordManager();
 }
Example #20
0
  private void initializeReference() {
    repeatUpdateHandler = new Handler();
    plusButton = (Button) (myPickerView.findViewById(R.id.picker_plus));
    plusButton.setOnClickListener(this);
    plusButton.setOnLongClickListener(this);
    plusButton.setOnTouchListener(this);
    displayEditText = (EditText) (myPickerView.findViewById(R.id.picker_display));
    minusButton = (Button) (myPickerView.findViewById(R.id.picker_minus));
    minusButton.setOnClickListener(this);
    minusButton.setOnLongClickListener(this);
    minusButton.setOnTouchListener(this);

    if (visibility == VISIBILITY_GONE) {
      displayEditText.setVisibility(View.GONE);
    }

    initData();
  }
 private void enablePostButton(boolean enabled) {
   postButton.setEnabled(enabled);
   if (enabled) {
     postButton.setOnClickListener(new PostListener());
   } else {
     postButton.setOnTouchListener(null);
     postButton.setOnClickListener(null);
   }
   updatePostButtonText();
 }
  private void setItemEventOnCreate() {
    bRadio.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (sOnPauseRadio == false) {
              player = new MediaPlayer();
              setRadioPath("radio", "rtsp://real3.atimemedia.com/live/chill.sdp");
              sOnPauseRadio = true;
              if (vPlay.isPlaying() == true) {
                vPlay.stopPlayback();
                sOnPauseWebcam = true;
              }
              tRadioStatus.setText("Radio : Active");
            } else {
              player.release();
              tRadioStatus.setText("Radio : InActive");
            }
            return false;
          }
        });
    bWebcam.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (sOnPauseWebcam == false) {
              setRadioPath("webcam", "rtsp://real3.atimemedia.com/live/green_256.sdp");
              sOnPauseWebcam = true;
              if (player.isPlaying() == true) {
                player.release();
                sOnPauseRadio = true;
              }
              tRadioStatus.setText("Webcam : Active");
            } else {
              vPlay.stopPlayback();
              tRadioStatus.setText("Webcam : InActive");
            }
            return false;
          }
        });
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    global_app = (SupervisorApplication) getApplication();
    decimalFormat = new DecimalFormat("#.########");

    setContentView(R.layout.layout_default_map);
    searchButton = (Button) findViewById(R.id.search);
    searchButton.setOnClickListener(this);
    searchButton.setOnTouchListener(this);
    logo = (Button) findViewById(R.id.logo);
    logo.setOnClickListener(this);
    logo.setOnTouchListener(this);

    lastLocation = global_app.getLastLocation();
    // Log.d(TAG, "lastLocation: LAT: " + Double.toString(lastLocation.getLatitude()) + " LON: " +
    // Double.toString(lastLocation.getLongitude()));

    userMarker = getResources().getDrawable(R.drawable.me);
    currentMarker = getResources().getDrawable(R.drawable.current_marker);
    pendingMarker = getResources().getDrawable(R.drawable.pending_marker);
    doneMarker = getResources().getDrawable(R.drawable.done_marker);
    cancelMarker = getResources().getDrawable(R.drawable.cancel_marker);

    try {
      taskId = getIntent().getExtras().getLong("taskId");
      Log.d(TAG + "task id", Long.toString(taskId));
      animateToTaskPosition = true;
    } catch (NullPointerException e) {
      animateToTaskPosition = false;
    }

    mapView = (MapView) findViewById(R.id.map);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(false);

    mapController = mapView.getController();
    mapController.setZoom(16);

    receiver = new TaskUpdateReceiver();
    filter = new IntentFilter(SupervisorApplication.UPDATE_VIEW_INTENT);
    registerReceiver(receiver, filter);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(
        null); // DO NOT LOAD savedInstanceState since onSaveInstanceState(Bundle) is not overridden
    Timber.d("Creating TestActivity");

    developerOptionsActivity = this;

    setContentView(R.layout.test_layout);

    addWifiNetworksBtn = (Button) findViewById(R.id.add_wifi_networks);
    addWifiNetworksBtn.setOnTouchListener(
        new View.OnTouchListener() {

          private Date touchEventStarted;
          private Toast toast;
          private Context context;
          private Boolean touching;
          public AsyncToast asyncToast;

          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            Timber.d("Touch Event: " + String.valueOf(motionEvent.getActionMasked()));
            context = view.getContext();

            if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) {
              // Start touch
              touchEventStarted = new Date();
              touching = true;

              asyncToast = new AsyncToast(developerOptionsActivity, touchEventStarted);
              asyncToast.execute();
            } else if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP
                || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) {
              // End touch
              if (touchEventStarted != null) {
                Date touchEventEnd = new Date();
                Long diff = touchEventEnd.getTime() - touchEventStarted.getTime();
                int numWifis = (int) ((diff / 100) % 200) + 1;
                addWifiNetworks(view, numWifis);

                touching = false;
                asyncToast.stop();
                asyncToast.cancel(true);
              }
            }

            return true;
          }
        });

    testLogScroll = (ScrollView) findViewById(R.id.test_log);
    testDBContainer = (LinearLayout) findViewById(R.id.testDBContainer);
  }
Example #25
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);

    btnStart = (Button) this.findViewById(R.id.btnNew);
    btnStart.setOnClickListener(this);
    btnStart.setOnTouchListener(this);

    btnResume = (Button) this.findViewById(R.id.btnResume);
    btnResume.setOnClickListener(this);
    btnResume.setOnTouchListener(this);

    btnExit = (Button) this.findViewById(R.id.btnExit);
    btnExit.setOnClickListener(this);
    btnExit.setOnTouchListener(this);
  }
  public void initialLabels(String t) {
    taskState = (Button) findViewById(R.id.taskButton);
    taskState.setText("Go Back and check later!");
    taskState.setOnClickListener(this);
    taskState.setOnTouchListener(btnTouchState);

    taskName = (TextView) findViewById(R.id.taskName);
    taskName.setText(t);

    taskStatus = (TextView) findViewById(R.id.taskStatus);
    taskStatus.setText(taskStatusText);
  }
Example #27
0
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.dialog_sleep);
    del = (Button) findViewById(R.id.dialog_button_delete);
    del.setOnClickListener(this);
    del.setOnTouchListener(this);
    ok = (Button) findViewById(R.id.dialog_button_ok);
    ok.setOnClickListener(this);
    ok.setOnTouchListener(this);
    cancel = (Button) findViewById(R.id.dialog_button_cancel);
    cancel.setOnClickListener(this);
    cancel.setOnTouchListener(this);
    String[] arrayStr = new String[121];

    adapter1 = new ArrayAdapter(getContext(), R.layout.dialog_sleep_item, arrayStr);
    galleryViewHours = (MyGalleryView) findViewById(R.id.passw_1);
    galleryViewHours.setAdapter(adapter1);
    galleryViewHours.setOnItemSelectedListener(this);
    galleryViewHours.setItemTextColor(0xff000000, Color.parseColor("#ff0000"));
    galleryViewHours.setSpacing(16);

    // TODO
    /*do
    {
        if (i >= arrayStr.length)
        {
            if (cruTime > 0)
            {
                i = cruTime;
            } else
            {
                i = 30;
            }
            galleryViewHours.setSelection(i);
            return;
        }
        arrayStr[i] = (new StringBuilder(String.valueOf(i))).toString();
        i++;
    } while (true);*/
  }
Example #28
0
  // Helper function for connectToActivity
  protected void setupButton(int id) {
    Button but = (Button) parentActivity.findViewById(id);
    buttons.add(but);
    but.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent me) {
            if (me.getAction() == MotionEvent.ACTION_UP) pressButtonById(v.getId(), true);

            return true;
          }
        });
  }
Example #29
0
 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   this.rec = new RecognizerTask(getApplicationContext());
   this.rec_thread = new Thread(this.rec);
   this.listening = false;
   Button b = (Button) findViewById(R.id.Button01);
   b.setOnTouchListener(this);
   this.performance_text = (TextView) findViewById(R.id.PerformanceText);
   this.edit_text = (EditText) findViewById(R.id.EditText01);
   this.rec.setRecognitionListener(this);
   this.rec_thread.start();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gl_interaction);

    mView = (GLSurfaceViewInteraction) findViewById(R.id.opengl_view);

    Button btnUp = (Button) findViewById(R.id.btn_up);
    btnUp.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            mView.queueEvent(mUpRunnable);
          }
        });

    Button btnLeft = (Button) findViewById(R.id.btn_left);
    btnLeft.setOnTouchListener(new TouchHandler(mStartLeftRunnable, mStopLeftRunnable));

    Button btnRight = (Button) findViewById(R.id.btn_right);
    btnRight.setOnTouchListener(new TouchHandler(mStartRightRunnable, mStopRightRunnable));

    Button btnDown = (Button) findViewById(R.id.btn_down);
    btnDown.setOnTouchListener(new TouchHandler(mStartDownRunnable, mStopDownRunnable));
  }