android.widget.TextView#setBackgroundColor ( )源码实例Demo

下面列出了android.widget.TextView#setBackgroundColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Musicoco   文件: MainSheetsController.java
private void updateTextAndColor(TextView categoryView, int count, TextView countView, int[] colors) {

        categoryView.setBackgroundColor(colors[2]);
        categoryView.setTextColor(colors[3]);

        GradientDrawable countD = new GradientDrawable();
        countD.setColor(colors[0]);
        countD.setCornerRadius(countView.getHeight() / 2);
        countView.setBackground(countD);
        countView.setTextColor(colors[1]);

        int c = count;
        if (countView == mCountRecent) {
            int recent = activity.getResources().getInteger(R.integer.sheet_recent_count);
            c = count > recent ? recent : c;
        }
        countView.setText(String.valueOf(c));

    }
 
源代码2 项目: RxTools-master   文件: RxBaseRoundProgressBar.java
private void previewLayout(Context context) {
    setGravity(Gravity.CENTER);
    TextView tv = new TextView(context);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    tv.setLayoutParams(params);
    tv.setGravity(Gravity.CENTER);
    tv.setText(getClass().getSimpleName());
    tv.setTextColor(Color.WHITE);
    tv.setBackgroundColor(Color.GRAY);
    addView(tv);
}
 
源代码3 项目: Musicoco   文件: PlayThemeCustomActivity.java
private void update() {
    viewHolder.imageSwitch.setImageResource(dataHolder.images[select]);
    for (int i = 0; i < viewHolder.texts.length; i++) {
        TextView view = viewHolder.texts[i];
        if (i == select) {
            view.setTextColor(selectTC);
            view.setBackgroundColor(selectBC);
        } else {
            view.setTextColor(mainTC);
            view.setBackgroundColor(Color.TRANSPARENT);
        }
    }
}
 
源代码4 项目: meiShi   文件: UiHelper.java
/**
 * 创建一个简单的PopupWindow只显示一行文字
 *
 * @return
 */
public static PopupWindow createSimplePopupWindow(String text, int backgroundColorId) {
    View popView = LayoutInflater.from(App.getInstance()).inflate(R.layout.view_popwindow_text, null);
    TextView textView = (TextView) popView.findViewById(R.id.textView);
    int color = ResourcesUtils.getColor(popView, backgroundColorId);
    textView.setBackgroundColor(color);
    textView.setText(text);
    PopupWindow popupWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setOutsideTouchable(true);
    return popupWindow;
}
 
源代码5 项目: Colours   文件: MainActivity.java
private void createLightContrastingColor() {
	// Connect XML View
	LightContrastingColorTextView = (TextView) findViewById(R.id.LightContrastingColorTextView);

	// Define background color
	int backgroundColor = Colour.seashellColor(); // Change this to see a
													// new contrasting color
	LightContrastingColorTextView.setBackgroundColor(backgroundColor);

	// Set contrasting color
	LightContrastingColorTextView.setTextColor(Colour
			.blackOrWhiteContrastingColor(backgroundColor));

}
 
@Override
public View getItemView(Fragment fragment, ImageItem imageItem, IPickerPresenter presenter) {
    if (imageItem.isVideo()) {
        TextView view = new TextView(fragment.getContext());
        view.setText("这是视频");
        view.setTextColor(Color.WHITE);
        view.setGravity(Gravity.CENTER);
        view.setBackgroundColor(Color.RED);
        return view;
    }
    return super.getItemView(fragment, imageItem, presenter);
}
 
源代码7 项目: android   文件: ScreenSlidePageFragment.java
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.item_transformer, container, false);
    TextView tvContent = view.findViewById(R.id.tv_content);
    tvContent.setText(String.valueOf(mIndex));
    tvContent.setBackgroundColor(COLORS[mRandom.nextInt(COLORS.length)]);
    return view;
}
 
源代码8 项目: android_9.0.0_r45   文件: AppWidgetHostView.java
/**
 * Inflate and return a view that represents an error state.
 */
protected View getErrorView() {
    TextView tv = new TextView(mContext);
    tv.setText(com.android.internal.R.string.gadget_host_error_inflating);
    // TODO: get this color from somewhere.
    tv.setBackgroundColor(Color.argb(127, 0, 0, 0));
    return tv;
}
 
