Better qr code resizing

This commit is contained in:
Dominik Schürmann 2015-02-27 22:26:11 +01:00
parent 2cd7be6373
commit 54e04f496e
6 changed files with 48 additions and 5 deletions

View File

@ -106,9 +106,9 @@
android:name=".ui.EditKeyActivity" android:name=".ui.EditKeyActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_edit_key" /> android:label="@string/title_edit_key" />
<!-- NOTE: Dont use configChanges for QR Code view! We use a different layout for landscape -->
<activity <activity
android:name=".ui.QrCodeViewActivity" android:name=".ui.QrCodeViewActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/share_qr_code_dialog_title" /> android:label="@string/share_qr_code_dialog_title" />
<activity <activity
android:name=".ui.ViewKeyActivity" android:name=".ui.ViewKeyActivity"

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar_include"
layout="@layout/toolbar_standalone" />
<LinearLayout
android:layout_below="@id/toolbar_include"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/qr_code_image_layout"
android:transitionName="qr_code"
android:layout_gravity="center_horizontal"
android:layout_margin="32dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
app:cardBackgroundColor="@android:color/white"
app:cardUseCompatPadding="true"
app:cardCornerRadius="4dp">
<org.sufficientlysecure.keychain.ui.widget.AspectRatioImageView
android:id="@+id/qr_code_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:dominantMeasurement="height"
app:aspectRatioEnabled="true" />
</android.support.v7.widget.CardView>
</LinearLayout>
</RelativeLayout>

View File

@ -12,11 +12,12 @@
android:layout_below="@id/toolbar_include" android:layout_below="@id/toolbar_include"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="horizontal">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/qr_code_image_layout" android:id="@+id/qr_code_image_layout"
android:transitionName="qr_code" android:transitionName="qr_code"
android:layout_gravity="center_vertical"
android:layout_margin="32dp" android:layout_margin="32dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -30,6 +31,7 @@
android:id="@+id/qr_code_image" android:id="@+id/qr_code_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:dominantMeasurement="width"
app:aspectRatioEnabled="true" /> app:aspectRatioEnabled="true" />
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>

View File

@ -134,6 +134,7 @@
android:clickable="true" android:clickable="true"
android:foreground="?android:attr/selectableItemBackground" android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="@android:color/white"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp"> card_view:cardCornerRadius="4dp">

View File

@ -68,11 +68,11 @@
android:layout_height="1dip" android:layout_height="1dip"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/view_key_qr_code_layout" android:id="@+id/view_key_qr_code_layout"
android:transitionName="qr_code" android:transitionName="qr_code"
android:visibility="visible" android:visibility="visible"
android:layout_marginTop="16dp"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="200dp" android:layout_height="200dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -81,6 +81,7 @@
android:foreground="?android:attr/selectableItemBackground" android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="@android:color/white"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp"> card_view:cardCornerRadius="4dp">
<ImageView <ImageView
@ -93,7 +94,7 @@
style="@style/SectionHeader" style="@style/SectionHeader"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="14dp" android:layout_marginTop="16dp"
android:text="@string/section_share_key" android:text="@string/section_share_key"
android:layout_weight="1" /> android:layout_weight="1" />

View File

@ -18,7 +18,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="@android:color/white"
card_view:cardElevation="2sp" card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp"> card_view:cardCornerRadius="4dp">