コード例 #1
0
ファイル: MainActivity.java プロジェクト: Red680812/MyObdDemo
  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);
  }
コード例 #2
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;
  }
コード例 #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;
    }
コード例 #4
0
ファイル: ReportActivity.java プロジェクト: EE5415/Ada
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_report);
   Bundle bundle = getIntent().getExtras();
   double height = Double.parseDouble(bundle.getString("height")) / 100;
   double weight = Double.parseDouble(bundle.getString("weight"));
   double bmi = weight / (height * height);
   DecimalFormat nf = new DecimalFormat("0.00");
   TextView result = (TextView) findViewById(R.id.report_result);
   result.setText(getString(R.string.bmi_result) + " " + nf.format(bmi));
   // Give health advice
   ImageView image = (ImageView) findViewById(R.id.report_image);
   TextView advice = (TextView) findViewById(R.id.report_advice);
   if (bmi > 25) {
     image.setImageResource(R.drawable.bot_fat);
     advice.setText(R.string.advice_heavy);
   } else if (bmi < 20) {
     image.setImageResource(R.drawable.bot_thin);
     advice.setText(R.string.advice_light);
   } else {
     image.setImageResource(R.drawable.bot_fit);
     advice.setText(R.string.advice_average);
   }
 }
コード例 #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_view);

    setTitle("ListView");

    final ListView listView = (ListView) findViewById(R.id.list_view);

    LayoutInflater layoutInflater = getLayoutInflater();

    View header = layoutInflater.inflate(R.layout.list_item_header_footer, null);
    View footer = layoutInflater.inflate(R.layout.list_item_header_footer, null);
    TextView txtHeaderTitle = (TextView) header.findViewById(R.id.txt_title);
    TextView txtFooterTitle = (TextView) footer.findViewById(R.id.txt_title);
    txtHeaderTitle.setText("THE HEADER!");
    txtFooterTitle.setText("THE FOOTER!");

    listView.addHeaderView(header);
    listView.addFooterView(footer);

    final SampleAdapter adapter = new SampleAdapter(this, R.id.txt_line1);
    listView.setAdapter(adapter);

    final List<String> sampleData = SampleData.generateSampleData();
    for (String data : sampleData) {
      adapter.add(data);
    }
  }
コード例 #6
0
  private void initView(String cont) {
    if (CommUtil.isBlank(cont)) {
      return;
    }
    String[] conts = cont.split(" *, *");
    if (conts.length != 5) {
      Log.e(Constants.TAG, "指令长度不为10节,长度不对,指令内容:" + cont);
      return;
    }
    String[] time1 = formatTimeStr(conts[1].replaceAll(CmdType.CL.getType() + "=", ""));
    String[] time2 = formatTimeStr(conts[3]);
    startTimeTV.setText(time1[0]);
    endTimeTV.setText(time1[1]);
    startTimeTV1.setText(time2[0]);
    endTimeTV1.setText(time2[1]);

    int j = 2;
    checkTVOne1.setChecked(!"0".equals(conts[j].charAt(0) + ""));
    checkTVOne2.setChecked(!"0".equals(conts[j].charAt(1) + ""));
    checkTVOne3.setChecked(!"0".equals(conts[j].charAt(2) + ""));
    checkTVOne4.setChecked(!"0".equals(conts[j].charAt(3) + ""));
    checkTVOne5.setChecked(!"0".equals(conts[j].charAt(4) + ""));
    checkTVOne6.setChecked(!"0".equals(conts[j].charAt(5) + ""));
    checkTVOne7.setChecked(!"0".equals(conts[j].charAt(6) + ""));

    int i = 4;
    checkTV1.setChecked(!"0".equals(conts[i].charAt(0) + ""));
    checkTV2.setChecked(!"0".equals(conts[i].charAt(1) + ""));
    checkTV3.setChecked(!"0".equals(conts[i].charAt(2) + ""));
    checkTV4.setChecked(!"0".equals(conts[i].charAt(3) + ""));
    checkTV5.setChecked(!"0".equals(conts[i].charAt(4) + ""));
    checkTV6.setChecked(!"0".equals(conts[i].charAt(5) + ""));
    checkTV7.setChecked(!"0".equals(conts[i].charAt(6) + ""));
  }
