QR codes for profiles

This commit is contained in:
Grishka
2024-02-22 21:35:46 +03:00
parent b1e999cc9c
commit 5cf222379a
46 changed files with 2086 additions and 6 deletions

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@android:color/white"
android:pathData="M5.5,16Q4.875,16 4.438,15.562Q4,15.125 4,14.5V13H5.5V14.5Q5.5,14.5 5.5,14.5Q5.5,14.5 5.5,14.5H14.5Q14.5,14.5 14.5,14.5Q14.5,14.5 14.5,14.5V13H16V14.5Q16,15.125 15.562,15.562Q15.125,16 14.5,16ZM10,13 L6,9 7.062,7.938 9.25,10.125V3H10.75V10.125L12.938,7.938L14,9Z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="@android:color/white"
android:pathData="M2.5,9.125V2.5H9.125V9.125ZM4.25,7.375H7.375V4.25H4.25ZM2.5,17.5V10.875H9.125V17.5ZM4.25,15.75H7.417V12.625H4.25ZM10.875,9.125V2.5H17.5V9.125ZM12.625,7.375H15.75V4.25H12.625ZM15.854,17.5V15.833H17.5V17.5ZM10.875,12.521V10.875H12.542V12.521ZM12.542,14.167V12.521H14.208V14.167ZM10.875,15.833V14.167H12.542V15.833ZM12.542,17.5V15.833H14.208V17.5ZM14.208,15.833V14.167H15.854V15.833ZM14.208,12.521V10.875H15.854V12.521ZM15.854,14.167V12.521H17.5V14.167Z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M2,7V2H7V4H4V7ZM2,22V17H4V20H7V22ZM17,22V20H20V17H22V22ZM20,7V4H17V2H22V7ZM17.5,17.5H19V19H17.5ZM17.5,14.5H19V16H17.5ZM16,16H17.5V17.5H16ZM14.5,17.5H16V19H14.5ZM13,16H14.5V17.5H13ZM16,13H17.5V14.5H16ZM14.5,14.5H16V16H14.5ZM13,13H14.5V14.5H13ZM19,5V11H13V5ZM11,13V19H5V13ZM11,5V11H5V5ZM9.5,17.5V14.5H6.5V17.5ZM9.5,9.5V6.5H6.5V9.5ZM17.5,9.5V6.5H14.5V9.5Z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="24dp"/>
<solid android:color="#000"/>
</shape>

View File

@@ -24,6 +24,7 @@
android:orientation="vertical">
<RelativeLayout
android:id="@+id/profile_header"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -291,8 +292,9 @@
<FrameLayout
android:id="@+id/profile_action_btn_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<org.joinmastodon.android.ui.views.ProgressBarButton
android:id="@+id/profile_action_btn"
@@ -314,6 +316,20 @@
android:outlineProvider="none"
android:visibility="gone" />
</FrameLayout>
<ImageButton
android:id="@+id/qr_code"
android:layout_width="36.67dp"
android:layout_height="36.67dp"
android:layout_gravity="center_vertical"
style="@style/Widget.Mastodon.M3.Button.Outlined"
android:tint="?colorM3OnSurfaceVariant"
android:layout_marginStart="8dp"
android:layout_marginEnd="1.67dp"
android:contentDescription="@string/qr_code"
android:scaleType="centerCrop"
android:padding="9dp"
android:src="@drawable/ic_qr_code_20px"/>
</LinearLayout>

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
<include layout="@layout/profile_qr_toolbar" />
<view class="org.joinmastodon.android.fragments.ProfileQrCodeFragment$CustomizedLinearLayout"
android:id="@+id/particle_animation_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical"
android:orientation="vertical">
<org.joinmastodon.android.ui.views.FixedAspectRatioFrameLayout
android:id="@+id/corner_animation_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:aspectRatio="1">
<LinearLayout
android:id="@+id/code_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="40dp"
android:orientation="vertical"
android:paddingTop="17dp"
android:background="@drawable/rect_24dp"
android:backgroundTint="?colorM3Primary">
<View
android:id="@+id/code"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="12dp"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="16dp"
android:baselineAligned="false"
android:orientation="horizontal">
<me.grishka.appkit.views.RoundedImageView
android:id="@+id/avatar"
android:layout_width="20dp"
android:layout_height="20dp"
app:cornerRadius="10dp"
android:importantForAccessibility="no"/>
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginHorizontal="4dp"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3OnPrimary"
android:alpha="0.7"
tools:text="Gargron"/>
<TextView
android:id="@+id/domain"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:alpha="0.7"
android:textAppearance="@style/m3_label_small"
android:textColor="?colorM3Primary"
android:paddingHorizontal="4dp"
android:background="@drawable/rect_4dp"
android:backgroundTint="?colorM3OnPrimary"
android:gravity="center_vertical"
android:singleLine="true"
android:ellipsize="end"
tools:text="mastodon.social"/>
</LinearLayout>
</LinearLayout>
</org.joinmastodon.android.ui.views.FixedAspectRatioFrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:paddingHorizontal="16dp"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/share_btn"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
style="@style/Widget.Mastodon.M3.Button.Filled">
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:drawableStart="@drawable/ic_share_20px"
style="@style/Widget.Mastodon.M3.Button.Filled"
android:background="@null"
android:padding="0dp"
android:drawablePadding="7dp"
android:drawableTint="?colorM3OnPrimary"
android:clickable="false"
android:focusable="false"
android:text="@string/share_user"/>
</FrameLayout>
<Button
android:id="@+id/save_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:drawableStart="@drawable/ic_download_20px"
android:drawablePadding="7dp"
android:drawableTint="?colorM3OnPrimary"
style="@style/Widget.Mastodon.M3.Button.Filled"
android:text="@string/save"/>
</LinearLayout>
</view>
</LinearLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
tools:showIn="@layout/fragment_profile_qr" />

View File

@@ -63,4 +63,9 @@
<declare-styleable name="ProgressBarButton">
<attr name="progressBar" format="reference"/>
</declare-styleable>
<declare-styleable name="RoundedImageView">
<attr name="cornerRadius" format="dimension"/>
<attr name="roundBottomCorners" format="boolean"/>
</declare-styleable>
</resources>

View File

@@ -702,4 +702,6 @@
<string name="what_is_activitypub_title">Whats ActivityPub?</string>
<string name="what_is_activitypub">ActivityPub is like the language Mastodon speaks with other social networks.\n\nIt lets you connect and interact with people not just on Mastodon, but across different social apps too.</string>
<string name="handle_copied">Handle copied to clipboard.</string>
<string name="qr_code">QR code</string>
<string name="scan_qr_code">Scan QR code</string>
</resources>