Browse Source

Calculate ImageContrastColor more precise & some doc nits (#544)

Fixing color bug, updating license headers and CONTRIBUTORS

Co-authored-by: opyale <opyale@noreply.gitea.io>
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
pull/547/head
opyale 1 year ago
committed by M M Arif
parent
commit
5a10127c1c
  1. 1
      CONTRIBUTORS.md
  2. 17
      app/src/main/java/org/mian/gitnex/helpers/ColorInverter.java
  3. 2
      app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java
  4. 2
      app/src/main/java/org/mian/gitnex/helpers/ssl/MTMDecision.java
  5. 4
      app/src/main/java/org/mian/gitnex/helpers/ssl/MemorizingActivity.java
  6. 2
      app/src/main/java/org/mian/gitnex/helpers/ssl/MemorizingTrustManager.java

1
CONTRIBUTORS.md

@ -3,6 +3,7 @@ This part lists all PUBLIC individuals having contributed content to the code.
* M M Arif (mmarif)
* 6543
* opyale
* Unpublished
# Translators

17
app/src/main/java/org/mian/gitnex/helpers/ColorInverter.java

@ -33,7 +33,22 @@ public class ColorInverter {
if(imageView != null) {
Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
return getContrastColor(bitmap.getPixel(bitmap.getWidth() / 2, bitmap.getHeight() / 2));
int colorSum = 0;
int divisionValue = 0;
for(int height=0; height<bitmap.getHeight(); height += 10) {
for(int width=0; width<bitmap.getWidth(); width += 10) {
colorSum += bitmap.getPixel(width, height);
divisionValue++;
}
}
// Calculate average color
return getContrastColor(colorSum / divisionValue);
}
else {

2
app/src/main/java/org/mian/gitnex/helpers/PicassoCache.java

@ -17,7 +17,7 @@ import java.util.Map;
import java.util.UUID;
/**
* Author anonTree1417
* Author opyale
*/
public class PicassoCache implements Cache {

2
app/src/main/java/org/mian/gitnex/helpers/ssl/MTMDecision.java

@ -1,7 +1,7 @@
package org.mian.gitnex.helpers.ssl;
/**
* Author Georg Lukas, modified by anonTree1417
* Author Georg Lukas, modified by opyale
*/
class MTMDecision {

4
app/src/main/java/org/mian/gitnex/helpers/ssl/MemorizingActivity.java

@ -7,7 +7,7 @@ import android.os.Bundle;
import org.mian.gitnex.R;
/**
* Author Georg Lukas, modified by anonTree1417
* Author Georg Lukas, modified by opyale
*/
public class MemorizingActivity extends Activity {
@ -41,4 +41,4 @@ public class MemorizingActivity extends Activity {
}
}
}

2
app/src/main/java/org/mian/gitnex/helpers/ssl/MemorizingTrustManager.java

@ -39,7 +39,7 @@ import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
/**
* Author Georg Lukas, modified by anonTree1417
* Author Georg Lukas, modified by opyale
*/
public class MemorizingTrustManager implements X509TrustManager {

Loading…
Cancel
Save