@Override
 public void onReceive(Context context, Intent intent) {
   // TODO Auto-generated method stub
   if (intent.getAction().equals("android.intent.action.HEADSET_PLUG")) {
     headset_name.setText("headset name = " + intent.getStringExtra("name"));
     if (intent.hasExtra("state")) {
       if (0 == intent.getIntExtra("state", 2)) {
         // 耳机拔出
         headset_name.setText("");
         headset_img.setImageResource(R.drawable.phoneflat);
       }
       if (1 == intent.getIntExtra("state", 2)) {
         // 耳机插入
         if (intent.hasExtra("microphone")) {
           if (0 == intent.getIntExtra("microphone", 2)) {
             // 耳机没有麦克风
             headset_img.setImageResource(R.drawable.headset_without_mic);
           }
           if (1 == intent.getIntExtra("microphone", 2)) {
             // 耳机有麦克风
             headset_img.setImageResource(R.drawable.headset_with_mic);
           }
         }
       }
     }
   }
 }
 public void onRadioButtonClicked(View v) {
   if (v.getId() == R.id.group_closed_radio) {
     groupLogo.setImageResource(R.drawable.group_closed);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_closed_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_closed
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_closed_description);
   } else if (v.getId() == R.id.group_open_radio) {
     groupLogo.setImageResource(R.drawable.group_open);
     groupLogo.setBackgroundColor(R.color.color_primary);
     groupTypeDescr.setText(R.string.group_open_description);
     Log.e(
         TAG,
         "Cliccato: "
             + v.getId()
             + "! Setto: "
             + R.drawable.group_open
             + ", "
             + R.color.color_primary
             + ", "
             + R.string.group_open_description);
   }
 }
Exemple #3
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ndialog);
    instance = ndialog.this;
    // 获取传递过来的参数
    Bundle b = new Bundle();
    b = getIntent().getBundleExtra("data");
    promt = b.getString("promt");
    icon = b.getInt("icon");
    time = b.getInt("time");
    // 绑定组件
    IvIcon = (ImageView) findViewById(R.id.icon);
    TvPromt = (TextView) findViewById(R.id.promt);
    // 设置提示框内容,delay为提示框延迟函数
    TvPromt.setText(promt);
    switch (icon) {
      case 0:
        IvIcon.setImageResource(R.drawable.wrong1);
        break;
      case 1:
        IvIcon.setImageResource(R.drawable.loading);
        Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.animation);
        IvIcon.startAnimation(hyperspaceJumpAnimation);
        isYaolianwang = true;
        setFinishOnTouchOutside(false); // 点击外部不返回

        break;
      default:
        IvIcon.setImageResource(R.mipmap.about1);
    }

    delay();
  }
