Пример #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_server);

    // init
    sPref = PreferenceManager.getDefaultSharedPreferences(this);
    ipView = (TextView) findViewById(R.id.IPField);
    portView = (TextView) findViewById(R.id.portField);
    startStop = (ToggleButton) findViewById(R.id.start_stop);
    // initialise with the correct value first, so that a started server will definitely be killed
    // again
    startStop.setChecked(sPref.getBoolean("SERVER_STARTED", false));
    startStop.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              sPref.edit().putBoolean("SERVER_STARTED", true).commit();
              startServer();
            } else {
              stopServer();
              sPref.edit().putBoolean("SERVER_STARTED", false).commit();
            }
          }
        });

    address = getWiFiIP();
    ipView.setText(address.getHostAddress());
    portView.setText(String.valueOf(port));
  }
Пример #2
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.image);
   toggleButton = (ToggleButton) findViewById(R.id.toggleButton);
   imageView = (ImageView) findViewById(R.id.imageView);
   toggleButton.setOnCheckedChangeListener(this);
 }
Пример #3
0
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

      view = inflater.inflate(R.layout.explore, container, false);
      toggleButton = (ToggleButton) view.findViewById(R.id.toggleButton);
      gridView_episodes = (GridView) view.findViewById(R.id.gridView_episodes);
      gridView_shows = (GridView) view.findViewById(R.id.gridView_shows);

      toggleButton.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              if (isChecked) {
                toggleButton.setText("IsChecked == Episodes");
                gridView_episodes.setVisibility(View.VISIBLE);
                gridView_shows.setVisibility(View.GONE);
                gridView_episodes.bringToFront();
                // Toast.makeText(context, "IsChecked == Episodes",
                // Toast.LENGTH_LONG).show();
              } else {
                toggleButton.setText("IsChecked == Shows");
                gridView_episodes.setVisibility(View.GONE);
                gridView_shows.setVisibility(View.VISIBLE);
                gridView_shows.bringToFront();
                // Toast.makeText(context, "IsChecked == Shows",
                // Toast.LENGTH_LONG).show();
              }
            }
          });
      return view;
    }
Пример #4
0
  public ToggleMenuItem(
      Context context,
      String label,
      int imgRes,
      boolean isToggle,
      OnCheckedChangeListener listener) {
    super(context);

    View.inflate(context, R.layout.sw_menu_item_toggle, this);
    itemLabel = (TextView) findViewById(R.id.textLabel);
    itemIcon = (ImageView) findViewById(R.id.imageView);
    toggleButton = (ToggleButton) findViewById(R.id.toggleButton);

    if (imgRes != 0) {
      itemIcon.setImageResource(imgRes);
      itemIcon.setVisibility(VISIBLE);
    } else {
      itemIcon.setVisibility(GONE);
    }

    itemLabel.setText(label);

    toggleButton.setChecked(isToggle);
    toggleButton.setOnCheckedChangeListener(listener);
  }
Пример #5
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    addressField = (EditText) findViewById(addressText);
    portField = (EditText) findViewById(portText);
    intervalField = (EditText) findViewById(intervalText);

    addressField.setText(preferences.getString("address", null));
    portField.setText(Integer.toString(preferences.getInt("port", 8080)));
    intervalField.setText(Integer.toString(preferences.getInt("interval", 10)));

    startButton = (ToggleButton) findViewById(R.id.startButton);

    service = new Intent(this, LocationService.class);
    startButton.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {

              /*service.putExtra("address", addressField.getText().toString());
              service.putExtra("port", Integer.parseInt(portField.getText().toString()));
              service.putExtra("interval", Integer.parseInt(intervalField.getText().toString()));*/
              updatePreferences();

              System.out.println("Starting service act");
              startService(service);
            } else {
              stopService(service);
            }
          }
        });
  }