コード例 #7
0
ファイル: Tab2_Search.java プロジェクト: narae427/pure_e
  public void AddCursorData(Cursor outCursor) {
    sp_adapter.clear();

    if (outCursor.getCount() == 0) {
      s_result.setText(" 검색 결과가 없습니다 ! ");

      return;
    }
    s_result.setText("");
    int musicNumberCol = outCursor.getColumnIndex("music_num");
    int titleCol = outCursor.getColumnIndex("m_title");
    int artistCol = outCursor.getColumnIndex("m_artist");
    int imageCol = outCursor.getColumnIndex("m_image");
    int urlCol = outCursor.getColumnIndex("m_url");
    int lyricsCol = outCursor.getColumnIndex("lyrics");
    int scoreCol = outCursor.getColumnIndex("score");

    Resources res = getResources();

    while (outCursor.moveToNext()) {
      int music_num = outCursor.getInt(musicNumberCol);
      String m_title = outCursor.getString(titleCol);
      String m_artist = outCursor.getString(artistCol);
      byte[] m_image = outCursor.getBlob(imageCol);
      String m_url = outCursor.getString(urlCol);
      String lyrics = outCursor.getString(lyricsCol);
      int score = outCursor.getInt(scoreCol);
      sp_adapter.addItem(new IconTextItem(m_image, m_title, m_artist, m_url, lyrics, score));
    }
    outCursor.close();
  }
コード例 #8
0
        @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));
          }
        }
コード例 #9
0
 @Override
 public void bindView(View view, Context context, Cursor cursor) {
   super.bindView(view, context, cursor);
   TextView setup = (TextView) view.findViewById(R.id.text3);
   TextView reply = (TextView) view.findViewById(R.id.text4);
   locationCursor.moveToPosition(cursor.getPosition());
   long rt = locationCursor.getLong(1);
   if (rt > 0) {
     Calendar cal = Calendar.getInstance();
     cal.setTimeInMillis(rt);
     DateFormat sdf = SimpleDateFormat.getDateTimeInstance();
     setup.setText("requested on: " + sdf.format(cal.getTime()));
   } else {
     setup.setText("requested on: <not available>");
   }
   rt = locationCursor.getLong(2);
   if (rt > 0) {
     Calendar cal = Calendar.getInstance();
     cal.setTimeInMillis(rt);
     DateFormat sdf = SimpleDateFormat.getDateTimeInstance();
     reply.setText("updated on:" + sdf.format(cal.getTime()));
     ((ImageView) view.findViewById(R.id.status))
         .setImageResource(android.R.drawable.presence_online);
   } else {
     reply.setText("updated on: <not available>");
   }
 }
コード例 #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    earIcon = (ImageView) findViewById(R.id.earIcon);
    flatDisplay = (TextView) findViewById(R.id.flatText);
    sharpDisplay = (TextView) findViewById(R.id.sharpText);
    prevNote = (TextView) findViewById(R.id.nextLower);
    nextNote = (TextView) findViewById(R.id.nextHigher);
    noteDisplay = (TextView) findViewById(R.id.noteDisplay);
    noteDisplay.setKeepScreenOn(true);
    noteDisplay.setText("");
    instruction = (TextView) findViewById(R.id.tunerInsruction);
    instruction.setText("");

    offsetCentView = (CenterOffsetView) findViewById(R.id.centView);
    offsetCentView.setRange(25);
    offsetCentView.setQuantization(2.5f);
    offsetCentView.setMarkAt(kCentThreshold);

    int techVisibility = kShowTechInfo ? View.VISIBLE : View.INVISIBLE;
    frequencyDisplay = (TextView) findViewById(R.id.frequencyDisplay);
    frequencyDisplay.setVisibility(techVisibility);
    decibelView = (TextView) findViewById(R.id.decibelView);
    decibelView.setVisibility(techVisibility);

    addAccidentalListener();
  }
コード例 #11
0
ファイル: ActivityGame.java プロジェクト: tzachs/Trivia
  private void parseGameSetupAndStart() {

    switch (mCurrentGameType) {
      case GAMETYPE_ALL_QUESTIONS:
        break;
      case GAMETYPE_CATEGORIES:
        break;
      case GAMETYPE_LEVELS:
        mCurrentGame =
            new ClassGameLevels(
                mCurrentGameType,
                3,
                10,
                10,
                mRestartLivesEachLevel,
                mTriviaDb,
                mTimeToAnswerQuestion);

        break;

      default:
        break;
    }

    mCurrentGame.setGameListener(this);
    // TODO: change this to start from certain level
    mCurrentGame.setupNewGame(0);
    textViewLivesLeftValue.setText(mCurrentGame.getCurrentLivesAsString());
    textViewGameScoreText.setText(mCurrentGame.getGameScoreAsString());
    showStartLevel();
  }
