@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater =
          (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View rowView = inflater.inflate(R.layout.list_item_icon, parent, false);
      TextView textView = (TextView) rowView.findViewById(R.id.label);

      ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
      textView.setText(mValues[position]);

      // Set icons
      String s = mValues[position];
      if (s.equals("CPU")) {
        imageView.setImageResource(R.drawable.ic_drawer_cpu);
      } else if (s.equals("System")) {
        imageView.setImageResource(R.drawable.ic_drawer_system);
      } else if (s.equals("Disks")) {
        imageView.setImageResource(R.drawable.ic_drawer_disks);
      } else if (s.equals("Processes")) {
        imageView.setImageResource(R.drawable.ic_drawer_processes);
      } else if (s.equals("GPU")) {
        imageView.setImageResource(R.drawable.ic_drawer_gpu);
      } else if (s.equals("Overview")) {
        imageView.setImageResource(R.drawable.ic_drawer_overview);
      } else if (s.equals("History")) {
        imageView.setImageResource(R.drawable.ic_drawer_history);
      } else if (s.equals("Notifications")) {
        imageView.setImageResource(R.drawable.ic_drawer_notifications);
      }
      imageView.setContentDescription(s + " icon");

      return rowView;
    }
 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);
 }
示例#3
0
    public View getView(int position, View convertView, ViewGroup parent) {
      final View view =
          (convertView != null)
              ? convertView
              : LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.bookmark_item, parent, false);
      final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon);
      final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text);
      final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle);

      final Bookmark bookmark = getItem(position);
      if (bookmark == null) {
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageResource(R.drawable.ic_list_plus);
        textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue());
        bookTitleView.setVisibility(View.GONE);
      } else {
        imageView.setVisibility(View.GONE);
        textView.setText(bookmark.getText());
        if (myCurrentBook) {
          bookTitleView.setVisibility(View.GONE);
        } else {
          bookTitleView.setVisibility(View.VISIBLE);
          bookTitleView.setText(bookmark.getBookTitle());
        }
      }
      return view;
    }
  private void setState(State state) {
    this.state = state;
    switch (state) {
      case PULL_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(pullToRefreshText);

        if (showLastUpdatedText && lastUpdated != -1) {
          lastUpdatedTextView.setVisibility(View.VISIBLE);
          lastUpdatedTextView.setText(
              String.format(lastUpdatedText, lastUpdatedDateFormat.format(new Date(lastUpdated))));
        }

        break;

      case RELEASE_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(releaseToRefreshText);
        break;

      case REFRESHING:
        setUiRefreshing();

        lastUpdated = System.currentTimeMillis();
        if (onRefreshListener == null) {
          setState(State.PULL_TO_REFRESH);
        } else {
          onRefreshListener.onRefresh();
        }

        break;
    }
  }
        @Override
        public void onReceive(Context context, Intent intent) {
          final String action = intent.getAction();
          if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
            mConnected = true;
            updateConnectionState(R.string.connected);
            invalidateOptionsMenu();
          } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
            mConnected = false;
            updateConnectionState(R.string.disconnected);
            invalidateOptionsMenu();
          } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
            BluetoothGattService gattService = mBluetoothLeService.getSoftSerialService();
            characteristicTX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX);
            // characteristicRX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX);
            characteristicRX = characteristicTX;

            if ((gattService != null) && (characteristicTX != null)) {
              mBluetoothLeService.setCharacteristicNotification(characteristicTX, true);

              isSerial.setText("Serial ready");
              updateReadyState(R.string.ready);
            } else {
              isSerial.setText("Serial can't be found");
            }

          } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
            displayData(intent.getStringExtra(mBluetoothLeService.EXTRA_DATA));
          }
        }