Exemple #4
0
  public void updateMainContent(Card cc) {
    TextView cash = (TextView) findViewById(R.id.menu_text);
    if (game.getAddedCash() > 0)
      cash.setText("Cash: $" + game.getCash() + "  (+$" + game.getAddedCash() + ")");
    else if (game.getAddedCash() < 0)
      cash.setText("Cash: $" + game.getCash() + "  ($" + game.getAddedCash() + ")");
    else cash.setText("Cash: $" + game.getCash());

    LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout3);
    new Color();
    ll.setBackgroundColor(
        Color.rgb(
            game.getCurrentCard().getColor()[0],
            game.getCurrentCard().getColor()[1],
            game.getCurrentCard().getColor()[2]));

    TextView h1 = (TextView) findViewById(R.id.textView1);
    h1.setText(cc.getStreet().toUpperCase());

    TextView h2 = (TextView) findViewById(R.id.textView2);
    h2.setText(cc.getArea());

    TextView own = (TextView) findViewById(R.id.textView3);
    own.setText("" + cc.getOwner());

    TextView val = (TextView) findViewById(R.id.textView4);
    val.setText("$" + Integer.toString(cc.getValue()));

    TextView tax = (TextView) findViewById(R.id.textView5);
    tax.setText("$" + Integer.toString(cc.getTax()));

    TextView hou = (TextView) findViewById(R.id.textView6);
    String pri = new String();
    if (cc.getHousePrise() <= 0) pri = " --";
    else pri = Integer.toString(cc.getHousePrise());
    hou.setText("$" + pri);

    // The buttons
    buyStreet.setEnabled(
        game.getCash() >= game.getCurrentCard().getValue()
            && game.getCurrentCard().getStreet() != GameMechanics.DEFAULT_STREET
            && game.getPlayer().getUserId() != game.getCurrentCard().getOwnerId());

    buyHouse.setEnabled(
        game.getCash() >= game.getCurrentCard().getHousePrise()
            && game.getCurrentCard().getHouses() < 5
            && game.getCurrentCard().getStreet() != GameMechanics.DEFAULT_STREET
            && game.getPlayer().getUserId() == game.getCurrentCard().getOwnerId());

    // Do the houses
    for (int i = 1; i <= 5; i++) {
      ImageView houses = new ImageView(this);
      houses = (ImageView) findViewById(ivid[i]);
      if (cc.getHouses() >= i) houses.setImageResource(hoid[i]);
      else houses.setImageResource(hoid[0]);
      houses.invalidate();
    }

    return;
  }
  public void dropIn(View view) {
    if (gameIsActive) {
      ImageView counter = (ImageView) view;
      String tag = (String) counter.getTag();
      int num = Integer.parseInt(tag);
      if (spots[num] == 2) {
        counter.setTranslationY(-1000f);
        if (player == 0) {
          counter.setImageResource(R.drawable.yellow);
          spots[num] = 0;
          checkIfWon();
          player = 1;

        } else if (player == 1) {
          counter.setImageResource(R.drawable.red);
          spots[num] = 1;
          checkIfWon();
          player = 0;
        }
        counter.animate().translationYBy(1000f).rotation(360).setDuration(1000);

      } else
        Toast.makeText(this, "Please Choose A Spot That Hasn't Been Taken", Toast.LENGTH_SHORT)
            .show();
    }
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View return_view = null;

    return_view = _inflater.inflate(R.layout.album_view_item, null);

    ImageView cover = (ImageView) return_view.findViewById(R.id.album_view_item_cover);
    TextView name = (TextView) return_view.findViewById(R.id.album_view_name);

    try {
      if (_albums.get(position) != null) {
        if (_albums.get(position).isLocked() && !_albums.get(position).getPassword().equals("")) {
          cover.setImageResource(R.drawable.album_cover_locked);
        } else {
          cover.setImageResource(R.drawable.album_cover_default);
        }

        name.setText(_albums.get(position).getAlbumName());
        name.setEllipsize(TruncateAt.MARQUEE);
        name.setMarqueeRepeatLimit(-1);
        name.setSelected(true);
      }
    } catch (Exception e) {
    }

    return_view.startAnimation(AnimationUtils.loadAnimation(_activity, android.R.anim.fade_in));
    return return_view;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    InstagramPhoto photo = getItem(position);

    if (convertView == null) { // is recycled view ?
      // create one
      convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_photo, parent, false);
    }

    TextView tvCaption = (TextView) convertView.findViewById(R.id.tvCaption);
    TextView tvUser = (TextView) convertView.findViewById(R.id.tvUser);
    TextView tvComment1 = (TextView) convertView.findViewById(R.id.tvComment1);
    TextView tvLikes = (TextView) convertView.findViewById(R.id.tvLikes);
    ImageView ivPhoto = (ImageView) convertView.findViewById(R.id.ivPhoto);
    ImageView ivThumb = (ImageView) convertView.findViewById(R.id.ivThumb);

    tvCaption.setText(photo.caption);
    tvUser.setText(photo.username);
    tvComment1.setText(photo.comments);
    tvLikes.setText(photo.likes);
    // tvUsername.setText() //still have a username remains unused

    ivPhoto.setImageResource(0); // clear image first (this might be a recycled view)
    ivThumb.setImageResource(0); // as above
    Picasso.with(getContext()).load(photo.imageUrl).into(ivPhoto); // call picasso lib to load image
    Picasso.with(getContext())
        .load(photo.profilePicture)
        .into(ivThumb); // call picasso lib to load image

    return convertView;
  }
  @Override
  public void onViewCreated(View view, Bundle onSavedInstanceState) {
    super.onViewCreated(view, onSavedInstanceState);
    jpg = (ImageView) getView().findViewById(R.id.imageView3);
    cal1000();
    cal1200();
    cal1500();
    cal1800();

    Bundle bundle = getArguments();
    if (bundle != null) buttonPushed = bundle.getInt("button");

    if (buttonPushed > 1) {
      if (buttonPushed == 1000) {
        jpg.setImageResource(R.drawable.image1000);
        jpg.setScaleType(ImageView.ScaleType.FIT_END);
      } else if (buttonPushed == 1200) {
        jpg.setImageResource(R.drawable.image1200);
        jpg.setScaleType(ImageView.ScaleType.FIT_END);
      } else if (buttonPushed == 1500) {
        jpg.setImageResource(R.drawable.image1500);
        jpg.setScaleType(ImageView.ScaleType.FIT_END);
      } else if (buttonPushed == 1800) {
        jpg.setImageResource(R.drawable.image1800);
        jpg.setScaleType(ImageView.ScaleType.FIT_END);
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_details);

    Intent intent = getIntent();
    blipProps = intent.getStringArrayListExtra("Blip Properties");

    if (blipProps != null) {
      TextView dialogName = (TextView) findViewById(R.id.txtName);
      dialogName.setText(blipProps.get(0));

      TextView dialogAddress = (TextView) findViewById(R.id.txtAddress);
      dialogAddress.setText(blipProps.get(1));

      TextView dialogCity = (TextView) findViewById(R.id.txtCity);
      dialogCity.setText(blipProps.get(2));

      TextView dialogState = (TextView) findViewById(R.id.txtState);
      dialogState.setText(blipProps.get(3));

      TextView dialogZip = (TextView) findViewById(R.id.txtZip);
      dialogZip.setText(blipProps.get(4));

      TextView dialogRecord = (TextView) findViewById(R.id.txtRecord);
      dialogRecord.setText(blipProps.get(5));

      TextView dialogViolation = (TextView) findViewById(R.id.txtViolation);
      dialogViolation.setText(blipProps.get(6));

      TextView dialogDesc = (TextView) findViewById(R.id.txtDesc);
      dialogDesc.setText(blipProps.get(7));

      TextView dialogComments = (TextView) findViewById(R.id.txtComments);
      dialogComments.setText(blipProps.get(8));

      TextView dialogAction = (TextView) findViewById(R.id.actionStatus);
      dialogAction.setText(blipProps.get(9));

      ImageView iImage = (ImageView) findViewById(R.id.detailImage);

      if (blipProps.get(9).equalsIgnoreCase("Abated")) {
        iImage.setImageResource(R.drawable.clean);
      } else if (blipProps.get(9).equalsIgnoreCase("Not Abated")) {
        iImage.setImageResource(R.drawable.td);
      } else {
        iImage.setImageResource(R.drawable.tu);
      }

      Button dialogButton = (Button) findViewById(R.id.btnCancel);
      dialogButton.setText("OK");
      dialogButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              finish();
            }
          });
    }
  }
 synchronized void initBottomStatus(int num) { // 4
   if (mLeftAmplitude == null || mRightAmplitude == null) {
     LogUtil.w(TAG, "mLeftAmplitude: " + mLeftAmplitude + " ,mRightAmplitude: " + mRightAmplitude);
     return;
   }
   mLeftAmplitude.removeAllViews();
   mRightAmplitude.removeAllViews();
   for (int i = 0; i < 6; i++) {
     ImageView imageViewl_i = new ImageView(getContext());
     ImageView imageViewR_i = new ImageView(getContext());
     if (i > (6 - num - 1)) { // 1
       imageViewl_i.setImageResource(R.drawable.chatroom_speaker);
     } else {
       imageViewl_i.setImageResource(R.drawable.chatroom_unspeaker);
     }
     if (i >= num) { // 4
       imageViewR_i.setImageResource(R.drawable.chatroom_unspeaker);
     } else {
       imageViewR_i.setImageResource(R.drawable.chatroom_speaker);
     }
     mLeftAmplitude.addView(
         imageViewl_i,
         new LinearLayout.LayoutParams(
             LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f));
     mRightAmplitude.addView(
         imageViewR_i,
         new LinearLayout.LayoutParams(
             LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f));
   }
 }
  public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    if (convertView == null) vi = inflater.inflate(R.layout.droplet_list_row, null);

    final Droplet droplet = data.get(position);
    Region region = droplet.getRegion();
    Image image = droplet.getImage();

    TextView nameTextView = (TextView) vi.findViewById(R.id.nameTextView);
    TextView ipAddressTextView = (TextView) vi.findViewById(R.id.ipAddressTextView);
    TextView statusTextView = (TextView) vi.findViewById(R.id.statusTextView);
    ImageView distroImageView = (ImageView) vi.findViewById(R.id.distroImageView);
    ImageView flagImageView = (ImageView) vi.findViewById(R.id.flagImageView);
    if (region != null) flagImageView.setImageResource(ApiHelper.getLocationFlag(region.getName()));
    else flagImageView.setVisibility(View.GONE);

    if (image != null)
      distroImageView.setImageResource(
          ApiHelper.getDistributionLogo(image.getDistribution(), droplet.getStatus()));

    nameTextView.setText(droplet.getName());
    ipAddressTextView.setText(droplet.getIpAddress());
    statusTextView.setText(droplet.getStatus());

    return vi;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = getLayoutInflater();
      View list_object = inflater.inflate(R.layout.single_list_object, parent, false);

      TextView label = (TextView) list_object.findViewById(R.id.row_text);
      TextView title = (TextView) findViewById(R.id.txtHeader);
      Typeface font1 = Typeface.createFromAsset(getAssets(), "HelveticaNeueLTStd-Roman.otf");
      Typeface font2 = Typeface.createFromAsset(getAssets(), "HelveticaNeueLTStd-Bd.otf");
      label.setTypeface(font1);
      title.setTypeface(font2);
      String[] title_array = getResources().getStringArray(R.array.cat_00);
      title.setText(title_array[0]);

      String[] cat_array = getResources().getStringArray(R.array.cat_01);
      label.setText(cat_array[position]);
      ImageView icon = (ImageView) list_object.findViewById(R.id.icon);

      // open close list array to open ();
      if (SetItem[position] == "1") {
        icon.setImageResource(R.drawable.icon_unlock);
      } else {
        icon.setImageResource(R.drawable.icon_lock);
      }

      return list_object;
    }
  @Override
  protected void onResume() {
    super.onResume();
    // fb
    try {
      uiHelper.onResume();
    } catch (Exception e) {
      e.printStackTrace(); // altrimenti crashava
    }
    // Rilancio la musica se e solo se non è già attiva
    // Questo ci permette di utilizzare la stessa traccia musicale tra Activity differenti, oltre
    // al metodo presente nel onPause che controlla se siamo o no in background
    KeyguardManager keyguardManager =
        (KeyguardManager) getApplicationContext().getSystemService(Activity.KEYGUARD_SERVICE);
    boolean bloccoSchermoAttivo = keyguardManager.inKeyguardRestrictedInputMode();
    if (!bloccoSchermoAttivo && !SoundManager.isBackgroundMusicPlaying()) {
      SoundManager.playBackgroundMusic(getApplicationContext());
      // Update SOUND UI ICON di conseguenza
      if (SoundManager.SOUND_ON) {
        if (soundImage != null) {
          soundImage.setImageResource(R.drawable.soundon);
        }
      } else {
        if (soundImage != null) {
          soundImage.setImageResource(R.drawable.soundoff);
        }
      }
    }

    waiting = false;
    waitingAudio = false;
    // LogUtils.logHeap();
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    int type = getItemViewType(position);
    if (convertView == null) {
      if (type == 0) {
        convertView = mInflater.inflate(R.layout.item_op, null);
      } else if (type == MediaEntity.IMAGE) {
        convertView = mInflater.inflate(R.layout.item_grid, null);
      } else if (type == MediaEntity.AUDIO) {
        convertView = mInflater.inflate(R.layout.item_grid, null);
      } else if (type == MediaEntity.VIDEO) {
        convertView = mInflater.inflate(R.layout.item_grid_video, null);
      } else {
        throw new IllegalArgumentException("no this kind of viewType");
      }
    }

    int folderType = mDataFolder.getType();
    if (position == 0) {
      ImageView img = (ImageView) convertView;
      if (folderType == MediaEntity.IMAGE) {
        img.setImageResource(R.mipmap.img_op_camera);
        img.setOnClickListener(v -> mActivity.toTakePhoto());
      } else if (type == MediaEntity.VIDEO) {
        img.setImageResource(R.mipmap.img_op_video);
        img.setOnClickListener(v -> mActivity.toMakeVideo());
      }
    } else {
      ImageView imgCover = (ImageView) convertView.findViewById(R.id.img);
      ImageView imgCheck = (ImageView) convertView.findViewById(R.id.img_check_box);
      int realPosition = position - 1;
      MediaEntity en = mDada.get(realPosition);
      imgCheck.setSelected(mediaManager.isSelected(en));
      imgCheck.setOnClickListener(v1 -> mediaManager.toggle(en));

      Glide.with(mActivity).load(en.getPath()).crossFade().into(imgCover);
      if (type == MediaEntity.IMAGE) {
        imgCover.setOnClickListener(
            v -> {
              if (mOnMediaClickListener == null) {
                ActivityImageShower.startActivity(mActivity, mDataFolder, realPosition);
              } else {
                mOnMediaClickListener.onMediaClick(en, realPosition);
              }
            });
      } else if (type == MediaEntity.VIDEO) {
        TextView txtTime = (TextView) convertView.findViewById(R.id.txt_time);
        txtTime.setText(getSecond(en.getDuration()));
        imgCover.setOnClickListener(
            v -> {
              if (mOnMediaClickListener == null) {
                ActivityVideoShower.startActivity(mActivity, en);
              } else {
                mOnMediaClickListener.onMediaClick(en, realPosition);
              }
            });
      }
    }
    return convertView;
  }
  private void initializeUIElements() {
    TextView textViewDeviceName = (TextView) findViewById(R.id.textViewDeviceName);
    textViewDeviceName.setText(device.getName());

    ImageView imageViewPairStatus = (ImageView) findViewById(R.id.imageViewPairStatus);
    switch (device.getBondState()) {
      case BluetoothDevice.BOND_NONE:
        imageViewPairStatus.setImageResource(R.drawable.bluetooth_notpaired);
        break;
      case BluetoothDevice.BOND_BONDED:
        imageViewPairStatus.setImageResource(R.drawable.bluetooth_paired);
        break;
      case BluetoothDevice.BOND_BONDING:
        imageViewPairStatus.setImageResource(R.drawable.bluetooth_bonding);
        break;
    }

    TextView textViewStatus = (TextView) findViewById(R.id.textViewStatus);
    switch (device.getBondState()) {
      case BluetoothDevice.BOND_BONDED:
        textViewStatus.setText(R.string.label_status_bonded);
        break;
      case BluetoothDevice.BOND_BONDING:
        textViewStatus.setText(R.string.label_status_bonding);
        break;
      case BluetoothDevice.BOND_NONE:
        textViewStatus.setText(R.string.label_status_not_bonded);
        break;
    }

    TextView textViewAddress = (TextView) findViewById(R.id.textViewAddress);
    textViewAddress.setText(
        getResources().getString(R.string.label_device_address) + " " + device.getAddress());
  }
