Skip to content

Commit

Permalink
Added supporting this app section
Browse files Browse the repository at this point in the history
  • Loading branch information
albertogeniola committed Jan 23, 2022
1 parent 7e532ce commit 9714be0
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.albertogeniola.merossconf.ui.fragments.support_this_app;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.albertogeniola.merossconf.R;

/**
* A simple {@link Fragment} subclass.
* Use the {@link SupportThisApp#newInstance} factory method to
* create an instance of this fragment.
*/
public class SupportThisApp extends Fragment {

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

public SupportThisApp() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment SupportThisApp.
*/
// TODO: Rename and change types and number of parameters
public static SupportThisApp newInstance(String param1, String param2) {
SupportThisApp fragment = new SupportThisApp();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_support_this_app, container, false);
}
}
Binary file added app/src/main/res/drawable/donate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/hand_heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions app/src/main/res/layout/fragment_support_this_app.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.fragments.support_this_app.SupportThisApp">

<ImageView
android:id="@+id/imageView2"
android:layout_width="192dp"
android:layout_height="166dp"
android:layout_marginTop="24dp"
android:src="@drawable/donate"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView32" />

<TextView
android:id="@+id/textView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/fragment_support_title"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView33"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:text="@string/support_this_app_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView35"
/>

<TextView
android:id="@+id/textView36"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:text="@string/support_this_app_links"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView33" />

<TextView
android:id="@+id/textView35"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/support_this_app_text_intro"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="@+id/textView33"
app:layout_constraintStart_toStartOf="@+id/textView33"
app:layout_constraintTop_toBottomOf="@+id/imageView2" />

<TextView
android:id="@+id/textView39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/support_this_app_github_sponsorhip_link"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="@+id/textView36"
app:layout_constraintTop_toBottomOf="@+id/textView36" />

<TextView
android:id="@+id/textView38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/support_this_app_buy_me_a_coffe_link"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="@+id/textView39"
app:layout_constraintTop_toBottomOf="@+id/textView39" />
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/menu/activity_main_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
android:id="@+id/about_fragment"
android:icon="@drawable/ic_baseline_info_24"
android:title="@string/menu_about" />
<item
android:id="@+id/supporting_this_app"
android:icon="@drawable/hand_heart"
android:title="@string/fragment_support_title" />
</group>
</menu>
5 changes: 5 additions & 0 deletions app/src/main/res/navigation/mobile_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@
android:name="com.albertogeniola.merossconf.ui.fragments.device.DeviceListFragment"
android:label="@string/title_device_list"
tools:layout="@layout/fragment_device_list" />
<fragment
android:id="@+id/supporting_this_app"
android:name="com.albertogeniola.merossconf.ui.fragments.support_this_app.SupportThisApp"
android:label="@string/fragment_support_title"
tools:layout="@layout/fragment_support_this_app" />
</navigation>
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
<string name="account_activity_logged_info">Your account data is represented as follows.</string>

<string name="title_device_list">Devices</string>
<string name="fragment_support_title">Supporting this app</string>
<string name="support_this_app_text_intro">First of all, if you reached this section of the app, it means you care about it, and <b>that\'s great!</b> </string>
<string name="support_this_app_text">This app, as well as almost all the other tools that I developed, is free &amp; opensource. If you feel thankful and would like to support my work, you can do that via in a couple of ways.</string>
<string name="support_this_app_links">Have a look at the following for more info:</string>
<string name="support_this_app_buy_me_a_coffe_link"><a href="https://www.buymeacoffee.com/albertogeniola">BuyMeACoffe program</a></string>
<string name="support_this_app_github_sponsorhip_link"><a href="https://github.com/sponsors/albertogeniola/">GitHub Sponsorship program</a></string>


<string name="manual_setup_info">Use this option to manually set the UserId and Key values manually. Such values are usually provided by the Meross HTTP API broker or by the HA Local Addon. However, you can manually set such values in case you want to pair against third-party brokers: you sure know what you are doing.</string>

Expand Down

0 comments on commit 9714be0

Please sign in to comment.