Пример #6
0
  public void addSegment(String title) {
    DisplayMetrics metrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);

    ToggleButton b = new ToggleButton(getContext());
    b.setText(title);
    b.setTextOff(title);
    b.setTextOn(title);
    b.setTextColor(Color.WHITE);
    b.setTypeface(Typeface.DEFAULT_BOLD);
    b.setMinimumWidth((int) (40 * metrics.density));
    if (mSwitches.size() == 0) {
      b.setBackgroundResource(mLeftDrawable);
      b.setEnabled(false);
      b.setChecked(true);
    } else {
      if (mSwitches.size() > 1) {
        ToggleButton temp = mSwitches.get(mSwitches.size() - 1);
        temp.setBackgroundResource(mMidDrawable);
      }

      b.setBackgroundResource(mRightDrawable);
    }

    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.weight = 0.1f;
    params.gravity = Gravity.CENTER;
    b.setLayoutParams(params);

    b.setOnCheckedChangeListener(this);

    mSwitches.add(b);
    addView(b);
  }
Пример #7
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ch0110_main);

    // ToggleButtonの切り替えを検出
    final ToggleButton tb = (ToggleButton) findViewById(R.id.ToggleButton);
    tb.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Toast.makeText(
                    Ch0110.this,
                    getString(R.string.ch0110_toggle_shift, isChecked),
                    Toast.LENGTH_SHORT)
                .show();
          }
        });

    // Switchの切り替えを検出
    final Switch sw = (Switch) findViewById(R.id.Switch);
    sw.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Toast.makeText(
                    Ch0110.this,
                    getString(R.string.ch0110_switch_shift, isChecked),
                    Toast.LENGTH_SHORT)
                .show();
          }
        });
  }
Пример #8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

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

    sptimer = (Spinner) findViewById(R.id.sptimer);
    sptimer.setOnItemSelectedListener(this);
    sptimer.setEnabled(false);

    btn_get_send_message = (Button) findViewById(R.id.btn_get_send_message);
    btn_get_send_message.setOnClickListener(this);
    btn_get_send_message.setEnabled(false);

    btn_start_stop = (ToggleButton) findViewById(R.id.btn_start_stop);
    btn_start_stop.setOnCheckedChangeListener(this);
    btn_start_stop.setEnabled(false);

    btn_update_credentials = (Button) findViewById(R.id.btn_update_credentials);
    btn_update_credentials.setOnClickListener(this);

    item = getResources().getStringArray(R.array.digit_array)[0];

    getSavedDeviceId();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    final SharedPreferences.Editor editor = prefs.edit();

    if (prefs.getBoolean(PREF_LANDSCAPE, false)) {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    ToggleButton toggleLandscape = (ToggleButton) findViewById(R.id.toggle_landscape_mode);
    toggleLandscape.setChecked(prefs.getBoolean(PREF_LANDSCAPE, false));
    toggleLandscape.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            editor.putBoolean(PREF_LANDSCAPE, isChecked);
            editor.apply();
          }
        });
    setResult(BACK_FROM_SETTINGS);
  }
Пример #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });

    ToggleButton toggle = (ToggleButton) findViewById(R.id.toggleButton);

    toggle.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              // 打开WIFI
            } else {
              // 关闭WIFI
            }
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ground_station_maps);

    SupportMapFragment mapFragment =
        (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

    mapFragment.getMapAsync(this);

    locate = (Button) findViewById(R.id.locate);
    add = (Button) findViewById(R.id.add);
    clear = (Button) findViewById(R.id.clear);
    config = (Button) findViewById(R.id.config);
    upload = (Button) findViewById(R.id.upload);
    start = (Button) findViewById(R.id.start);
    stop = (Button) findViewById(R.id.stop);
    tb = (ToggleButton) findViewById(R.id.tb);
    takeoff = (Button) findViewById(R.id.takeoff);

    locate.setOnClickListener(this);
    add.setOnClickListener(this);
    clear.setOnClickListener(this);
    config.setOnClickListener(this);
    upload.setOnClickListener(this);
    start.setOnClickListener(this);
    stop.setOnClickListener(this);
    takeoff.setOnClickListener(this);

    tb.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              // Use the satellite map
              aMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
            } else {
              // Use the normal map
              aMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            }
          }
        });

    DroneCode = 1; // Initiate Inspire 1's SDK in function onInitSDK
    mGroundStationTask = new DJIGroundStationTask(); // Initiate an object for GroundStationTask

    mTimer = new Timer();
    class Task extends TimerTask {
      // int times = 1;

      @Override
      public void run() {
        // Log.d(TAG ,"==========>Task Run In!");
        updateDroneLocation();
      }
    };
    mTask = new Task();
  }
