protected void drawMoreEvents(Canvas canvas, int remainingEvents, int x) {
   int y = mHeight - (mExtrasDescent + EVENT_BOTTOM_PADDING);
   String text =
       getContext().getResources().getQuantityString(R.plurals.month_more_events, remainingEvents);
   mEventExtrasPaint.setAntiAlias(true);
   mEventExtrasPaint.setFakeBoldText(true);
   canvas.drawText(String.format(text, remainingEvents), x, y, mEventExtrasPaint);
   mEventExtrasPaint.setFakeBoldText(false);
 }
  private void handleJsonList(ViewHolder holder, int position) {
    ThreadPageInfo entry = getEntry(position);
    // this.topicListInfo.getArticleEntryList().get(position);

    if (entry == null) {
      return;
    }
    Resources res = inflater.getContext().getResources();
    ThemeManager theme = ThemeManager.getInstance();
    boolean night = false;
    int nightLinkColor = res.getColor(R.color.night_link_color);
    if (theme.getMode() == ThemeManager.MODE_NIGHT) night = true;
    holder.author.setText(entry.getAuthor());
    if (night) holder.author.setTextColor(nightLinkColor);

    String lastPoster = entry.getLastposter_org();
    if (StringUtil.isEmpty(lastPoster)) lastPoster = entry.getLastposter();
    holder.lastReply.setText(lastPoster);
    holder.num.setText("" + entry.getReplies());
    if (night) {
      holder.lastReply.setTextColor(nightLinkColor);
      holder.num.setTextColor(nightLinkColor);
    }

    holder.title.setTextColor(res.getColor(theme.getForegroundColor()));
    float size = PhoneConfiguration.getInstance().getTextSize();

    String titile = entry.getContent();
    if (StringUtil.isEmpty(titile)) {
      titile = entry.getSubject();
      holder.title.setText(StringUtil.unEscapeHtml(titile));

    } else {
      holder.title.setText(StringUtil.removeBrTag(StringUtil.unEscapeHtml(titile)));
    }

    holder.title.setTextSize(size);
    final TextPaint tp = holder.title.getPaint();
    tp.setFakeBoldText(false);

    if (!StringUtil.isEmpty(entry.getTitlefont())) {
      final String font = entry.getTitlefont();
      if (font.equals("~1~~") || font.equals("~~~1")) {
        tp.setFakeBoldText(true);
      } else if (font.startsWith("green")) {
        holder.title.setTextColor(res.getColor(R.color.title_green));
      } else if (font.startsWith("blue")) {
        holder.title.setTextColor(res.getColor(R.color.title_blue));
      } else if (font.startsWith("red")) {
        holder.title.setTextColor(res.getColor(R.color.title_red));
      } else if (font.startsWith("orange")) {
        holder.title.setTextColor(res.getColor(R.color.title_orange));
      }
    }
  }
  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);
    }
  }
  private void findView() {
    mDelTv = (TextView) findViewById(R.id.del_tv);
    mForwardTv = (TextView) findViewById(R.id.forward_tv);
    mSmsContentTv = (TextView) findViewById(R.id.sms_content_tv);
    mTitleTv = (TextView) findViewById(R.id.activity_title_tv);

    TextPaint tp = mDelTv.getPaint();
    tp.setFakeBoldText(true);
    tp = mForwardTv.getPaint();
    tp.setFakeBoldText(true);
    tp = mTitleTv.getPaint();
    tp.setFakeBoldText(true);

    mTitleTv.setText(R.string.collect_detail);

    mDelTv.setText(R.string.sms_dialogue_delete);
    mForwardTv.setText(R.string.forward);
  }
  private void findView() {
    mTitleTv = (TextView) findViewById(R.id.title_tv);

    findViewById(R.id.button_close).setOnClickListener(this);
    TextPaint tp = mTitleTv.getPaint();
    tp.setFakeBoldText(true);
    mTitleTv.setText(getContext().getString(R.string.sms_dialogue_select_category));
    mListView = (ListView) findViewById(R.id.listproc);
    mListView.setOnItemClickListener(this);
  }
