parent
9cb7bb6bd1
commit
e9cfa9dcab
@ -0,0 +1,90 @@ |
||||
/* |
||||
* Copyright (C) 2017 Anthony Chomienne, anthony@mob-dev.fr |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License |
||||
* as published by the Free Software Foundation; either version 3 |
||||
* of the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
*/ |
||||
|
||||
package fr.mobdev.blooddonation.dialog; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.app.Dialog; |
||||
import android.content.DialogInterface; |
||||
import android.content.Intent; |
||||
import android.net.Uri; |
||||
import android.os.Bundle; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.widget.ImageView; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.appcompat.app.AlertDialog; |
||||
import androidx.fragment.app.DialogFragment; |
||||
import fr.mobdev.blooddonation.Database; |
||||
import fr.mobdev.blooddonation.R; |
||||
|
||||
@SuppressLint("InflateParams") |
||||
public class SupportDialog extends DialogFragment { |
||||
|
||||
public SupportDialog() |
||||
{ |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public Dialog onCreateDialog(Bundle savedInstanceState) { |
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |
||||
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater(); |
||||
View view = inflater.inflate(R.layout.support_dialog, null); |
||||
|
||||
ImageView tipeee = view.findViewById(R.id.tipeee); |
||||
tipeee.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
String url = "https://tipeee.com/schoumi"; |
||||
Intent intent = new Intent(Intent.ACTION_VIEW); |
||||
intent.setData(Uri.parse(url)); |
||||
startActivity(intent); |
||||
} |
||||
}); |
||||
|
||||
ImageView liberapay = view.findViewById(R.id.liberapay); |
||||
liberapay.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
String url = "https://fr.liberapay.com/Schoumi"; |
||||
Intent intent = new Intent(Intent.ACTION_VIEW); |
||||
intent.setData(Uri.parse(url)); |
||||
startActivity(intent); |
||||
} |
||||
}); |
||||
|
||||
builder |
||||
.setTitle(R.string.information) |
||||
.setView(view) |
||||
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { |
||||
public void onClick(DialogInterface dialog, int id) { |
||||
Database.getInstance(getActivity()).setHasShownSupport(); |
||||
} |
||||
}).setOnCancelListener(new DialogInterface.OnCancelListener() { |
||||
@Override |
||||
public void onCancel(DialogInterface dialogInterface) { |
||||
Database.getInstance(getActivity()).setHasShownSupport(); |
||||
} |
||||
}); |
||||
return builder.create(); |
||||
} |
||||
} |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,37 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
<TextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginBottom="15dp" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_marginTop="15dp" |
||||
android:gravity="center_horizontal" |
||||
android:text="@string/initiative" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
<ImageView |
||||
android:id="@+id/tipeee" |
||||
android:src="@drawable/tipeee" |
||||
android:layout_width="match_parent" |
||||
android:layout_gravity="center_horizontal" |
||||
android:layout_height="100dp" /> |
||||
<TextView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginBottom="15dp" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:gravity="center_horizontal" |
||||
android:text="@string/and" |
||||
android:textAppearance="?android:attr/textAppearanceMedium" /> |
||||
<ImageView |
||||
android:id="@+id/liberapay" |
||||
android:src="@drawable/liberapay_logo" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="100dp" /> |
||||
|
||||
|
||||
</LinearLayout> |
Loading…
Reference in new issue