コード例 #12
0
ファイル: StartTasks.java プロジェクト: pimmen89/taskMaster
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View sView = convertView;

      if (position < nThumbsIds.size() - 1) {
        LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
        if (chosen.indexOf(nThumbsIds.get(position)) == -1) {
          sView = inflater.inflate(R.layout.task_square, parent, false);
          TextView tView = (TextView) sView.findViewById(R.id.textView);
          tView.setText(nThumbsIds.get(position));
        } else {
          sView = inflater.inflate(R.layout.selectedsquare, parent, false);
          TextView tView = (TextView) sView.findViewById(R.id.selectTextView);
          tView.setText(nThumbsIds.get(position));
        }
      } else {
        LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
        sView = inflater.inflate(R.layout.new_square, parent, false);

        TextView tView = (TextView) sView.findViewById(R.id.newTextView);

        tView.setText(nThumbsIds.get(position));
      }

      return sView;
    }
コード例 #13
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi =
            (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.row_facility, null);
      }

      FacilityModel areaInfo = items.get(position);

      if (areaInfo != null) {
        TextView facility_name = (TextView) v.findViewById(R.id.row_facility_name);
        TextView facility_type = (TextView) v.findViewById(R.id.row_facility_type);
        TextView facility_phone = (TextView) v.findViewById(R.id.row_facility_phone);
        TextView facility_address = (TextView) v.findViewById(R.id.row_facility_address);

        facility_name.setText(areaInfo.getName());
        if (areaInfo.getType() == 0) {
          facility_type.setText("공립");
        } else {
          facility_type.setText("사립");
        }
        facility_phone.setText(areaInfo.getTelephone());
        facility_address.setText(areaInfo.getAddress());
      }

      return v;
    }
コード例 #14
0
  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;
    }
  }
コード例 #15
0
  public void rollDice() {
    int rollResult;
    int[] rolls;

    switch (m_rollMode) {
      case SINGLE:
        m_rollResultTv.setText(Integer.toString(m_diceSet.singleRoll(getDieType())));
        break;
      case XDY:
        rolls = m_diceSet.multiRollWithResults(getDieQuantity(), getDieType());
        rollResult = sumIntArray(rolls);
        m_rollResultTv.setText(Integer.toString(rollResult));
        refreshRollsListView(rolls);
        break;
      case CUMULATIVE:
        rolls = m_diceSet.multiRollWithResults(getDieQuantity(), getDieType());
        rollResult = sumIntArray(rolls);
        m_rollSum += rollResult;
        if (m_rollSum > MAX_ROLL_SUM) m_rollSum = MAX_ROLL_SUM;
        m_rollSumTv.setText(getString(R.string.roller_sum_label) + " " + m_rollSum);
        m_rollResultTv.setText(Integer.toString(rollResult));
        refreshRollsListView(rolls);
        break;
      default:
        throw new IllegalStateException("Invalid roll mode: " + m_rollMode);
    }
  }
コード例 #16
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);
    }
  }
コード例 #17
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String response = getIntent().getStringExtra("response");
    boolean success = getIntent().getBooleanExtra("success", false);

    LinearLayout l = new LinearLayout(this);
    l.setOrientation(LinearLayout.VERTICAL);
    l.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    l.setPadding(10, 10, 10, 10);

    TextView t = new TextView(this);
    t.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    t.setGravity(Gravity.CENTER);
    if (success) {
      t.setText(R.string.sync_ok);
    } else {
      t.setText(R.string.sync_failed);
    }
    t.setTextSize(22);
    l.addView(t);
    t = new TextView(this);
    t.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    t.setText(response);
    l.addView(t);
    setContentView(l);
  }