Example #6
0
  public void setSwitchTypeface(Typeface tf, int style) {
    if (style > 0) {
      if (tf == null) {
        tf = Typeface.defaultFromStyle(style);
      } else {
        tf = Typeface.create(tf, style);
      }

      setSwitchTypeface(tf);
      // now compute what (if any) algorithmic styling is needed
      int typefaceStyle = tf != null ? tf.getStyle() : 0;
      int need = style & ~typefaceStyle;
      mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0);
      mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
    } else {
      mTextPaint.setFakeBoldText(false);
      mTextPaint.setTextSkewX(0);
      setSwitchTypeface(tf);
    }
  }
Example #7
0
  public PopupBall(final Context context) {
    super(context);
    mContext = context;
    LayoutInflater mLayoutInflater =
        (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    trendView = mLayoutInflater.inflate(R.layout.popup_ball, null);
    ballLayout = (RelativeLayout) trendView.findViewById(R.id.layout_popup_ball);

    mPopupWindow =
        new PopupWindow(
            trendView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    // mPopupWindow = new PopupWindow(context);
    // mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    // mPopupWindow.setContentView(trendView);
    // mPopupWindow.setWidth(120);
    // mPopupWindow.setHeight(80);
    mPopupWindow.setFocusable(false);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setOnDismissListener(
        new OnDismissListener() {

          @Override
          public void onDismiss() {
            dismissListener.isDismiss();
          }
        });
    textView = (TextView) trendView.findViewById(R.id.ball_open_count);
    TextPaint tp = textView.getPaint();
    tp.setFakeBoldText(true);
    textView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            fullListener.onBallClick();
            disAblePopupWindow();
          }
        });
  }
Example #8
0
  private void initZoomButtons(final OsmandMapTileView view, FrameLayout parent) {
    int minimumWidth = view.getResources().getDrawable(R.drawable.map_zoom_in).getMinimumWidth();

    Context ctx = view.getContext();
    ImageView bottomShadow = new ImageView(ctx);
    bottomShadow.setBackgroundResource(R.drawable.bottom_shadow);
    android.widget.FrameLayout.LayoutParams params =
        new FrameLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
    params.setMargins(0, 0, 0, 0);
    parent.addView(bottomShadow, params);

    zoomTextPaint = new TextPaint();
    zoomTextPaint.setTextSize(18 * scaleCoefficient);
    zoomTextPaint.setAntiAlias(true);
    zoomTextPaint.setFakeBoldText(true);

    zoomShadow = view.getResources().getDrawable(R.drawable.zoom_background);

    zoomInButton = new Button(ctx);
    zoomInButton.setBackgroundResource(R.drawable.map_zoom_in);
    params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT);
    params.setMargins(0, 0, 0, 0);
    zoomInButton.setContentDescription(ctx.getString(R.string.zoomIn));
    parent.addView(zoomInButton, params);

    zoomOutButton = new Button(ctx);
    zoomOutButton.setBackgroundResource(R.drawable.map_zoom_out);
    params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT);

    params.setMargins(0, 0, minimumWidth, 0);
    zoomOutButton.setContentDescription(ctx.getString(R.string.zoomOut));
    parent.addView(zoomOutButton, params);

    activity.accessibleContent.add(zoomInButton);
    activity.accessibleContent.add(zoomOutButton);

    zoomInButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (view.isZooming()) {
              activity.changeZoom(view.getZoom() + 2);
              //					activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
            } else {
              activity.changeZoom(view.getZoom() + 1);
              //					activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
            }
          }
        });

    zoomOutButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            activity.changeZoom(view.getZoom() - 1);
            //				activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
          }
        });
  }