源代码9 项目: RichEditorView   文件: TextViewItem.java
@Override
public void onSelectChange(boolean isSelected) {
    TextView textView = (TextView) getMainView();
    if(textView != null) {
        if (isSelected) {
            textView.setBackgroundColor(Color.YELLOW);
        } else {
            textView.setBackgroundColor(Color.TRANSPARENT);
        }
    }
}
 
public ViewHolder(View view) {
    tvItemTitle   = (TextView) view.findViewById(R.id.tvItemTitle);
    tvItemLicense = (TextView) view.findViewById(R.id.tvItemLicense);

    tvItemTitle.setTextColor(customUI.getTitleTextColor());
    tvItemLicense.setBackgroundColor(customUI.getLicenseBackgroundColor());
    tvItemLicense.setTextColor(customUI.getLicenseTextColor());
}
 
源代码11 项目: SmallGdufe-Android   文件: ScheduleView.java
/**
 * 横的分界线
 *
 * @return
 */
private View getWeekTransverseLine() {
    TextView mWeekline = new TextView(getContext());
    mWeekline.setBackgroundColor(getResources().getColor(R.color.view_line));
    mWeekline.setHeight(TimeTableLineHeight);
    mWeekline.setWidth(LayoutParams.FILL_PARENT);
    return mWeekline;
}
 
源代码12 项目: grox   文件: MainActivity.java
private void updateUI(State newState) {
  final TextView label = (TextView) findViewById(R.id.label);
  label.setBackgroundColor(getResources().getColor(android.R.color.background_light));
  label.setText("");
  if (newState.isRefreshing) {
    label.setText("↺");
  } else if (newState.error != null) {
    label.setText(newState.error);
  } else if (newState.color != State.INVALID_COLOR) {
    label.setBackgroundColor(newState.color);
  }
}
 
源代码13 项目: RunMap   文件: BuildingActivity.java
@Override
public void showEmptyLayout() {
    TextView textView = new TextView(BuildingActivity.this);
    textView.setText(R.string.string_empty_tips);
    textView.setTextSize(30);
    textView.setBackgroundColor(Color.WHITE);
    textView.setGravity(Gravity.CENTER);
    ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    textView.setLayoutParams(lp);
    ((ViewGroup)(findViewById(android.R.id.content))).addView(textView);
}
 
源代码14 项目: droidkit-webrtc   文件: AppRTCDemoActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Thread.setDefaultUncaughtExceptionHandler(
      new UnhandledExceptionHandler(this));

  getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

  Point displaySize = new Point();
  getWindowManager().getDefaultDisplay().getRealSize(displaySize);

  vsv = new AppRTCGLView(this, displaySize);
  VideoRendererGui.setView(vsv);
  remoteRender = VideoRendererGui.create(0, 0, 100, 100);
  localRender = VideoRendererGui.create(70, 5, 25, 25);

  vsv.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        toggleHUD();
      }
    });
  setContentView(vsv);
  logAndToast("Tap the screen to toggle stats visibility");

  hudView = new TextView(this);
  hudView.setTextColor(Color.BLACK);
  hudView.setBackgroundColor(Color.WHITE);
  hudView.setAlpha(0.4f);
  hudView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 5);
  hudView.setVisibility(View.INVISIBLE);
  addContentView(hudView, hudLayout);

  if (!factoryStaticInitialized) {
    abortUnless(PeerConnectionFactory.initializeAndroidGlobals(
        this, true, true),
      "Failed to initializeAndroidGlobals");
    factoryStaticInitialized = true;
  }

  AudioManager audioManager =
      ((AudioManager) getSystemService(AUDIO_SERVICE));
  // TODO(fischman): figure out how to do this Right(tm) and remove the
  // suppression.
  @SuppressWarnings("deprecation")
  boolean isWiredHeadsetOn = audioManager.isWiredHeadsetOn();
  audioManager.setMode(isWiredHeadsetOn ?
      AudioManager.MODE_IN_CALL : AudioManager.MODE_IN_COMMUNICATION);
  audioManager.setSpeakerphoneOn(!isWiredHeadsetOn);

  sdpMediaConstraints = new MediaConstraints();
  sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
      "OfferToReceiveAudio", "true"));
  sdpMediaConstraints.mandatory.add(new MediaConstraints.KeyValuePair(
      "OfferToReceiveVideo", "true"));

  final Intent intent = getIntent();
  if ("android.intent.action.VIEW".equals(intent.getAction())) {
    connectToRoom(intent.getData().toString());
    return;
  }
  showGetRoomUI();
}
 
