Ejemplo n.º 1
1
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   textView = new TextView(this);
   textView.setText("Toca y arrastra (solo un dedo)");
   textView.setOnTouchListener(this);
   setContentView(textView);
 }
 @Override
 public void setMessage(String sMsg) {
   _tvPuzzleText.setText(sMsg);
   // _parent.doToast(sMsg);
   // _tvMessage.setText(sMsg);
   // m_textMessage.setText(sMsg);
 }
Ejemplo n.º 3
0
 @Override
 public boolean onTouch(View v, MotionEvent event) {
   builder.setLength(0);
   switch (event.getAction()) {
     case MotionEvent.ACTION_DOWN:
       builder.append("down, ");
       break;
     case MotionEvent.ACTION_MOVE:
       builder.append("move, ");
       break;
     case MotionEvent.ACTION_CANCEL:
       builder.append("cancel, ");
       break;
     case MotionEvent.ACTION_UP:
       builder.append("up, ");
       break;
   }
   builder.append(event.getX());
   builder.append(", ");
   builder.append(event.getY());
   String text = builder.toString();
   Log.d("TouchTest", text);
   textView.setText(text);
   return true;
 }
Ejemplo n.º 4
0
 @Nonnull
 public PropertyView setValue(@Nullable CharSequence value) {
   final TextView valueView = getValueTextView();
   valueView.setText(value);
   valueView.setVisibility(Strings.isEmpty(value) ? GONE : VISIBLE);
   return this;
 }
Ejemplo n.º 5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    c = this;
    preferences = PreferenceManager.getDefaultSharedPreferences(c);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gpu_sgx540);

    gpuCurrent = readFile(Constants.GPU_SGX540);
    seekGpu = (SeekBar) findViewById(R.id.seek_gpu);

    gpu = Arrays.asList(153, 307, 384);
    seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent));

    /*else{
    seekGpu.setEnabled(false);
    seekIva.setEnabled(false);
    TextView ns = (TextView)findViewById(R.id.not_supported);
    ns.setVisibility(View.VISIBLE);
    }*/
    preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    curGpuTxt = (TextView) findViewById(R.id.current_gpu);
    maxGpuTxt = (TextView) findViewById(R.id.max_gpu);
    minGpuTxt = (TextView) findViewById(R.id.min_gpu);

    mhz = getResources().getString(R.string.mhz);
    current = getResources().getString(R.string.current);
    max = getResources().getString(R.string._max);
    min = getResources().getString(R.string._min);
    curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz);
    maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz);
    minGpuTxt.setText(min + ": " + gpu.get(0) + mhz);

    Button cancel = (Button) findViewById(R.id.cancel);
    cancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
  }
Ejemplo n.º 6
0
  private void updateLoader() {
    if (NavigineApp.Navigation == null) return;

    // Log.d(TAG, String.format(Locale.ENGLISH, "Update loader: %d", mLoader));

    long timeNow = DateTimeUtils.currentTimeMillis();
    if (mLoader < 0) return;

    int status = LocationLoader.checkLocationLoader(mLoader);
    if (status < 100) {
      if ((Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT / 3 && status == 0)
          || (Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT)) {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText("Loading timeout!\nPlease, check your internet connection!");
        Log.d(TAG, String.format(Locale.ENGLISH, "Load stopped on timeout!"));
        LocationLoader.stopLocationLoader(mLoader);
        mLoader = -1;
      } else {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText(String.format(Locale.ENGLISH, "Loading content (%d%%)", status));
      }
    } else {
      Log.d(TAG, String.format(Locale.ENGLISH, "Load finished with result: %d", status));
      LocationLoader.stopLocationLoader(mLoader);
      mLoader = -1;

      if (status == 100) {
        parseMapsXml();
        if (mInfoList.isEmpty()) {
          mListView.setVisibility(View.GONE);
          mStatusLabel.setVisibility(View.VISIBLE);
          mStatusLabel.setText("No locations available");
        } else {
          mListView.setVisibility(View.VISIBLE);
          mStatusLabel.setVisibility(View.GONE);
        }
      } else {
        mListView.setVisibility(View.GONE);
        mStatusLabel.setVisibility(View.VISIBLE);
        mStatusLabel.setText("Error loading!\nPlease, check your ID!");
      }
    }
  }
        // @Override
        public void handleMessage(Message msg) {
          if (msg.what == 1) {
            _progressDlg.hide();

            getNumPuzzles();
            if (_seekBar != null) {
              _seekBar.setMax(_num);
            }

            play();
          } else if (msg.what == 2) {
            _progressDlg.setMessage(
                _parent.getString(R.string.msg_progress)
                    + String.format(" %d", (_cnt * 100) / _num)
                    + " %");
          } else if (msg.what == 3) {
            _progressDlg.hide();
            _tvPuzzleText.setText("An error occured during install");
          }
        }
 @Override
 public void setMessage(int res) {
   _tvPuzzleText.setText(res);
   // _parent.doToast(_parent.getString(res));
 }
  @Override
  public void play() {
    m_iFrom = -1;
    Log.i("ChessViewPuzzle", "Numboard = " + _jni.getNumBoard());

    _imgStatus.setImageResource(R.drawable.indicator_none);

    String sPGN;

    _iPos++;
    if (_iPos < 1) _iPos = 1;
    if (_iPos > _num) {
      setMessage("You completed all puzzles!!!");
      return;
    }

    if (_seekBar != null) {
      _seekBar.setProgress(_iPos);
    }
    if (_cursor != null) {
      _cursor.moveToPosition(_iPos - 1);
      sPGN = _cursor.getString(_cursor.getColumnIndex(MyPuzzleProvider.COL_PGN));
      Log.i("ChessViewPuzzle", "init: " + sPGN);
      loadPGN(sPGN);

      jumptoMove(0);

      int turn = _jni.getTurn();
      if (turn == BoardConstants.BLACK && false == _view.getFlippedBoard()
          || turn == BoardConstants.WHITE && _view.getFlippedBoard()) _view.flipBoard();

      String sWhite = _mapPGNHead.get("White");
      if (sWhite == null) {
        sWhite = "";
      } else {
        sWhite = sWhite.replace("?", "");
      }
      String sDate = _mapPGNHead.get("Date");
      if (sDate == null) {
        sDate = "";
      } else {
        sDate = sDate.replace("????", "");
        sDate = sDate.replace(".??.??", "");
      }

      if (sWhite.length() > 0 && sDate.length() > 0) {
        sWhite += ", ";
      }

      _tvPuzzleText.setText(
          "# " + _iPos + " - " + sWhite
              + sDate); // + "\n\n" + _mapPGNHead.get("Event") + ", " +
                        // _mapPGNHead.get("Date").replace(".??.??", ""));
      // _tvPuzzle.setText(");

      _imgTurn.setImageResource(
          (turn == BoardConstants.WHITE ? R.drawable.turnwhite : R.drawable.turnblack));

      updateState();
    }
  }