Example #9
0
  /**
   * Loads the syntax as specified in the XML
   *
   * @param xml
   */
  public void loadSyntax(XML xml) {
    // Get the list of defined styles
    XML[] styleList = xml.getChild("styles").getChildren();
    for (XML style : styleList) {
      // Make sure that this is a "style" element
      if (!style.getName().equals("style")) continue;

      // Parse the style
      TextPaint paint = new TextPaint(getPaint());
      String name = style.getContent();
      String hex = style.getString("color", "#FF000000").substring(1);
      boolean bold = style.getString("bold", "false").equals("true") ? true : false;

      // Build the TextPaint
      paint.setStyle(TextPaint.Style.FILL);
      paint.setColor(PApplet.unhex(hex));
      paint.setFakeBoldText(
          bold); // TODO what does "fake" mean? Is this something we should be concerned about?

      // Add the style
      styles.put(name, paint);
    }

    // Get the list of defined keywords
    XML[] keywords = xml.getChild("keywords").getChildren();
    ArrayList<Keyword> tempSyntax = new ArrayList<>();

    syntax = new Keyword[keywords.length];
    for (int i = 0; i < keywords.length; i++) {
      XML keyword = keywords[i];

      // Make sure that this is a "keyword" element
      if (!keyword.getName().equals("keyword")) continue;

      // Parse the keyword
      String style = keyword.getString("style", "");
      String name = keyword.getContent();
      boolean function = keyword.getString("function", "false").equals("true");

      String reference = keyword.getString("reference", "processing");
      boolean noUnderscore = keyword.getString("reference_hint", "").equals("no_underscore");

      String parentClass = keyword.getString("class", "");
      boolean staticInParentClass = Boolean.valueOf(keyword.getString("static", "false"));

      // If there is a parent class, then open that class... we don't know how to be fancier yet
      // Automatically add an underscore if the keyword is a function and doesn't have the
      // "no_underscore" hint
      String referenceTarget =
          keyword.getString(
              "reference_target",
              parentClass.length() > 0
                  ? parentClass
                  : (name + (function && !noUnderscore ? "_" : "")));

      // If this isn't a valid style, bail out
      if (!styles.containsKey(style)) continue;

      // Add the keyword
      tempSyntax.add(
          new Keyword(
              name,
              styles.get(style),
              function,
              reference,
              referenceTarget,
              parentClass,
              staticInParentClass));
    }

    syntax = new Keyword[tempSyntax.size()];

    // We need to do this because more than the half of the reported XML elements are null
    for (int i = 0; i < tempSyntax.size(); i++) {
      syntax[i] = tempSyntax.get(i);
    }

    syntaxLoaded.set(true);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_analyze_jiehuan_detail);

    // 标题变粗
    TextPaint textPaint = null;
    TextView tvTitleItemBuyDate = (TextView) super.findViewById(R.id.tv_title_itembuydate);
    textPaint = tvTitleItemBuyDate.getPaint();
    textPaint.setFakeBoldText(true);
    TextView tvTitleJieChu = (TextView) super.findViewById(R.id.tv_title_jiechu);
    textPaint = tvTitleJieChu.getPaint();
    textPaint.setFakeBoldText(true);
    TextView tvTitleHuanRu = (TextView) super.findViewById(R.id.tv_title_huanru);
    textPaint = tvTitleHuanRu.getPaint();
    textPaint.setFakeBoldText(true);
    TextView tvTitleJieRu = (TextView) super.findViewById(R.id.tv_title_jieru);
    textPaint = tvTitleJieRu.getPaint();
    textPaint.setFakeBoldText(true);
    TextView tvTitleHuanChu = (TextView) super.findViewById(R.id.tv_title_huanchu);
    textPaint = tvTitleHuanChu.getPaint();
    textPaint.setFakeBoldText(true);

    // 数据库
    sqlHelper = new DatabaseHelper(this);

    // 取传入的值
    Intent intent = super.getIntent();
    curDate = intent.getStringExtra("date");

    // 初始化
    listAnalyzeJieHuanDetail = (ListView) super.findViewById(R.id.list_analyzejiehuandetail);
    listAnalyzeJieHuanDetail.setDivider(null);
    layNoItem = (LinearLayout) super.findViewById(R.id.lay_noitem);

    // 列表点击
    listAnalyzeJieHuanDetail.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ListView lv = (ListView) parent;
            @SuppressWarnings("unchecked")
            Map<String, String> map = (Map<String, String>) lv.getItemAtPosition(position);
            String date = map.get("datevalue");

            TextView tvItemBuyDate = (TextView) view.findViewById(R.id.tv_analyze_itembuydate);
            tvItemBuyDate.setBackgroundColor(
                AnalyzeJieHuanDetailActivity.this.getResources().getColor(R.color.color_tran_main));
            TextView tvJieChuPrice = (TextView) view.findViewById(R.id.tv_analyze_jiechu);
            tvJieChuPrice.setBackgroundColor(
                AnalyzeJieHuanDetailActivity.this.getResources().getColor(R.color.color_tran_main));
            TextView tvHuanRuPrice = (TextView) view.findViewById(R.id.tv_analyze_huanru);
            tvHuanRuPrice.setBackgroundColor(
                AnalyzeJieHuanDetailActivity.this.getResources().getColor(R.color.color_tran_main));
            TextView tvJieRuPrice = (TextView) view.findViewById(R.id.tv_analyze_jieru);
            tvJieRuPrice.setBackgroundColor(
                AnalyzeJieHuanDetailActivity.this.getResources().getColor(R.color.color_tran_main));
            TextView tvHuanChuPrice = (TextView) view.findViewById(R.id.tv_analyze_huanchu);
            tvHuanChuPrice.setBackgroundColor(
                AnalyzeJieHuanDetailActivity.this.getResources().getColor(R.color.color_tran_main));

            Intent intent = new Intent(AnalyzeJieHuanDetailActivity.this, DayDetailActivity.class);
            intent.putExtra("date", date);
            startActivityForResult(intent, FIRST_REQUEST_CODE);
          }
        });

    // 返回按钮
    ImageButton btnTitleBack = (ImageButton) super.findViewById(R.id.btn_title_back);
    btnTitleBack.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            AnalyzeJieHuanDetailActivity.this.setResult(Activity.RESULT_OK);
            AnalyzeJieHuanDetailActivity.this.close();
          }
        });

    setListData(curDate);
  }
  /**
   * Sets up the text and style properties for painting. Override this if you want to use a
   * different paint.
   */
  @Override
  protected void initView() {
    super.initView();

    if (!mInitialized) {
      Resources resources = getContext().getResources();
      mShowDetailsInMonth = Utils.getConfigBool(getContext(), R.bool.show_details_in_month);
      TEXT_SIZE_EVENT_TITLE = resources.getInteger(R.integer.text_size_event_title);
      TEXT_SIZE_MONTH_NUMBER = resources.getInteger(R.integer.text_size_month_number);
      SIDE_PADDING_MONTH_NUMBER = resources.getInteger(R.integer.month_day_number_margin);
      CONFLICT_COLOR = resources.getColor(R.color.month_dna_conflict_time_color);
      EVENT_TEXT_COLOR = resources.getColor(R.color.calendar_event_text_color);
      if (mScale != 1) {
        TOP_PADDING_MONTH_NUMBER *= mScale;
        TOP_PADDING_WEEK_NUMBER *= mScale;
        SIDE_PADDING_MONTH_NUMBER *= mScale;
        SIDE_PADDING_WEEK_NUMBER *= mScale;
        SPACING_WEEK_NUMBER *= mScale;
        TEXT_SIZE_MONTH_NUMBER *= mScale;
        TEXT_SIZE_EVENT *= mScale;
        TEXT_SIZE_EVENT_TITLE *= mScale;
        TEXT_SIZE_MORE_EVENTS *= mScale;
        TEXT_SIZE_MONTH_NAME *= mScale;
        TEXT_SIZE_WEEK_NUM *= mScale;
        DAY_SEPARATOR_OUTER_WIDTH *= mScale;
        DAY_SEPARATOR_INNER_WIDTH *= mScale;
        DAY_SEPARATOR_VERTICAL_LENGTH *= mScale;
        DAY_SEPARATOR_VERTICAL_LENGHT_PORTRAIT *= mScale;
        EVENT_X_OFFSET_LANDSCAPE *= mScale;
        EVENT_Y_OFFSET_LANDSCAPE *= mScale;
        EVENT_Y_OFFSET_PORTRAIT *= mScale;
        EVENT_SQUARE_WIDTH *= mScale;
        EVENT_SQUARE_BORDER *= mScale;
        EVENT_LINE_PADDING *= mScale;
        EVENT_BOTTOM_PADDING *= mScale;
        EVENT_RIGHT_PADDING *= mScale;
        DNA_MARGIN *= mScale;
        DNA_WIDTH *= mScale;
        DNA_ALL_DAY_HEIGHT *= mScale;
        DNA_MIN_SEGMENT_HEIGHT *= mScale;
        DNA_SIDE_PADDING *= mScale;
        DEFAULT_EDGE_SPACING *= mScale;
        DNA_ALL_DAY_WIDTH *= mScale;
        TODAY_HIGHLIGHT_WIDTH *= mScale;
      }
      if (!mShowDetailsInMonth) {
        TOP_PADDING_MONTH_NUMBER += DNA_ALL_DAY_HEIGHT + DNA_MARGIN;
      }
      mInitialized = true;
    }
    mPadding = DEFAULT_EDGE_SPACING;
    loadColors(getContext());
    // TODO modify paint properties depending on isMini

    mMonthNumPaint = new Paint();
    mMonthNumPaint.setFakeBoldText(false);
    mMonthNumPaint.setAntiAlias(true);
    mMonthNumPaint.setTextSize(TEXT_SIZE_MONTH_NUMBER);
    mMonthNumPaint.setColor(mMonthNumColor);
    mMonthNumPaint.setStyle(Style.FILL);
    mMonthNumPaint.setTextAlign(Align.RIGHT);
    mMonthNumPaint.setTypeface(Typeface.DEFAULT);

    mMonthNumAscentHeight = (int) (-mMonthNumPaint.ascent() + 0.5f);
    mMonthNumHeight = (int) (mMonthNumPaint.descent() - mMonthNumPaint.ascent() + 0.5f);

    mEventPaint = new TextPaint();
    mEventPaint.setFakeBoldText(true);
    mEventPaint.setAntiAlias(true);
    mEventPaint.setTextSize(TEXT_SIZE_EVENT_TITLE);
    mEventPaint.setColor(mMonthEventColor);

    mSolidBackgroundEventPaint = new TextPaint(mEventPaint);
    mSolidBackgroundEventPaint.setColor(EVENT_TEXT_COLOR);
    mFramedEventPaint = new TextPaint(mSolidBackgroundEventPaint);

    mDeclinedEventPaint = new TextPaint();
    mDeclinedEventPaint.setFakeBoldText(true);
    mDeclinedEventPaint.setAntiAlias(true);
    mDeclinedEventPaint.setTextSize(TEXT_SIZE_EVENT_TITLE);
    mDeclinedEventPaint.setColor(mMonthDeclinedEventColor);

    mEventAscentHeight = (int) (-mEventPaint.ascent() + 0.5f);
    mEventHeight = (int) (mEventPaint.descent() - mEventPaint.ascent() + 0.5f);

    mEventExtrasPaint = new TextPaint();
    mEventExtrasPaint.setFakeBoldText(false);
    mEventExtrasPaint.setAntiAlias(true);
    mEventExtrasPaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventExtrasPaint.setTextSize(TEXT_SIZE_EVENT);
    mEventExtrasPaint.setColor(mMonthEventExtraColor);
    mEventExtrasPaint.setStyle(Style.FILL);
    mEventExtrasPaint.setTextAlign(Align.LEFT);
    mExtrasHeight = (int) (mEventExtrasPaint.descent() - mEventExtrasPaint.ascent() + 0.5f);
    mExtrasAscentHeight = (int) (-mEventExtrasPaint.ascent() + 0.5f);
    mExtrasDescent = (int) (mEventExtrasPaint.descent() + 0.5f);

    mEventDeclinedExtrasPaint = new TextPaint();
    mEventDeclinedExtrasPaint.setFakeBoldText(false);
    mEventDeclinedExtrasPaint.setAntiAlias(true);
    mEventDeclinedExtrasPaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventDeclinedExtrasPaint.setTextSize(TEXT_SIZE_EVENT);
    mEventDeclinedExtrasPaint.setColor(mMonthDeclinedExtrasColor);
    mEventDeclinedExtrasPaint.setStyle(Style.FILL);
    mEventDeclinedExtrasPaint.setTextAlign(Align.LEFT);

    mWeekNumPaint = new Paint();
    mWeekNumPaint.setFakeBoldText(false);
    mWeekNumPaint.setAntiAlias(true);
    mWeekNumPaint.setTextSize(TEXT_SIZE_WEEK_NUM);
    mWeekNumPaint.setColor(mWeekNumColor);
    mWeekNumPaint.setStyle(Style.FILL);
    mWeekNumPaint.setTextAlign(Align.RIGHT);

    mWeekNumAscentHeight = (int) (-mWeekNumPaint.ascent() + 0.5f);

    mDNAAllDayPaint = new Paint();
    mDNATimePaint = new Paint();
    mDNATimePaint.setColor(mMonthBusyBitsBusyTimeColor);
    mDNATimePaint.setStyle(Style.FILL_AND_STROKE);
    mDNATimePaint.setStrokeWidth(DNA_WIDTH);
    mDNATimePaint.setAntiAlias(false);
    mDNAAllDayPaint.setColor(mMonthBusyBitsConflictTimeColor);
    mDNAAllDayPaint.setStyle(Style.FILL_AND_STROKE);
    mDNAAllDayPaint.setStrokeWidth(DNA_ALL_DAY_WIDTH);
    mDNAAllDayPaint.setAntiAlias(false);

    mEventSquarePaint = new Paint();
    mEventSquarePaint.setStrokeWidth(EVENT_SQUARE_BORDER);
    mEventSquarePaint.setAntiAlias(false);

    if (DEBUG_LAYOUT) {
      Log.d("EXTRA", "mScale=" + mScale);
      Log.d(
          "EXTRA",
          "mMonthNumPaint ascent="
              + mMonthNumPaint.ascent()
              + " descent="
              + mMonthNumPaint.descent()
              + " int height="
              + mMonthNumHeight);
      Log.d(
          "EXTRA",
          "mEventPaint ascent="
              + mEventPaint.ascent()
              + " descent="
              + mEventPaint.descent()
              + " int height="
              + mEventHeight
              + " int ascent="
              + mEventAscentHeight);
      Log.d(
          "EXTRA",
          "mEventExtrasPaint ascent="
              + mEventExtrasPaint.ascent()
              + " descent="
              + mEventExtrasPaint.descent()
              + " int height="
              + mExtrasHeight);
      Log.d(
          "EXTRA",
          "mWeekNumPaint ascent=" + mWeekNumPaint.ascent() + " descent=" + mWeekNumPaint.descent());
    }
  }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_launcher);

    topText = (TextView) findViewById(R.id.topname);
    topText.setTextColor(Color.WHITE);
    topText.setTextSize(24.0f);
    topText.setTypeface(Typeface.MONOSPACE, Typeface.BOLD_ITALIC);
    // 使用TextPaint的仿“粗体”设置setFakeBoldText为true。目前还无法支持仿“斜体”方法
    tp = topText.getPaint();

    tp.setFakeBoldText(true);
    loginImage = (ImageView) findViewById(R.id.loginImage);
    //		loginImage.setBackgroundDrawable(new BitmapDrawable(Util.toRoundBitmap(this, "test.jpg")));
    //		loginImage.getBackground().setAlpha(0);
    //		loginImage.setImageBitmap(Util.toRoundBitmap(this, "test.jpg"));

    Button signIn = (Button) findViewById(R.id.signInButton);
    recognizerFile = new File(this.getExternalFilesDir(null).getAbsolutePath() + "/recognizer.xml");
    signIn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            // File recognizerFile = new File(this.getExternalFilesDir(null).getAbsolutePath() +
            // "/recognizer.xml");
            // Launcher.recognizerFile.delete();
            // isReset = true;
            if (recognizerFile.exists()) {
              Intent intent = new Intent(Launcher.this, LockScreen.class);
              startActivity(intent);
              finish();
            } else {
              Intent intent = new Intent(Launcher.this, Introduction.class);
              startActivity(intent);
              finish();
            }
          }
        });

    Button signUp = (Button) findViewById(R.id.signUpButton);
    signUp.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            // File recognizerFile = new File(this.getExternalFilesDir(null).getAbsolutePath() +
            // "/recognizer.xml");
            if (recognizerFile.exists()) {
              recognizerFile.delete();
              System.gc();
            }
            Intent intent = new Intent(Launcher.this, Introduction.class);
            startActivity(intent);
            finish();
          }
        });

    // init();
    //		if (LoginedActivity.isReset){
    //			recognizerFile.delete();
    //			LoginedActivity.isReset = false;
    //		}

    //		if (recognizerFile.exists()) {
    //	    	Intent intent = new Intent(this,LockScreen.class);
    //	    	startActivity(intent);
    //	    	finish();
    //	    } else {
    //	    	Intent intent = new Intent(this, Introduction.class);
    //	    	startActivity(intent);
    //	    	finish();
    //	    }

  }
