Skip to content

Commit

Permalink
System wallpaper background
Browse files Browse the repository at this point in the history
Fix for transparency setting, better default value
  • Loading branch information
dvhh committed Apr 22, 2015
1 parent 3383d01 commit 7f982c1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1564,12 +1564,15 @@ protected void onDraw(Canvas canvas) {
Paint backgroundPaint =
reverseVideo ? mForegroundPaint : mBackgroundPaint;
if(mBackgroundDrawable==null) {
//canvas.drawRect(0, 0, w, h, backgroundPaint);
canvas.drawRect(0, 0, w, h, backgroundPaint);
}else{
mBackgroundDrawable.setBounds(0,0,w,h);

mBackgroundDrawable.setBounds(0, 0, w, h);
mBackgroundDrawable.draw(canvas);
backgroundPaint.setAlpha(255 - mBackgroundAlpha);
canvas.drawRect(0, 0, w, h, backgroundPaint);

//backgroundPaint.setAlpha(255 - mBackgroundAlpha);
canvas.drawRect(0,mVisibleRows*mCharacterHeight+mTopOfScreenMargin, w, h, backgroundPaint);

}
float x = -mLeftColumn * mCharacterWidth;
float y = mCharacterHeight + mTopOfScreenMargin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ public void drawTextRun(Canvas canvas, float x, float y, int lineOffset,
mTextPaint.setColor(mPalette[backColor]);

float left = x + lineOffset * mCharWidth;
if(inverse) {
canvas.drawRect(left, y + mCharAscent - mCharDescent,
left + runWidth * mCharWidth, y,
mTextPaint);
}
canvas.drawRect(left, y + mCharAscent - mCharDescent,
left + runWidth * mCharWidth, y,
mTextPaint);

boolean cursorVisible = lineOffset <= cursorOffset && cursorOffset < (lineOffset + runWidth);
float cursorX = 0;
Expand Down
10 changes: 9 additions & 1 deletion term/src/main/java/jackpal/androidterm/util/TermSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;

Expand Down Expand Up @@ -301,7 +302,14 @@ public int getFontSize() {
}

public int[] getColorScheme() {
return COLOR_SCHEMES[mColorId];
int[] result=COLOR_SCHEMES[mColorId];
if(mUseSystemWallpaper) {
int alpha = ( mWallpaperAlpha << 24 ) ;
int old= result[1];
result[1] = old & 0x00ffffff | alpha;
Log.d("Term",String.format("%x %x %x",result[1],old,alpha));
}
return result;
}

public boolean defaultToUTF8Mode() {
Expand Down
2 changes: 1 addition & 1 deletion term/src/main/res/values/defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<integer name="pref_orientation_default">0</integer>
<integer name="pref_toast_position_default">4</integer>
<bool name="pref_use_system_wallpaper_default">false</bool>
<integer name="pref_transparency_default" translatable="false">64</integer>
<integer name="pref_transparency_default" translatable="false">192</integer>
<string name="pref_customfontfilepath_default"></string>
<bool name="pref_safe_margins_default">false</bool>
<string name="pref_cursorstyle_default" translatable="false">0</string>
Expand Down

0 comments on commit 7f982c1

Please sign in to comment.