コード例 #18
0
ファイル: MainActivity.java プロジェクト: uriunger/bitcoin
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View v;
      if (convertView == null) {
        v = mInflater.inflate(R.layout.monitor, parent, false);
      } else {
        v = convertView;
      }

      Monitor monitor = getMonitorByPosition(position);

      TextView monitorName = (TextView) v.findViewById(R.id.monitorName);
      monitorName.setText(monitor.name());

      TextView monitorDescription = (TextView) v.findViewById(R.id.monitorDescription);
      monitorDescription.setText(monitor.desc());

      Button removeButton = (Button) v.findViewById(R.id.removeMonitorButton);
      removeButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              new DeleteMonitorDialogFragment(
                      new Runnable() {
                        @Override
                        public void run() {
                          monitoringService.removeMonitor(getMonitorIdByPosition(position));
                          onDataChange();
                        }
                      })
                  .show(getFragmentManager(), "DeleteMonitor");
            }
          });

      Button editButton = (Button) v.findViewById(R.id.editMonitorButton);
      editButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent intent = new Intent(MainActivity.this, TickerMonitorEditActivity.class);
              intent.putExtra(MONITOR_ID, getMonitorIdByPosition(position));
              startActivityForResult(intent, 1);
              // actual change the monitor is done on onActivityResult
            }
          });

      GridView monitorResponses = (GridView) v.findViewById(R.id.monitorResponses);
      try {
        ResponseAdapter adapter = monitorResultsAdapters.get(monitor);
        monitorResponses.setAdapter(adapter);
      } catch (RuntimeException e) {
        Log.e(CoynesMonitoring.TAG, "caught exception", e);
        throw e;
      }

      return v;
    }
コード例 #19
0
 /** Update user's profile info */
 private void updateUI() {
   if (mUser != null) {
     mUserInfo.setText(buildUserInfoDisplay(mUser));
     mProfilePictureView.setProfileId(mUser.getId());
   } else {
     mUserInfo.setText(null);
     mProfilePictureView.setProfileId(null);
   }
 }
コード例 #20
0
  void startPainting() {
    if (anomaly.getEcgDataList() != null && anomaly.getEcgDataList().size() != 0) {

      handler = new Handler();
      runnable =
          new Runnable() {
            @Override
            public void run() {

              int[] datas = new int[2];
              datas[0] = anomaly.getEcgDataList().get(i).getRAW_ra_ll();
              datas[1] = anomaly.getEcgDataList().get(i).getRAW_la_ll();
              graphView.setDataWithAdjustment(datas, "Shimmer", "u12");

              i++;
              if (i == anomaly.getEcgDataList().size()) {
                handler.removeCallbacks(runnable);

                playButton.setVisibility(Button.INVISIBLE);
                pauseButton.setVisibility(Button.INVISIBLE);
              } else {
                handler.postDelayed(runnable, 5);
              }
            }
          };

      handler.postDelayed(runnable, 0);

      boolean[] detectedAnomalies = anomaly.getDetectedAnomalies();

      if (detectedAnomalies[0]) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER_HORIZONTAL);
        textView.setTextSize(16);
        textView.setText("PQ arası anomali");
        llDetectedAnomalies.addView(textView);
      }
      if (detectedAnomalies[1]) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER_HORIZONTAL);
        textView.setTextSize(16);
        textView.setText("QRS arası anomali");
        llDetectedAnomalies.addView(textView);
      }
      if (detectedAnomalies[2]) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER_HORIZONTAL);
        textView.setTextSize(16);
        textView.setText("QT arası anomali");
        llDetectedAnomalies.addView(textView);
      }

    } else {
      Toast.makeText(context, "Bir sorun oluştu", Toast.LENGTH_LONG).show();
    }
  }
コード例 #21
0
  private void playMusic(int iPosition) {
    AudioVO mAudio = null;
    if ((iType == 0) || (iType == 1)) mAudio = (AudioVO) mAudioList.getItem(iPosition);
    else mAudio = (AudioVO) mDragAudioList.getItem(iPosition);
    mTxtTitle.setText((CharSequence) mAudio.getTitle());
    mTxtDescription.setText((CharSequence) mAudio.getDescription());

    startMediaPlayer(
        2, iType, iPosition, 0, 0, mAudio.getId(), mAudio.getTitle(), mAudio.getDescription());
  }