Exemple #16
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View row = null;

      if (convertView == null) {
        LayoutInflater inflater =
            (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.file_picker_list_item, parent, false);
      } else {
        row = convertView;
      }

      File object = mObjects.get(position);

      ImageView imageView = (ImageView) row.findViewById(R.id.file_picker_image);
      TextView textView = (TextView) row.findViewById(R.id.file_picker_text);
      // Set single line
      textView.setSingleLine(true);

      textView.setText(object.getName());
      if (object.isFile()) {
        // Show the file icon
        imageView.setImageResource(R.drawable.file);
      } else {
        // Show the folder icon
        imageView.setImageResource(R.drawable.folder);
      }

      return row;
    }
  /** 设置帖子详情 */
  private void setFavoriteNoteDetailView() {
    if (noteDetail == null) return;

    noteDetailTitleView.setText(noteDetail.getContentTitle());
    noteDetailContentView.setText(noteDetail.getContentTextData());
    noteDetailNameView.setText(noteDetail.getCreateUsername());
    noteDetailDateView.setText(noteDetail.getCreateDate());

    if (noteDetail.getIsCollected() == 0) {
      noteDetaiFavoriteView.setImageResource(R.drawable.fd_restaurant_collection_disable);
    } else if (noteDetail.getIsCollected() == 1) {
      noteDetaiFavoriteView.setImageResource(R.drawable.fd_restaurant_collection_enable);
    }

    //		noteForwardCountView.setText("转发("+noteDetail.getCollectCount()+")");
    noteFavoriteCountView.setText("收藏(" + noteDetail.getCollectCount() + ")");
    List<FDImage> noteDetailImages = noteDetail.getPicList();
    if (noteDetailImages != null && noteDetailImages.size() > 0) {
      noteDetailImageView.setVisibility(View.VISIBLE);
      FDHorizontalListViewAdapter photoAdapter =
          new FDHorizontalListViewAdapter(this, noteDetailImages, false);
      noteDetailImageView.setAdapter(photoAdapter);
    } else {
      noteDetailImageView.setVisibility(View.GONE);
    }
  }