Example #13
0
  @Override
  protected void onDraw(Canvas canvas) {
    // Location
    x = getWidth() / 2;
    y = getHeight() / 2;
    int pos = (int) (textSize / 2);
    int framesPerSecond = 60;

    // Brushes
    Paint blueBrush = new Paint(Paint.ANTI_ALIAS_FLAG);
    blueBrush.setColor(mContext.getResources().getColor(R.color.sunshine_blue));
    blueBrush.setStrokeWidth(3f);

    Paint whiteBrush = new Paint(Paint.ANTI_ALIAS_FLAG);
    whiteBrush.setColor(mContext.getResources().getColor(R.color.background_wind_speed));
    whiteBrush.setStrokeWidth(3f);

    Paint redBrush = new Paint(Paint.ANTI_ALIAS_FLAG);
    redBrush.setColor(Color.RED);
    redBrush.setStrokeWidth(3f);

    TextPaint textPaint = new TextPaint();
    textPaint.setColor(Color.YELLOW);
    textPaint.setFakeBoldText(true);
    textPaint.setStrokeWidth(2f);
    textPaint.setTextSize(textSize);
    textSize = textPaint.getTextSize();

    // External Circle
    canvas.drawCircle(x, y, height / 2, blueBrush);
    // Internal Circle
    canvas.drawCircle(x, y, (height / 2) - textSize, whiteBrush);
    // Indicator Circle
    canvas.drawCircle(x, y, (height / 17), redBrush);

    mCanvas = canvas;
    mCanvas.save();

    // Direction labels
    canvas.drawText(mContext.getString(R.string.north), x - pos, textSize, textPaint);
    canvas.drawText(mContext.getString(R.string.south), x - pos, y * 2 - 2, textPaint);
    canvas.drawText(mContext.getString(R.string.east), (x * 2) - textSize + 2, y + pos, textPaint);
    canvas.drawText(mContext.getString(R.string.west), textSize - (pos * 2), y + pos, textPaint);

    // Layers for rotated labels
    Canvas canNE = canvas;
    Canvas canNW = canvas;
    canNE.save();
    canNW.save();

    // Indicator
    setWindSpeedDirection(direction);

    canNE.rotate(45, x, y);
    canNE.drawText(mContext.getString(R.string.north_east), x - (pos * 2), textSize, textPaint);
    canNE.drawText(mContext.getString(R.string.south_west), x - (pos * 2), y * 2 - 2, textPaint);
    canNW.rotate(270, x, y);
    canNW.drawText(mContext.getString(R.string.north_west), x - (pos * 2), textSize, textPaint);
    canNW.drawText(mContext.getString(R.string.south_east), x - (pos * 2), y * 2 - 2, textPaint);
    canvas.restore();

    if (!finishAnimation) {
      postInvalidateDelayed(1000 / framesPerSecond);
    }
  }