Ejemplo n.º 10
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      if (view == null) {
        LayoutInflater inflater =
            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.content_list_item, null);
      }
      TextView titleTextView = (TextView) view.findViewById(R.id.list_item_title);
      TextView stateTextView = (TextView) view.findViewById(R.id.list_item_state);
      TextView downTextView = (TextView) view.findViewById(R.id.list_item_downbar);
      Button downloadButton = (Button) view.findViewById(R.id.list_item_download_button);
      Button uploadButton = (Button) view.findViewById(R.id.list_item_upload_button);

      LocationInfo info = mInfoList.get(position);
      String titleText = info.title;
      String stateText = "";

      if (titleText.length() > 30) titleText = titleText.substring(0, 28) + "...";

      synchronized (mLoaderMap) {
        if (mLoaderMap.containsKey(info.title)) {
          LoaderState loader = mLoaderMap.get(info.title);
          if (loader.state < 100) stateText = String.format(Locale.ENGLISH, "%d%%", loader.state);
          else if (loader.state == 100) stateText = String.format(Locale.ENGLISH, "Done!");
          else stateText = String.format(Locale.ENGLISH, "Failed!");
        }
      }

      if (info.localVersion < 0) titleText += " (?)";
      else {
        if (info.localModified)
          titleText += String.format(Locale.ENGLISH, " (v. %d+)", info.localVersion);
        else titleText += String.format(Locale.ENGLISH, " (v. %d)", info.localVersion);
      }

      String mapFile = NavigineApp.Settings.getString("map_file", "");
      if (mapFile.equals(info.archiveFile)) {
        titleTextView.setTypeface(null, Typeface.BOLD);
        view.setBackgroundColor(Color.parseColor("#590E0E"));
      } else {
        titleTextView.setTypeface(null, Typeface.NORMAL);
        view.setBackgroundColor(Color.BLACK);
      }

      titleTextView.setText(titleText);
      stateTextView.setText(stateText);

      if (info.localModified) {
        downloadButton.setVisibility(View.GONE);
        uploadButton.setVisibility(View.VISIBLE);
        downTextView.setText("Version is modified. Upload?");
      } else if (info.serverVersion > info.localVersion) {
        downloadButton.setVisibility(View.VISIBLE);
        uploadButton.setVisibility(View.GONE);
        String downText =
            String.format(Locale.ENGLISH, "Version available: %d", info.serverVersion);
        downTextView.setText(downText);
      } else {
        downloadButton.setVisibility(View.INVISIBLE);
        uploadButton.setVisibility(View.GONE);
        downTextView.setText("Version is up to date");
      }

      downloadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startDownload(position);
            }
          });

      uploadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              startUpload(position);
            }
          });

      return view;
    }