示例#6
0
  private void addTableRow(String key, String val) {
    TableLayout tl = (TableLayout) findViewById(R.id.data_table);
    TableRow tr = new TableRow(this);
    MarginLayoutParams params =
        new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.setMargins(TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN);
    tr.setLayoutParams(params);
    tr.setBackgroundColor(Color.BLACK);
    TextView name = new TextView(this);
    name.setGravity(Gravity.RIGHT);
    name.setText(key + ": ");
    TextView value = new TextView(this);
    value.setGravity(Gravity.LEFT);
    value.setText(val);
    tr.addView(name);
    tr.addView(value);
    tl.addView(
        tr, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    /*
     * TODO remove this hack
     *
     * let's define a limit number of rows
     */
    if (tl.getChildCount() > 10) tl.removeViewAt(0);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false);

    int idEstadistica = this.mPageNumber;

    // Titulo y descripcion de estadistica
    TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica);
    TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica);

    tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo());
    descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion());

    rootView.addView(
        new EstadisticaViewLayout(Utilidades.getAppContext())
            .getView(RelacionEstadisticas.getRelacion().get(idEstadistica)));
    // }
    // catch (Exception e)
    // {
    //	Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(),
    // Toast.LENGTH_LONG).show();
    //	Log.e("ERROR", e.getLocalizedMessage());
    // }
    // Set the title view to show the page number.
    /*((TextView) rootView.findViewById(android.R.id.text1)).setText(
    getString(R.string.title_template_step, mPageNumber + 1));*/

    return rootView;
  }
示例#8
0
  /** Clears the table, removes all values. */
  public void ClearForm() {

    Utilities.LogDebug("GpsMainActivity.ClearForm");

    TextView tvLatitude = (TextView) findViewById(R.id.txtLatitude);
    TextView tvLongitude = (TextView) findViewById(R.id.txtLongitude);
    TextView tvDateTime = (TextView) findViewById(R.id.txtDateTimeAndProvider);

    TextView tvAltitude = (TextView) findViewById(R.id.txtAltitude);

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

    TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites);
    TextView txtDirection = (TextView) findViewById(R.id.txtDirection);
    TextView txtAccuracy = (TextView) findViewById(R.id.txtAccuracy);

    tvLatitude.setText("");
    tvLongitude.setText("");
    tvDateTime.setText("");
    tvAltitude.setText("");
    txtSpeed.setText("");
    txtSatellites.setText("");
    txtDirection.setText("");
    txtAccuracy.setText("");
  }
示例#9
0
  public void onFileName(String newFileName) {
    if (newFileName == null || newFileName.length() <= 0) {
      return;
    }

    TextView txtFilename = (TextView) findViewById(R.id.txtFileName);

    if (AppSettings.shouldLogToGpx() || AppSettings.shouldLogToKml()) {

      txtFilename.setText(
          getString(R.string.summary_current_filename_format, Session.getCurrentFileName()));
    } else {
      txtFilename.setText("");
    }
  }
示例#10
0
 @Override
 public void onClick(View view) {
   if (view.getId() == R.id.button1) {
     // textView.setText(getString(R.string.cambiar_texto));
     textView.setText(R.string.cambiar_texto);
   }
 }
  /* Scan the files in the new directory, and store them in the filelist.
   * Update the UI by refreshing the list adapter.
   */
  private void loadDirectory(String newdirectory) {
    if (newdirectory.equals("../")) {
      try {
        directory = new File(directory).getParent();
      } catch (Exception e) {
      }
    } else {
      directory = newdirectory;
    }
    SharedPreferences.Editor editor = getPreferences(0).edit();
    editor.putString("lastBrowsedDirectory", directory);
    editor.commit();
    directoryView.setText(directory);

    filelist = new ArrayList<FileUri>();
    ArrayList<FileUri> sortedDirs = new ArrayList<FileUri>();
    ArrayList<FileUri> sortedFiles = new ArrayList<FileUri>();
    if (!newdirectory.equals(rootdir)) {
      String parentDirectory = new File(directory).getParent() + "/";
      Uri uri = Uri.parse("file://" + parentDirectory);
      sortedDirs.add(new FileUri(uri, parentDirectory));
    }
    try {
      File dir = new File(directory);
      File[] files = dir.listFiles();
      if (files != null) {
        for (File file : files) {
          if (file == null) {
            continue;
          }
          String filename = file.getName();
          if (file.isDirectory()) {
            Uri uri = Uri.parse("file://" + file.getAbsolutePath() + "/");
            FileUri fileuri = new FileUri(uri, uri.getPath());
            sortedDirs.add(fileuri);
          } else if (filename.endsWith(".mid")
              || filename.endsWith(".MID")
              || filename.endsWith(".midi")
              || filename.endsWith(".MIDI")) {

            Uri uri = Uri.parse("file://" + file.getAbsolutePath());
            FileUri fileuri = new FileUri(uri, uri.getLastPathSegment());
            sortedFiles.add(fileuri);
          }
        }
      }
    } catch (Exception e) {
    }

    if (sortedDirs.size() > 0) {
      Collections.sort(sortedDirs, sortedDirs.get(0));
    }
    if (sortedFiles.size() > 0) {
      Collections.sort(sortedFiles, sortedFiles.get(0));
    }
    filelist.addAll(sortedDirs);
    filelist.addAll(sortedFiles);
    adapter = new IconArrayAdapter<FileUri>(this, android.R.layout.simple_list_item_1, filelist);
    this.setListAdapter(adapter);
  }
 @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;
 }
