@Override
  public void bindView(View view, Context context, Cursor cursor) {
    // take a holder
    StocksDataViewHolder holder = (StocksDataViewHolder) view.getTag();

    // header index
    int accountId = cursor.getInt(cursor.getColumnIndex(StockRepository.HELDAT));
    if (!mHeadersAccountIndex.containsKey(accountId)) {
      mHeadersAccountIndex.put(accountId, cursor.getPosition());
    }

    // symbol
    String symbol = cursor.getString(cursor.getColumnIndex(StockRepository.SYMBOL));
    holder.symbolTextView.setText(symbol);

    // name
    String name = cursor.getString(cursor.getColumnIndex(StockRepository.STOCKNAME));
    holder.nameTextView.setText(name);

    // price
    String price = cursor.getString(cursor.getColumnIndex(StockRepository.CURRENTPRICE));
    holder.priceTextView.setText(price);

    // check if item is checked
    if (mCheckedPosition.get(cursor.getPosition(), false)) {
      view.setBackgroundResource(R.color.material_green_100);
    } else {
      view.setBackgroundResource(android.R.color.transparent);
    }
  }
Пример #2
0
  protected void applyTheme(int theme) {
    Resources res = getResources();

    mRootView.setBackgroundColor(
        res.getColor(MODE_NIGHT == theme ? R.color.background_night : R.color.background));

    if (!mHideTitle) {
      final RelativeLayout titleView = (RelativeLayout) findViewById(R.id.title_bar);
      final TextView titleText = (TextView) findViewById(R.id.title_text);
      final View divider = findViewById(R.id.split_h);
      final ImageView backBtn = (ImageView) findViewById(R.id.ic_arrow);

      final View leftView = findViewById(R.id.back_view);

      if (MODE_NIGHT == theme) {
        titleView.setBackgroundColor(0xFF1C1C1C);
        titleText.setTextColor(0xFF666666);
        divider.setBackgroundColor(0xFF303030);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back_night);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg_night);
      } else {
        titleView.setBackgroundColor(res.getColor(R.color.action_bar_color));
        titleText.setTextColor(res.getColor(R.color.white));
        divider.setBackgroundColor(0xFFCACACA);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg);
      }
    }
  }
Пример #3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragement_hours, container, false);

    int orientation = getResources().getConfiguration().orientation;
    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
      rootView.setBackgroundResource(R.drawable.background_portrait);
    } else {
      rootView.setBackgroundResource(R.drawable.background_landscape);
    }

    TextView monday = (TextView) rootView.findViewById(R.id.mondayHoursText);
    monday.setText(getArguments().getString(getResources().getString(R.string.monday)));

    TextView tuesday = (TextView) rootView.findViewById(R.id.tuesdayHoursText);
    tuesday.setText(getArguments().getString(getResources().getString(R.string.tuesday)));

    TextView wednesday = (TextView) rootView.findViewById(R.id.wednesdayHoursText);
    wednesday.setText(getArguments().getString(getResources().getString(R.string.wednesday)));

    TextView thursday = (TextView) rootView.findViewById(R.id.thursdayHoursText);
    thursday.setText(getArguments().getString(getResources().getString(R.string.thursday)));

    TextView friday = (TextView) rootView.findViewById(R.id.fridayHoursText);
    friday.setText(getArguments().getString(getResources().getString(R.string.friday)));

    TextView saturday = (TextView) rootView.findViewById(R.id.saturdayHoursText);
    saturday.setText(getArguments().getString(getResources().getString(R.string.saturday)));

    TextView sunday = (TextView) rootView.findViewById(R.id.sundayHoursText);
    sunday.setText(getArguments().getString(getResources().getString(R.string.sunday)));

    return rootView;
  }
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;

    if (row == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      row = inflater.inflate(R.layout.list_row, null);
    } else row.setTag(""); // when reused, don't pretend to be something else

    TextView name = (TextView) row.findViewById(R.id.row_label);
    name.setText(mItems.get(position).mLabel);

    if (mLoadingBar == position
        || mItems.get(position).icon() == R.drawable.now_playing
        || mItems.get(position).icon() == R.drawable.now_paused) {
      ViewSwitcher switcher = (ViewSwitcher) row.findViewById(R.id.row_view_switcher);
      row.findViewById(R.id.row_view_switcher).setVisibility(View.VISIBLE);
      switcher.setDisplayedChild(mLoadingBar == position ? 1 : 0);
      ((ImageView) row.findViewById(R.id.row_disclosure_icon))
          .setImageResource(mItems.get(position).icon());
    } else {
      row.findViewById(R.id.row_view_switcher).setVisibility(View.GONE);
    }

    row.findViewById(R.id.row_icon).setVisibility(View.VISIBLE);
    ((ImageView) row.findViewById(R.id.row_icon)).setScaleType(ImageView.ScaleType.CENTER);
    ((ImageView) row.findViewById(R.id.row_icon)).setImageResource(R.drawable.list_icon_station);

    if (position == mItems.size() - 1) {
      row.setBackgroundResource(R.drawable.list_entry_rounded_bottom);
      row.setTag("bottom");
    } else row.setBackgroundResource(R.drawable.list_entry);

    return row;
  }