Exemple #18
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater =
        (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (convertView == null) convertView = inflater.inflate(this.resource, parent, false);

    Lista item = getItem(position);
    ((TextView) convertView.findViewById(R.id.txtId)).setText("" + item.id);
    ((TextView) convertView.findViewById(R.id.txtUsuario)).setText(item.nombre);
    ((TextView) convertView.findViewById(R.id.txtTitle)).setText(item.operador);
    ((TextView) convertView.findViewById(R.id.txtFavorito)).setText(item.favorito);
    TextView time = ((TextView) convertView.findViewById(R.id.txtFavorito));
    time.setText(item.favorito);

    String num = "true";
    if (item.favorito.equals(num)) {
      ImageView img = ((ImageView) convertView.findViewById(R.id.imageView));
      img.setImageResource(R.drawable.favorite);
    } else {

      ImageView img = ((ImageView) convertView.findViewById(R.id.imageView));
      img.setImageResource(R.drawable.onfavorite);
    }
    return convertView;
  }
  @Override
  public void initData() {
    // 获取主贴id
    mMainId = getIntent().getLongExtra(ForumCommentActivity.INTENT_KEY_FOLLOWID, 0);
    mPraise_done = getIntent().getIntExtra(PostDetailActivity.INTENT_KEY_PRAISE_DONE, -1);
    mPraise_num = getIntent().getLongExtra(PostDetailActivity.INTENT_KEY_PRAISE_NUM, -1);
    mReply_num = getIntent().getLongExtra(PostDetailActivity.INTENT_KEY_REPLY_NUM, -1);
    if (mPraise_done != -1) {
      mTvComment.setText(Util.getLove(mReply_num));
      mTvPraise.setText(Util.getLove(mPraise_num));
      if (mPraise_done == PostEntity.C_PRAISE_DONE) {
        mIvPraise.setImageResource(R.drawable.big_image_like_click);
      } else {
        mIvPraise.setImageResource(R.drawable.big_image_like_normal);
      }
    }
    // 更多精品适配器
    mLvMorePick.setAdapter(new MorePickAdapter(mContext));
    // PostDetailExpandAdapter adapter = new
    // PostDetailExpandAdapter(mContext, mListView, null);
    // adapter.addFootView(vMorePick);
    // mListView.setAdapter(adapter);
    // 下载帖子详情
    new PostDetailTask(false).execute();

    // 恢复草稿箱
    mInputBar.restorePostDraft(
        mEditContent,
        ApplicationVariable.INSTANCE.getUapUid(),
        mMainId,
        SEND_FAILED_SAVE_FILE_NAME);
    // 删除草稿
    mInputBar.deletePostDraft(
        ApplicationVariable.INSTANCE.getUapUid(), mMainId, SEND_FAILED_SAVE_FILE_NAME);
  }