示例#13
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.terciaria);

    Intent i = getIntent();
    double raizPotencia = i.getDoubleExtra("raizPotencia", 0.00);
    btnVoltar = (Button) findViewById(R.id.btnVoltar);
    btnVoltar.setOnClickListener(this);

    double raiz = Math.sqrt(raizPotencia);
    double potencia = Math.pow(raizPotencia, 2);
    TextView txtRaiz = (TextView) findViewById(R.id.resRaiz);
    txtRaiz.setText(String.valueOf(raiz));
    //
    TextView txtPotencia = (TextView) findViewById(R.id.resPotencia);
    txtPotencia.setText(String.valueOf(potencia));
  }
示例#14
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();
          }
        });
  }
示例#15
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!");
      }
    }
  }
 public void restartGame(View v) {
   for (int i = 1; i <= 9; i++) {
     View mainView =
         findViewById(
             getResources()
                 .getIdentifier("mainView" + Integer.toString(i), "id", getPackageName()));
     if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
       mainView.setBackgroundDrawable(getResources().getDrawable(R.drawable.empty));
     } else {
       mainView.setBackground(getResources().getDrawable(R.drawable.empty));
     }
     player = 1;
     matriz = new int[3][3];
     tv.setText("Jogador 1");
     tv1.setText("");
     vencedor = false;
   }
 }
 private void initPagerItems() {
   for (int i = 0; i < bitmapList.size(); i++) {
     View v = LayoutInflater.from(this).inflate(R.layout.call_activity_itempage, null);
     ImageView imageView = (ImageView) v.findViewById(R.id.contactIv);
     TextView textView = (TextView) v.findViewById(R.id.contactTv);
     imageView.setImageBitmap(bitmapList.get(i));
     textView.setText(nameList.get(i));
     viewArrayList.add(v);
   }
 }
示例#18
0
  private View getEmptyView() {
    if (mEmptyRoot == null) {
      mEmptyRoot = mView.findViewById(R.id.empty_root);
      ImageView mIvEmpty = (ImageView) mView.findViewById(R.id.iv_empty);
      TextView mTvEmpty = (TextView) mView.findViewById(R.id.tv_empty);

      mIvEmpty.setImageResource(R.drawable.hand);
      mTvEmpty.setText("下拉扫描新歌曲");
    }
    return mEmptyRoot;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    sdk = android.os.Build.VERSION.SDK_INT;
    player = 1;

    tv = (TextView) findViewById(R.id.mainTextView);
    tv1 = (TextView) findViewById(R.id.mainTextViewVencedor);
    tv.setText("Jogador 1");
  }
示例#20
0
 @Override
 public boolean onTouch(View view, MotionEvent event) {
   String str = null;
   int i = 0;
   str =
       "x="
           + event.getX(i) / view.getMeasuredWidth()
           + ",y="
           + event.getY(i) / view.getMeasuredHeight();
   textView.setText(str);
   return false;
 }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if (v == null) {
     LayoutInflater vi =
         (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     v = vi.inflate(R.layout.row, null);
   }
   Message m = items.get(position);
   // if (m != null) {
   m.createColorFromString(m.from);
   TextView tt = (TextView) v.findViewById(R.id.username);
   TextView bt = (TextView) v.findViewById(R.id.message);
   if (isMonospaced) {
     tt.setTypeface(Typeface.MONOSPACE);
     bt.setTypeface(Typeface.MONOSPACE);
   }
   tt.setText(m.getFrom());
   tt.setTextColor(m.color);
   bt.setText(m.getMessage());
   // }
   return v;
 }
