public void run() {
          timeInMilliseconds = SystemClock.uptimeMillis() - startTime;
          updatedTime = timeSwapBuff + timeInMilliseconds;

          updatedTime = maxTimeMilliseconds - timeInMilliseconds;

          if (updatedTime > 5) {
            int secs = (int) (updatedTime / 1000);
            int mins = secs / 60;
            secs = secs % 60;
            int milliseconds = (int) (updatedTime % 1000);
            timerValue.setText(
                String.format("%02d", mins)
                    + ":"
                    + String.format("%02d", secs)
                    + ":"
                    + String.format("%03d", milliseconds));
            customHandler.postDelayed(this, 0);
          } else {
            customHandler.removeCallbacks(updateTimerThread);
            timerValue.setText(
                String.format("%02d", 0)
                    + ":"
                    + String.format("%02d", 0)
                    + ":"
                    + String.format("%03d", 0));
          }
        }
Beispiel #2
1
  private void setupHistoryRow(View view, History history, User user) {
    final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture);
    {
      if (user.containsNonNullValue(USER_PICTURE)) {
        String pictureUrl = user.getPictureUrl(USER_PICTURE, RemoteModel.PICTURE_THUMB);
        pictureView.setUrl(pictureUrl);
      } else {
        pictureView.setUrl(null);
      }
      pictureView.setVisibility(View.VISIBLE);
    }

    final AsyncImageView commentPictureView =
        (AsyncImageView) view.findViewById(R.id.comment_picture);
    commentPictureView.setVisibility(View.GONE);

    final TextView nameView = (TextView) view.findViewById(R.id.title);
    {
      nameView.setText(
          getHistoryComment(
              (AstridActivity) fragment.getActivity(), history, user, linkColor, fromView));
      nameView.setTextColor(grayColor);
    }

    final TextView date = (TextView) view.findViewById(R.id.date);
    {
      CharSequence dateString =
          DateUtils.getRelativeTimeSpanString(
              history.getValue(History.CREATED_AT),
              DateUtilities.now(),
              DateUtils.MINUTE_IN_MILLIS,
              DateUtils.FORMAT_ABBREV_RELATIVE);
      date.setText(dateString);
    }
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Activity activity = (Activity) getContext();
    LayoutInflater inflater = activity.getLayoutInflater();

    View rowView = inflater.inflate(R.layout.news, null);
    Article article = getItem(position);

    TextView textView = (TextView) rowView.findViewById(R.id.article_title_text);
    textView.setText(article.getTitle());

    TextView dateView = (TextView) rowView.findViewById(R.id.article_listing_smallprint);
    String pubDate = article.getPubDate();
    // SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss Z", Locale.ENGLISH);
    // Date pDate;
    //	pDate = (Date) df.parse(pubDate);
    pubDate = "published " + "by " + article.getAuthor();
    // pubDate = article.getGuid();
    // + DateUtils.getDateDifference(pDate) +
    dateView.setText(pubDate);

    if (!article.isRead()) {
      LinearLayout row = (LinearLayout) rowView.findViewById(R.id.article_row_layout);
      row.setBackgroundColor(Color.WHITE);
      textView.setTypeface(Typeface.DEFAULT_BOLD);
    }
    return rowView;
  }
 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);
   }
 }
  @Override
  public void onLocationChanged(Location location) {
    double lati, longi;
    lati = location.getLatitude();
    longi = location.getLongitude();

    textLati.setText(lati + "");
    textLong.setText(longi + "");
    String url =
        "https://www.google.co.in/maps/@"
            + textLati.getText().toString()
            + ","
            + textLong.getText().toString()
            + ",15z?hl=en";

    Toast.makeText(MainActivity.this, "hiiiiii", Toast.LENGTH_LONG).show();

    try {
      FileWriter writer = new FileWriter(filePath, false);
      writer.write(url);
      writer.flush();
      writer.close();

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Beispiel #6
1
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    View v = convertView;

    if (v == null) {
      LayoutInflater vi;
      vi = LayoutInflater.from(getContext());
      v = vi.inflate(R.layout.itemlayout, null);
    }

    Item p = getItem(position);

    if (p != null) {
      TextView tt1 = (TextView) v.findViewById(R.id.name);
      TextView tt2 = (TextView) v.findViewById(R.id.content);

      if (tt1 != null) {
        tt1.setText(p.name);
      }

      if (tt2 != null) {
        tt2.setText(p.content);
      }
    }

    return v;
  }
 @Nullable
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   // Bind view with id
   View view = inflater.inflate(R.layout.detail_movie_fragment, container, false);
   titleView = (TextView) view.findViewById(R.id.title);
   releaseYearView = (TextView) view.findViewById(R.id.release_year);
   scoreView = (TextView) view.findViewById(R.id.score);
   overviewView = (TextView) view.findViewById(R.id.overview);
   imagePoster = (ImageView) view.findViewById(R.id.image);
   insertTrailerPoint = (ViewGroup) view.findViewById(R.id.insert_trailer_point);
   insertReviewPoint = (ViewGroup) view.findViewById(R.id.insert_review_point);
   trailerVideo = new ArrayList<>();
   reviewsList = new ArrayList<>();
   // Parse json movie from intent extra
   Gson gson = new Gson();
   String jsonMovie = getArguments().getString("movie");
   Movie movie = gson.fromJson(jsonMovie, Movie.class);
   // Set text and source picture.
   titleView.setText(movie.getTitle());
   releaseYearView.setText(movie.getRelease_date());
   scoreView.setText(movie.getscore() + "/10");
   String url = "http://image.tmdb.org/t/p/w185/" + movie.getimage_path();
   Picasso.with(getActivity()).load(url).into(imagePoster);
   overviewView.setText(movie.getOverview());
   // Start new thread
   FetchTrailerTask task = new FetchTrailerTask();
   task.execute(movie.getId());
   return view;
 }
