Exemplo n.º 1
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();
  }
Exemplo n.º 2
0
 void updateFormatBarEnabledState(boolean enabled) {
   float alpha = (enabled ? TOOLBAR_ALPHA_ENABLED : TOOLBAR_ALPHA_DISABLED);
   for (ToggleButton button : mTagToggleButtonMap.values()) {
     button.setEnabled(enabled);
     button.setAlpha(alpha);
   }
 }
Exemplo n.º 3
0
  private void setToggles() {
    recentToggle.setChecked(false);
    nameToggle.setChecked(false);
    keywordsToggle.setChecked(false);
    descToggle.setChecked(false);
    interestsToggle.setChecked(false);

    switch (activeToggle) {
      case 0:
        recentToggle.setChecked(true);
        break;
      case 1:
        nameToggle.setChecked(true);
        break;
      case 2:
        keywordsToggle.setChecked(true);
        break;
      case 3:
        descToggle.setChecked(true);
        break;
      case 4:
        interestsToggle.setChecked(true);
        break;
      default:
        throw new RuntimeException("Invalid Toggle State: " + activeToggle);
    }
  }
Exemplo n.º 4
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();
          }
        });
  }
        public void handleMessage(android.os.Message msg) {
          if (msg.what == EVENT_UPDATE_ARM_STATE) {
            if (mArmStateQueue.size() > 0) {
              mCurrentArmState = mArmStateQueue.remove();
            } else {
              ToggleButton autoModeToggle = (ToggleButton) findViewById(R.id.autoModeToggle);
              // 自動モードならサーチを試みる
              if (autoModeToggle.isChecked() && startAutoGrabAction()) {
                // OK
              }
              // 単に待つ
              else {
                mCurrentArmState = mWaitingArmState;
              }
            }
            if (mCurrentArmState.armStateType == ArmStateType.READY_TO_AUTO_MODE) {
              if (mObjectBundle.detected) {
                float distance =
                    CtkMath.distance(mCurrentArmState.exPosition, mObjectBundle.position);
                // オブジェクトが動いてないなら掴みにかかる
                if (distance <= AUTO_MODE_DIFF) {
                  startGrabAction(false);
                }
              }
            }

            TextView armStateText = (TextView) findViewById(R.id.armStateText);
            armStateText.setText(mCurrentArmState.armStateType.name());
            this.sendEmptyMessageDelayed(EVENT_UPDATE_ARM_STATE, mCurrentArmState.time);

            sendValues(mCurrentArmState.armAngles);
          }
        };
Exemplo n.º 6
0
  private void MVC_view_handler(String cmd) {
    try {
      int mapValue;
      switch (cmd) {
        case "FOLL":
          mapValue = appData.get("FOLL");
          if (mapValue == MOVE_FOLLOW_OFF) mMoveFollow.setChecked(false);
          else if (mapValue == MOVE_FOLLOW_ON) mMoveFollow.setChecked(true);
          break;

        case "SMOD":
          MainActivity.setSpinnerSelect(mSampleMode, appData.get("SMOD"));
          break;

        case "FILT":
          MainActivity.setSpinnerSelect(mFilterSelecter, appData.get("FILT"));
          break;

        default:
          break;
      }
    } catch (NullPointerException e) {
      Log.i("ThirdFrament:handleCmd", "This Fragment NOT Attach Now");
    }
  }
Exemplo n.º 7
0
  // Use this method to read sms, when sms text is already know (already found
  // by another method)
  public void readMessages(
      String message,
      Calendar calendar,
      TextView tempr,
      TextView dateV,
      ToggleButton toggleButton) {
    // Making toggle button visible
    toggleButton.setVisibility(View.VISIBLE);

    // Taking required information from message
    String messageTemp = message.substring(message.indexOf("T=") + 2, message.indexOf("T=") + 6);
    tempr.setText(messageTemp);

    // Taking calendar object and getting date and time of incoming
    // message, the feeding information to view
    int smsDay = calendar.get(Calendar.DATE);
    int smsTime = calendar.get(Calendar.HOUR_OF_DAY);
    String smsReceived = smsDay + " - " + smsTime;
    dateV.setText(smsReceived);

    // If yes, check security status and change Toggle button information
    // Accordingly
    if (message.indexOf("Apsauga isjungta") > -1) {
      toggleButton.setChecked(false);
    } else {
      toggleButton.setChecked(true);
    }
  }