Пример #12
0
 /**
  * Constructor for Toggle Button component when using the GLE.
  *
  * @param container
  * @param resourceId
  */
 public Toggle(ComponentContainer container, int resourceId) {
   super(container, resourceId);
   view = (ToggleButton) container.$context().findViewById(resourceId);
   if (view == null) {
     throw new IllegalArgumentException(
         "View with resource Id " + resourceId + " is coming up null!");
   }
   view.setOnCheckedChangeListener(this);
 }
Пример #13
0
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      //            TextView textView = new TextView(getActivity());
      //            textView.setGravity(Gravity.CENTER);
      //            Bundle args = getArguments();
      //            textView.setText(Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
      //            return textView;
      View v = null;
      int fragmentIndex = getArguments().getInt(ARG_SECTION_NUMBER);
      switch (fragmentIndex) {
        case 0:
          {
            v = inflater.inflate(R.layout.tab1, container, false);
            EditText edt = (EditText) v.findViewById(R.id.editText1);
          }
          break;

        case 1:
          {
            v = inflater.inflate(R.layout.tab2, container, false);
            final ProgressBar pgBar = (ProgressBar) v.findViewById(R.id.progressBar2);
            ToggleButton tgBtn = (ToggleButton) v.findViewById(R.id.toggleButton1);
            tgBtn.setOnCheckedChangeListener(
                new OnCheckedChangeListener() {

                  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    System.out.println("isChecked: " + isChecked);
                    if (isChecked) {
                      pgBar.setVisibility(View.VISIBLE);
                    } else {
                      pgBar.setVisibility(View.GONE);
                    }
                  }
                });
          }
          break;
        case 2:
          {
            v = inflater.inflate(R.layout.tab3, container, false);
            CheckBox chkBox = (CheckBox) v.findViewById(R.id.checkBox1);
            chkBox.setOnCheckedChangeListener(
                new OnCheckedChangeListener() {

                  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    System.out.println("isChecked: " + isChecked);
                  }
                });
          }
          break;

        default:
          break;
      }

      return v;
    }
Пример #14
0
 public void onUsbPortConnect() {
   startButton.setOnCheckedChangeListener(new StartButtonChangeEventListener());
   emergencyButton.setOnClickListener(new EmergencyButtonClickEventListener());
   engineFactorSeekBar.setOnSeekBarChangeListener(new EngineFactorSeekBarEventListener());
   // -------------------------------------------------------
   // Resources.setInfoFragmentUpdater(infoFragment);
   // OrientationJoyStickView joyButtonView = (OrientationJoyStickView)
   // findViewById(R.id.joyButton);
   // Resources.setJoyButtonView(joyButtonView);
 }
