Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java-sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
android:layout_gravity="center"
android:gravity="center"
android:visibility="gone"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:id="@+id/sdk_error" />

<FrameLayout
Expand Down
2 changes: 1 addition & 1 deletion java-sample/src/main/res/layout/item_dropdown.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:padding="8dp"
android:textSize="16sp"/>
android:textAppearance="?attr/textAppearanceBodyLarge"/>
1 change: 1 addition & 0 deletions kotlin-sample/src/main/res/layout/activity_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="Loading" />

</FrameLayout>
3 changes: 2 additions & 1 deletion kotlin-sample/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="Welcome to the snabble SDK Sample!" />

<Button
Expand All @@ -27,5 +27,6 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="Show payment credentials"/>
</LinearLayout>
4 changes: 2 additions & 2 deletions kotlin-sample/src/main/res/layout/fragment_success.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:layout_gravity="center"
android:text="Custom success screen"
android:textSize="20sp" />
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="Custom success screen" />
</FrameLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -52,7 +52,7 @@
import okhttp3.RequestBody;
import okhttp3.Response;

public class CreditCardInputView extends FrameLayout {
public class CreditCardInputView extends RelativeLayout {
public static final String ARG_PROJECT_ID = "projectId";
public static final String ARG_PAYMENT_TYPE = "paymentType";

Expand All @@ -69,6 +69,7 @@ public class CreditCardInputView extends FrameLayout {
private String projectId;
private Project lastProject;
private TextView threeDHint;
private boolean isLoaded;

public CreditCardInputView(Context context) {
super(context);
Expand Down Expand Up @@ -130,9 +131,36 @@ public void onProgressChanged(WebView view, final int newProgress) {
threeDHint = findViewById(R.id.threed_secure_hint);
threeDHint.setVisibility(View.GONE);

watchForBigSizeChanges();
requestHash();
}

public void watchForBigSizeChanges() {
addOnLayoutChangeListener(new OnLayoutChangeListener() {
int highestHeight = 0;

@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
int height = bottom - top;
highestHeight = Math.max(highestHeight, height);
if (height < highestHeight) {
threeDHint.setVisibility(View.GONE);

// for some reason the WebView bounds do not update itself on layout changes
webView.setLeft(getLeft());
webView.setTop(getTop());
webView.setRight(getRight());
webView.setBottom(getBottom());
} else {
if (isLoaded) {
threeDHint.setVisibility(View.VISIBLE);
}
}
}
});
}

public void load(String projectId, PaymentMethod paymentType) {
this.projectId = projectId;
this.paymentType = paymentType;
Expand Down Expand Up @@ -232,7 +260,12 @@ private void loadForm(HashResponse hashResponse) {
NumberFormat numberFormat = NumberFormat.getCurrencyInstance(project.getCurrencyLocale());
BigDecimal chargeTotal = new BigDecimal(hashResponse.chargeTotal);
threeDHint.setVisibility(View.VISIBLE);
threeDHint.setText(resources.getString(R.string.Snabble_CC_3dsecureHint_retailerWithPrice, numberFormat.format(chargeTotal), companyName));
threeDHint.setText(
resources.getString(R.string.Snabble_CC_3dsecureHint_retailerWithPrice,
numberFormat.format(chargeTotal),
companyName)
);
isLoaded = true;
} catch (IOException e) {
Logger.e(e.getMessage());
threeDHint.setVisibility(View.GONE);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/res/layout/snabble_dialog_bundle_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textSize="15sp"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:layout_marginBottom="16dp"
android:text="@string/Snabble.Scanner.BundleDialog.headline" />

Expand Down
21 changes: 9 additions & 12 deletions ui/src/main/res/layout/snabble_dialog_product_confirmation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:layout_below="@+id/close"
android:layout_centerHorizontal="true"
android:layout_marginBottom="4dp"
android:textSize="14sp"
android:textAppearance="?attr/textAppearanceBodyMedium"
tools:text="Wiha" />

<TextView
Expand All @@ -43,7 +43,7 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center"
android:textSize="16sp"
android:textAppearance="?attr/textAppearanceBodyLarge"
tools:text="Schraubendreher Top G 8,0x1,2" />

<TextView
Expand All @@ -53,7 +53,7 @@
android:layout_below="@+id/name"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textSize="15sp"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:alpha="0.6"
android:layout_marginBottom="4dp"
tools:text="1,29 €" />
Expand All @@ -65,7 +65,7 @@
android:layout_below="@+id/originalPrice"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textSize="20sp"
android:textAppearance="?attr/textAppearanceTitleLarge"
tools:text="2 × 1,00 € = 2,00 €" />

<TextView
Expand All @@ -75,7 +75,7 @@
android:layout_below="@+id/price"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:textSize="12sp"
android:textAppearance="?attr/textAppearanceBodySmall"
tools:text="+ 0,45 € deposit" />

<com.google.android.material.button.MaterialButton
Expand All @@ -86,7 +86,7 @@
android:layout_below="@+id/depositPrice"
android:layout_centerHorizontal="true"
android:layout_marginBottom="-16dp"
android:textSize="14sp"
android:textAppearance="?attr/textAppearanceBodyMedium"
tools:text="Reduzierten Preis eingeben"
tools:textColor="#c40000" />

Expand Down Expand Up @@ -138,7 +138,7 @@
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="number"
android:textSize="16sp"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="1" />

</com.google.android.material.textfield.TextInputLayout>
Expand Down Expand Up @@ -178,7 +178,7 @@
android:layout_marginStart="4dp"
android:layout_toEndOf="@+id/quantity_text_input"
android:layout_toRightOf="@+id/quantity_text_input"
android:textSize="17sp"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:visibility="gone"
tools:text="g" />

Expand All @@ -192,10 +192,7 @@
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:text="@string/Snabble.Scanner.addToCart"
app:autoSizeMaxTextSize="16sp"
app:autoSizeMinTextSize="8sp"
app:autoSizeTextType="uniform" />
android:text="@string/Snabble.Scanner.addToCart" />


<!-- invisible view as a margin, marginBottom does not work on API 16-18 -->
Expand Down
5 changes: 2 additions & 3 deletions ui/src/main/res/layout/snabble_dialog_sepa_legal_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="17sp"
android:textStyle="bold"
android:textAppearance="?attr/textAppearanceTitleMedium"
android:text="@string/Snabble.SEPA.mandate"/>

<ScrollView
Expand All @@ -40,7 +39,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="13sp"
android:textAppearance="?attr/textAppearanceBodySmall"
tools:text="Ich ermächtige Lebensmittelmärkte snabble GmbH, einmalig eine Zahlung von meinem Konto mittels Lastschrift einzuziehen."/>
</ScrollView>
</LinearLayout>
Expand Down
1 change: 1 addition & 0 deletions ui/src/main/res/layout/snabble_fragment_base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="The snabble SDK is not initialized."/>

<FrameLayout
Expand Down
1 change: 1 addition & 0 deletions ui/src/main/res/layout/snabble_fragment_selfscanning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="24dp"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="@string/Snabble.Scanner.Camera.allowAccess"/>

<com.google.android.material.button.MaterialButton
Expand Down
3 changes: 1 addition & 2 deletions ui/src/main/res/layout/snabble_item_bundle_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
android:id="@+id/name"
android:gravity="center"
android:padding="16dp"
android:textSize="17sp"
android:textStyle="bold"
android:textAppearance="?attr/textAppearanceTitleMedium"
tools:text="Coca Cola 1,0 l Mehrweg" />
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,50 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="58dp"
android:background="?android:attr/selectableItemBackground">
android:layout_height="wrap_content">

<ImageView
android:layout_width="42dp"
android:layout_height="match_parent"
android:layout_margin="16dp"
android:id="@+id/icon"
android:layout_centerVertical="true"
android:scaleType="fitCenter"
tools:src="@drawable/snabble_ic_payment_select_sepa"/>
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:scaleType="fitCenter"
tools:src="@drawable/snabble_ic_payment_select_sepa" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/icon"
android:layout_toEndOf="@+id/icon"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/delete"
android:layout_toStartOf="@+id/delete"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="start"
app:autoSizeMinTextSize="10sp"
app:autoSizeMaxTextSize="16sp"
app:autoSizeTextType="uniform"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:id="@+id/text"
tools:text="*********************************1234" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="start"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:id="@+id/valid_to"
tools:text="12/2020" />
</LinearLayout>


<ImageView
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:id="@+id/delete"
android:layout_centerVertical="true"
android:contentDescription="@string/Snabble.Delete"
android:background="?attr/selectableItemBackground"
android:src="@drawable/snabble_ic_delete"
app:tint="?attr/colorOnSurface" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
tools:text="SEPA"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
4 changes: 2 additions & 2 deletions ui/src/main/res/layout/snabble_item_payment_options_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/helper_image"
tools:text="SEPA"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Expand All @@ -40,7 +40,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
tools:text="1"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
4 changes: 2 additions & 2 deletions ui/src/main/res/layout/snabble_item_payment_select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/name"
android:textSize="14sp"
android:textAppearance="?attr/textAppearanceBodyMedium"
tools:text="SEPA-Lastschrift"
tools:visibility="visible" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/id"
android:textSize="12sp"
android:textAppearance="?attr/textAppearanceBodySmall"
android:enabled="false"
tools:text="*****************1234"
tools:visibility="visible" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
android:paddingTop="12dp"
android:paddingBottom="16dp"
android:gravity="center"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textAppearance="?attr/textAppearanceBodyLarge"
android:text="@string/Snabble.Shoppingcart.howToPay" />
Loading