Exemple #20
0
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
   Log.i("Rooms", "onItemsSelected position: " + position + " id: " + id);
   ImageView image = (ImageView) findViewById(R.id.imageView_rooms);
   switch (position) {
     case 0:
       if (image != null) {
         image.setImageResource(R.drawable.bathroom);
       } else {
         Log.e("Rooms", "onItemSelected could not get ImageView resource to display room");
       }
       break;
     case 1:
       if (image != null) {
         image.setImageResource(R.drawable.bedroom);
       } else {
         Log.e("Rooms", "onItemSelected could not get ImageView resource to display room");
       }
       break;
     case 2:
       if (image != null) {
         image.setImageResource(R.drawable.kitchen);
       } else {
         Log.e("Rooms", "onItemSelected could not get ImageView resource to display room");
       }
       break;
   }
 }
Exemple #21
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.login_number:
       iv_code.setVisibility(View.GONE);
       iv_password.setImageResource(R.drawable.icon_pwd);
       login_number.setBackgroundResource(R.drawable.background_view_green_left);
       login_Code.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.white));
       login_Code.setTextColor(getResources().getColor(R.color.black));
       type = "number";
       break;
     case R.id.login_Code:
       iv_code.setVisibility(View.VISIBLE);
       iv_password.setImageResource(R.drawable.icon_code);
       login_Code.setBackgroundResource(R.drawable.background_view_green_right);
       login_number.setBackgroundColor(getResources().getColor(R.color.transparent));
       login_number.setTextColor(getResources().getColor(R.color.black));
       login_Code.setTextColor(getResources().getColor(R.color.white));
       passwordEditText.setHint("验证码为4位数字");
       type = "code";
       break;
     case R.id.iv_code:
       currentUsername = usernameEditText.getText().toString().trim();
       Log.e("username", currentUsername);
       if (!currentUsername.equals("") && currentUsername != null) {
         registercode(currentUsername);
       } else {
         Toast.makeText(context, "请输入手机号码", Toast.LENGTH_SHORT).show();
       }
       break;
   }
 }