コード例 #22
0
ファイル: EditPage.java プロジェクト: ychy00001/ShareSdkLibs
  // if platform selected form platform gridview is SinaWeibo,
  // TencentWeibo, Facebook, or Twitter, there will be a button
  // in the left-bottom of the page, which provides At-friends function
  private LinearLayout getAtLine(String platform) {
    if (!isShowAtUserLayout(platform)) {
      return null;
    }
    LinearLayout llAt = new LinearLayout(getContext());
    LayoutParams lpAt = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpAt.rightMargin = dipToPx(getContext(), 4);
    lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
    lpAt.weight = 1;
    llAt.setLayoutParams(lpAt);
    llAt.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            if (platforms != null && platforms.size() > 0) {
              FollowListPage subPage = new FollowListPage();
              subPage.setPlatform(platforms.get(0));
              subPage.showForResult(activity, null, EditPage.this);
            } else {
              int resId = getStringRes(activity, "ssdk_oks_select_one_plat_at_least");
              if (resId > 0) {
                Toast.makeText(getContext(), resId, Toast.LENGTH_SHORT).show();
              }
            }
          }
        });

    TextView tvAt = new TextView(getContext());
    int resId = getBitmapRes(activity, "ssdk_oks_btn_back_nor");
    if (resId > 0) {
      tvAt.setBackgroundResource(resId);
    }
    int dp_32 = dipToPx(getContext(), 32);
    tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32));
    tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    tvAt.setText(getAtUserButtonText(platform));
    int dp_2 = dipToPx(getContext(), 2);
    tvAt.setPadding(0, 0, 0, dp_2);
    tvAt.setTypeface(Typeface.DEFAULT_BOLD);
    tvAt.setTextColor(0xff000000);
    tvAt.setGravity(Gravity.CENTER);
    llAt.addView(tvAt);

    TextView tvName = new TextView(getContext());
    tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    tvName.setTextColor(0xff000000);
    resId = getStringRes(activity, "ssdk_oks_list_friends");
    String text = getContext().getString(resId, getName(platform));
    tvName.setText(text);
    LayoutParams lpName = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpName.gravity = Gravity.CENTER_VERTICAL;
    tvName.setLayoutParams(lpName);
    llAt.addView(tvName);

    return llAt;
  }
コード例 #23
0
  public void onResume() {
    super.onResume();

    // Log.i("WaveLoop", "onStart");

    if (PlayerProxy.instance() == null) {
      // mNowPlayingMain.setEnabled(false);
      // mNowPlayingMain.setVisibility(View.INVISIBLE);

      mWaveLoopMain.removeView(mNowPlayingMain);
      return;
    }

    final AudioInfo audioInfo = PlayerProxy.getAudioInfo();
    if (audioInfo != null) {
      mWaveLoopMain.removeView(mNowPlayingMain);
      mWaveLoopMain.addView(mNowPlayingMain);

      // mNowPlayingMain.setEnabled(true);
      // mNowPlayingMain.setVisibility(View.VISIBLE);

      mNowPlayingArtist.setText(audioInfo.artist);
      mNowPlayingAlbum.setText(audioInfo.album);
      mNowPlayingTitle.setText(audioInfo.title);

      mNowPlayingPlayBtn.setImageResource(
          (PlayerProxy.isPlaying()) ? R.drawable.pause_bkgnd : R.drawable.play_bkgnd);

      mNowPlayingPlayBtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (PlayerProxy.isPlaying()) PlayerProxy.pause();
              else PlayerProxy.play();

              mNowPlayingPlayBtn.setImageResource(
                  (PlayerProxy.isPlaying()) ? R.drawable.pause_bkgnd : R.drawable.play_bkgnd);
            }
          });

      mNowPlayingBtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent i = new Intent(WaveLoopActivity.this, player_main.class);
              i.putExtra("오디오파일경로", (int) audioInfo.dataRowId);
              startActivity(i);
            }
          });
    } else {
      mWaveLoopMain.removeView(mNowPlayingMain);
      // mNowPlayingMain.setEnabled(false);
      // mNowPlayingMain.setVisibility(View.INVISIBLE);
    }
  }