@Override
    protected void initData() {
        userBean = MyApplication.getInstance().getUserBean();
        mAccountInfoBeanList = JsonUtil.parseJsonToArrayList(userBean.getAccount_info(), AccountInfoBean.class);
        for (int i = 0; i < mAccountInfoBeanList.size(); i++) {
            if (mAccountInfoBeanList.get(i).getIs_main_account().equals("1")) {//剔除主账号
                mAccountInfoBeanList.remove(i);
            }
        }
        LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        layoutManager.setSmoothScrollbarEnabled(true);
        mUserAccountNumber.setLayoutManager(layoutManager);
        mCommonAdapter = new CommonAdapter<AccountInfoBean>(this, R.layout.item_comment_swip, mAccountInfoBeanList) {
            @Override
            protected void convert(final ViewHolder holder, final AccountInfoBean accountInfoBean, final int position) {
                final TextView oneMenu = holder.getView(R.id.right_one);
                final TextView account_number = holder.getView(R.id.account_number);
                final ImageView account_img = holder.getView(R.id.account_img);
                final ImageView account_lock = holder.getView(R.id.account_lock);
                final SwipeItemLayout swipeLayout = (SwipeItemLayout) holder.itemView;
                account_number.setText(accountInfoBean.getAccount_name());
                if (accountInfoBean.getIs_privacy_policy().equals("1")) {
                    account_lock.setVisibility(View.VISIBLE);
                } else {
                    account_lock.setVisibility(View.GONE);
                }
                MyApplication.getInstance().showImage(accountInfoBean.getAccount_img(), account_img);
                oneMenu.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        presenter.setPolicyAccountData(accountInfoBean.getAccount_name(), (accountInfoBean.getIs_privacy_policy().equals("0") ? "1" : "0"), (position - 1));
                        swipeLayout.close();
                    }
                });
                holder.getConvertView().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Bundle bundle = new Bundle();
                        bundle.putParcelable("bean", accountInfoBean);
                        ActivityUtils.next(WalletManagementActivity.this, AccountDetailsActivity.class, bundle);
                    }
                });
            }
        };

        //顶部布局作为头添加进去
        HeaderAndFooterWrapper headerAndFooterWrapper = new HeaderAndFooterWrapper(mCommonAdapter);
        LayoutInflater mInflater = LayoutInflater.from(this);
        View contentView = mInflater.inflate(R.layout.wallet_management_header, null);
        LinearLayout linearLayout = (LinearLayout) contentView.findViewById(R.id.wallet_management_header_ll);
        desc = (TextView) contentView.findViewById(R.id.desc);
        create_number = (TextView) contentView.findViewById(R.id.create_number);
        import_number = (TextView) contentView.findViewById(R.id.import_number);
        backup_number = (TextView) contentView.findViewById(R.id.backup_number);
        reset_password = (TextView) contentView.findViewById(R.id.reset_password);
        main_account = (TextView) contentView.findViewById(R.id.main_account);
        main_account_img = (ImageView) contentView.findViewById(R.id.main_account_img);
        headerAndFooterWrapper.addHeaderView(linearLayout);

        main_account.setText(userBean.getWallet_main_account());
        MyApplication.getInstance().showImage(userBean.getWallet_main_account_img(), main_account_img);
//        mUserAccountNumber.addItemDecoration(new RecycleViewDivider(getContext(), LinearLayoutManager.HORIZONTAL, 1, getResources().getColor(R.color.line)));
        mUserAccountNumber.setAdapter(headerAndFooterWrapper);


        if (!Utils.getSpUtils().getString("loginmode", "").equals("phone")) {
            desc.setBackgroundColor(getResources().getColor(R.color.black_box_coin_backgroud));
            desc.setTextColor(getResources().getColor(R.color.blackbox_desc_text));
            TextDrawUtil.setDrawableTop(this,create_number, R.mipmap.black_box_creat_account);
            TextDrawUtil.setDrawableTop(this,import_number, R.mipmap.black_box_import_account);
            TextDrawUtil.setDrawableTop(this,backup_number, R.mipmap.black_box_back_up_wallet);
            TextDrawUtil.setDrawableTop(this,reset_password, R.mipmap.black_box_chang_pwd);
        }
    }
 