Beispiel #8
0
  private void stopTreatment() {
    // send 0V command
    sendDataToDevice(EbandageGattAttributes.ZERO_VOLTS);
    voltageTextView.setText("");
    polarityTextView.setText("");
    max_volt = false; // default state
    polarityChanged = false; // default state POSITIVE
    timerStopped = true; // default timer stopped state
    // set button default state
    showMinutes(true);
    setButtonDisabled(true);
    increaseThread = null;
    decreaseThread = null;
    countDownTimer.cancel();

    // send OFF command to device
    if (mBluetoothLeService.sendPolarityCharacteristics(
        hexStringToByteArray(EbandageGattAttributes.EBANDAGE_OFF))) {
      Log.i(TAG, "Device is turned off");
    } else {
      Log.i(TAG, "Turning device off failed");
      // Try again !
      mBluetoothLeService.sendPolarityCharacteristics(
          hexStringToByteArray(EbandageGattAttributes.EBANDAGE_OFF));
    }
  }
  /**
   * 加载完毕,显示加载结果。注意:加载完成后一定要调用这个方法
   *
   * @param isSuccess true成功,false代表失败
   */
  public void loadMoreFinish(boolean isSuccess) {
    if (loadingBar == null || loadHintText == null) return;
    loadingBar.clearAnimation();
    loadingBar.setVisibility(View.GONE);

    if (showRefreshResultEnable) {
      if (isSuccess) { // 加载更多成功
        loadHintText.setText(R.string.load_succeed);
        Drawable drawable = getResources().getDrawable(R.mipmap.icon_load_succeed);
        loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
        loadHintText.setCompoundDrawablePadding(dp2px(10));
      } else { // 加载更多失败
        loadHintText.setText(R.string.load_fail);
        Drawable drawable = getResources().getDrawable(R.mipmap.icon_load_failed);
        loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
        loadHintText.setCompoundDrawablePadding(dp2px(10));
      }
    }
    if (pullUpY < 0) {
      postDelayed(
          new Runnable() {
            @Override
            public void run() {
              changeStage(DONE);
              hide();
            }
          },
          showRefreshResultEnable ? 1000 : 0); // 判断刷新结果停留1秒
    } else {
      changeStage(DONE);
      hide();
    }
  }
 public void displayGoals(boolean display_present) {
   this.display_present = display_present;
   MySQLiteHelper db = new MySQLiteHelper(activity);
   List<Goal> goals = db.getAllGoals();
   goalsToDisplay.clear();
   for (Goal goal : goals) {
     if (goal.getComplete() == Goal.INCOMPLETE && display_present) {
       goalsToDisplay.add(goal);
     } else if (goal.getComplete() == Goal.COMPLETE && !display_present) {
       goalsToDisplay.add(goal);
     }
   }
   if (goalAdapter == null) {
     goalAdapter = new GoalAdapter(activity, R.layout.goal_listview_row, goalsToDisplay);
   } else {
     goalsListView.post(
         new Runnable() {
           @Override
           public void run() {
             goalAdapter.notifyDataSetChanged();
           }
         });
   }
   if (goals.size() == 0 && display_present) {
     txtviewIntro.setText("Press the action button to add a goal.");
     txtviewIntro.setVisibility(View.VISIBLE);
   } else if (!display_present && Goal.getCompleteGoals(goals).size() == 0) {
     txtviewIntro.setText("When you complete a goal it will be displayed here.");
     txtviewIntro.setVisibility(View.VISIBLE);
   } else {
     txtviewIntro.setVisibility(View.GONE);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff359AC4));

    TextView textView_id = (TextView) findViewById(R.id.profile_id);
    TextView textView_pw = (TextView) findViewById(R.id.profile_pw);

    Intent intent_main = getIntent();

    String id = intent_main.getStringExtra("id");
    String pw = intent_main.getStringExtra("password");

    textView_id.setText(String.valueOf(id));
    textView_pw.setText(String.valueOf(pw));

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }
Beispiel #12
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.chase_activity_result);
   playerData =
       (PlayerData)
           this.getIntent()
               .getExtras()
               .getSerializable(GameSettings.CHASE_GAME_PLAYER_TO_RESULT_TAG);
   gameData =
       (GameData)
           this.getIntent().getExtras().getSerializable(GameSettings.CHASE_GAME_TO_RESULT_TAG);
   new ToolbarSetter(this);
   try {
     Results.setForChase(gameData, playerData);
   } catch (RestException e) {
     e.printStackTrace();
     e.getErrorAlert(this).show();
   }
   TextView result = (TextView) findViewById(R.id.resultsTextView);
   if (gameData.getChases().get(playerData.getUserID()).getStatus().equals(ChaseStatus.DEAD)) {
     result.setText("You LOSE!\n You're character is dead");
   } else {
     result.setText("You WIN!\n Hunter didn't catch you!");
   }
 }
 @Override
 public void onServiceConnected(ComponentName name, IBinder service) {
   mServiceBinder = (CheckBinder) service;
   Intent extrasIntent = getIntent();
   String action = extrasIntent.getAction();
   boolean b =
       mServiceBinder.getTaskRunnningStatus(UpdateService.TASK_ID_DOWNLOAD)
           == ThreadTask.RUNNING_STATUS_UNSTART;
   if (ACTION_CHECK.equals(action) && b) {
     Intent intent = new Intent(DownloadActivity.this, UpdateService.class);
     intent.putExtra(
         UpdateService.KEY_START_COMMAND, UpdateService.START_COMMAND_START_CHECKING);
     startService(intent);
     setCheckView();
   } else if (ACTION_DOWNLOAD.equals(action) || !b) {
     setDownloadView();
   }
   if (DownloadTask.FAIL_ACTION.equals(action)) {
     setDownloadView();
     mPercent.setVisibility(View.VISIBLE);
     mPercent.setText(R.string.download_error);
   } else if (DownloadTask.SUCCEED_ACTION.equals(action)) {
     setDownloadView();
     mPercent.setVisibility(View.VISIBLE);
     mPercent.setText(getString(R.string.Download_succeed));
     mProgress.setProgress(100);
     mCombineBtn.setText(R.string.download_update);
     mCombineBtn.setTag(Integer.valueOf(R.string.download_update));
   }
 }
 private void init() {
   it = getIntent();
   order_id = it.getStringExtra("order_id");
   rec_id = it.getStringExtra("rec_id");
   goods_num = it.getStringExtra("goods_num");
   goods_pay_price = it.getStringExtra("goods_pay_price");
   goods_price = it.getStringExtra("goods_price");
   goods_name = it.getStringExtra("goods_name");
   tv_goods_pay_price = (TextView) findViewById(R.id.tv_goods_pay_price);
   tv_goods_pay_price.setText(goods_pay_price);
   tv_pay_price = (TextView) findViewById(R.id.tv_pay_price);
   tv_pay_price.setText(goods_pay_price);
   tv_goods_name = (TextView) findViewById(R.id.tv_goods_name);
   tv_goods_name.setText(goods_name);
   tv_goods_price = (TextView) findViewById(R.id.tv_goods_price);
   tv_goods_price.setText(goods_price);
   tv_goods_num = (TextView) findViewById(R.id.tv_goods_num);
   tv_goods_num.setText(goods_num);
   btn_sub = (Button) findViewById(R.id.btn_sub);
   btn_sub.setOnClickListener(this);
   check_1 = (CheckBox) findViewById(R.id.check_1);
   check_2 = (CheckBox) findViewById(R.id.check_2);
   ll_check_1 = (LinearLayout) findViewById(R.id.ll_check_1);
   ll_check_2 = (LinearLayout) findViewById(R.id.ll_check_2);
   ll_check_1.setOnClickListener(this);
   ll_check_2.setOnClickListener(this);
   et_pay_price = (EditText) findViewById(R.id.et_pay_price);
   et_pay_price.setText(goods_pay_price);
   et_goos_nnum = (EditText) findViewById(R.id.et_goos_nnum);
   et_goos_nnum.setText(goods_num);
   et_extend_msg = (EditText) findViewById(R.id.et_extend_msg);
 }