Пример #5
0
 /** @param refreshResult PullToRefreshLayout.SUCCEED代表成功,PullToRefreshLayout.FAIL代表失败 */
 public void refreshFinish(int refreshResult, String msg) {
   refreshingView.clearAnimation();
   refreshingView.setVisibility(View.GONE);
   switch (refreshResult) {
     case SUCCEED:
       // 刷新成功
       refreshStateImageView.setVisibility(View.VISIBLE);
       refreshStateTextView.setText(
           TextUtils.isEmpty(msg) ? getResources().getText(R.string.refresh_succeed) : msg);
       refreshStateImageView.setBackgroundResource(R.drawable.ic_load_success);
       break;
     case FAIL:
     default:
       // 刷新失败
       refreshStateImageView.setVisibility(View.VISIBLE);
       refreshStateTextView.setText(TextUtils.isEmpty(msg) ? "暂无数据加载" : msg);
       refreshStateImageView.setBackgroundResource(R.drawable.ic_load_failed);
       break;
   }
   // 刷新结果停留1秒
   new Handler() {
     @Override
     public void handleMessage(Message msg) {
       changeState(DONE);
       hide();
     }
   }.sendEmptyMessageDelayed(0, 1000);
 }
Пример #6
0
 /** 最简单的dialogure设置圆角背景 在没有title的时候使用 */
 public void setDialogRoundBg() {
   setMessage(null, 16);
   mContentView.setBackgroundResource(R.drawable.common_radius_top_white_background);
   mOkBtn.setBackgroundResource(R.drawable.common_radius_bottom_right_white_background);
   mCancelBtn.setBackgroundResource(R.drawable.common_radius_bottom_lift_white_background);
   mButtonView.setBackgroundResource(R.drawable.common_radius_bottom_white_background);
 }
    @Override
    public View getView(int arg0, View convertView, ViewGroup arg2) {
      ChildViewHolder cvh = null;
      if (convertView == null) {
        convertView =
            LayoutInflater.from(getActivity()).inflate(R.layout.doc_list_item_message, null);
        cvh = new ChildViewHolder(convertView);

        convertView.setTag(cvh);
      } else {
        cvh = (ChildViewHolder) convertView.getTag();
      }

      if (arg0 % 2 == 0) {
        convertView.setBackgroundResource(R.drawable.listview_001);
      } else {
        convertView.setBackgroundResource(R.drawable.listview_002);
      }

      DocMessageBean msg = messageList.get(arg0);

      if (msg.getIsRead().equals("1")) {
        cvh.imageIcon.setImageResource(R.drawable.icon_massge2);
      } else {
        cvh.imageIcon.setImageResource(R.drawable.icon_massge);
      }

      cvh.msgText.setText(msg.getMessage());
      cvh.timeText.setText(msg.getPushTime());

      return convertView;
    }
 private void addRemoveConf(View callView) {
   CTCall call = (CTCall) callView.getTag(); // get the call to add/remove
   if (confList.contains(call)) {
     // Move call to private list. If selected call was moved set conference to hold
     confList.remove(call);
     privateList.add(call);
     call.iIsInConferece = false;
     TiviPhoneService.doCmd("*-" + call.iCallId);
     if (call == TiviPhoneService.calls.selectedCall) setConfOnHold();
   } else {
     // move from private to conference. If the conference is on hold (does not
     // contains selected call) then new call will be set to hold also if it is
     // not the selected call.
     privateList.remove(call);
     confList.add(call);
     call.iIsInConferece = true;
     if (call != TiviPhoneService.calls.selectedCall && !call.iIsOnHold && isConfOnHold()) {
       call.iIsOnHold = true;
       TiviPhoneService.doCmd("*h" + call.iCallId);
     }
     TiviPhoneService.doCmd("*+" + call.iCallId);
   }
   if (call.iIsOnHold) {
     callView.setBackgroundResource(R.drawable.call_mng_hold);
   } else {
     callView.setBackgroundResource(R.drawable.call_mng_normal);
   }
   updateContentView();
 }
 /**
  * Draw cell for display if item is selected or not
  *
  * @param frontView view to draw
  * @param position position in list
  */
 protected void reloadChoiceStateInView(View frontView, int position) {
   if (isChecked(position)) {
     if (swipeDrawableChecked > 0) frontView.setBackgroundResource(swipeDrawableChecked);
   } else {
     if (swipeDrawableUnchecked > 0) frontView.setBackgroundResource(swipeDrawableUnchecked);
   }
 }