源代码16 项目: TelePlus-Android   文件: VoIPActivity.java
private void showDebugAlert() {
      if(VoIPService.getSharedInstance()==null)
          return;
VoIPService.getSharedInstance().forceRating();
final LinearLayout debugOverlay=new LinearLayout(this);
      debugOverlay.setOrientation(LinearLayout.VERTICAL);
      debugOverlay.setBackgroundColor(0xCC000000);
      int pad=AndroidUtilities.dp(16);
      debugOverlay.setPadding(pad, pad*2, pad, pad*2);

      TextView title=new TextView(this);
      title.setTextColor(0xFFFFFFFF);
      title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      title.setTypeface(Typeface.DEFAULT_BOLD);
      title.setGravity(Gravity.CENTER);
      title.setText("libtgvoip v"+VoIPController.getVersion());
      debugOverlay.addView(title, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 16));

      ScrollView scroll=new ScrollView(this);
      final TextView debugText=new TextView(this);
      debugText.setTypeface(Typeface.MONOSPACE);
      debugText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
      debugText.setMaxWidth(AndroidUtilities.dp(350));
      debugText.setTextColor(0xFFFFFFFF);
      debugText.setText(getFormattedDebugString());
      scroll.addView(debugText);
      debugOverlay.addView(scroll, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 1f));

      TextView closeBtn=new TextView(this);
      closeBtn.setBackgroundColor(0xFFFFFFFF);
      closeBtn.setTextColor(0xFF000000);
      closeBtn.setPadding(pad, pad, pad, pad);
      closeBtn.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
      closeBtn.setText(LocaleController.getString("Close", R.string.Close));
      debugOverlay.addView(closeBtn, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));

      final WindowManager wm=(WindowManager) getSystemService(WINDOW_SERVICE);
      wm.addView(debugOverlay, new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_PANEL, 0, PixelFormat.TRANSLUCENT));

      closeBtn.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v){
              wm.removeView(debugOverlay);
          }
      });

      final Runnable r = new Runnable() {
          @Override
          public void run() {
              if (isFinishing() || VoIPService.getSharedInstance() == null) {
                  return;
              }
              debugText.setText(getFormattedDebugString());
              debugOverlay.postDelayed(this, 500);
          }
      };
      debugOverlay.postDelayed(r, 500);
  }
 
private void displaySuggestion(View view, Suggestion suggestion) {
    TextView status = (TextView) view.findViewById(R.id.uv_status);
    TextView responseStatus = (TextView) view.findViewById(R.id.uv_response_status);
    View responseDivider = view.findViewById(R.id.uv_response_divider);
    TextView title = (TextView) view.findViewById(R.id.uv_title);

    if (suggestion.isSubscribed()) {
        ((CheckBox) view.findViewById(R.id.uv_subscribe_checkbox)).setChecked(true);
    }

    if (suggestion.getStatus() == null) {
        status.setVisibility(View.GONE);
        int defaultColor = Color.DKGRAY;
        responseStatus.setTextColor(defaultColor);
        responseDivider.setBackgroundColor(defaultColor);
    } else {
        int color = Color.parseColor(suggestion.getStatusColor());
        status.setBackgroundColor(color);
        status.setText(suggestion.getStatus());
        responseStatus.setTextColor(color);
        responseStatus.setText(String.format(getString(R.string.uv_admin_response_format), suggestion.getStatus().toUpperCase(Locale.getDefault())));
        responseDivider.setBackgroundColor(color);
    }

    title.setText(suggestion.getTitle());
    ((TextView) view.findViewById(R.id.uv_text)).setText(suggestion.getText());
    ((TextView) view.findViewById(R.id.uv_creator)).setText(String.format(view.getContext().getString(R.string.uv_posted_by_format), suggestion.getCreatorName(), DateFormat.getDateInstance().format(suggestion.getCreatedAt())));

    if (suggestion.getAdminResponseText() == null) {
        view.findViewById(R.id.uv_admin_response).setVisibility(View.GONE);
    } else {
        view.findViewById(R.id.uv_admin_response).setVisibility(View.VISIBLE);
        ((TextView) view.findViewById(R.id.uv_admin_name)).setText(suggestion.getAdminResponseUserName());
        ((TextView) view.findViewById(R.id.uv_response_date)).setText(DateFormat.getDateInstance().format(suggestion.getAdminResponseCreatedAt()));
        ((TextView) view.findViewById(R.id.uv_response_text)).setText(suggestion.getAdminResponseText());
        ImageView avatar = (ImageView) view.findViewById(R.id.uv_admin_avatar);
        ImageCache.getInstance().loadImage(suggestion.getAdminResponseAvatarUrl(), avatar);
    }

    ((TextView) view.findViewById(R.id.uv_comment_count)).setText(Utils.getQuantityString(view, R.plurals.uv_comments, suggestion.getNumberOfComments()).toUpperCase(Locale.getDefault()));
    ((TextView) view.findViewById(R.id.uv_subscriber_count)).setText(String.format(view.getContext().getResources().getQuantityString(R.plurals.uv_number_of_subscribers_format, suggestion.getNumberOfSubscribers()), Utils.getQuantityString(view, R.plurals.uv_subscribers, suggestion.getNumberOfSubscribers())));
}
 