Exemple #22
0
  /**
   * 处理点击事件
   *
   * @param parent
   * @param view
   * @param position
   * @param id
   */
  protected void handleItemClick(AdapterView<?> parent, View view, int position, long id) {
    ImageItem item = mAdapter.getItem(position);
    ImageView selected = (ImageView) view.findViewById(R.id.isselected);
    if (mSelectTotal < ConstantKeys.MAX_SELECT_IMAGE_COUNT) {
      item.setSelected(!item.isSelected());
      if (item.isSelected()) {
        selected.setImageResource(R.drawable.ic_takephoto_album_img_selected);
        mSelectTotal++;
        setSendText(mSelectTotal);
        mSelectedMap.put(position, mDataList.get(position));

      } else if (!item.isSelected()) {
        selected.setImageResource(R.drawable.ic_takephoto_album_img_select_nor);
        mSelectTotal--;
        setSendText(mSelectTotal);
        mSelectedMap.remove(position);
      }
    } else if (mSelectTotal >= ConstantKeys.MAX_SELECT_IMAGE_COUNT) {
      if (item.isSelected() == true) {
        item.setSelected(!item.isSelected());
        selected.setImageResource(R.drawable.ic_takephoto_album_img_select_nor);
        mSelectTotal--;
        mSelectedMap.remove(position);
      } else {
        android.os.Message message = android.os.Message.obtain(mHandler, 0);
        message.sendToTarget();
      }
    }
  }
  @Override
  public View getView(int position, View view, ViewGroup parent) {
    DeviceCandidate device = getItem(position);

    if (view == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      view = inflater.inflate(R.layout.device_candidate_item, parent, false);
    }
    ImageView deviceImageView = (ImageView) view.findViewById(R.id.device_candidate_image);
    TextView deviceNameLabel = (TextView) view.findViewById(R.id.device_candidate_name);
    TextView deviceAddressLabel = (TextView) view.findViewById(R.id.device_candidate_address);

    String name = formatDeviceCandidate(device);
    deviceNameLabel.setText(name);
    deviceAddressLabel.setText(device.getMacAddress());

    switch (device.getDeviceType()) {
      case PEBBLE:
        deviceImageView.setImageResource(R.drawable.ic_device_pebble);
        break;
      case MIBAND:
        deviceImageView.setImageResource(R.drawable.ic_device_miband);
        break;
      default:
        deviceImageView.setImageResource(R.drawable.ic_launcher);
    }

    return view;
  }
  /**
   * Notifies the pager indicator that the data set has changed. Be sure to notify the pager as well
   * (though you may wish to place that call in here yourself).
   */
  public void notifyDataSetChanged() {
    if (pager != null && pager.getAdapter() != null) {

      // remove the old items (if any exist)
      itemContainer.removeAllViews();

      // I'm sure this could be optimised a lot more, eg,
      // by reusing existing ImageViews, but it
      // does the job well enough for now.
      items.removeAll(items);

      // now create the new items.
      for (int i = 0; i < pager.getAdapter().getCount(); i++) {

        ImageView item = new ImageView(context);

        if (i == pager.getCurrentItem()) {
          item.setImageResource(R.drawable.bulb_lit4);
        } else {
          item.setImageResource(R.drawable.bulb_unlit4);
        }

        item.setTag(i);
        item.setOnClickListener(itemClickListener);
        items.add(item);

        itemContainer.addView(item);
      }
    }
  }