Beispiel #15
0
  private void dependToShowDialog() {
    if (!SomeUtil.hasSystemFeatureGPS(this)) {
      // 系统没有 GPS 模块就不弹出开启 GPS 的对话框
      return;
    }
    if (!SomeUtil.isGPSOn(this)) {
      mDialog = new Dialog(this, R.style.Dialog_style_dim2);
      View view = View.inflate(this, R.layout.dialog_my_vehicle_condition, null);
      TextView txt1 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_heading);
      TextView txt2 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_subheading);
      ImageView ivYes = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_yes);
      ImageView ivNo = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_no);

      txt1.setText(getResources().getString(R.string.myVehicleCondition_heading_no_gps));
      txt2.setText(getResources().getString(R.string.myVehicleCondition_subheading_no_gps));
      ivYes.setOnClickListener(mDialogOnClickListener);
      ivNo.setOnClickListener(mDialogOnClickListener);

      mDialog.setContentView(view);
      mDialog.setCanceledOnTouchOutside(true);
      mDialog.getWindow().setType((WindowManager.LayoutParams.TYPE_SYSTEM_ALERT));
      mDialog.show();
    } else {
      mLocationClient.start();
    }
  }
 private AlertDialog cancleTrackDialog(final String id) {
   LayoutInflater factory = LayoutInflater.from(this);
   /*中奖查询的查看详情使用余额查询的布局*/
   View view = factory.inflate(R.layout.usercenter_balancequery, null);
   final AlertDialog dialog = new AlertDialog.Builder(this).create();
   TextView title = (TextView) view.findViewById(R.id.usercenter_balancequery_title);
   TextView remind = (TextView) view.findViewById(R.id.usercenter_remind_text);
   remind.setVisibility(TextView.GONE);
   title.setText(R.string.cancel_add_num);
   TextView detailTextView = (TextView) view.findViewById(R.id.balanceinfo);
   detailTextView.setTextSize(18);
   detailTextView.setText(R.string.usercenter_cancleTrackRemind);
   Button cancleLook = (Button) view.findViewById(R.id.usercenter_balancequery_back);
   cancleLook.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           dialog.cancel();
         }
       });
   Button okBtn = (Button) view.findViewById(R.id.usercenter_balancequery_ok);
   okBtn.setVisibility(Button.VISIBLE);
   okBtn.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           dialog.cancel();
           cancleTrackNet(id);
         }
       });
   dialog.show();
   dialog.getWindow().setContentView(view);
   return dialog;
 }
  void InitToolBarView() throws Exception {
    mSettingToolbar = (Toolbar) findViewById(R.id.setting_toolbar);
    mSettingToolbar.setTitle("");
    mSettingToolbar.setNavigationIcon(R.drawable.settingtoolbar_return);
    mSettingToolbarTextViewInfo = (TextView) findViewById(R.id.settingtoolbar_info);
    // 设置字体加粗
    TextPaint tp = mSettingToolbarTextViewInfo.getPaint();
    tp.setFakeBoldText(true);
    setSupportActionBar(mSettingToolbar);

    mViewNetset = (Switch) findViewById(R.id.setting_netsetting);
    mViewTempClear = (TextView) findViewById(R.id.setting_tempclear);
    String strTempSize = DataCleanManager.getTotalCacheSize(getApplicationContext());
    mViewTempClear.setText("清除缓存\n缓存大小为:" + strTempSize);
    mViewSetDefaultUrl = (TextView) findViewById(R.id.setting_setdefaulturl);
    mViewSetDefaultUrl.setText("设置默认网址\n默认网址为:" + GetDafaultUrl());
    mViewCheckUpdate = (TextView) findViewById(R.id.setting_checkupdate);
    mViewAbout = (TextView) findViewById(R.id.setting_about);
    mViewClose = (TextView) findViewById(R.id.setting_close);
    // 设置网络选项初始值
    mIsOnlyWifi = GetNetConfig();
    if (mIsOnlyWifi == 0) {
      SettingInfo.SetmIsOnlyWifi(false);
      mViewNetset.setChecked(false);
    } else {
      SettingInfo.SetmIsOnlyWifi(true);
      mViewNetset.setChecked(true);
    }
  }
 protected void setTitle(TextView view) {
   if (orgs != null && !orgs.login.isEmpty()) {
     view.setText(orgs.login);
   } else {
     view.setText("NULL");
   }
 }
  /**
   * Method for registering the user based on credentials placed into EditText views.
   *
   * @param view The view housing the EditTexts for simplicity.
   */
  private void registerUser(View view) {
    // ensure view isnt null
    if (view != null) {
      // retrieve the values within the edit texts
      // final TextView errorText = (TextView) view.findViewById(R.id.register_error_label);
      final EditText usernameField = (EditText) view.findViewById(R.id.register_username);
      final EditText password = (EditText) view.findViewById(R.id.register_password);
      final EditText passwordCheck = (EditText) view.findViewById(R.id.register_password_redo);

      String username = usernameField.getText().toString();
      String pwd = password.getText().toString();
      String pwdCheck = passwordCheck.getText().toString();

      // Ensure the fields are not empty and the passwords match
      if (username.length() != 0 && pwd.length() != 0 && pwd.equals(pwdCheck)) {
        // hash the password to increase security a bit
        String pwdHash = String.valueOf(password.getText().toString().hashCode());
        String regUrl = url;
        regUrl += "?username="******"&password="******"Attempting to Register Account!");
        new AddUserWebTask().execute(regUrl);
      }

      // a field is empty
      if (username.length() == 0 || pwd.length() == 0 || pwdCheck.length() == 0) {
        errorText.setText("Error: Cannot leave a field blank!");
      }

      // passwords do not match
      if (!pwd.equals(pwdCheck)) {
        errorText.setText("Error: Passwords do not match!");
      }
    }
  }