Пример #15
0
  @Override
  public void onContentChanged() {
    super.onContentChanged();
    setSlideRole(R.layout.layout_slidemenu_attribute);
    setSlideRole(R.layout.layout_primary_menu);
    setSlideRole(R.layout.layout_secondary_menu);
    mSlideMenu = getSlideMenu();

    mPrimaryShadowWidth = (SeekBar) findViewById(R.id.primaryShadowWidth);
    mSecondaryShadowWidth = (SeekBar) findViewById(R.id.secondaryShadowWidth);
    mSlideMode = (RadioGroup) findViewById(R.id.slideMode);
    mSlideLeft = (ToggleButton) findViewById(R.id.slideLeft);
    mSlideRight = (ToggleButton) findViewById(R.id.slideRight);

    mPrimaryShadowWidth.setOnSeekBarChangeListener(this);
    mSecondaryShadowWidth.setOnSeekBarChangeListener(this);
    mSlideMode.setOnCheckedChangeListener(this);
    mSlideLeft.setOnCheckedChangeListener(this);
    mSlideRight.setOnCheckedChangeListener(this);
  }
Пример #16
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   tgbButton = (ToggleButton) findViewById(R.id.toggleButton1);
   img = (ImageView) findViewById(R.id.imageView1);
   tgbButton.setOnCheckedChangeListener(this);
   linearLayout = (LinearLayout) findViewById(R.id.layout1);
   camera = Camera.open();
   camera.startPreview();
 }
 private void setupActionBar() {
   ActionBar ab = getSupportActionBar();
   ab.setDisplayHomeAsUpEnabled(true);
   ab.setDisplayShowCustomEnabled(true);
   ab.setDisplayShowHomeEnabled(true);
   ab.setDisplayShowTitleEnabled(true);
   View v = getLayoutInflater().inflate(R.layout.actionbar_change_pwd, null);
   ab.setCustomView(v);
   btnConfirm = (ToggleButton) v.findViewById(R.id.btn_on_confirm);
   btnConfirm.setOnCheckedChangeListener(this);
 }
Пример #18
0
  private void initDatas() {

    tb_dev_usb_control.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            tv_dev_usb_control.setText(isChecked ? R.string.usb_text_on : R.string.usb_text_off);
            ic_dev_usb_control.setImageResource(
                isChecked ? R.drawable.dev_usb_usbon : R.drawable.dev_usb_usboff);
            tv_dev_usb_control.setEnabled(isChecked);
            Toasts.showShort(DevUSBActivity.this, isChecked ? "开" : "关");
          }
        });
  }
  @Override
  public void onPause() {
    super.onPause();
    button.setOnCheckedChangeListener(null);
    equalizer_presets.setOnItemSelectedListener(null);
    preamp.setOnSeekBarChangeListener(null);
    bands_layout.removeAllViews();

    SharedPreferences preferences =
        PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
    SharedPreferences.Editor editor = preferences.edit();
    editor.putBoolean("equalizer_enabled", button.isChecked());
    Preferences.putFloatArray(editor, "equalizer_values", equalizer);
    editor.putInt("equalizer_preset", equalizer_presets.getSelectedItemPosition());
    editor.commit();
  }
Пример #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit_credential);

    toggleButton_pswd_prtcn = (ToggleButton) findViewById(R.id.toggleButton_arm);
    toggleButton_pswd_prtcn.setOnCheckedChangeListener(this);
    toggleButton_pswd_prtcn.setChecked(false);
    img_eye = (ImageView) findViewById(R.id.img_eye);
    img_eye.setImageLevel(0); // default
    img_eye.setOnClickListener(this);
    edt_password = (EditText) findViewById(R.id.edt_password);
    edt_password.setInputType(129); // default
    save_bar = (SaveBarView) findViewById(R.id.save_bar);
    save_bar.hideBin();
    save_bar.setQuickactionListener(this);
  }
Пример #21
0
  private void setListeners() {

    switch_markdown.setOnCheckedChangeListener(
        new ToggleListener(
            getActivity(), "use_markdown", switch_markdown, switch_markdown_button, null));

    View.OnClickListener clickToToggleListener =
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            switch_markdown.toggle();
          }
        };

    switch_markdown_button.setOnClickListener(clickToToggleListener);
    markdown_editor_setting.setOnClickListener(clickToToggleListener);
  }