Exemple #25
0
    public View getView(int position, View convertView, ViewGroup parent) {

      View row = super.getView(position, convertView, parent);

      ImageView icon = (ImageView) row.findViewById(R.id.icon);
      ImageView listThumb = (ImageView) row.findViewById(R.id.listThumb);
      TextView author = (TextView) row.findViewById(R.id.bookAuthor);

      Drawable d = new BitmapDrawable(bookImages.get(position));

      icon.setImageResource(R.drawable.blank);
      listThumb.setImageDrawable(d);
      author.setText("Author:" + authors.get(position));

      fileNames = booksInDirectory.list();

      for (int i = 0; i < fileNames.length; i++) {
        System.out.println(fileNames[i]);

        if (fileNames[i].equals(bookArray[position])) {
          icon.setImageResource(R.drawable.accept);
        }
      }

      return (row);
    }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_registration3);
   getSupportActionBar().hide();
   Intent i = getIntent();
   login = i.getStringExtra("login");
   int id = i.getIntExtra("id", 0);
   TextView txt1 = (TextView) findViewById(R.id.txt1);
   TextView txt2 = (TextView) findViewById(R.id.txt2);
   TextView txt3 = (TextView) findViewById(R.id.txt3);
   ImageView img1 = (ImageView) findViewById(R.id.img1);
   ImageView img2 = (ImageView) findViewById(R.id.img2);
   ImageView img3 = (ImageView) findViewById(R.id.img3);
   if (id == 1) {
     txt1.setText("USA (+3 oil wells)");
     txt2.setText("Russia (+2500 soldiers)");
     txt3.setText("EU (+10 special points from the start and +20 spec. points every round)");
     addid = 0;
   }
   if (id == 2) {
     img1.setImageResource(R.drawable.isisflag);
     img2.setImageResource(R.drawable.bohaflag);
     img3.setImageResource(R.drawable.alshflag);
     txt1.setText("ISIS (+3 oil wells)");
     txt2.setText(
         "Boko Haram (+10 special points from the start and +20 spec. points every round)");
     txt3.setText("Al Shabat (+2500 soldiers)");
     addid = 3;
   }
 }
 @Override
 public void onClickEvent(View view) {
   switch (view.getId()) {
     case R.id.btn_more:
       btnClickMore();
       break;
     case R.id.btn_user_model:
       AppLockApplication.getInstance().setVisitorState(true);
       finish();
       break;
     case R.id.gesturepwd_unlock_forget:
       unGoHome = true;
       Intent intent = new Intent(this, SecretCheckActivity.class);
       startActivity(intent);
       closePopView();
       break;
     case R.id.btn_user_check:
       boolean flag = SharedPreferenceUtil.readUnlockUserByEnter();
       SharedPreferenceUtil.editUnlockUserByEnter(!flag);
       if (SharedPreferenceUtil.readUnlockUserByEnter()) {
         iv_user_check.setImageResource(R.drawable.checkbox_select);
       } else {
         iv_user_check.setImageResource(R.drawable.checkbox_unselect);
       }
       break;
     default:
       break;
   }
   super.onClickEvent(view);
 }
  public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    if (convertView == null) vi = inflater.inflate(R.layout.list_row_course_name, null);

    TextView textNameAss = (TextView) vi.findViewById(R.id.text_name_ass);
    TextView textDueDate = (TextView) vi.findViewById(R.id.text_due_date);
    ImageView thumb_image = (ImageView) vi.findViewById(R.id.imageView2);

    HashMap<String, String> dataMap = new HashMap<String, String>();
    dataMap = data.get(position);

    // Setting all values in listview
    textNameAss.setText(dataMap.get(AStudiezFragmentAssignments.ASS_NAME));
    // textDueDate.setText(dataMap.get(AStudiezFragmentAssignments.ASS_DUE_DATE));
    textDueDate.setText(dataMap.get(AStudiezFragmentAssignments.ASS_DUE_DATE));

    if (dataMap.get(AStudiezFragmentAssignments.ASS_PRIORITY).contains("1"))
      thumb_image.setImageResource(R.drawable.redpoint);
    else if (dataMap.get(AStudiezFragmentAssignments.ASS_PRIORITY).contains("2"))
      thumb_image.setImageResource(R.drawable.yellowpoint);
    else if (dataMap.get(AStudiezFragmentAssignments.ASS_PRIORITY).contains("3"))
      thumb_image.setImageResource(R.drawable.greenpoint);

    // thumb_image.setImageResource(R.drawable.redpoint);
    return vi;
  }
 private void updateUI() {
   decodeMessages();
   if (SafeBox.sharedInstance().isUnlock(mAccount.mId))
     mImgUnlock.setImageResource(R.drawable.unlock);
   else mImgUnlock.setImageResource(R.drawable.lock);
   mMessageListView.notifyDataSetChanged();
 }
 @Override
 public Object instantiateItem(ViewGroup container, final int position) {
   final Info info = mDatas.get(position);
   // 设置一大堆演示用的数据,麻里麻烦~~
   View view = LayoutInflater.from(mContext).inflate(R.layout.viewpager_layout, null);
   ImageView ivPortrait = (ImageView) view.findViewById(R.id.iv);
   ImageView ivSex = (ImageView) view.findViewById(R.id.iv_sex);
   TextView tvName = (TextView) view.findViewById(R.id.user_name);
   TextView tvDistance = (TextView) view.findViewById(R.id.tv_distance);
   tvName.setText(info.getName());
   tvDistance.setText(info.getDistance() + "km");
   ivPortrait.setImageResource(info.getPortraitId());
   if (info.getSex()) {
     ivSex.setImageResource(R.drawable.girl);
   } else {
     ivSex.setImageResource(R.drawable.boy);
   }
   ivPortrait.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Toast.makeText(mContext, "这是 " + info.getName() + " >.<", Toast.LENGTH_SHORT).show();
         }
       });
   container.addView(view);
   return view;
 }