示例#22
0
 public void handleMessage(Message msg) {
   mValue++;
   mText.setText(Integer.toString(mValue));
   try {
     Thread.sleep(50);
   } catch (InterruptedException e) {;
   }
   if (mValue < 100 && mQuit == false) {
     mProgress.setProgress(mValue);
     mHandler.sendEmptyMessage(0);
   } else {
     dismissDialog(0);
   }
 }
  private void displayData(String data) {
    if (data != null) {
      // Log.v(TAG, "BLE Return Data : " + data);

      sbuffer.append(data);
      if (data.endsWith("\n")) {
        String tmp = sbuffer.toString();
        if (tmp.startsWith("q")) {
          returnText.setText(tmp.substring(0, tmp.length() - 1));
          onSensorChanged(tmp.substring(2));
        }
        sbuffer = new StringBuilder();
      }
    }
  }
示例#24
0
  public void showDetails(Equipment equipment) {
    equip = equipment;
    View view;
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      view = getActivity().findViewById(R.id.detail_frag);
    } else {
      view = getActivity().findViewById(R.id.main_frame);
      Button button = (Button) view.findViewById(R.id.closeButton);
      button.setVisibility(View.VISIBLE);
    }

    TextView textIt_no = (TextView) view.findViewById(R.id.it_no2);
    TextView textType = (TextView) view.findViewById(R.id.type2);
    TextView textBrand = (TextView) view.findViewById(R.id.brand2);
    TextView textModel = (TextView) view.findViewById(R.id.model2);
    TextView textE_id = (TextView) view.findViewById(R.id.e_id);
    TextView textDescription = (TextView) view.findViewById(R.id.description);
    TextView textAquired = (TextView) view.findViewById(R.id.aquired);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
    } else {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
    }
    textIt_no.setText("Item nr: \t\t\t\t" + equipment.getIt_no());
    textType.setText("Type: \t\t\t\t\t" + equipment.getType());
    textBrand.setText("Brand: \t\t\t\t" + equipment.getBrand());
    textModel.setText("Model: \t\t\t\t" + equipment.getModel());
    textE_id.setText("Equipment ID: \t" + equipment.getE_id());
    textDescription.setText("Description: \t" + equipment.getDescription());
    textAquired.setText("Aquired: \t\t\t" + equipment.getAquired());

    downloadImageThread();

    ImageView image = (ImageView) view.findViewById(R.id.equipment_image);
    image.setImageBitmap(bitmap);
  }
    protected void onPostExecute(String[] result) {
      // ("Download complete: " + result + "\nComplete");

      if (result.length < 2) {
        text1.setText("Error: " + result[0]);

      } else {
        // text1.setText("Starting download " + result[1] + "... " + result[0]);

        doDownload(result[0], result[1]);

        finish();

        Toast.makeText(mContext.get(), "Downloading " + result[1] + "...", Toast.LENGTH_LONG)
            .show();
      }
    }
示例#26
0
 private View getFooterView() {
   if (mFooterView == null) {
     FrameLayout fl = new FrameLayout(getActivity());
     TextView tv = new TextView(getActivity());
     tv.setGravity(Gravity.CENTER);
     tv.setTextColor(0xFFaaaaaa);
     tv.setBackgroundColor(0xFFffffff);
     FrameLayout.LayoutParams params =
         new FrameLayout.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, (int) CommonUtils.dpToPx(getActivity(), 50));
     fl.addView(tv, params);
     mFooterView = fl;
   }
   TextView tv = (TextView) mFooterView.getChildAt(0);
   tv.setText("共有" + SongManager.with(getActivity()).getSongSize() + "首歌");
   return mFooterView;
 }
