From 0f2ee296b4e03bf0c6452fe99bb3e4fd90b6bdbf Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 16 Jul 2017 21:05:58 -0400 Subject: [PATCH 1/3] Remove container class for intro slides Even with passing a bundle with the layout ID sometimes some users will encounter a situation where the _layout variable is null. To avoid further issues, creating a class for each intro slide, so the layout is encoded into the class itself. --- app/src/main/AndroidManifest.xml | 2 +- .../protect/card_locker/IntroActivity.java | 43 ------------------- .../protect/card_locker/MainActivity.java | 2 + .../card_locker/intro/IntroActivity.java | 36 ++++++++++++++++ .../card_locker/intro/IntroSlide1.java | 19 ++++++++ .../IntroSlide2.java} | 15 +++---- .../card_locker/intro/IntroSlide3.java | 19 ++++++++ .../card_locker/intro/IntroSlide4.java | 19 ++++++++ .../card_locker/intro/IntroSlide5.java | 19 ++++++++ .../card_locker/intro/IntroSlide6.java | 19 ++++++++ .../protect/card_locker/MainActivityTest.java | 2 +- 11 files changed, 140 insertions(+), 55 deletions(-) delete mode 100644 app/src/main/java/protect/card_locker/IntroActivity.java create mode 100644 app/src/main/java/protect/card_locker/intro/IntroActivity.java create mode 100644 app/src/main/java/protect/card_locker/intro/IntroSlide1.java rename app/src/main/java/protect/card_locker/{IntroSlide.java => intro/IntroSlide2.java} (54%) create mode 100644 app/src/main/java/protect/card_locker/intro/IntroSlide3.java create mode 100644 app/src/main/java/protect/card_locker/intro/IntroSlide4.java create mode 100644 app/src/main/java/protect/card_locker/intro/IntroSlide5.java create mode 100644 app/src/main/java/protect/card_locker/intro/IntroSlide6.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ad7ea95a0..e112d6e68 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -49,7 +49,7 @@ android:configChanges="orientation|screenSize" android:theme="@style/AppTheme.NoActionBar"/> diff --git a/app/src/main/java/protect/card_locker/IntroActivity.java b/app/src/main/java/protect/card_locker/IntroActivity.java deleted file mode 100644 index 465f694a7..000000000 --- a/app/src/main/java/protect/card_locker/IntroActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -package protect.card_locker; - -import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.v4.app.Fragment; - -import com.github.paolorotolo.appintro.AppIntro; - - -public class IntroActivity extends AppIntro -{ - @Override - public void init(Bundle savedInstanceState) - { - addIntroSlide(R.layout.intro1_layout); - addIntroSlide(R.layout.intro2_layout); - addIntroSlide(R.layout.intro3_layout); - addIntroSlide(R.layout.intro4_layout); - addIntroSlide(R.layout.intro5_layout); - addIntroSlide(R.layout.intro6_layout); - } - - private void addIntroSlide(@LayoutRes int layout) - { - Fragment slide = new IntroSlide(); - Bundle args = new Bundle(); - args.putInt("layout", layout); - slide.setArguments(args); - addSlide(slide); - } - - @Override - public void onSkipPressed(Fragment fragment) { - finish(); - } - - @Override - public void onDonePressed(Fragment fragment) { - finish(); - } -} - - diff --git a/app/src/main/java/protect/card_locker/MainActivity.java b/app/src/main/java/protect/card_locker/MainActivity.java index 0d7bdf1d7..7eb745794 100644 --- a/app/src/main/java/protect/card_locker/MainActivity.java +++ b/app/src/main/java/protect/card_locker/MainActivity.java @@ -29,6 +29,8 @@ import com.google.common.collect.ImmutableMap; import java.util.Calendar; import java.util.Map; +import protect.card_locker.intro.IntroActivity; + public class MainActivity extends AppCompatActivity { private static final String TAG = "LoyaltyCardLocker"; diff --git a/app/src/main/java/protect/card_locker/intro/IntroActivity.java b/app/src/main/java/protect/card_locker/intro/IntroActivity.java new file mode 100644 index 000000000..04e18cfa3 --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroActivity.java @@ -0,0 +1,36 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.annotation.LayoutRes; +import android.support.v4.app.Fragment; + +import com.github.paolorotolo.appintro.AppIntro; + +import protect.card_locker.R; + + +public class IntroActivity extends AppIntro +{ + @Override + public void init(Bundle savedInstanceState) + { + addSlide(new IntroSlide1()); + addSlide(new IntroSlide2()); + addSlide(new IntroSlide3()); + addSlide(new IntroSlide4()); + addSlide(new IntroSlide5()); + addSlide(new IntroSlide6()); + } + + @Override + public void onSkipPressed(Fragment fragment) { + finish(); + } + + @Override + public void onDonePressed(Fragment fragment) { + finish(); + } +} + + diff --git a/app/src/main/java/protect/card_locker/intro/IntroSlide1.java b/app/src/main/java/protect/card_locker/intro/IntroSlide1.java new file mode 100644 index 000000000..7e53d7652 --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide1.java @@ -0,0 +1,19 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import protect.card_locker.R; + +public class IntroSlide1 extends Fragment +{ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.intro1_layout, container, false); + return v; + } +} diff --git a/app/src/main/java/protect/card_locker/IntroSlide.java b/app/src/main/java/protect/card_locker/intro/IntroSlide2.java similarity index 54% rename from app/src/main/java/protect/card_locker/IntroSlide.java rename to app/src/main/java/protect/card_locker/intro/IntroSlide2.java index 7fff1f357..6ee1952b7 100644 --- a/app/src/main/java/protect/card_locker/IntroSlide.java +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide2.java @@ -1,4 +1,4 @@ -package protect.card_locker; +package protect.card_locker.intro; import android.os.Bundle; import android.support.v4.app.Fragment; @@ -6,20 +6,15 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -public class IntroSlide extends Fragment -{ - int _layout; +import protect.card_locker.R; - @Override - public void setArguments(Bundle bundle) - { - _layout = bundle.getInt("layout"); - } +public class IntroSlide2 extends Fragment +{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(_layout, container, false); + View v = inflater.inflate(R.layout.intro2_layout, container, false); return v; } } diff --git a/app/src/main/java/protect/card_locker/intro/IntroSlide3.java b/app/src/main/java/protect/card_locker/intro/IntroSlide3.java new file mode 100644 index 000000000..deb6927b0 --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide3.java @@ -0,0 +1,19 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import protect.card_locker.R; + +public class IntroSlide3 extends Fragment +{ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.intro3_layout, container, false); + return v; + } +} diff --git a/app/src/main/java/protect/card_locker/intro/IntroSlide4.java b/app/src/main/java/protect/card_locker/intro/IntroSlide4.java new file mode 100644 index 000000000..d47a5ac8e --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide4.java @@ -0,0 +1,19 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import protect.card_locker.R; + +public class IntroSlide4 extends Fragment +{ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.intro4_layout, container, false); + return v; + } +} diff --git a/app/src/main/java/protect/card_locker/intro/IntroSlide5.java b/app/src/main/java/protect/card_locker/intro/IntroSlide5.java new file mode 100644 index 000000000..6127ab1ba --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide5.java @@ -0,0 +1,19 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import protect.card_locker.R; + +public class IntroSlide5 extends Fragment +{ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.intro5_layout, container, false); + return v; + } +} diff --git a/app/src/main/java/protect/card_locker/intro/IntroSlide6.java b/app/src/main/java/protect/card_locker/intro/IntroSlide6.java new file mode 100644 index 000000000..d3fba4f98 --- /dev/null +++ b/app/src/main/java/protect/card_locker/intro/IntroSlide6.java @@ -0,0 +1,19 @@ +package protect.card_locker.intro; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import protect.card_locker.R; + +public class IntroSlide6 extends Fragment +{ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View v = inflater.inflate(R.layout.intro6_layout, container, false); + return v; + } +} diff --git a/app/src/test/java/protect/card_locker/MainActivityTest.java b/app/src/test/java/protect/card_locker/MainActivityTest.java index d727fb89d..77c36b672 100644 --- a/app/src/test/java/protect/card_locker/MainActivityTest.java +++ b/app/src/test/java/protect/card_locker/MainActivityTest.java @@ -131,7 +131,7 @@ public class MainActivityTest ComponentName componentName = next.getComponent(); String name = componentName.flattenToShortString(); - assertEquals("protect.card_locker/.IntroActivity", name); + assertEquals("protect.card_locker/.intro.IntroActivity", name); Bundle extras = next.getExtras(); assertNull(extras); From 641d29a6f883151a4222f47fa4dc85f10cc804b9 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 16 Jul 2017 21:06:16 -0400 Subject: [PATCH 2/3] Remove usage of depreated location of ActivityController --- .../java/protect/card_locker/LoyaltyCardViewActivityTest.java | 2 +- app/src/test/java/protect/card_locker/MainActivityTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java b/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java index b351a5c08..0501b0c79 100644 --- a/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java +++ b/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java @@ -24,7 +24,7 @@ import org.robolectric.annotation.Config; import org.robolectric.res.builder.RobolectricPackageManager; import org.robolectric.shadows.ShadowActivity; import org.robolectric.shadows.ShadowLog; -import org.robolectric.util.ActivityController; +import org.robolectric.android.controller.ActivityController; import java.io.IOException; diff --git a/app/src/test/java/protect/card_locker/MainActivityTest.java b/app/src/test/java/protect/card_locker/MainActivityTest.java index 77c36b672..9b7de1270 100644 --- a/app/src/test/java/protect/card_locker/MainActivityTest.java +++ b/app/src/test/java/protect/card_locker/MainActivityTest.java @@ -21,7 +21,7 @@ import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; -import org.robolectric.util.ActivityController; +import org.robolectric.android.controller.ActivityController; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; From fb7e3e12f260cba0831a5d57dc08b4a89a82f75d Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 16 Jul 2017 21:19:43 -0400 Subject: [PATCH 3/3] Add menu option to lock screen when viewing card When passing a phone to a clerk to scan the barcode, if the phone is rotated and the screen reloads it can be bothersome or confusion. To avoid this situation, a new option is added to lock the screen. A menu icon is now added which defaults as unlocked. When touched the app sets its orientation to the "natural" orientation of the device. When touched again the sensor dictates the orientation of the device. --- .../card_locker/LoyaltyCardViewActivity.java | 23 ++++++++++++++++ .../drawable-hdpi/ic_lock_open_white_24dp.png | Bin 0 -> 306 bytes .../ic_lock_outline_white_24dp.png | Bin 0 -> 303 bytes .../drawable-mdpi/ic_lock_open_white_24dp.png | Bin 0 -> 200 bytes .../ic_lock_outline_white_24dp.png | Bin 0 -> 198 bytes .../ic_lock_open_white_24dp.png | Bin 0 -> 354 bytes .../ic_lock_outline_white_24dp.png | Bin 0 -> 343 bytes .../ic_lock_open_white_24dp.png | Bin 0 -> 512 bytes .../ic_lock_outline_white_24dp.png | Bin 0 -> 494 bytes .../ic_lock_open_white_24dp.png | Bin 0 -> 665 bytes .../ic_lock_outline_white_24dp.png | Bin 0 -> 651 bytes app/src/main/res/menu/card_view_menu.xml | 5 ++++ app/src/main/res/values-cs/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-lt/strings.xml | 2 ++ app/src/main/res/values-nl/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 2 ++ .../LoyaltyCardViewActivityTest.java | 25 ++++++++++++++++++ 20 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_lock_outline_white_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_lock_open_white_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_lock_outline_white_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_lock_outline_white_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_lock_open_white_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_lock_outline_white_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_lock_outline_white_24dp.png diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index b556336c5..50f9d1327 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -2,8 +2,11 @@ package protect.card_locker; import android.app.Activity; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.support.design.widget.Snackbar; @@ -53,6 +56,8 @@ public class LoyaltyCardViewActivity extends AppCompatActivity boolean updateLoyaltyCard; boolean viewLoyaltyCard; + boolean rotationEnabled; + DBHelper db; @Override @@ -305,6 +310,8 @@ public class LoyaltyCardViewActivity extends AppCompatActivity getMenuInflater().inflate(R.menu.card_add_menu, menu); } + rotationEnabled = true; + return super.onCreateOptionsMenu(menu); } @@ -361,6 +368,22 @@ public class LoyaltyCardViewActivity extends AppCompatActivity finish(); return true; + case R.id.action_lock_unlock: + if(rotationEnabled) + { + 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); + item.setTitle(R.string.lockScreen); + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); + } + rotationEnabled = !rotationEnabled; + return true; + case R.id.action_save: doSave(); return true; diff --git a/app/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_lock_open_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..6bae68f56f59152d7954b776356836e29d112497 GIT binary patch literal 306 zcmV-20nPr2P)z6=Sc_Dj*w)pzMgQ*Bw7UA7Dr$`r1xi-+ub_BF5eVxiW8nHlLhF*F4) zT5-@2JZhIG+Md8D25KlUE15-iyra;p4s`?Xz5$2Tp+4w+J3j>%0Vtx!;Oaj@Ycjbi z8OzkeP$ni>7|O*Y4?{pL(9n}BXxsU`TdB~2DVXS_K@ZB@r9mIc6lu`CGPh|^#{|6D zPyK3}&gR`%{nGaNm+g(^8f$<07*qoM6N<$ Ef{!GExBvhE literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_lock_outline_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_lock_outline_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..e53f54186b98e10d7a746605480e85b5c7871d2f GIT binary patch literal 303 zcmV+~0nq-5P)zT|8+I z56y`ubKxNnrZ8;H2goN?s(d^rB*_X`_V;|y2!O%!LE8W}&j$?w7&ssF*D_f2`@FmM zL4^wMFZvukKnv%1kIwNzwuFa*F~8Y!S_A|4BYTloxb~PT13Ul#002ovPDHLkV1mqT Be?M_o(s$PU`djtkFiI?Tz*G<{nz+kZ@dA?CArZ z+4J+g=S*of|K4?O<5bo9gHBnl^TiFk-ZQ8h?>m=}^&03f22WQ%mvv4FO#qKMPVE2y literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_lock_open_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..cbe9e1cd072f92e7e897569fb6f603d08109b5c5 GIT binary patch literal 354 zcmV-o0iFJdP)f;2!>A;^bm0sMOyR}fh~lHkZK#ocm>^j+MLA{9gfZ!Y0-TD z%fb1;zz@U!l7YE}y^D*zN3RToYc9CvroQ{LZzk;kJ#VCXtyd1zUw^Xo(Wy?90#h+N zV|_u;H}Of#%MxG^zdi3fuRrm^d%#!y=D-}Vi?9Ek_zaje2Nr%$8&Hx4X0qB6%fsu_Tw|2BPyapKgsc8qpJg`yHDi1sfd zaJ=`Q{#r@P3=kLFpwz-cawxV20<$Z(Mj^ZeYybcN07*qoM6N<$f~W?X AOaK4? literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_lock_outline_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_lock_outline_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..e2d109130ee373561b490926bd4e56051666bfe7 GIT binary patch literal 343 zcmV-d0jU0oP)p3tS7xqJ;y3vQIM^pSyk=TedJOXhB1xS#W@cJ+lDAAE!9y1zsS9OR??+ zPYRb})dEA|jcS3R@ICi}{jdeiJf*?CAcHOL*(A-iKopJau}1@GzU1!}c)@i=L5FA$Cn3PQ|z84W5z7Gr`S7b&?Wi4(&5B>`iK{N zC*Or6=!_Ul4_t9X@l1;$e{zrasT^pS<2>JZu9G8ONr3|HtbgV;m~LswfX;Kz&QS&a z2biA9fJR{IRGxkbrZ+O630Wy878l@wtj{u_n5?DM`EO+Xk^!Y;jjhgqBI~ydsP25k zq#y+;Xu}*cU_rvJN|@6pYzlh94H8APn}CkFL8=u&eb4~Odi6mIB%9R-B}lfe5BfK6 zM*}7WDM&#II#iHZQOs)L7*t$QBHHdiB#30000u}fVdXGbo!zOf@PtGlZx{iKQ zm9vxO3y*lj7qXPQq<`;}`pI4vyI)zte*REuv+k1>LF75gtny`;%}EM~km3`^$&#EM zHJ964l5|w>H5d!J8_po2O0P;bB7QQfLHvKjI-Q`4h`kM$K8!f06Z9GU9GB}R{E&m)RtrH~f23r0hI2L3<7E~ScnBXHRS|!B?#+ch|&KiE8 z;Tx-(J3Bwn@|8LMK@(^i^$+@pruY6qDKsVggAfWY4lKxmEXacTHAqGj87(>)BqNH9 z7M%;KKB9bOPUnIqsAjZtK_98+edmHw4MqzK`am`BIu|rXHN%|?n#(uJeeS?xFIdIb zvYeHj{&dV`l=mb^@Qz{T*vGX=7GyydWI=uKcgzPgz4H$mL({NNi;NZuWJK{HqlE$) kQGCg0(JC^c7-KqS3OnC-IP@zyWB>pF07*qoM6N<$f+f7(-~a#s literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_lock_open_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..8ab410727c653344ea279fd97da6a622a9ee3e64 GIT binary patch literal 665 zcmV;K0%rY*P)yb?`#6$F;bZe(w3FQj2{G?EaFY=-y}OalQDL>eaT zh_)T>*VS{2F$6%KeQw$( z=Hvm}jOvs1KQTB>w5nu|Mxv}fc1p! zIp5#6p0lh0)*GQb36btr-f1A00k&O0SZt+g_sliOuIhEG%2SGDAFR^5@HHz z0g8M>q5}%)09r`ZOao9su7t8bAV#u=Ki~w(j{E_ABfF|Rrg%2o`Fsg(S@&JzyX?-?c;sOT@>nrmC11v&p{UIgPnV+qn(`6bQ(WA#9 zHA*^Y6rcbFC_n)UP=Es50s4<_j*;xpAJ9aynm?dSf>a45e?UZxRCOW`fVFY6%wa=E z4jVVS95!_1ym6uYV%s9AbRHb=vOgAFNL_0{tiQe2%sG=XfmR zipK9dR)0!9{g|3IOZ)iz!`!nz_T0?d^GiSTS}^;)Rw?;;d~(IT**43Xvx2_u-!-+Q z_{yK1DXhm|ESKcN_751BJ>9qLdcrR0x&z^#uYI+>f4pM8GrvIijpX~E_0PW6`NB}h z9`o6@{&r09A%26@+Vk-T7cl0rXEd+@(S}Z*T#=a>uD3ikZ`|5G-<7Z5pmNEKo4X#@ zA8Gr3ChO&^JjYe0^K1E|ZOmBsPb35zRX9kS{pFAgII_&?1B2odZXwfMfa?5Na}6>3lG9Nx;_N^btmD4FHCOa6kJuKgW;jUaDFW}W($eY@o+ESuKyn^F4X zif8h#7Z*%ix + Editovat Smazat Potvrdit + Lock Screen + Unlock Screen Odstzranit věrnostní kartu Opravdu chcete smazat tuto věrnostní kartu? Ano diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8f4071dfc..9ff7d193d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -33,6 +33,8 @@ %1$s: %2$s Bestätigen Kopiere die Nummer in die Zwischenablage + Lock Screen + Unlock Screen Löschen Bitte bestätigen Sie, dass diese Karte gelöscht werden soll. Lösche die Kundenkarte diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 87aa34148..e8c660771 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -18,6 +18,8 @@ Modifier Modifier Supprimer + Lock Screen + Unlock Screen Confirmer Supprimer la carte de fidélité Confirmez que vous souhaitez supprimer cette carte diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 9e4897c3c..1d3bf2f07 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -56,6 +56,8 @@ Copia ID negli appunti ID della carta copiato negli appunti Conferma + Lock Screen + Unlock Screen Rimuovi carta fedeltà Conferma che vuoi eliminare questa carta. Fare il backup dei dati ti permette di spostare le tue tessere da un dispositivo ad un altro. diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 953c51718..18c0d71c3 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -19,6 +19,8 @@ Redaguoti Ištrinti Patvirtinti + Lock Screen + Unlock Screen Panaikinti lojalumo kortelę Prašome patvirtinti jog Jūs norite panaikinti šią lojalumo kortelę. Gerai diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index d0908a155..52f695c1b 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -58,7 +58,8 @@ Bevestig Bevestig deze kaart te verwijderen. Verwijder kaart - + Lock Screen + Unlock Screen Data die is geback-upt maakt het mogelijk om je klantenkaarten naar een ander apparaat te verplaatsen. Importeren succesvol Importeren mislukte diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 613d83108..7e5d86717 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,8 @@ Edit Delete Confirm + Lock Screen + Unlock Screen Remove Loyalty Card Please confirm that you want to delete this card. OK diff --git a/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java b/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java index 0501b0c79..5504d80d2 100644 --- a/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java +++ b/app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java @@ -6,6 +6,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; @@ -30,6 +31,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.robolectric.Shadows.shadowOf; @RunWith(RobolectricTestRunner.class) @@ -414,4 +416,27 @@ public class LoyaltyCardViewActivityTest shadowOf(activity).clickMenuItem(android.R.id.home); assertEquals(true, activity.isFinishing()); } + + @Test + public void checkMenu() throws IOException + { + ActivityController activityController = createActivityWithLoyaltyCard(false); + Activity activity = (Activity)activityController.get(); + DBHelper db = new DBHelper(activity); + + db.insertLoyaltyCard("store", "note", BARCODE_DATA, BARCODE_TYPE); + + activityController.start(); + activityController.visible(); + activityController.resume(); + + final Menu menu = shadowOf(activity).getOptionsMenu(); + assertTrue(menu != null); + + // The settings and add button should be present + assertEquals(menu.size(), 2); + + assertEquals("Lock Screen", menu.findItem(R.id.action_lock_unlock).getTitle().toString()); + assertEquals("Edit", menu.findItem(R.id.action_edit).getTitle().toString()); + } }