Пример #22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(LAYOUT);

    sensorData = new SensorData();
    //        sensorData = (SensorData) Serialization.deserExternalData(Serialization.DATA_FILE);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    scanToggleButton = (ToggleButton) findViewById(R.id.scan_toggle_button);
    mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

    scanToggleButton.setBackgroundColor(Color.parseColor("#259C25"));
    scanToggleButton.setOnCheckedChangeListener(this);
    restartButton = (Button) findViewById(R.id.restart_button);
    restartButton.setOnClickListener(this);
  }
Пример #23
0
 private void initView() {
   findViewById(R.id.backLayout).setOnClickListener(this);
   findViewById(R.id.cet4Layout).setOnClickListener(this);
   findViewById(R.id.cet6Layout).setOnClickListener(this);
   // findViewById(R.id.masterLayout).setOnClickListener(this);
   findViewById(R.id.qqLayout).setOnClickListener(this);
   ToggleButton toggleButton = (ToggleButton) findViewById(R.id.screenLockTg);
   boolean isOpen =
       DataHelper.getBooleanFromSharedPreferences(getApplicationContext(), SCREENLOCKKEY);
   toggleButton.setChecked(isOpen);
   toggleButton.setOnCheckedChangeListener(
       new CompoundButton.OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
           DataHelper.putData2SharedPreferences(getApplicationContext(), SCREENLOCKKEY, isChecked);
         }
       });
 }
Пример #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    SharedPreferences settings = getSharedPreferences(MainMenuActivity.PREFERENCES_FILE, 0);
    String username = settings.getString(MainMenuActivity.USERNAME_FIELD, "Player");
    if (!username.equals("Player")) {
      settings = getSharedPreferences(MainMenuActivity.PREFERENCES_FILE + "_" + username, 0);
      username = settings.getString(MainMenuActivity.USERNAME_FIELD, "Player1");
    }
    int color = settings.getInt(MainMenuActivity.COLOR_FIELD, MainMenuActivity.COLOR_GREEN);
    currentColor = color;
    int difficulty =
        settings.getInt(MainMenuActivity.DIFFICULTY_FIELD, MainMenuActivity.DIFFICULTY_NORMAL);
    currentDifficulty = difficulty;
    ((EditText) findViewById(R.id.name_field)).setText(username);
    if (color == MainMenuActivity.COLOR_YELLOW) {
      ((ImageButton) findViewById(R.id.color_button))
          .setImageDrawable(getResources().getDrawable(R.drawable.yellowstar));
    } else if (color == MainMenuActivity.COLOR_RED) {
      ((ImageButton) findViewById(R.id.color_button))
          .setImageDrawable(getResources().getDrawable(R.drawable.redstar));
    } else {
      ((ImageButton) findViewById(R.id.color_button))
          .setImageDrawable(getResources().getDrawable(R.drawable.greenstar));
    }
    if (difficulty == MainMenuActivity.DIFFICULTY_EASY) {
      ((RadioGroup) findViewById(R.id.difficulty_buttons)).check(R.id.easy_button);
    } else if (difficulty == MainMenuActivity.DIFFICULTY_HARD) {
      ((RadioGroup) findViewById(R.id.difficulty_buttons)).check(R.id.hard_button);
    } else {
      ((RadioGroup) findViewById(R.id.difficulty_buttons)).check(R.id.medium_button);
    }

    ((RadioGroup) findViewById(R.id.difficulty_buttons)).setOnCheckedChangeListener(this);

    ((ImageButton) findViewById(R.id.color_button)).setOnClickListener(this);

    tButton = (ToggleButton) findViewById(R.id.music_toggle);
    if (!isMyServiceRunning()) {
      tButton.setChecked(true);
    }
    tButton.setOnCheckedChangeListener(this);
  }
