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 660be19..1317c43 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 6913a77..bb5eb3a 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 ac1c330..7b5fd60 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 2c663bd..2f8f643 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>