Skip to content

Commit

Permalink
nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed Sep 10, 2019
1 parent e4a1092 commit e8db1b9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
18 changes: 18 additions & 0 deletions app/src/main/java/omegacentauri/mobi/simplestopwatch/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class Options extends PreferenceActivity {
public static final String PREF_BOOST = "boost";
public static final String PREF_ALARM = "alarm";
public static final String PREF_VOLUME = "volume";
public static final int highlightPercent = 25;
static Map<String, int[]> colorMap = new HashMap<String,int[]>();
static final int[] defaultColor = {Color.WHITE, Color.BLACK};

Expand Down Expand Up @@ -95,6 +96,23 @@ static int getBackColor(SharedPreferences options) {
}
}

static int getHighlightColor(SharedPreferences options) {
int fore = getForeColor(options);
int back = getBackColor(options);

int high = 0;
for (int i = 0 ; i < 4 ; i++) {
int shift = i*8;
int mask = 0xFF << (i*8);
int f = (fore >> shift) & 0xFF;
int b = (back >> shift) & 0xFF;
int c = (b * highlightPercent + f * (100-highlightPercent)) / 100;
high |= c << shift;
}

return high;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class StopWatch extends Activity {
};
private View.OnTouchListener highlighter;
private TextView laps;
private View.OnTouchListener imageHighlighter;

public float dp2px(float dp){
return dp * (float)getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT;
Expand Down Expand Up @@ -100,17 +101,26 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
return false;
}
};
/* secondButton.setOnLongClickListener(new View.OnLongClickListener() {
firstButton.setOnTouchListener(highlighter);
secondButton.setOnTouchListener(highlighter);
/*
imageHighlighter = new View.OnTouchListener() {
@Override
public boolean onLongClick(View view) {
if (stopwatch.active && stopwatch.lapData.length() > 0) {
askClearLapData();
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
((ImageButton)view).setColorFilter(Options.getHighlightColor(options), PorterDuff.Mode.MULTIPLY);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
((ImageButton)view).setColorFilter(Options.getForeColor(options), PorterDuff.Mode.MULTIPLY);
}
return true;
return false;
}
}); */
firstButton.setOnTouchListener(highlighter);
secondButton.setOnTouchListener(highlighter);
};
((ImageButton)findViewById(R.id.settings)).setOnTouchListener(imageHighlighter);
((ImageButton)findViewById(R.id.menu)).setOnTouchListener(imageHighlighter);
*/

chrono.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_stop_watch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
android:id="@+id/fraction"
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.9"
android:gravity="center"
android:text=".0"
android:textColor="#FFFFFF"
Expand All @@ -79,6 +79,7 @@
android:layout_height="wrap_content"
android:background="@null"
android:onClick="onButtonSettings"
android:layout_marginRight="8dp"
android:src="@drawable/settings" />

<ImageButton
Expand Down

0 comments on commit e8db1b9

Please sign in to comment.