Пример #10
0
 /**
  * 加载完毕,显示加载结果。注意:加载完成后一定要调用这个方法
  *
  * @param refreshResult PullToRefreshLayout.SUCCEED代表成功,PullToRefreshLayout.FAIL代表失败
  */
 public void loadmoreFinish(int refreshResult, String msg) {
   loadingView.clearAnimation();
   loadingView.setVisibility(View.GONE);
   switch (refreshResult) {
     case SUCCEED:
       // 加载成功
       loadStateImageView.setVisibility(View.VISIBLE);
       loadStateTextView.setText(TextUtils.isEmpty(msg) ? "加载成功" : msg);
       loadStateImageView.setBackgroundResource(R.drawable.ic_load_success);
       break;
     case FAIL:
     default:
       // 加载失败
       loadStateImageView.setVisibility(View.VISIBLE);
       loadStateTextView.setText(TextUtils.isEmpty(msg) ? "加载失败" : msg);
       loadStateImageView.setBackgroundResource(R.drawable.ic_load_failed);
       break;
   }
   // 刷新结果停留1秒
   new Handler() {
     @Override
     public void handleMessage(Message msg) {
       changeState(DONE);
       hide();
     }
   }.sendEmptyMessageDelayed(0, 1000);
 }
Пример #11
0
  /**
   * Request or remove the focus from this window.
   *
   * @param focus Whether we want to gain or lose focus.
   * @return True if focus changed successfully, false if it failed.
   */
  public boolean onFocus(boolean focus) {
    if (!Utils.isSet(flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
      // window is focusable

      if (focus == focused) {
        // window already focused/unfocused
        return false;
      }

      focused = focus;

      // alert callbacks and cancel if instructed
      if (mContext.onFocusChange(id, this, focus)) {
        Log.d(
            TAG,
            "Window "
                + id
                + " focus change "
                + (focus ? "(true)" : "(false)")
                + " cancelled by implementation.");
        focused = !focus;
        return false;
      }

      if (!Utils.isSet(flags, StandOutFlags.FLAG_WINDOW_FOCUS_INDICATOR_DISABLE)) {
        // change visual state
        View content = findViewById(R.id.content);
        if (focus) {
          // gaining focus
          content.setBackgroundResource(R.drawable.border_focused);
        } else {
          // losing focus
          if (Utils.isSet(flags, StandOutFlags.FLAG_DECORATION_SYSTEM)) {
            // system decorations
            content.setBackgroundResource(R.drawable.border);
          } else {
            // no decorations
            content.setBackgroundResource(0);
          }
        }
      }

      // set window manager params
      StandOutLayoutParams params = getLayoutParams();
      params.setFocusFlag(focus);
      mContext.updateViewLayout(id, params);

      if (focus) {
        mContext.setFocusedWindow(this);
      } else {
        if (mContext.getFocusedWindow() == this) {
          mContext.setFocusedWindow(null);
        }
      }

      return true;
    }
    return false;
  }
Пример #12
0
 /**
  * 显示loading圈
  *
  * @param isTransparentBg isTransparentBg
  */
 private void showProgressView(Boolean isTransparentBg) {
   mProgressBarView.setVisibility(VISIBLE);
   if (!isTransparentBg) {
     mProgressBarView.setBackgroundResource(android.R.color.black);
   } else {
     mProgressBarView.setBackgroundResource(android.R.color.transparent);
   }
 }
 // ×Ô¶¯Çл»ºáÆÁÊúÆÁ
 public static void AutoBackground(
     Activity activity, View view, int Background_v, int Background_h) {
   int orient = ScreenOrient(activity);
   if (orient == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { // ×ÝÏò
     view.setBackgroundResource(Background_v);
   } else { // ºáÏò
     view.setBackgroundResource(Background_h);
   }
 }
	/**
	 * Returns the view for a specific item on the list
	 */
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View row = convertView;

		final WorkItem currentItem = getItem(position);

		if (row == null) {
			LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
			row = inflater.inflate(mLayoutResourceId, parent, false);
		}

		row.setTag(currentItem);
		final CheckBox checkBox = (CheckBox) row
				.findViewById(R.id.checkToDoItem);
		final TextView txtDate = (TextView) row
				.findViewById(R.id.textDueDate);

		final Calendar c = Calendar.getInstance();
		c.setTime(currentItem.getDueDate());

		int year = c.get(Calendar.YEAR);
		int month = c.get(Calendar.MONTH);
		int day = c.get(Calendar.DAY_OF_MONTH);
		int hour = c.get(Calendar.HOUR_OF_DAY);
		int minute = c.get(Calendar.MINUTE);
		@SuppressWarnings("deprecation")
		String gmtTime = currentItem.getDueDate().toGMTString();
		// set current date into textview
		txtDate.setText(gmtTime);
		
		checkBox.setText(currentItem.getTitle());
		checkBox.setChecked(currentItem.isComplete());
		checkBox.setEnabled(true);
		checkBox.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				if (checkBox.isChecked()) {
					checkBox.setEnabled(false);
					if (mContext instanceof ToDoActivity) {
						ToDoActivity activity = (ToDoActivity) mContext;
						activity.checkItem(currentItem);
					}
				}
			}
		});
		
		Date currentDate = new Date();
		row.setBackgroundResource(R.color.normal);
		if(currentItem.getDueDate().before(currentDate))
		{
			row.setBackgroundResource(R.color.highlight);	
		}
		
		return row;
	}