Example #14
0
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    measureWidth(widthMeasureSpec);
    this.imgSize = (int) ((JokerView.windowH / 5) * 0.6);
    this.rightBorder = (int) (JokerView.windowH / 5);
    int TextWidth = this.width - this.imgSize - this.rightBorder;

    Rect bounds = new Rect();
    LayoutTextPaint = new TextPaint();
    LayoutTextPaint.setTextSize((float) (UI_Size_Base.that.getScaledFontSize() * 1.3));
    LayoutTextPaint.getTextBounds("T", 0, 1, bounds);
    LineSep = bounds.height() / 3;

    LayoutTextPaint.setAntiAlias(true);
    LayoutTextPaint.setColor(Global.getColor(R.attr.TextColor));

    if (joker.Tage == -1) // this Joker is Owner
    {
      LayoutTage =
          new StaticLayout(
              "Owner von diesem Cache",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    } else {
      LayoutTage =
          new StaticLayout(
              "gefunden vor " + String.valueOf(joker.Tage) + " Tagen",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    }
    LayoutTelefon =
        new StaticLayout(
            "Tel: " + joker.Telefon,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutBemerkung =
        new StaticLayout(
            "Bem.:" + joker.Bemerkung,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutTextPaintBold = new TextPaint(LayoutTextPaint);
    LayoutTextPaintBold.setFakeBoldText(true);
    LayoutName =
        new StaticLayout(
            joker.GCLogin + " (" + joker.Vorname + ", " + joker.Name + ")",
            LayoutTextPaintBold,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    this.height =
        (LineSep * 5)
            + LayoutTage.getHeight()
            + LayoutTelefon.getHeight()
            + LayoutBemerkung.getHeight()
            + LayoutName.getHeight();

    setMeasuredDimension(this.width, this.height);
  }
Example #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.activity_main);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar1);
    final ImageView J = (ImageView) findViewById(R.id.jinrituijian);
    J.setOnClickListener(
        new android.view.View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent j1 = new Intent(MainActivity.this, Baocai.class);
            startActivity(j1);
          }
        });
    final ImageView show = (ImageView) findViewById(R.id.show);
    final Handler myHandler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            // 如果该消息是本程序所发送的
            if (msg.what == 0x1233) {
              // 动态地修改所显示的图片
              show.setImageResource(imagelunbo[lunbo++ % imagelunbo.length]);
            }
          }
        };
    new Timer()
        .schedule(
            new TimerTask() {
              @Override
              public void run() {
                myHandler.sendEmptyMessage(0x1233);
              }
            },
            0,
            2000);
    TextView tv = (TextView) findViewById(R.id.textb);
    TextPaint tp = tv.getPaint();
    tp.setFakeBoldText(true);
    // 定义一个集合
    List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>();
    for (int i = 0; i < names.length; i++) {
      Map<String, Object> listItem = new HashMap<String, Object>();
      listItem.put("header", imageIds[i]);
      listItem.put("personName", names[i]);
      listItem.put("desc", descs[i]);
      listItems.add(listItem);
    }
    SimpleAdapter simpleAdapter =
        new SimpleAdapter(
            this,
            listItems,
            R.layout.simple_item,
            new String[] {"personName", "header", "desc"},
            new int[] {R.id.name, R.id.header, R.id.desc});
    // 定义一个ListView
    ListView list = (ListView) findViewById(R.id.mylist);
    list.setAdapter(simpleAdapter);
    // 导入TabHost
    View niTab = (View) LayoutInflater.from(this).inflate(R.layout.tabmini, null);
    View woTab = (View) LayoutInflater.from(this).inflate(R.layout.sec, null);
    View taTab = (View) LayoutInflater.from(this).inflate(R.layout.thr, null);
    View weTab = (View) LayoutInflater.from(this).inflate(R.layout.fou, null);

    TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
    tabHost.setup();

    tabHost.addTab(tabHost.newTabSpec("nitab").setIndicator(niTab).setContent(R.id.tab1));
    tabHost.addTab(tabHost.newTabSpec("wotab").setIndicator(woTab).setContent(R.id.tab2));
    tabHost.addTab(tabHost.newTabSpec("tatab").setIndicator(taTab).setContent(R.id.tab3));
    tabHost.addTab(tabHost.newTabSpec("wetab").setIndicator(weTab).setContent(R.id.tab4));
    // ListView点击事件
    list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            if (arg2 == 0) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 1) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 2) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 3) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 4) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 5) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 6) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 7) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
            if (arg2 == 8) {
              Intent i1 = new Intent(MainActivity.this, Shucai.class);
              startActivity(i1);
            }
          }
        });
    // 登陆按钮
    Button b = (Button) findViewById(R.id.Button01);
    b.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent i = new Intent(MainActivity.this, Zhuce.class);
            startActivity(i);
          }
        });

    ListView gouwulist = (ListView) findViewById(R.id.listViewgouwuche);
    List<Map<String, Object>> gouwulistItems = new ArrayList<Map<String, Object>>();
    Map<String, Object> gouwumap = new HashMap<String, Object>();
    gouwumap.put("image", R.drawable.a1);
    gouwumap.put("title1", "包菜");
    gouwumap.put("title2", "单价:3.8");
    gouwumap.put("title3", "上架时间:2013-12-4");
    gouwulistItems.add(gouwumap);

    SimpleAdapter adapter =
        new SimpleAdapter(
            MainActivity.this,
            gouwulistItems,
            R.layout.shucaib,
            new String[] {"title1", "title2", "title3", "image"},
            new int[] {R.id.title1, R.id.title2, R.id.title3, R.id.image});
    gouwulist.setAdapter(adapter);
  }