Exemplo n.º 8
0
 private void clearFormatBarButtons() {
   for (ToggleButton button : mTagToggleButtonMap.values()) {
     if (button != null) {
       button.setChecked(false);
     }
   }
 }
Exemplo n.º 9
0
    private void toggleWifiRepeater(final ToggleButton button) {
        startBlinkingImage((ImageView) findViewById(R.id.wifiRepeaterArrow));
        if (button.isChecked()) {
            final File flagFile = new File("/data/data/fq.router2/etc/wifi-repeater-risk-notified");
            if (flagFile.exists()) {
                startWifiRepater();
            } else {
                new AlertDialog.Builder(this)
                        .setIcon(android.R.drawable.ic_dialog_alert)
                        .setTitle(R.string.wifi_repeater_risk_alert_title)
                        .setMessage(R.string.wifi_repeater_risk_alert_message)
                        .setPositiveButton(R.string.wifi_repeater_risk_alert_ok, new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                IOUtils.writeToFile(flagFile, "OK");
                                startWifiRepater();
                                button.setChecked(true);
                            }

                        })
                        .setNegativeButton(R.string.wifi_repeater_risk_alert_cancel, null)
                        .show();
                button.setChecked(false);
            }
        } else {
            startBlinkingStatus(_(R.string.status_wifi_repeater_stopping));
            disableWifiRepeaterButton();
            StopWifiRepeaterService.execute(this);
        }
    }
Exemplo n.º 10
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);
  }
  private void toggleCamera(boolean isNeedEnableCam) {

    // TODO temporary insertion will be removed when GLVideoView will be fixed
    DisplayMetrics displaymetrics = new DisplayMetrics();
    displaymetrics.setToDefaults();

    ViewGroup.LayoutParams layoutParams = imgMyCameraOff.getLayoutParams();

    layoutParams.height = localVideoView.getHeight();
    layoutParams.width = localVideoView.getWidth();

    imgMyCameraOff.setLayoutParams(layoutParams);

    Log.d(
        TAG,
        "Width is: "
            + imgMyCameraOff.getLayoutParams().width
            + " height is:"
            + imgMyCameraOff.getLayoutParams().height);

    if (SessionManager.getCurrentSession() != null) {
      SessionManager.getCurrentSession().setVideoEnabled(isNeedEnableCam);
      cameraToggle.setChecked(isNeedEnableCam);

      if (isNeedEnableCam) {
        Log.d(TAG, "Camera is on");
        switchCameraToggle.setVisibility(View.VISIBLE);
        imgMyCameraOff.setVisibility(View.INVISIBLE);
      } else {
        Log.d(TAG, "Camera is off");
        switchCameraToggle.setVisibility(View.INVISIBLE);
        imgMyCameraOff.setVisibility(View.VISIBLE);
      }
    }
  }
  private void setWifiStatus(boolean onOff) {
    wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    if (onOff) {
      if (wifi.isWifiEnabled() == false) {
        Toast.makeText(
                getApplicationContext(),
                "Wifi is disabled. It is being enabled.",
                Toast.LENGTH_LONG)
            .show();
      }
      wifi.setWifiEnabled(true);
      scanning_textView.setVisibility(View.GONE);
      wifiListview.setVisibility(View.VISIBLE);
      wifiOnOff.setChecked(true);
      wifiOnOff.setBackgroundColor(getResources().getColor(R.color.greenEnd));
    } else {

      Toast.makeText(getApplicationContext(), "Wifi is disabled.", Toast.LENGTH_LONG).show();
      wifi.setWifiEnabled(false);
      wifiOnOff.setChecked(false);
      wifiOnOff.setBackgroundColor(getResources().getColor(R.color.lightGrey));
      scanning_textView.setVisibility(View.GONE);
      wifiListview.setVisibility(View.GONE);
    }
  }
Exemplo n.º 13
0
    void populateFrom(final int position) {
      final Profile account = getItem(position);
      Protocol p = RosterHelper.getInstance().getProtocol(account);
      if (null != p) {
        ImageView icProtocol = getImageProtocol();
        Icon ic = p.getStatusInfo().getIcon((byte) 0);
        if (ic != null) {
          icProtocol.setVisibility(ImageView.VISIBLE);
          icProtocol.setImageDrawable(ic.getImage());
        } else {
          icProtocol.setVisibility(ImageView.GONE);
        }
      }
      getTextLogin().setText(account.userId);
      ToggleButton tb = getToggleButton();
      tb.setChecked(account.isActive);
      tb.setFocusableInTouchMode(false);
      tb.setFocusable(false);

      tb.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              ToggleButton t = (ToggleButton) v.findViewById(R.id.toggle_button);
              account.isActive = t.isChecked();
              RosterHelper.getInstance().setCurrentProtocol();
              Options.saveAccount(account);
              notifyDataSetChanged();
            }
          });
    }