Пример #15
0
 @Override
 public void onTextChanged(CharSequence s, int start, int before, int count) {
   if (checkNextClickable()) {
     next_stepView.setClickable(true);
     next_stepView.setBackgroundResource(R.drawable.blue_retancle_button_selector);
   } else {
     next_stepView.setClickable(false);
     next_stepView.setBackgroundResource(R.color.vd0d0d0);
   }
 }
Пример #16
0
 public void setCurrentPage(int index) {
   for (int i = 0, size = getChildCount(); i < size; i++) {
     View view = getChildAt(i);
     if (i == index) {
       view.setBackgroundResource(EUExUtil.getResDrawableID("plugin_timemachine_page_focus"));
     } else {
       view.setBackgroundResource(EUExUtil.getResDrawableID("plugin_timemachine_page_normal"));
     }
   }
 }
  public void setCurrentItemWithoutAnim(int item) {
    final View oldChild = getChildAt(mCurrentPosition);
    final View newChild = getChildAt(item);

    oldChild.setBackgroundResource(R.color.transparent);
    newChild.setBackgroundResource(R.color.orange);

    mCurrentPosition = item;
    invalidate();
  }
Пример #18
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    HutangHolder holder = null;

    if (convertView == null) {
      holder = new HutangHolder();
      convertView = inflater.inflate(R.layout.hutang_fragment_list_rows, null);
      holder.nama = (TextView) convertView.findViewById(R.id.hutang_fragment_list_rows_judul);
      holder.tanggal_deadline =
          (TextView) convertView.findViewById(R.id.hutang_fragment_list_rows_tanggal_deadline);
      holder.nominalAtas =
          (TextView) convertView.findViewById(R.id.hutang_fragment_list_rows_nominal_atas);
      holder.nominalBawah =
          (TextView) convertView.findViewById(R.id.hutang_fragment_list_rows_nominal_bawah);
      holder.bar = (ProgressBar) convertView.findViewById(R.id.hutang_fragment_list_rows_bar);
      convertView.setTag(holder);
    } else {
      holder = (HutangHolder) convertView.getTag();
    }

    HutangObject hutangObject = values.get(position);

    // set nama
    holder.nama.setText(hutangObject.nama);

    // set tanggal
    holder.tanggal_deadline.setText(hutangObject.tanggal_deadline);

    //// nominal format
    DecimalFormatSymbols simbol = new DecimalFormatSymbols();
    simbol.setGroupingSeparator('.');
    DecimalFormat customFormat = new DecimalFormat("###,###,###", simbol);

    // set nominal atas dengan jumlah pengeluaran yang telah dikeluarkan
    holder.nominalAtas.setText(customFormat.format(hutangObject.jumlah_cicilan));

    // set nominal bawah dengan jumlah anggaran
    holder.nominalBawah.setText(customFormat.format(hutangObject.jumlah_hutang));

    // set seekbar
    holder.bar.setMax(hutangObject.jumlah_hutang);
    holder.bar.setProgress(hutangObject.jumlah_cicilan);

    // membuat warna zebra di rows
    if (position % 2 == 0) {
      convertView.setBackgroundResource(R.drawable.listview_rows_color_1);
    } else {
      convertView.setBackgroundResource(R.drawable.listview_rows_color_2);
    }

    return convertView;
  }
