]> git.ktnx.net Git - mobile-ledger.git/commitdiff
replace xml onClick declaration with run-time hooking
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 28 Dec 2020 16:47:55 +0000 (18:47 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 28 Dec 2020 16:47:55 +0000 (18:47 +0200)
declarative handlers are deprecated

app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
app/src/main/res/layout/activity_main.xml

index 2fc09379873faa8d030c094c709a9451270f568e..92cb1f4b87110a77da85aaf96d938c028ddde3d6 100644 (file)
@@ -301,6 +301,8 @@ public class MainActivity extends ProfileThemedActivity {
         Data.lastUpdateDate.observe(this, date -> refreshLastUpdateInfo());
         Data.lastUpdateTransactionCount.observe(this, date -> refreshLastUpdateInfo());
         Data.lastUpdateAccountCount.observe(this, date -> refreshLastUpdateInfo());
+        b.navAccountSummary.setOnClickListener(this::onAccountSummaryClicked);
+        b.navLatestTransactions.setOnClickListener(this::onLatestTransactionsClicked);
     }
     private void scheduleDataRetrievalIfStale(long lastUpdate) {
         long now = new Date().getTime();
index 1fc6d8b614f3898242fd2536c64754fceb9cd0d4..06feeb101f5ca379bc4217318b62373802b620d0 100644 (file)
                                 <TextView
                                     android:id="@+id/nav_account_summary"
                                     style="@style/nav_button"
-                                    android:onClick="onAccountSummaryClicked"
                                     android:text="@string/account_summary_title"
                                     app:drawableStartCompat="@drawable/ic_home_black_24dp"
                                     />
                                 <TextView
                                     android:id="@+id/nav_latest_transactions"
                                     style="@style/nav_button"
-                                    android:onClick="onLatestTransactionsClicked"
                                     android:text="@string/nav_transactions_title"
                                     app:drawableStartCompat="@drawable/ic_event_note_black_24dp"
                                     />