Skip to content

Commit

Permalink
Added Recent Documents button to main crypto screen
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrebane committed Sep 26, 2023
1 parent 130f633 commit 3c36bb0
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ee.ria.DigiDoc.android.crypto.home;

import static com.jakewharton.rxbinding4.view.RxView.clicks;

import android.content.Context;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityEvent;
Expand All @@ -14,17 +16,17 @@
import ee.ria.DigiDoc.android.crypto.create.CryptoCreateScreen;
import ee.ria.DigiDoc.android.main.home.HomeToolbar;
import ee.ria.DigiDoc.android.main.home.HomeView;
import ee.ria.DigiDoc.android.signature.list.SignatureListScreen;
import ee.ria.DigiDoc.android.utils.ViewDisposables;
import ee.ria.DigiDoc.android.utils.navigator.Navigator;
import ee.ria.DigiDoc.android.utils.navigator.Transaction;
import io.reactivex.rxjava3.core.Observable;

import static com.jakewharton.rxbinding4.view.RxView.clicks;

public final class CryptoHomeView extends CoordinatorLayout implements HomeView.HomeViewChild {

private final HomeToolbar toolbarView;
private final Button createButton;
private final Button recentDocumentsButton;

private final Navigator navigator;

Expand All @@ -43,6 +45,7 @@ public CryptoHomeView(Context context, @Nullable AttributeSet attrs, int defStyl
inflate(context, R.layout.crypto_home, this);
toolbarView = findViewById(R.id.toolbar);
createButton = findViewById(R.id.cryptoHomeCreateButton);
recentDocumentsButton = findViewById(R.id.cryptoHomeRecentDocumentsButton);
navigator = ApplicationApp.component(context).navigator();
AccessibilityUtils.setViewAccessibilityPaneTitle(this, R.string.main_home_navigation_crypto);

Expand All @@ -68,6 +71,8 @@ public void onAttachedToWindow() {
disposables.attach();
disposables.add(clicks(createButton).subscribe(ignored ->
navigator.execute(Transaction.push(CryptoCreateScreen.create()))));
disposables.add(clicks(recentDocumentsButton).subscribe(o ->
navigator.execute(Transaction.push(SignatureListScreen.create()))));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package ee.ria.DigiDoc.android.main.home;

import static android.util.TypedValue.COMPLEX_UNIT_SP;
import static com.jakewharton.rxbinding4.view.RxView.clicks;
import static com.jakewharton.rxbinding4.widget.RxRadioGroup.checkedChanges;
import static ee.ria.DigiDoc.android.accessibility.AccessibilityUtils.isLargeFontEnabled;
import static ee.ria.DigiDoc.android.utils.TextUtil.convertPxToDp;
import static ee.ria.DigiDoc.android.utils.TintUtils.tintCompoundDrawables;
import static ee.ria.DigiDoc.android.utils.display.DisplayUtil.getDeviceOrientation;

import android.content.Context;
Expand All @@ -27,22 +29,16 @@
import java.util.Set;

import ee.ria.DigiDoc.R;
import ee.ria.DigiDoc.android.utils.display.DisplayUtil;
import ee.ria.DigiDoc.android.utils.navigator.ContentView;
import ee.ria.DigiDoc.common.TextUtil;
import io.reactivex.rxjava3.core.Observable;

import static com.jakewharton.rxbinding4.view.RxView.clicks;
import static com.jakewharton.rxbinding4.widget.RxRadioGroup.checkedChanges;
import static ee.ria.DigiDoc.android.utils.TintUtils.tintCompoundDrawables;

public final class HomeMenuView extends NestedScrollView implements ContentView {

private final View closeButton;

private final Button helpView;
private final Button accessibilityView;
private final Button recentView;
private final Button settingsView;
private final Button aboutView;
private final Button diagnosticsView;
Expand Down Expand Up @@ -119,7 +115,6 @@ public HomeMenuView(@NonNull Context context, @Nullable AttributeSet attrs, int
TextUtil.splitTextAndJoin(
getResources().getString(R.string.main_home_menu_help_url_short), "", " "));
accessibilityView = findViewById(R.id.mainHomeMenuAccessibility);
recentView = findViewById(R.id.mainHomeMenuRecent);
settingsView = findViewById(R.id.mainHomeMenuSettings);
aboutView = findViewById(R.id.mainHomeMenuAbout);
diagnosticsView = findViewById(R.id.mainHomeMenuDiagnostics);
Expand All @@ -129,7 +124,6 @@ public HomeMenuView(@NonNull Context context, @Nullable AttributeSet attrs, int
russianButton = findViewById(R.id.mainHomeMenuLocaleRu);

tintCompoundDrawables(helpView);
tintCompoundDrawables(recentView);
tintCompoundDrawables(settingsView);
tintCompoundDrawables(aboutView);
tintCompoundDrawables(diagnosticsView);
Expand Down Expand Up @@ -160,7 +154,6 @@ public Observable<Integer> itemClicks() {
return Observable.mergeArray(
clicks(helpView).map(ignored -> R.id.mainHomeMenuHelp),
clicks(accessibilityView).map(ignored -> R.id.mainHomeMenuAccessibility),
clicks(recentView).map(ignored -> R.id.mainHomeMenuRecent),
clicks(settingsView).map(ignored -> R.id.mainHomeMenuSettings),
clicks(aboutView).map(ignored -> R.id.mainHomeMenuAbout),
clicks(diagnosticsView).map(ignored -> R.id.mainHomeMenuDiagnostics));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import ee.ria.DigiDoc.android.main.home.Intent.NavigationVisibilityIntent;
import ee.ria.DigiDoc.android.main.settings.SettingsScreen;
import ee.ria.DigiDoc.android.signature.create.SignatureCreateScreen;
import ee.ria.DigiDoc.android.signature.list.SignatureListScreen;
import ee.ria.DigiDoc.android.utils.LocaleService;
import ee.ria.DigiDoc.android.utils.ToastUtil;
import ee.ria.DigiDoc.android.utils.files.FileStream;
Expand Down Expand Up @@ -171,8 +170,6 @@ private static Transaction menuItemToTransaction(Context context, @IdRes int ite
return Transaction
.activity(createBrowserIntent(context, R.string.main_home_menu_help_url, configuration),
null);
case R.id.mainHomeMenuRecent:
return Transaction.push(SignatureListScreen.create());
case R.id.mainHomeMenuAccessibility:
return Transaction.push(AccessibilityScreen.create());
case R.id.mainHomeMenuSettings:
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/crypto_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
android:text="@string/crypto_home_create_button"
android:contentDescription="@string/crypto_home_create_text_accessibility" />

<Button
android:id="@id/cryptoHomeRecentDocumentsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_home_recent"
android:background="@drawable/transparent_button"
android:textColor="@color/accent"
android:contentDescription="@string/main_home_recent_accessibility" />

</LinearLayout>

</ScrollView>
Expand Down
11 changes: 1 addition & 10 deletions app/src/main/res/layout/main_home_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_home_menu_accessibility"
android:contentDescription="@string/main_home_menu_recent_accessibility"
android:contentDescription="@string/main_home_recent_accessibility"
android:drawableStart="@drawable/ic_icon_accessibility" />

<Button
android:id="@id/mainHomeMenuRecent"
style="@style/Widget.Application.MenuItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_home_menu_recent"
android:contentDescription="@string/main_home_menu_recent_accessibility"
android:drawableStart="@drawable/ic_folder_open" />

<Button
android:id="@id/mainHomeMenuSettings"
style="@style/Widget.Application.MenuItem"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/signature_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
android:id="@id/signatureHomeRecentDocumentsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_home_menu_recent"
android:text="@string/main_home_recent"
android:background="@drawable/transparent_button"
android:textColor="@color/accent"
android:contentDescription="@string/main_home_menu_recent_accessibility" />
android:contentDescription="@string/main_home_recent_accessibility" />

</LinearLayout>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-et/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
<string name="main_home_menu_help_url_short">link www.id.ee</string>
<string name="main_home_menu_help_url">https://www.id.ee/id-abikeskus/</string>
<string name="main_home_menu_accessibility">JUURDEPÄÄSETAVUS</string>
<string name="main_home_menu_recent">HILJUTISED DOKUMENDID</string>
<string name="main_home_menu_settings">SEADED</string>
<string name="main_home_menu_about">INFO</string>
<string name="main_home_menu_diagnostics">DIAGNOSTIKA</string>
<string name="main_home_recent">HILJUTISED DOKUMENDID</string>
<string name="main_home_recent_accessibility">Hiljutised dokumendid</string>

<!-- Main Accessibility -->
<string name="main_accessibility_title">Juurdepääsetavus</string>
Expand Down Expand Up @@ -595,7 +596,6 @@

<!-- Menu -->
<string name="main_home_menu_help_accessibility">Abi</string>
<string name="main_home_menu_recent_accessibility">Hiljutised dokumendid</string>
<string name="main_home_menu_settings_accessibility">Seaded</string>
<string name="main_home_menu_about_accessibility">Info</string>
<string name="main_home_menu_diagnostics_accessibility">Diagnostika</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<string name="main_home_menu_help_url_short">линк www.id.ee</string>
<string name="main_home_menu_help_url">https://www.id.ee/ru/id-pomoshh/</string>
<string name="main_home_menu_accessibility">ДОСТУПНОСТЬ</string>
<string name="main_home_menu_recent">НЕДАВНИЕ ДОКУМЕНТЫ</string>
<string name="main_home_recent">НЕДАВНИЕ ДОКУМЕНТЫ</string>
<string name="main_home_menu_settings">НАСТРОЙКИ</string>
<string name="main_home_menu_about">ИНФОРМАЦИЯ</string>
<string name="main_home_menu_diagnostics">ДИАГНОСТИКА</string>
Expand Down Expand Up @@ -594,7 +594,7 @@

<!-- Menu -->
<string name="main_home_menu_help_accessibility">Помощь</string>
<string name="main_home_menu_recent_accessibility">Недавние документы</string>
<string name="main_home_recent_accessibility">Недавние документы</string>
<string name="main_home_menu_settings_accessibility">Настройки</string>
<string name="main_home_menu_about_accessibility">Информация</string>
<string name="main_home_menu_diagnostics_accessibility">Диагностика</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<item type="id" name="mainHomeMenuCloseButton" />
<item type="id" name="mainHomeMenuHelp" />
<item type="id" name="mainHomeMenuAccessibility" />
<item type="id" name="mainHomeMenuRecent" />
<item type="id" name="mainHomeMenuSettings" />
<item type="id" name="mainHomeMenuAbout" />
<item type="id" name="mainHomeMenuDiagnostics" />
Expand Down Expand Up @@ -311,6 +310,7 @@

<!-- Crypto Home -->
<item type="id" name="cryptoHomeCreateButton" />
<item type="id" name="cryptoHomeRecentDocumentsButton" />

<!-- Crypto Create -->
<item type="id" name="cryptoCreateScreen" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<string name="main_home_menu_help_url_short">link www.id.ee</string>
<string name="main_home_menu_help_url">https://www.id.ee/en/id-help/</string>
<string name="main_home_menu_accessibility">ACCESSIBILITY</string>
<string name="main_home_menu_recent">RECENT DOCUMENTS</string>
<string name="main_home_recent">RECENT DOCUMENTS</string>
<string name="main_home_menu_settings">SETTINGS</string>
<string name="main_home_menu_about">INFO</string>
<string name="main_home_menu_diagnostics">DIAGNOSTICS</string>
Expand Down Expand Up @@ -589,7 +589,7 @@

<!-- Menu -->
<string name="main_home_menu_help_accessibility">Help</string>
<string name="main_home_menu_recent_accessibility">Recent documents</string>
<string name="main_home_recent_accessibility">Recent documents</string>
<string name="main_home_menu_settings_accessibility">Settings</string>
<string name="main_home_menu_about_accessibility">Info</string>
<string name="main_home_menu_diagnostics_accessibility">Diagnostics</string>
Expand Down

0 comments on commit 3c36bb0

Please sign in to comment.