源代码18 项目: LogicalDefence   文件: MainActivity.java
private void unsetDrawerItemSelected(TextView item) {
    if (item != null) {
        item.setBackgroundColor(Color.TRANSPARENT);
        item.setTextColor(getResources().getColor(R.color.primary_dark_material_dark));
    }
}
 
源代码19 项目: Auie   文件: UIActionSheetDialog.java
/**
 * 构建内容视图 - ANDROID
 * @return 内容视图
 */
private View createContentViewForANDROID(){
	//根布局
	rootLayout = new LinearLayout(context);
	rootLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	rootLayout.setOrientation(LinearLayout.VERTICAL);
	rootLayout.setBackgroundColor(Color.parseColor("#55000000"));
	rootLayout.setGravity(Gravity.BOTTOM);
	
	parentLayout = new LinearLayout(context);
	parentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	parentLayout.setOrientation(LinearLayout.VERTICAL);
	parentLayout.setBackgroundColor(backgroundColor);
	
	LinearLayout childLayout = new LinearLayout(context);
	LayoutParams childParams = getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	childLayout.setLayoutParams(childParams);
	childLayout.setOrientation(LinearLayout.VERTICAL);
	
	//标题
	TextView titleTextView = new TextView(context);
	titleTextView.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	titleTextView.setMinHeight(48 * DP);
	titleTextView.setTextSize(12);
	titleTextView.setGravity(Gravity.CENTER);
	titleTextView.setTextColor(titleColor);
	if (title == null) {
		titleTextView.setVisibility(View.GONE);
	}else{
		titleTextView.setVisibility(View.VISIBLE);
		titleTextView.setText(title);
	}
	
	//内容外层布局
	sheetLayout = new ScrollView(context);
	sheetLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	sheetLayout.setFadingEdgeLength(0);
	
	//内容内层布局
	contentLayout = new LinearLayout(context);
	contentLayout.setLayoutParams(getParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	contentLayout.setOrientation(LinearLayout.VERTICAL);
	sheetLayout.addView(contentLayout);
	
	//取消按钮
	final TextView cancelTextView = new TextView(context);
	LayoutParams params = getParams(LayoutParams.MATCH_PARENT, 52 * DP);
	params.setMargins(0, 8 * DP, 0, 0);
	cancelTextView.setLayoutParams(params);
	cancelTextView.setTextColor(cancelColor);
	cancelTextView.setTextSize(16);
	cancelTextView.setGravity(Gravity.CENTER);
	cancelTextView.setText("取消");
	cancelTextView.setBackgroundColor(itemBackgroundColor);
	cancelTextView.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			dismiss();
		}
	});
	
	//控件创建结束
	childLayout.addView(titleTextView);
	childLayout.addView(sheetLayout);
	parentLayout.addView(childLayout);
	parentLayout.addView(cancelTextView);
	rootLayout.addView(parentLayout);
	if (typeface != null) {
		titleTextView.setTypeface(typeface);
		cancelTextView.setTypeface(typeface);
	}
	return rootLayout;
}
 