コード例 #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_qnbankanswered_child);

    checkChildNotification();

    loginUser = BrainJuice.retrieveLoginUser();
    userMgr = BrainJuice.retrieveUserMgr();

    icon = (ImageView) this.findViewById(R.id.qnprofilepic);
    int j =
        getResources()
            .getIdentifier(
                userMgr.retrieveUser(loginUser).getProfile(), "drawable", getPackageName());
    icon.setImageResource(j);

    welcomeMsg = (TextView) this.findViewById(R.id.widget50);
    welcomeMsg.setText(Html.fromHtml("Hi, " + loginUser));

    faq = (ImageButton) this.findViewById(R.id.FAQ);
    faq.setOnClickListener(this);

    logout = (ImageButton) this.findViewById(R.id.Logout);
    logout.setOnClickListener(this);

    asking = (ImageButton) this.findViewById(R.id.Asking);
    asking.setOnClickListener(this);

    notification = (ImageButton) this.findViewById(R.id.notification);
    notification.setOnClickListener(this);

    qnbank = (ImageButton) this.findViewById(R.id.QuestionBank);
    qnbank.setOnClickListener(this);

    setting = (ImageButton) this.findViewById(R.id.widget43);
    setting.setOnClickListener(this);

    qnBody = (TextView) this.findViewById(R.id.QuestionBody);
    qnBody.setText(getIntent().getStringExtra("qn"));

    ansBody = (TextView) this.findViewById(R.id.AnswerBody);
    ansBody.setText(
        Html.fromHtml(
            "Replied by "
                + getIntent().getStringExtra("userReplied")
                + "<br /><br />"
                + getIntent().getStringExtra("answer")));

    if (getIntent().getStringExtra("like").equals("true")) {
      like = (TextView) this.findViewById(R.id.like);
      like.setText("You like this answer!");
    }
  }
コード例 #25
0
  public GdxLock(
      Context context,
      Configuration configuration,
      LockPatternUtils lockPatternUtils,
      KeyguardUpdateMonitor updateMonitor,
      KeyguardScreenCallback callback) {
    super(context);

    mContext = context;
    mCallback = callback;

    // init gesture detector
    // gestureDetector = new GestureDetector(new MyGestureDetector());

    // initialize lockscreen layout
    final LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(R.layout.gdxlock_sense3, this, true);

    // init screen width and height
    Display d =
        ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    mDisplayWidth = d.getWidth();
    mDisplayHeight = d.getHeight();

    // init ring
    ring = (ImageView) findViewById(R.id.ring);

    // move the ring to default position
    int left = (int) (mDisplayWidth / 2 - ringWidth / 2);
    int top = (int) (mDisplayHeight - ringHeight / 2 - 20 + 110);
    ring.setPadding(left, top, 0, 0);

    // set background...
    ViewGroup lockWallpaper = (ViewGroup) findViewById(R.id.root);
    setBackground(mContext, lockWallpaper);

    setFocusable(true);
    setFocusableInTouchMode(true);
    setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    // time & date setup
    mClock = (TextView) findViewById(R.id.clock);
    mDate = (TextView) findViewById(R.id.date);

    // label setup
    mdxLeft = (TextView) findViewById(R.id.dxLeft);
    mdxRight = (TextView) findViewById(R.id.dxRight);
    mdxLeft.setVisibility(View.VISIBLE);
    mdxLeft.setText(" ");
    mdxLeft.setTextColor(0xffffffff);
    mdxRight.setVisibility(View.VISIBLE);
    mdxRight.setText(" ");
    mdxRight.setTextColor(0xffffffff);
  }
コード例 #26
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      if (convertView == null) {
        convertView = LayoutInflater.from(getActivity()).inflate(R.layout.review_card, null);
      }

      ReviewData reviewData = getItem(position);

      // Author name
      TextView authorTextView = (TextView) convertView.findViewById(R.id.review_author);
      authorTextView.setText(reviewData.getAuthor());

      // Review content
      final TextView reviewContentTextView =
          (TextView) convertView.findViewById(R.id.review_content);
      reviewContentTextView.setText(reviewData.getContent());

      // Read more text
      final TextView readMoreTextView = (TextView) convertView.findViewById(R.id.read_more_action);

      // TextView.getLineCount() will return 0 after setText(), have to check getLineCount() in
      // TextView.post(Runnable)
      reviewContentTextView.post(
          new Runnable() {
            @Override
            public void run() {
              // If the review content is longer than a number of lines, show read-more TextView
              if (reviewContentTextView.getLineCount()
                  > getResources().getInteger(R.integer.review_default_line_num)) {
                readMoreTextView.setOnClickListener(
                    new View.OnClickListener() {
                      @Override
                      public void onClick(View view) {

                        // Scroll down animation of review
                        ObjectAnimator animation =
                            ObjectAnimator.ofInt(
                                reviewContentTextView,
                                "maxLines",
                                reviewContentTextView.getLineCount());
                        animation.setDuration(1000).start();
                        readMoreTextView.setVisibility(View.GONE);
                      }
                    });
              } else { // If the review content short enough, read-more feature is no needed, hide
                // it
                readMoreTextView.setVisibility(View.GONE);
              }
            }
          });

      return convertView;
    }