Exemplo n.º 14
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));
  }
Exemplo n.º 15
0
        @Override
        public void onServiceConnected(ComponentName className, IBinder serviceBinder) {
          Log.d("MainActivity", "service connected");

          // bound with Service. get Service instance
          MediaPlayerService.MediaPlayerBinder binder =
              (MediaPlayerService.MediaPlayerBinder) serviceBinder;
          mService = binder.getService();

          // send this instance to the service, so it can make callbacks on
          // this instance as a client
          mService.setClient(ListenFragment.this);
          mBound = true;

          // Set play/pause button to reflect state of the service's contained
          // player
          final ToggleButton playPauseButton =
              (ToggleButton) rootView.findViewById(R.id.playPauseButton);
          playPauseButton.setChecked(mService.getMediaPlayer().isPlaying());

          // Set station Picker to show currently set stream station
          Spinner stationPicker = (Spinner) rootView.findViewById(R.id.stationPicker);
          if (mService.getMediaPlayer() != null
              && mService.getMediaPlayer().getStreamStation() != null) {
            for (int i = 0; i < RadioList.ALl_STATIONS.length; i++) {
              if (mService.getMediaPlayer().getStreamStation().equals(RadioList.ALl_STATIONS[i])) {
                stationPicker.setSelection(i);
                mSelectedStream = (StreamStation) stationPicker.getItemAtPosition(i);
              }
            }
          }
        }
Exemplo n.º 16
0
  // 初始化歌曲列表
  private void initLocalMusicList() {
    // fileInfos = MediaUtil.getFileInfos(getApplicationContext()); //获取歌曲对象集合
    setListAdpter(MediaUtil.getMusicMaps(fileInfos)); // 显示歌曲列表
    music_siger_tv.setText(fileInfos.get(listPosition).getArtist());
    music_name_tv.setText(fileInfos.get(listPosition).getTitle());
    music_play_bt.setPressed(play_bt_press);
    music_play_bt.setChecked(play_bt_check);

    anim = ObjectAnimator.ofFloat(music_album_iv, "rotation", 0, 360);
    lin = new LinearInterpolator();
    anim.setDuration(6000);
    anim.setRepeatCount(-1);
    anim.setRepeatMode(ObjectAnimator.RESTART);
    anim.setInterpolator(lin); // 匀速

    PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 0f, 1f);
    PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 0, 1f);
    PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 0, 1f);
    animSongName = ObjectAnimator.ofPropertyValuesHolder(music_name_tv, pvhX, pvhY, pvhZ); // 渐现
    animSongName.setDuration(1000);
    animSongName.setRepeatCount(0);
    animSongName.setRepeatMode(ObjectAnimator.RESTART);

    animSongSinger = ObjectAnimator.ofPropertyValuesHolder(music_siger_tv, pvhX, pvhY, pvhZ); // 渐现
    animSongSinger.setDuration(1000);
    animSongSinger.setRepeatCount(0);
    animSongSinger.setRepeatMode(ObjectAnimator.RESTART);
  }
 public void reInitFragment() {
   mLayout.setVisibility(View.VISIBLE);
   mTxtDuration.setVisibility(View.GONE);
   mTxtTitle.setText(Utility.sMovieObject.Title);
   mTxtOverview.setText(Utility.sMovieObject.Overview);
   mTxtVoteAverage.setText(Utility.sMovieObject.VoteAverage + "/10");
   try {
     mTxtReleaseDate.setText(Utility.sMovieObject.ReleaseDate.split("-")[0]);
   } catch (Exception e) {
   }
   mTxtReviews.setText("");
   lstTrailersUrl.clear();
   lstReviewsContent.clear();
   lstTrailersNames.clear();
   adpTrailersUrl.notifyDataSetChanged();
   configListViewHeight(lstTrailers);
   if (mUtility.isMovieExist(Utility.sMovieObject.Id)) {
     imgPoster.setImageBitmap(mUtility.getImageBitmap(Utility.sMovieObject.MoviePoster));
     btnFavorite.setChecked(true);
   } else {
     Picasso.with(getActivity())
         .load(mUtility.IMAGE_URL + Utility.sMovieObject.MoviePoster)
         .placeholder(getContext().getResources().getDrawable(R.drawable.imgdefaultmovie))
         .error(getContext().getResources().getDrawable(R.drawable.imgdefaultmovie))
         .into(imgPoster);
     btnFavorite.setChecked(false);
   }
   new FetchAttachments().execute(MOVIE_INFO);
 }
