Fix white on white icons
@@ -6,6 +6,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.graphics.ColorUtils;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@@ -44,6 +45,8 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
ImportURIHelper importURIHelper;
|
||||
Settings settings;
|
||||
|
||||
boolean backgroundNeedsDarkIcons;
|
||||
|
||||
private void extractIntentFields(Intent intent)
|
||||
{
|
||||
final Bundle b = intent.getExtras();
|
||||
@@ -165,6 +168,17 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
|
||||
collapsingToolbarLayout.setBackgroundColor(backgroundHeaderColor);
|
||||
|
||||
// If the background is very bright, we should use dark icons
|
||||
backgroundNeedsDarkIcons = (ColorUtils.calculateLuminance(backgroundHeaderColor) > 0.5);
|
||||
if(backgroundNeedsDarkIcons)
|
||||
{
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if(actionBar != null)
|
||||
{
|
||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black);
|
||||
}
|
||||
}
|
||||
|
||||
if(barcodeImage.getHeight() == 0)
|
||||
{
|
||||
Log.d(TAG, "ImageView size is not known known at start, waiting for load");
|
||||
@@ -203,13 +217,21 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
{
|
||||
getMenuInflater().inflate(R.menu.card_view_menu, menu);
|
||||
|
||||
if(settings.getLockBarcodeScreenOrientation())
|
||||
// Always calculate lockscreen icon, it may need a black color
|
||||
boolean lockBarcodeScreenOrientation = settings.getLockBarcodeScreenOrientation();
|
||||
MenuItem item = menu.findItem(R.id.action_lock_unlock);
|
||||
setOrientatonLock(item, lockBarcodeScreenOrientation);
|
||||
if(lockBarcodeScreenOrientation)
|
||||
{
|
||||
MenuItem item = menu.findItem(R.id.action_lock_unlock);
|
||||
setOrientatonLock(item, true);
|
||||
item.setVisible(false);
|
||||
}
|
||||
|
||||
if(backgroundNeedsDarkIcons)
|
||||
{
|
||||
menu.findItem(R.id.action_share).setIcon(R.drawable.ic_share_black);
|
||||
menu.findItem(R.id.action_edit).setIcon(R.drawable.ic_mode_edit_black_24dp);
|
||||
}
|
||||
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@@ -258,13 +280,27 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
{
|
||||
if(lock)
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_outline_white_24dp);
|
||||
if(backgroundNeedsDarkIcons)
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_outline_black_24dp);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_outline_white_24dp);
|
||||
}
|
||||
item.setTitle(R.string.unlockScreen);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_open_white_24dp);
|
||||
if(backgroundNeedsDarkIcons)
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_open_black_24dp);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setIcon(R.drawable.ic_lock_open_white_24dp);
|
||||
}
|
||||
item.setTitle(R.string.lockScreen);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
|
||||
}
|
||||
|
||||
11
app/src/main/res/drawable-anydpi/ic_arrow_back_black.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||
</vector>
|
||||
11
app/src/main/res/drawable-anydpi/ic_lock_open_black_24dp.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2L8.9,8L8.9,6zM18,20L6,20L6,10h12v10z"/>
|
||||
</vector>
|
||||
11
app/src/main/res/drawable-anydpi/ic_mode_edit_black_24dp.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
||||
11
app/src/main/res/drawable-anydpi/ic_share_black.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#333333"
|
||||
android:alpha="0.6">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back_black.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
app/src/main/res/drawable-hdpi/ic_lock_open_black_24dp.png
Normal file
|
After Width: | Height: | Size: 358 B |
BIN
app/src/main/res/drawable-hdpi/ic_lock_outline_black_24dp.png
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
app/src/main/res/drawable-hdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 245 B |
BIN
app/src/main/res/drawable-hdpi/ic_share_black.png
Normal file
|
After Width: | Height: | Size: 453 B |
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back_black.png
Normal file
|
After Width: | Height: | Size: 124 B |
BIN
app/src/main/res/drawable-mdpi/ic_lock_open_black_24dp.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
app/src/main/res/drawable-mdpi/ic_lock_outline_black_24dp.png
Normal file
|
After Width: | Height: | Size: 235 B |
BIN
app/src/main/res/drawable-mdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 177 B |
BIN
app/src/main/res/drawable-mdpi/ic_share_black.png
Normal file
|
After Width: | Height: | Size: 287 B |
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back_black.png
Normal file
|
After Width: | Height: | Size: 182 B |
BIN
app/src/main/res/drawable-xhdpi/ic_lock_open_black_24dp.png
Normal file
|
After Width: | Height: | Size: 411 B |
BIN
app/src/main/res/drawable-xhdpi/ic_lock_outline_black_24dp.png
Normal file
|
After Width: | Height: | Size: 415 B |
BIN
app/src/main/res/drawable-xhdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 264 B |
BIN
app/src/main/res/drawable-xhdpi/ic_share_black.png
Normal file
|
After Width: | Height: | Size: 525 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back_black.png
Normal file
|
After Width: | Height: | Size: 237 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_lock_open_black_24dp.png
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_lock_outline_black_24dp.png
Normal file
|
After Width: | Height: | Size: 610 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_mode_edit_black_24dp.png
Normal file
|
After Width: | Height: | Size: 350 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_share_black.png
Normal file
|
After Width: | Height: | Size: 799 B |