コード例 #27
0
ファイル: SongView.java プロジェクト: Trupal00p/Subsonic
  public void setSong(MusicDirectory.Entry song, boolean checkable) {
    this.song = song;
    StringBuilder artist = new StringBuilder(40);

    String bitRate = null;
    if (song.getBitRate() != null) {
      bitRate =
          String.format(getContext().getString(R.string.song_details_kbps), song.getBitRate());
    }

    String fileFormat = null;
    if (song.getTranscodedSuffix() != null
        && !song.getTranscodedSuffix().equals(song.getSuffix())) {
      fileFormat = String.format("%s > %s", song.getSuffix(), song.getTranscodedSuffix());
    } else {
      fileFormat = song.getSuffix();
    }

    if (!song.isVideo()) {
      artist
          .append(song.getArtist())
          .append(" (")
          .append(
              String.format(
                  getContext().getString(R.string.song_details_all),
                  bitRate == null ? "" : bitRate,
                  fileFormat))
          .append(")");
    } else {
      artist.append(
          String.format(
              getContext().getString(R.string.song_details_all),
              bitRate == null ? "" : bitRate,
              fileFormat));
    }

    titleTextView.setText(song.getTitle());
    artistTextView.setText(artist);
    durationTextView.setText(Util.formatDuration(song.getDuration()));
    checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE);
    starButton.setVisibility(
        (Util.isOffline(getContext()) || !song.isStarred()) ? View.GONE : View.VISIBLE);
    starButton.setFocusable(false);

    moreButton = (ImageView) findViewById(R.id.artist_more);
    moreButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.showContextMenu();
          }
        });

    update();
  }
コード例 #28
0
  /** Config UI just one time */
  private void configUI() {
    setOrientation(LinearLayout.VERTICAL);
    setPadding(8, 8, 8, 8);

    TextView titleView = new TextView(ctx);
    titleView.setText(TEXT_TITLE);
    titleView.setTextColor(Color.LTGRAY);
    addView(titleView);

    LinearLayout subLayout = new LinearLayout(ctx);
    subLayout.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams subLayoutParams =
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    // configuring the iconView
    iconView.setImageDrawable(icon);
    LayoutParams icParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    icParams.gravity = Gravity.CENTER_VERTICAL;

    // configuring the msgView
    msgView.setText(msg);
    msgView.setPadding(10, 0, 0, 0);
    msgView.setTextSize(20);
    msgView.setTextColor(Color.WHITE);
    msgView.setGravity(Gravity.CENTER_VERTICAL);
    msgView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    msgView.setMaxLines(1);
    LayoutParams tvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    subLayout.addView(iconView, icParams);
    subLayout.addView(msgView, tvParams);

    addView(subLayout, subLayoutParams);

    actionBtn.setText(TEXT_DELETE);
    actionBtn.setTextColor(Color.WHITE);
    addView(actionBtn, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    undoRedoLayout.setOrientation(LinearLayout.HORIZONTAL);
    undoView = new ImageView(ctx);
    redoView = new ImageView(ctx);
    undoView.setImageDrawable(DrawableFactory.build(ctx, DrawableFactory.ICON_UNDO));
    redoView.setImageDrawable(DrawableFactory.build(ctx, DrawableFactory.ICON_REDO));
    undoView.setClickable(true);
    redoView.setClickable(true);
    LayoutParams undoRedoParams =
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    undoRedoParams.weight = 1;
    undoRedoLayout.addView(undoView, undoRedoParams);
    undoRedoLayout.addView(redoView, undoRedoParams);
    addView(undoRedoLayout);
  }
コード例 #29
0
 public void initDataGooder() {
   // 商家gooder
   user_name.setText(
       "店名:"
           + gooder.getName()
           + "\n"
           + "电话:"
           + gooder.getMobile()
           + "\n"
           + "地址:"
           + gooder.getAddress());
   user_cont.setText("简介:" + gooder.getInfo());
 }
コード例 #30
0
ファイル: AppAdapter.java プロジェクト: keoyauthin/File_Quest
		@Override
		protected void onPostExecute(Void result) {
			iView.setImageDrawable(draw);
			iTv.setText(name);
			iTv2.setText(size);
			if(date == 0){
				iTv3.setText("No Backup");
				iTv.setTextColor(Color.WHITE);
			}else{
				iTv3.setText("Backup On :" + new Date(date));
				iTv.setTextColor(Color.GREEN);
			}
			super.onPostExecute(result);
		}