Пример #1
0
  private void applyFontSize() {
    int fontSize = mPageControl.getDocumentFontSize();
    getSettings().setDefaultFontSize(fontSize);

    // 1.6 is taken from css - line-height: 1.6em;
    ScreenSettings.setLineHeightDips((int) (1.6 * fontSize));
  }
Пример #2
0
  /** apply settings set by the user using Preferences */
  @Override
  public void applyPreferenceSettings() {
    applyFontSize();

    changeBackgroundColour();

    ScreenSettings.setContentViewHeightPx(getHeight());
  }
Пример #3
0
 @Override
 public boolean changeBackgroundColour() {
   if (ScreenSettings.isNightMode()) {
     setBackgroundColor(Color.BLACK);
     setTextColor(Color.WHITE);
   } else {
     setBackgroundColor(Color.WHITE);
     setTextColor(Color.BLACK);
   }
   // should not return false but it is used to see if text needs refreshing, which it doesn't
   return false;
 }
Пример #4
0
  /** may need updating depending on environmental brightness */
  @Override
  public boolean changeBackgroundColour() {
    // if night mode then set scrollbar colour
    int newBackgroundColour = ScreenSettings.isNightMode() ? Color.BLACK : Color.WHITE;
    boolean changed = mCurrentBackgroundColour != newBackgroundColour;

    if (changed) {
      setBackgroundColor(newBackgroundColour);
      mCurrentBackgroundColour = newBackgroundColour;
    }
    return changed;
  }
Пример #5
0
 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   super.onMeasure(widthMeasureSpec, heightMeasureSpec);
   // update the height in ScreenSettings
   ScreenSettings.setContentViewHeightPx(getMeasuredHeight());
 }