Exemplo n.º 18
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_);
  }
Exemplo n.º 19
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    if (row == null) {
      LayoutInflater inflater =
          (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = inflater.inflate(R.layout.channelsitem, parent, false);
    }
    Channel channel = getItem(position);
    TextView channelName = (TextView) row.findViewById(R.id.txtName);
    TextView channelCreated = (TextView) row.findViewById(R.id.txtCreated);
    ToggleButton tg = (ToggleButton) row.findViewById(R.id.toggleButton1);

    tg.setOnClickListener(myCheckChangList);
    tg.setTag(position);
    if (channel.name != null) {
      channelName.setText(channel.name);
    }
    if (channel.created != null) {
      channelCreated.setText(channel.created);
    }
    if (channel.send != null) {
      tg.setChecked(channel.send);
      channelName.setTextColor(Color.BLACK);
    }

    return row;
  }
Exemplo n.º 20
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
            }
          }
        });
  }
Exemplo n.º 21
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.irdi_suche:
       if (searchRunning != 0) {
         Toast.makeText(getActivity(), "Bitte auf Suchergebniss warten.", Toast.LENGTH_SHORT)
             .show();
         break;
       }
       vollSuche = false;
       vollSucheButton.setChecked(false);
       irdiSucheButton.setChecked(true);
       break;
     case R.id.voll_suche:
       if (searchRunning != 0) {
         Toast.makeText(getActivity(), "Bitte auf Suchergebniss warten.", Toast.LENGTH_SHORT)
             .show();
         break;
       }
       vollSuche = true;
       vollSucheButton.setChecked(true);
       irdiSucheButton.setChecked(false);
       break;
   }
 }
  // This method is called when we click on a togle button
  // This method will write the value to the database
  private void changeToggleButton(int togleID) {
    try { // track we come here
      ActivityGroupSettings.group.parent.trackEvent(
          TrackingValues.eventCategorySettings,
          TrackingValues.eventCategorySettingsChangeFoodCompositionVisible);
    } catch (NullPointerException e) {
    }

    if (defaultValue != togleID) {
      updateToggleButton(togleID);
    } else {
      Toast.makeText(
              this, getResources().getString(R.string.standard_cant_be_hidden), Toast.LENGTH_SHORT)
          .show();

      // set toglebutton back to on
      switch (defaultValue) {
        case 1:
          tgCarb.toggle();
          break;
        case 2:
          tgProt.toggle();
          break;
        case 3:
          tgFat.toggle();
          break;
        case 4:
          tgKcal.toggle();
          break;
      }
    }
  }
Exemplo n.º 23
0
 private void setFromPrevBM(boolean isToggled, ToggleButton button) {
   if (isToggled) {
     button.setChecked(true);
   } else {
     button.setChecked(false);
   }
 }
Exemplo n.º 24
0
  @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);
  }
Exemplo n.º 25
0
  protected void performGetArticole() {

    String numeArticol = txtNumeArticol.getText().toString().trim();
    String tipCautare = "", tipArticol = "";

    if (tglButton.isChecked()) tipCautare = "C";
    else tipCautare = "N";

    if (tglTipArtBtn.isChecked()) tipArticol = "S";
    else tipArticol = "A";

    String localDep = UserInfo.getInstance().getCodDepart();

    if (isCV()) {
      localDep = CLPFragment1.departamentConsilier;
    } else if (UtilsUser.isAgentOrSD()) {
      localDep = UserInfo.getInstance().getCodDepart();
    } else if (UtilsUser.isKA()) {
      localDep = "00";
    }

    if (localDep.length() > 0) {
      HashMap<String, String> params = UtilsGeneral.newHashMapInstance();
      params.put("searchString", numeArticol);
      params.put("tipArticol", tipArticol);
      params.put("tipCautare", tipCautare);
      params.put("departament", localDep);

      opArticol.getArticoleDistributie(params);
    }
  }