Пример #19
0
 @Override
 public void onAutoFocus(boolean success, Camera camera) {
   if (success) {
     mode = MODE.FOCUSED;
     view_focus.setBackgroundResource(CRes.plugin_camera_view_focused_bg);
   } else {
     mode = MODE.FOCUSFAIL;
     view_focus.setBackgroundResource(CRes.plugin_camera_view_focus_fail_bg);
   }
   setFocusView();
 }
Пример #20
0
    @Override
    public void bindView(View view, Context context, final Cursor cursor) {
      boolean inConflict = WebData.Object.inConflict(cursor);

      if (inConflict) {
        view.setBackgroundResource(R.color.conflicted);
      } else {
        view.setBackgroundResource(android.R.color.black);
      }

      super.bindView(view, context, cursor);
    }
 /** 根据类型设置头部,图片,文字等 */
 private void setHeader() {
   if (mCategory.equals(Constant.CATEGORY_EXERCISE)) {
     mCollapsingToolbarLayout.setTitle("运动");
     mHeader.setBackgroundResource(R.mipmap.exerise_header);
   } else if (mCategory.equals(Constant.CATEGORY_FOOD)) {
     mCollapsingToolbarLayout.setTitle("美食");
     mHeader.setBackgroundResource(R.mipmap.food_header);
   } else if (mCategory.equals(Constant.CATEGORY_MOVIE)) {
     mCollapsingToolbarLayout.setTitle("电影");
     mHeader.setBackgroundResource(R.mipmap.movie_header);
   }
 }
Пример #22
0
 @Override
 public void onClick(View v) {
   if (player.isPlaying()) {
     player.pause();
     v.setBackgroundResource(R.drawable.player_play_button);
   } else {
     if (isPlayerSet) {
       player.start();
       v.setBackgroundResource(R.drawable.player_pause_button);
     }
   }
 }
Пример #23
0
 public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
 {
   ck localck;
   if (paramView == null)
   {
     localck = new ck();
     paramView = this.iD.inflate(2130903198, null);
     localck.mX = ((LinearLayout)paramView.findViewById(2131296822));
     localck.mY = ((ImageView)paramView.findViewById(2131296338));
     localck.mS = ((TextView)paramView.findViewById(2131296337));
     localck.ne = ((TextView)paramView.findViewById(2131296894));
     localck.na = ((LinearLayout)paramView.findViewById(2131296824));
     localck.nb = ((TextView)paramView.findViewById(2131296825));
     paramView.setTag(localck);
   }
   ae localae;
   try
   {
     localae = (ae)this.mH.get(paramInt);
     if (isEnabled(paramInt))
     {
       localck.nc = true;
       localck.mX.setVisibility(0);
       localck.na.setVisibility(8);
       if (localae.gE().equals("1"))
         paramView.setBackgroundResource(2130837903);
       while (true)
       {
         localck.ne.setVisibility(0);
         localck.ne.setText(localae.gy());
         localck.mS.setText(localae.getDisplayName());
         localck.mY.setImageResource(2130837907);
         return paramView;
         localck = (ck)paramView.getTag();
         break;
         paramView.setBackgroundResource(2130837902);
       }
     }
   }
   catch (Exception localException)
   {
     b.eA("PhoneListAdapter getView: " + localException.toString());
     return paramView;
   }
   localck.nc = false;
   String str = localae.getDisplayName();
   localck.nb.setText(str);
   localck.mX.setVisibility(8);
   localck.na.setVisibility(0);
   return paramView;
 }
 private void initFragmentLayoutBg(View view) {
   if (view != null && !(view instanceof SwipeBackLayout) && view.getBackground() == null) {
     int background = getWindowBackground();
     view.setBackgroundResource(background);
   } else {
     if (view instanceof SwipeBackLayout) {
       View childView = ((SwipeBackLayout) view).getChildAt(0);
       if (childView != null && childView.getBackground() == null) {
         int background = getWindowBackground();
         childView.setBackgroundResource(background);
       }
     }
   }
 }