源代码20 项目: your-local-weather   文件: GraphsActivity.java
@Override
protected void updateUI() {
    View switchPanel = findViewById(R.id.graph_switch_panel);
    if (ApiKeys.isWeatherForecastFeaturesFree(this)) {
        switchPanel.setVisibility(View.INVISIBLE);
    } else {
        switchPanel.setVisibility(View.VISIBLE);
    }

    WeatherForecastDbHelper weatherForecastDbHelper = WeatherForecastDbHelper.getInstance(this);
    long locationId = AppPreference.getCurrentLocationId(this);
    currentLocation = locationsDbHelper.getLocationById(locationId);
    if (currentLocation == null) {
        return;
    }
    mValueFormatter = new CustomValueFormatter(currentLocation.getLocale());
    rainSnowYAxisValueFormatter = new RainSnowYAxisValueFormatter(this, currentLocation.getLocale());
    forecastType.setChecked(2 == AppPreference.getForecastType(getBaseContext()));
    appendLog(getBaseContext(), TAG, "updateUI with forecastType:", forecastType.isChecked());
    WeatherForecastDbHelper.WeatherForecastRecord weatherForecastRecord = weatherForecastDbHelper.getWeatherForecast(locationId, (forecastType.isChecked() ? 2 : 1));
    if (weatherForecastRecord != null) {
        weatherForecastList.put(locationId, weatherForecastRecord.getCompleteWeatherForecast().getWeatherForecastList());
        locationWeatherForecastLastUpdate.put(locationId, weatherForecastRecord.getLastUpdatedTime());
    } else if (ForecastUtil.shouldUpdateForecast(this, locationId,
            forecastType.isChecked() ? UpdateWeatherService.LONG_WEATHER_FORECAST_TYPE : UpdateWeatherService.WEATHER_FORECAST_TYPE)) {
        if (forecastType.isChecked()) {
            updateLongWeatherForecastFromNetwork("GRAPHS");
        } else {
            updateWeatherForecastFromNetwork("GRAPHS");
        }
        return;
    }

    TextView temperatureLabel = (TextView) findViewById(R.id.graphs_temperature_label);
    temperatureLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    temperatureLabel.setTextColor(PreferenceUtil.getTextColor(this));
    TextView windLabel = (TextView) findViewById(R.id.graphs_wind_label);
    windLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    windLabel.setTextColor(PreferenceUtil.getTextColor(this));
    TextView rainLabel = (TextView) findViewById(R.id.graphs_rain_label);
    rainLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    rainLabel.setTextColor(PreferenceUtil.getTextColor(this));
    TextView snowLabel = (TextView) findViewById(R.id.graphs_snow_label);
    snowLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    snowLabel.setTextColor(PreferenceUtil.getTextColor(this));
    TextView rainBarLabel = (TextView) findViewById(R.id.graphs_bar_rain_label);
    rainBarLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    rainBarLabel.setTextColor(PreferenceUtil.getTextColor(this));
    TextView snowBarLabel = (TextView) findViewById(R.id.graphs_bar_snow_label);
    snowBarLabel.setBackgroundColor(PreferenceUtil.getBackgroundColor(this));
    snowBarLabel.setTextColor(PreferenceUtil.getTextColor(this));

    TextView combinedLabel = (TextView) findViewById(R.id.graphs_combined_label);
    StringBuilder combinedGraphLabel  = new StringBuilder();
    if (combinedGraphValues.contains(0)) {
        combinedGraphLabel.append(getString(R.string.label_temperature));
        combinedGraphLabel.append(" (");
        combinedGraphLabel.append(TemperatureUtil.getTemperatureUnit(this));
        combinedGraphLabel.append(")");
    }
    if (combinedGraphValues.contains(1)) {
        combinedGraphLabel.append(", ");
        combinedGraphLabel.append(getString(R.string.graph_rain_label));
        combinedGraphLabel.append("/");
        combinedGraphLabel.append(getString(R.string.graph_snow_label));
        combinedGraphLabel.append(" (");
        combinedGraphLabel.append(getString(AppPreference.getRainOrSnowUnit(this)));
        combinedGraphLabel.append(")");
    }
    if (combinedGraphValues.contains(2)) {
        combinedGraphLabel.append(", ");
        combinedGraphLabel.append(getString(R.string.label_wind));
        combinedGraphLabel.append(" (");
        combinedGraphLabel.append(AppPreference.getWindUnit(this));
        combinedGraphLabel.append(")");
    }
    if (combinedGraphValues.contains(3)) {
        combinedGraphLabel.append(", ");
        combinedGraphLabel.append(getString(R.string.label_pressure));
        combinedGraphLabel.append(" (");
        combinedGraphLabel.append(AppPreference.getPressureUnit(this));
        combinedGraphLabel.append(")");
    }
    combinedLabel.setText(combinedGraphLabel.toString());

    setCombinedChart(locationId, currentLocation.getLocale());
    setTemperatureChart(locationId, currentLocation.getLocale());
    setWindChart(locationId, currentLocation.getLocale());
    setRainChart(locationId, currentLocation.getLocale());
    setRainBarChart(locationId, currentLocation.getLocale());
    setSnowChart(locationId, currentLocation.getLocale());
    setSnowBarChart(locationId, currentLocation.getLocale());
    setPressureChart(locationId, currentLocation.getLocale());
    localityView.setText(Utils.getCityAndCountry(this, currentLocation.getOrderId()));
}
 
 方法所在类
 同类方法