Пример #25
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu_view);
    boolean alarm = PropertyManager.getInstance().getIsAlram();

    streambtn = (Button) findViewById(R.id.streambtn);
    storagebtn = (Button) findViewById(R.id.storagebtn);
    alarmbtn = (ToggleButton) findViewById(R.id.alrambtn);

    streambtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(MenuActivity.this, WebViewActivity.class);
            startActivity(intent);
          }
        });

    storagebtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(MenuActivity.this, LogListActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
          }
        });

    alarmbtn.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // �븣�엺 �꽭�똿 媛� 蹂�寃�
            PropertyManager.getInstance().setIsAlram(isChecked);
          }
        });
    alarmbtn.setChecked(alarm);
  }
Пример #26
0
  /**
   * 显示追加投注
   *
   * @param view
   */
  private void initZhuiJia() {
    LinearLayout toggleLinear = (LinearLayout) findViewById(R.id.buy_zixuan_linear_toggle);
    toggleLinear.setVisibility(LinearLayout.VISIBLE);
    ToggleButton zhuijiatouzhu = (ToggleButton) findViewById(R.id.dlt_zhuijia);
    zhuijiatouzhu.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            if (isChecked) {
              betAndGift.setAmt(3);
              betAndGift.setIssuper("0");
            } else {
              betAndGift.setIssuper("");
              betAndGift.setAmt(2);
            }
            addviewmiss.setCodeAmt(betAndGift.getAmt());
            getTouzhuAlert();
          }
        });
  }
Пример #27
0
  public UISwitcher() {
    ToggleButton btn = new ToggleButton(context);
    btn.setTextColor(Color.TRANSPARENT);
    btn.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            UISwitcher.this.setOn(isChecked, YES);
          }
        });
    this.setSwitcher(btn);
    btn.setFocusable(NO);
    this.setView(btn);
    this.setFrame(CGRectMake(0, 0, 0, 0));

    onImage = new UIImage(R.drawable.zz_c4a_switcher_on);
    offImage = new UIImage(R.drawable.zz_c4a_switcher_off);
    this.setOn(YES, YES);
  }
Пример #28
0
 private void registerEventMonitor() {
   mSampleMode.setOnItemSelectedListener(new customSpinnerListener());
   mFilterSelecter.setOnItemSelectedListener(new customSpinnerListener());
   mMoveFollow.setOnCheckedChangeListener(new customToggleButtonListener());
   mVideoPlay.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
           intent.setType("video/*");
           intent.addCategory(Intent.CATEGORY_OPENABLE);
           try {
             getActivity()
                 .startActivityForResult(Intent.createChooser(intent, null), VIDEO_REQUEST_CODE);
           } catch (android.content.ActivityNotFoundException ex) {
             Toast.makeText(getActivity(), "请安装文件管理器", Toast.LENGTH_SHORT).show();
           }
         }
       });
 }
  /** Inits the events. */
  private void initEvents() {
    btnRetry.setOnClickListener(this);
    btnOK.setOnClickListener(this);
    btnNext.setOnClickListener(this);
    ivBack.setOnClickListener(this);
    tbPswFlag.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              etInputPsw.setInputType(
                  InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            } else {
              etInputPsw.setInputType(
                  InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            }
          }
        });
  }
Пример #30
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState); // 继承父类方法
    setContentView(R.layout.textureball_layout); // 设置布局文件
    mSurfaceView = new MyGLSurfaceView(this); // 创建MySurfaceView对象
    mSurfaceView.requestFocus(); // 获取焦点
    mSurfaceView.setFocusableInTouchMode(true); // 设置为可触控
    LinearLayout ll = (LinearLayout) this.findViewById(R.id.lla); // 获得线性布局的引用
    ll.addView(mSurfaceView); //
    ToggleButton tb = (ToggleButton) this.findViewById(R.id.ToggleButton01); // 获得按钮引用
    tb.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mSurfaceView.setSmoothFlag(!mSurfaceView.isSmoothFlag());
            mSurfaceView.requestRender();
          }
        }); // 为按钮设置监听器
  }