Пример #25
0
 @Override
 public void onTabChanged(String tabId) {
   int tabID = Integer.valueOf(tabId);
   for (int i = 0; i < mTabWidget.getChildCount(); i++) {
     View view = mTabWidget.getChildAt(i);
     TextView title = (TextView) view.findViewById(R.id.main_activity_tab_text);
     if (tabID == i) {
       view.setBackgroundResource(R.drawable.number_bg_pressed);
       title.setTextColor(Color.rgb(255, 255, 255));
     } else {
       view.setBackgroundResource(R.drawable.number_bg);
       title.setTextColor(Color.rgb(0, 0, 0));
     }
   }
 }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   LayoutInflater inflater =
       (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   if (position == 0) {
     convertView = inflater.inflate(R.layout.son_dakika_title, null);
     holder.saatTitle = (TextView) convertView.findViewById(R.id.titleSonDakikaText);
     holder.saatTitle.setText(realValues[0][0]);
   } else if ((Home.HasBanner || haveBanner) && position == 1) {
     haveBanner = true;
     convertView = inflater.inflate(R.layout.banner_item, null);
     bannerK = 1;
   } else if (position == ValuesLength - 1) {
     convertView = inflater.inflate(R.layout.copyright_item, null);
     ((TextView) convertView.findViewById(R.id.Copyrigth))
         .setText("Copyright \u00A9 " + Integer.toString(year) + " Milliyet");
   } else {
     if (position - bannerK == 0) {
       convertView = inflater.inflate(R.layout.son_dakika_title, null);
       holder.saatTitle = (TextView) convertView.findViewById(R.id.titleSonDakikaText);
       holder.saatTitle.setText(realValues[0][0]);
     } else if (!realValues[position - bannerK][3].equals("")) {
       convertView = inflater.inflate(R.layout.news_items_with_image_without_publishtime, null);
       holder.haberTitle = (TextView) convertView.findViewById(R.id.haberText);
       holder.haberTitle.setText(realValues[position - bannerK][2]);
       ImageView jpgView = (ImageView) convertView.findViewById(R.id.newsImage);
       Bitmap bitmap =
           BitmapFactory.decodeFile(
               "/sdcard/Milliyet/newscategory/" + realValues[position - bannerK][3]);
       jpgView.setImageBitmap(bitmap);
       ID = (TextView) convertView.findViewById(R.id.ID);
       ID.setText(realValues[position - bannerK][1]);
     } else {
       convertView = inflater.inflate(R.layout.news_items_without_publishtime, null);
       holder.haberTitle = (TextView) convertView.findViewById(R.id.haberText);
       holder.haberTitle.setText(realValues[position - bannerK][2]);
       ID = (TextView) convertView.findViewById(R.id.ID);
       ID.setText(realValues[position - bannerK][1]);
     }
     if (position % 2 == 0) {
       convertView.setBackgroundResource(R.color.listview_selector_grey);
     } else {
       convertView.setBackgroundResource(R.color.listview_selector_white);
     }
   }
   convertView.setTag(holder);
   return convertView;
 }
