]> git.ktnx.net Git - mobile-ledger.git/commitdiff
NT: add simulation watermark when simulation is enabled
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 30 Nov 2019 10:54:01 +0000 (12:54 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 30 Nov 2019 10:54:01 +0000 (12:54 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java
app/src/main/res/layout/activity_new_transaction.xml
app/src/main/res/values-bg/strings.xml
app/src/main/res/values/strings.xml

index 660be19773891fa62c3cd85341719fef2e6752ff..1317c438f334e759756ed00194e6b07ccadb3ce7 100644 (file)
@@ -22,6 +22,7 @@ import android.os.Bundle;
 import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.View;
 
 import androidx.appcompat.widget.Toolbar;
 import androidx.lifecycle.ViewModelProviders;
@@ -131,8 +132,11 @@ public class NewTransactionActivity extends ProfileThemedActivity implements Tas
                 .setVisible(true);
         }
 
-        model.observeSimulateSave(this, state -> menu.findItem(R.id.action_simulate_save)
-                                                     .setChecked(state));
+        model.observeSimulateSave(this, state -> {
+            menu.findItem(R.id.action_simulate_save)
+                .setChecked(state);
+            findViewById(R.id.simulationLabel).setVisibility(state ? View.VISIBLE : View.GONE);
+        });
 
         return true;
     }
index 6913a7707eea968915a07e4bcde37d195c722b4b..bb5eb3ad75015a227a507df7962a49301499d422 100644 (file)
@@ -24,7 +24,8 @@
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
+        android:layout_height="match_parent"
+        android:animateLayoutChanges="true">
 
         <com.google.android.material.appbar.AppBarLayout
             android:id="@+id/toolbar_layout"
             app:layout_constraintTop_toBottomOf="@id/toolbar_layout"
             app:navGraph="@navigation/new_transaction_navigation" />
 
+        <TextView
+            android:id="@+id/simulationLabel"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:layout_margin="@dimen/activity_horizontal_margin"
+            android:clickable="false"
+            android:gravity="center"
+            android:rotation="-45"
+            android:text="@string/simulation_label"
+            android:textAlignment="center"
+            android:textColor="@color/table_row_dark_bg"
+            android:textIsSelectable="false"
+            android:textSize="54sp"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/toolbar_layout" />
+
     </androidx.constraintlayout.widget.ConstraintLayout>
 
 </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
index ac1c330d678a24faf70ac1e4db22fe1f9260bcab..7b5fd60097c3f8b910b0776944cf2a44aacc141e 100644 (file)
     <string name="new_transaction_saving">Запазване…</string>
     <string name="simulate_save_label">Симулиране на заявките за съхраняване</string>
     <string name="simulate_save_condensed_label">Симул. съхр.</string>
+    <string name="simulation_label">СИМУЛАЦИЯ</string>
 
 </resources>
index 2c663bd947d1d45a0bd044a90c95408e2c30023a..2f8f643c8e6e02e3065eb98463fa9a789eaffe9d 100644 (file)
     <string name="new_transaction_saving">Saving…</string>
     <string name="simulate_save_label">Simulate save requests</string>
     <string name="simulate_save_condensed_label">Simul. save</string>
+    <string name="simulation_label">SIMULATION</string>
 </resources>