Exemplo n.º 26
0
 private void setupImageDemoButton() {
   CharSequence txtoff = "Image demo off";
   CharSequence txton = "Image demo on";
   txtoff.toString().toLowerCase();
   txton.toString().toLowerCase();
   imagebtn.setTextOff(txtoff);
   imagebtn.setTextOn(txton);
 }
 @Override
 public void onLoaderReset(final Loader<Cursor> loader) {
   adapter.swapCursor(null);
   final View view = getView();
   if (view == null) return;
   final ToggleButton toggleContraction = (ToggleButton) view.findViewById(R.id.toggleContraction);
   toggleContraction.setChecked(false);
 }
Exemplo n.º 28
0
  /**
   * In HTML mode, applies formatting to selected text, or inserts formatting tag at current cursor
   * position
   *
   * @param toggleButton format bar button which was clicked
   * @param tag identifier tag
   */
  private void applyFormattingHtmlMode(ToggleButton toggleButton, String tag) {
    if (mSourceViewContent == null) {
      return;
    }

    // Replace style tags with their proper HTML tags
    String htmlTag;
    if (tag.equals(getString(R.string.format_bar_tag_bold))) {
      htmlTag = "b";
    } else if (tag.equals(getString(R.string.format_bar_tag_italic))) {
      htmlTag = "i";
    } else if (tag.equals(getString(R.string.format_bar_tag_strikethrough))) {
      htmlTag = "del";
    } else if (tag.equals(getString(R.string.format_bar_tag_unorderedList))) {
      htmlTag = "ul";
    } else if (tag.equals(getString(R.string.format_bar_tag_orderedList))) {
      htmlTag = "ol";
    } else {
      htmlTag = tag;
    }

    int selectionStart = mSourceViewContent.getSelectionStart();
    int selectionEnd = mSourceViewContent.getSelectionEnd();

    if (selectionStart > selectionEnd) {
      int temp = selectionEnd;
      selectionEnd = selectionStart;
      selectionStart = temp;
    }

    boolean textIsSelected = selectionEnd > selectionStart;

    String startTag = "<" + htmlTag + ">";
    String endTag = "</" + htmlTag + ">";

    // Add li tags together with ul and ol tags
    if (htmlTag.equals("ul") || htmlTag.equals("ol")) {
      startTag = startTag + "\n\t<li>";
      endTag = "</li>\n" + endTag;
    }

    Editable content = mSourceViewContent.getText();
    if (textIsSelected) {
      // Surround selected text with opening and closing tags
      content.insert(selectionStart, startTag);
      content.insert(selectionEnd + startTag.length(), endTag);
      toggleButton.setChecked(false);
      mSourceViewContent.setSelection(selectionEnd + startTag.length() + endTag.length());
    } else if (toggleButton.isChecked()) {
      // Insert opening tag
      content.insert(selectionStart, startTag);
      mSourceViewContent.setSelection(selectionEnd + startTag.length());
    } else {
      // Insert closing tag
      content.insert(selectionEnd, endTag);
      mSourceViewContent.setSelection(selectionEnd + endTag.length());
    }
  }
Exemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sniff);
    ;

    // HIDE STATUS BAR
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);

    // ScrollView
    scrollView = (ScrollView) findViewById(R.id.scrollSniff);
    scrollView.post(
        new Runnable() {
          @Override
          public void run() {
            scrollView.fullScroll(View.FOCUS_DOWN);
          }
        });

    // SETUP NFC
    nfc = new Nfc(this);
    NfcAdapter adapter = nfc.getNfcAdapter();

    // UPDATE OUTPUT
    Intent intent = getIntent();
    if (intent.hasExtra(Stealth.EXTRA_MESSAGE)) {
      protocols = intent.getStringExtra(Stealth.EXTRA_MESSAGE);
    }
    if (protocols == null) {
      protocols = "";
    }

    // Create the output text
    output = (TextView) findViewById(R.id.scrollText);

    // Deal with the toggle button presses
    final ToggleButton mode_toggle = (ToggleButton) findViewById(R.id.swap_mode);

    mode_toggle.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (!mode_toggle.isChecked()) {

              Intent intent = new Intent(v.getContext(), Stealth.class);
              intent.putExtra(Stealth.EXTRA_MESSAGE, protocols);
              startActivity(intent);
            }
          }
        });

    // RESTOFCODE
    androidFile = new AndroidFile(logLocation);
    output.setText(protocols);
  }
Exemplo n.º 30
0
 public void checkButton(ToggleButton personale) {
   if (personale.isChecked()) {
     personale.setBackgroundResource(R.layout.acceso);
     personale.setText("Acceso");
   } else {
     personale.setBackgroundResource(R.layout.spento);
     personale.setText("Spento");
   }
 }