示例#27
0
  private void playerInfo() {
    Player player = getGamesClient().getCurrentPlayer();
    String name = player.getDisplayName();
    Uri uri = player.getIconImageUri();

    String displayName;
    if (player == null) {
      Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
      displayName = "???";
    } else {
      displayName = player.getDisplayName();
      appPreference.setLoginName(displayName);
    }

    userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName));
    // userIcon.setImageURI(uri);
  }
  private void showDeleteDialog() {
    Log.d(TAG, "showDeleteDialog() called");

    final Dialog deleteDialog = new Dialog(NoteActivity.this);
    LinearLayout dialogLayout =
        (LinearLayout) View.inflate(NoteActivity.this, R.layout.delete_note_dialog, null);
    deleteDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    deleteDialog.setContentView(dialogLayout);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(deleteDialog.getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;

    deleteDialog.show();
    deleteDialog.getWindow().setAttributes(lp);

    TextView noteTitleTextView =
        (TextView) dialogLayout.findViewById(R.id.delete_note_dialog_delete_note_title_textview);
    noteTitleTextView.setText(note.getTitle());

    Button confirmDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_confirm_button);
    confirmDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog confirm button clicked");
            noteProvider.deleteNote(note);
            finish();
          }
        });

    Button cancelDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_cancel_button);
    cancelDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog cancel button clicked");
            deleteDialog.dismiss();
          }
        });
  }
示例#29
0
        public void run() {
          /*
           * If values are not default, then we have values to calculate MPG
           */
          Log.d(TAG, "SPD:" + speed + ", MAF:" + maf + ", LTFT:" + ltft);
          if (speed > 1 && maf > 1 && ltft != 0) {
            FuelEconomyWithMAFObdCommand fuelEconCmd =
                new FuelEconomyWithMAFObdCommand(
                    FuelType.DIESEL, speed, maf, ltft, false /* TODO */);
            TextView tvMpg = (TextView) findViewById(R.id.fuel_econ_text);
            String liters100km = String.format("%.2f", fuelEconCmd.getLitersPer100Km());
            tvMpg.setText("" + liters100km);
            Log.d(TAG, "FUELECON:" + liters100km);
          }

          if (mServiceConnection.isRunning()) queueCommands();

          // run again in 2s
          mHandler.postDelayed(mQueueCommands, 2000);
        }
示例#30
0
  private void SetBackGroundforList() {
    // TODO Auto-generated method stub
    mDownView_parent_txt1 = new TextView(activity.getApplicationContext());
    RelativeLayout.LayoutParams lp1 =
        new RelativeLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    lp1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    mDownView_parent_txt1.setId(Integer.parseInt("111111"));
    mDownView_parent_txt1.setLayoutParams(lp1);
    mDownView_parent_txt1.setGravity(Gravity.CENTER_HORIZONTAL);
    mDownView_parent_txt1.setText(HalfText);
    mDownView_parent_txt1.setWidth(textwidth2);
    mDownView_parent_txt1.setPadding(0, textheight / 4, 0, 0);
    mDownView_parent_txt1.setHeight(textheight);
    mDownView_parent_txt1.setBackgroundColor(Color.parseColor(FullColor));
    mDownView_parent_txt1.setTextColor(Color.parseColor(TextColor));
    mDownView_parent_txt1.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
    mDownView_parent.addView(mDownView_parent_txt1, 0);

    //         if(SwipeType==Double){
    //             mDownView_parent_txt2 = new TextView(activity.getApplicationContext());
    //             mDownView_parent_txt2.setId(222222);
    //             RelativeLayout.LayoutParams lp2 =new
    // RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
    //             lp2.addRule(RelativeLayout.LEFT_OF,mDownView_parent_txt1.getId());
    //             mDownView_parent_txt2.setLayoutParams(lp2);
    //             mDownView_parent_txt2.setGravity(Gravity.CENTER_HORIZONTAL);
    //             mDownView_parent_txt2.setText(FullText);
    //             mDownView_parent_txt2.setWidth(textwidth);
    //             mDownView_parent_txt2.setPadding(0, textheight/4, 0, 0);
    //             mDownView_parent_txt2.setHeight(textheight);
    //             mDownView_parent_txt2.setBackgroundColor(Color.parseColor(FullColor));
    //             mDownView_parent_txt2.setTextColor(Color.parseColor(TextColor));
    //             mDownView_parent_txt2.setCompoundDrawablesWithIntrinsicBounds(null ,
    // FullDrawable, null, null );
    //             mDownView_parent.addView(mDownView_parent_txt2, 1);
    //         }
  }