Пример #27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPointContainer = (LinearLayout) findViewById(R.id.point_container);
    mTvTitle = (TextView) findViewById(R.id.tv_title);

    // ListView --> setAdapter() --》 adapter --->集合List<数据>

    // 初始化数据

    mListDatas = new ArrayList<ImageView>();
    for (int i = 0; i < imgs.length; i++) {
      // 给集合添加ImageView
      ImageView iv = new ImageView(this);
      iv.setImageResource(imgs[i]);
      iv.setScaleType(ScaleType.FIT_XY);

      mListDatas.add(iv);

      // 添加点
      View point = new View(this);
      point.setBackgroundResource(R.drawable.point_normal);
      LayoutParams params = new LayoutParams(10, 10);
      if (i != 0) {
        params.leftMargin = 10;
      } else {
        point.setBackgroundResource(R.drawable.point_selected);

        mTvTitle.setText(titles[i]);
      }
      mPointContainer.addView(point, params);
    }

    // 设置数据的方式
    mPager.setAdapter(new MyAdapter());

    // 设置监听器
    mPager.setOnPageChangeListener(this);

    // 设置默认选中中间的item
    int middle = Integer.MAX_VALUE / 2;
    int extra = middle % mListDatas.size();
    int item = middle - extra;
    mPager.setCurrentItem(item);
  }
  private void switchCallHold(CTCall call, View view) {

    // If call is currently not on hold, try to set it to hold
    if (!call.iIsOnHold) {
      if (call == TiviPhoneService.calls.selectedCall) // Never put selected call in hold mode
      return;

      if (inOutList.contains(call)) return;

      // handle conference calls only: we can set a call to hold mode without switching selected
      // call
      if (confList.contains(call)) {
        if (isConfOnHold()) // if conference is on hold, no need to process
        return;
      }
      view.setBackgroundResource(R.drawable.call_mng_hold);
      call.iIsOnHold = true;
      TiviPhoneService.doCmd("*h" + call.iCallId);
    }
    // Try to set to non-hold mode
    else {
      CTCall otherCall = TiviPhoneService.calls.selectedCall;

      if (confList.contains(call)) {
        // empty - may be we need some code later
      }
      // try to set the clicked call to un-hold state
      else if (privateList.contains(call)) {

        // The clicked call will become the selected call, thus if the current selected
        // call is a conference call we need to set conference to hold first.
        if (confList.contains(otherCall)) {
          setConfOnHold();
        } else {
          View otherView = findContentViewByTag(otherCall);
          otherCall.iIsOnHold = true;
          otherView.setBackgroundResource(R.drawable.call_mng_hold);
          TiviPhoneService.doCmd("*h" + otherCall.iCallId);
        }
      } else return;

      // un-hold the clicked call and set it as new current selected call
      call.iIsOnHold = false;
      view.setBackgroundResource(R.drawable.call_mng_normal);
      TiviPhoneService.calls.setCurCall(call);
      TiviPhoneService.doCmd("*u" + call.iCallId);
    }
  }
Пример #29
0
  /** 自定义归属地浮窗 */
  private void showToast(String string) {
    windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);

    WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    params.height = WindowManager.LayoutParams.WRAP_CONTENT;
    params.width = WindowManager.LayoutParams.WRAP_CONTENT;
    params.flags =
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
            | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
            | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
    params.format = PixelFormat.TRANSLUCENT;
    params.type = WindowManager.LayoutParams.TYPE_TOAST;
    params.setTitle("Toast");

    view = View.inflate(this, R.layout.toast_layout, null);

    int[] bgs =
        new int[] {
          R.drawable.call_locate_white,
          R.drawable.call_locate_orange,
          R.drawable.call_locate_blue,
          R.drawable.call_locate_gray,
          R.drawable.call_locate_green
        };
    int style = getSharedPreferences("config", MODE_PRIVATE).getInt("address_style", 0);
    TextView textView = (TextView) view.findViewById(R.id.tv_number);
    view.setBackgroundResource(bgs[style]);
    textView.setText(string);
    windowManager.addView(view, params);
  }
  private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

      View v = tabsContainer.getChildAt(i);

      v.setBackgroundResource(tabBackgroundResId);

      if (v instanceof TextView) {

        TextView tab = (TextView) v;
        tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
        tab.setTypeface(tabTypeface, tabTypefaceStyle);
        tab.setTextColor(tabTextColor);

        // setAllCaps() is only available from API 14, so the upper case is made manually if we are
        // on a
        // pre-ICS-build
        if (textAllCaps) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            tab.setAllCaps(true);
          } else {
            tab.setText(tab.getText().toString().toUpperCase(locale));
          }
        }
      }
    }
  }