Beispiel #20
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (inflater == null)
      inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) convertView = inflater.inflate(R.layout.list_row, null);

    if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader();
    NetworkImageView thumbNail = (NetworkImageView) convertView.findViewById(R.id.thumbnail);
    TextView username = (TextView) convertView.findViewById(R.id.username);
    TextView phone = (TextView) convertView.findViewById(R.id.phone);

    // getting user data for the row
    User user = userItems.get(position);

    // thumbnail image
    thumbNail.setImageUrl(user.getThumbnailUrl(), imageLoader);

    // username
    username.setText(user.getUsername());

    // phone
    phone.setText(user.getPhone());

    return convertView;
  }
  public void setData(CalendarItem item) {
    mItem = item;
    float textsize = IN_MONTH_TEXT_SIZE_SP;
    int textColor = NUMBER_COLOR;
    if (!item.inMonth) {
      textsize = OUT_MONTH_TEXT_SIZE_SP;
      textColor = OUT_MONTH_TEXT_COLOR;
    } else {
      textsize = IN_MONTH_TEXT_SIZE_SP;
      switch (item.dayOfWeek) {
        case Calendar.SUNDAY:
          textColor = SUN_COLOR;
          break;
        case Calendar.SATURDAY:
          textColor = SAT_COLOR;
          break;
        default:
          textColor = NUMBER_COLOR;
          break;
      }
    }
    numberView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textsize);
    numberView.setTextColor(textColor);
    numberView.setText("" + item.dayOfMonth);
    // contentView setting

    ArrayList items = item.items;
    int size = items.size();
    StringBuilder sb = new StringBuilder();
    sb.append("o");
    contentView.setText(sb.toString());
  }
  @Override
  public View getView(int position, View _view, ViewGroup parent) {
    View view = _view;
    Object menuItem = getItem(position);

    if (menuItem instanceof MenuCategory) {
      if (view == null) {
        view =
            LayoutInflater.from(mContext)
                .inflate(R.layout.view_navigation_drawer_item, parent, false);
      }
      ((TextView) view).setText(((MenuCategory) menuItem).mTitle);
    } else {
      if (view == null) {
        view =
            LayoutInflater.from(mContext)
                .inflate(R.layout.view_navigation_drawer_item, parent, false);
      }

      TextView itemTitle = (TextView) view;
      itemTitle.setText(((MenuActivity) menuItem).mTitle);

      // Setting icon menu item
      int iconResource = ((MenuActivity) menuItem).mIconResource;
      if (iconResource > 0) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
          itemTitle.setCompoundDrawablesRelativeWithIntrinsicBounds(iconResource, 0, 0, 0);
        } else {
          itemTitle.setCompoundDrawablesWithIntrinsicBounds(iconResource, 0, 0, 0);
        }
      }
    }
    return view;
  }
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.purchaselistrow, null);
      }
      PurchaseHistoryEntity watchListAllEntity = items.get(position);

      if (watchListAllEntity != null) {
        // TextView nt = (TextView)
        // v.findViewById(R.id.fileNameTextView);
        TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1);
        TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2);
        TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3);
        TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4);
        TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5);

        /*STATUS
        注文日 (order date)
        納品日 (delivery date)
        依頼枚数(no. of request)
        納品枚数(no. of delivery)*/

        tv1.setText("STATUS: " + watchListAllEntity.get_status_ja());
        tv2.setText("注文日: " + watchListAllEntity.get_order_created_at());
        tv3.setText("納品日: " + watchListAllEntity.get_order_created_at());
        tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount());
        tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount());
      }

      return v;
    }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = inflateLayout();
    }
    TextView title = (TextView) convertView.findViewById(R.id.tv_search_result_title);
    TextView net = (TextView) convertView.findViewById(R.id.tv_search_result_original_net);
    TextView time = (TextView) convertView.findViewById(R.id.tv_search_result_time);

    SpannableString s = new SpannableString(mList.get(position).getTitle());
    Pattern p = Pattern.compile(keyword);
    Matcher m = p.matcher(s);
    while (m.find()) {
      int start = m.start();
      int end = m.end();
      s.setSpan(
          new ForegroundColorSpan(mContext.getResources().getColor(R.color.orange)),
          start,
          end,
          Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    title.setText(s);
    net.setText(mList.get(position).getSite());
    time.setText(formatTime(mList.get(position).getCreateTime()));
    return convertView;
  }
Beispiel #25
0
  @Override
  public View getView(int position, View bankView, ViewGroup parent) {
    // set the rowview
    View rowView = bankView;
    // reuse views
    if (rowView == null) {
      // if the row view is not null then inflate for display
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_bank_item, null);
    }

    // get the text views and set the values to the values in the list
    TextView username = (TextView) rowView.findViewById(R.id.value_username);
    TextView website = (TextView) rowView.findViewById(R.id.value_website);
    TextView password = (TextView) rowView.findViewById(R.id.value_password);
    TextView expiration = (TextView) rowView.findViewById(R.id.value_expires);

    username.setText(PasswordInfoArrayList.get(position).getUsername());
    website.setText(PasswordInfoArrayList.get(position).getWebsite());
    password.setText(PasswordInfoArrayList.get(position).getPassword());

    DateHelper expires = PasswordInfoArrayList.get(position).getExpiration();
    boolean expired = expires.isLaterThan(DateHelper.getCurrentDate());
    if (expired) {
      expiration.setTextColor(Color.RED);
    }
    String expStr = PasswordInfoArrayList.get(position).getExpiration().toString();
    expiration.setText(expStr);

    return rowView;
  }
 public void bindHour(Hour hour) {
   mTimeLabel.setText(hour.getHour());
   mSummaryLabel.setText(hour.getSummary());
   mHourlyPrecipLabel.setText(hour.getPrecipPossibility() + "%");
   mTemperatureLabel.setText(hour.getTemperature() + "");
   mIconImageView.setImageResource(hour.getIconId());
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.layout_amministrazione_fragment, container, false);

    TextView label = (TextView) view.findViewById(R.id.text_amministrazione);
    label.setText(this.amministrazione.getLabel());

    TextView indirizzo = (TextView) view.findViewById(R.id.text_amministrazione_indirizzo);
    indirizzo.setText(this.amministrazione.getIndirizzo() + " " + this.amministrazione.getComune());

    TextView homepage = (TextView) view.findViewById(R.id.text_amministrazione_homepage);

    if (this.amministrazione.getHomepage() != null) {
      homepage.setText(this.amministrazione.getHomepage().trim());
      homepage.setVisibility(View.VISIBLE);
    } else {
      homepage.setVisibility(View.GONE);
    }
    TextView phone = (TextView) view.findViewById(R.id.text_amministrazione_homepage);
    if (this.amministrazione.getTelefono() != null) {

      phone.setText(this.amministrazione.getTelefono().trim());
      phone.setVisibility(View.VISIBLE);
    } else {
      phone.setVisibility(View.GONE);
    }
    listEmail = (ExpandableListView) view.findViewById(R.id.expand_listview_amministrazione_email);
    listPec = (ExpandableListView) view.findViewById(R.id.expand_listview_amministrazione_pec);
    listCecpac =
        (ExpandableListView) view.findViewById(R.id.expand_listview_amministrazione_cecpac);
    addContactButton = (ImageView) view.findViewById(R.id.button_add_administration_contact);
    return view;
  }
Beispiel #28
0
  @Override
  public void updateProgress(boolean updateOnlyProgress) {
    BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask =
        DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
    // needed when rotation is performed and progress can be null
    if (progressView == null) {
      return;
    }
    if (updateOnlyProgress) {
      if (!basicProgressAsyncTask.isIndeterminate()) {
        progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
        determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
      }
    } else {
      boolean visible =
          basicProgressAsyncTask != null
              && basicProgressAsyncTask.getStatus() != AsyncTask.Status.FINISHED;
      progressView.setVisibility(visible ? View.VISIBLE : View.GONE);
      if (visible) {
        boolean indeterminate = basicProgressAsyncTask.isIndeterminate();
        indeterminateProgressBar.setVisibility(!indeterminate ? View.GONE : View.VISIBLE);
        determinateProgressBar.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        cancel.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        progressPercent.setVisibility(indeterminate ? View.GONE : View.VISIBLE);

        progressMessage.setText(basicProgressAsyncTask.getDescription());
        if (!indeterminate) {
          progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
          determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
        }
      }
      updateDownloadButton(false);
    }
  }
  @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 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;
  }