Skip to content

Commit

Permalink
Add developer and designer information
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Apr 17, 2019
1 parent 2ba1ed3 commit fafbe49
Show file tree
Hide file tree
Showing 10 changed files with 470 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ class AboutActivity : AppCompatActivity(), ActivityLauncher, AndroidViewDslScope
}

binding.cards {
cardOwner {
buttonGithub.onClick(viewModel::openOwnerGithub)
buttonWebsite.onClick(viewModel::openOwnerWebsite)
}
cardDesigner {
buttonGithub.onClick(viewModel::openDesignerGithub)
buttonWebsite.onClick(viewModel::openDesignerWebsite)
}
cardDeveloper {
buttonGithub.onClick(viewModel::openDeveloperGithub)
buttonWebsite.onClick(viewModel::openDeveloperWebsite)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package rocks.poopjournal.metadataremover.viewmodel
import android.app.Application
import android.content.Intent
import androidx.annotation.StringRes
import androidx.core.net.toUri
import androidx.lifecycle.AndroidViewModel
import com.mikepenz.aboutlibraries.LibsBuilder
import rocks.poopjournal.metadataremover.R
Expand Down Expand Up @@ -61,8 +62,7 @@ class AboutViewModel(application: Application) : AndroidViewModel(application),
.getString(addressRes)
val subject = applicationContext
.getString(subjectRes)
val intent = Intent(Intent.ACTION_SENDTO)
intent.putExtra(Intent.EXTRA_EMAIL, arrayOf(address))
val intent = Intent(Intent.ACTION_SENDTO, "mailto:$address".toUri())
intent.putExtra(Intent.EXTRA_SUBJECT, subject)
if (intent.resolveActivity(applicationContext.packageManager) != null) {
startActivity(intent)
Expand Down Expand Up @@ -96,6 +96,14 @@ class AboutViewModel(application: Application) : AndroidViewModel(application),

fun openSupport() = openUrl(R.string.url_about_button_support)

fun openOwnerGithub() = openUrl(R.string.url_button_about_owner_github)

fun openOwnerWebsite() = openUrl(R.string.url_button_about_owner_website)

fun openDesignerGithub() = openUrl(R.string.url_button_about_designer_github)

fun openDesignerWebsite() = openUrl(R.string.url_button_about_designer_website)

fun openDeveloperGithub() = openUrl(R.string.url_button_about_developer_github)

fun openDeveloperWebsite() = openUrl(R.string.url_button_about_developer_website)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 203 additions & 0 deletions app/src/main/res/layout/activity_about_card_designer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ MIT License
~
~ Copyright (c) 2018 Jan Heinrich Reimer
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->
<layout 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"
tools:context=".ui.AboutActivity">

<data>

<import
alias="View"
type="android.view.View" />

</data>

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_start"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_begin="@dimen/baseline_card_inner" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_start_button"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_begin="@dimen/baseline_card_inner_button_horizontal" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_end"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_end="@dimen/baseline_card_inner" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_end_button"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_end="@dimen/baseline_card_inner_button_horizontal" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_top"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_begin="@dimen/baseline_card_inner" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_end="@dimen/baseline_card_inner" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/baseline_bottom_button"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_end="@dimen/baseline_card_inner_button_vertical" />

<Space
android:id="@+id/baseline_information_top"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/baseline_top"
app:layout_constraintBottom_toTopOf="@id/barrier_above_information"
app:layout_constraintStart_toStartOf="@id/barrier_above_information" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_above_information"
android:layout_width="0dp"
android:layout_height="0dp"
app:barrierDirection="top"
app:constraint_referenced_ids="avatar,name,role" />

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatar"
android:layout_width="@dimen/size_avatar"
android:layout_height="@dimen/size_avatar"
android:src="@drawable/art_about_designer_profile_image"
app:layout_constraintBottom_toBottomOf="@id/barrier_below_information"
app:layout_constraintStart_toStartOf="@id/baseline_start"
app:layout_constraintTop_toTopOf="@id/barrier_above_information"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/name"
style="@style/Base.TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/baseline"
android:ellipsize="end"
android:lines="1"
android:text="@string/title_about_designer_name"
app:layout_constraintBottom_toTopOf="@id/role"
app:layout_constraintEnd_toEndOf="@id/baseline_end"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="@id/barrier_above_information"
app:layout_constraintVertical_chainStyle="packed" />

<TextView
android:id="@+id/role"
style="@style/TextAppearance.AppCompat.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/baseline"
android:ellipsize="end"
android:lines="1"
android:text="@string/description_about_designer_role"
android:textAllCaps="true"
android:textColor="?android:textColorSecondary"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintBottom_toBottomOf="@id/barrier_below_information"
app:layout_constraintEnd_toEndOf="@id/baseline_end"
app:layout_constraintStart_toEndOf="@id/avatar"
android:layout_marginTop="@dimen/baseline_typo" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_below_information"
android:layout_width="0dp"
android:layout_height="0dp"
app:barrierDirection="bottom"
app:constraint_referenced_ids="avatar,name,role" />

<Space
android:id="@+id/baseline_buttons_top"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/baseline_card_inner_button_vertical"
app:layout_constraintTop_toBottomOf="@id/barrier_below_information"
app:layout_constraintStart_toStartOf="@id/barrier_below_information" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_github"
style="@style/Widget.App.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:text="@string/title_button_about_designer_github"
app:layout_constraintBottom_toBottomOf="@id/baseline_bottom_button"
app:layout_constraintEnd_toStartOf="@id/button_website"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@id/baseline_start_button"
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_website"
style="@style/Widget.App.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:text="@string/title_button_about_designer_website"
app:layout_constraintBottom_toBottomOf="@id/baseline_bottom_button"
app:layout_constraintStart_toEndOf="@id/button_github"
app:layout_constraintEnd_toStartOf="@id/space_button_end"
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top" />

<Space
android:id="@+id/space_button_end"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@id/button_website"
app:layout_constraintStart_toEndOf="@id/button_website"
app:layout_constraintEnd_toEndOf="@id/baseline_end_button" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.cardview.widget.CardView>

</layout>
12 changes: 4 additions & 8 deletions app/src/main/res/layout/activity_about_card_developer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@
app:layout_constraintEnd_toEndOf="@id/baseline_end"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="@id/barrier_above_information"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@tools:sample/full_names" />
app:layout_constraintVertical_chainStyle="packed" />

<TextView
android:id="@+id/role"
Expand All @@ -147,8 +146,7 @@
app:layout_constraintBottom_toBottomOf="@id/barrier_below_information"
app:layout_constraintEnd_toEndOf="@id/baseline_end"
app:layout_constraintStart_toEndOf="@id/avatar"
android:layout_marginTop="@dimen/baseline_typo"
tools:text="@tools:sample/full_names" />
android:layout_marginTop="@dimen/baseline_typo" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_below_information"
Expand Down Expand Up @@ -176,8 +174,7 @@
app:layout_constraintEnd_toStartOf="@id/button_website"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@id/baseline_start_button"
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top"
tools:text="@tools:sample/lorem" />
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_website"
Expand All @@ -189,8 +186,7 @@
app:layout_constraintBottom_toBottomOf="@id/baseline_bottom_button"
app:layout_constraintStart_toEndOf="@id/button_github"
app:layout_constraintEnd_toStartOf="@id/space_button_end"
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top"
tools:text="@tools:sample/lorem" />
app:layout_constraintTop_toBottomOf="@id/baseline_buttons_top" />

<Space
android:id="@+id/space_button_end"
Expand Down
Loading

0 comments on commit fafbe49

Please sign in to comment.