2019-06-03 23:25:05 +02:00
|
|
|
package org.mian.gitnex.fragments;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.TextView;
|
2020-07-07 19:15:01 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.fragment.app.Fragment;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.R;
|
2020-07-07 19:15:01 +02:00
|
|
|
import org.mian.gitnex.helpers.AppUtil;
|
|
|
|
import org.mian.gitnex.helpers.TinyDB;
|
2019-06-03 23:25:05 +02:00
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Author M M Arif
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class AboutFragment extends Fragment {
|
|
|
|
|
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
View v = inflater.inflate(R.layout.fragment_about, container, false);
|
|
|
|
|
|
|
|
TinyDB tinyDb = new TinyDB(getContext());
|
|
|
|
|
|
|
|
final TextView appVerBuild;
|
|
|
|
final TextView donationLink;
|
|
|
|
final TextView donationLinkPatreon;
|
2019-10-04 16:21:24 +02:00
|
|
|
final TextView translateLink;
|
2019-06-03 23:25:05 +02:00
|
|
|
final TextView appWebsite;
|
|
|
|
final TextView appRepo;
|
|
|
|
|
|
|
|
appVerBuild = v.findViewById(R.id.appVerBuild);
|
2019-10-22 17:27:33 +02:00
|
|
|
TextView viewTextGiteaVersion = v.findViewById(R.id.giteaVersion);
|
2019-06-03 23:25:05 +02:00
|
|
|
donationLink = v.findViewById(R.id.donationLink);
|
|
|
|
donationLinkPatreon = v.findViewById(R.id.donationLinkPatreon);
|
2019-10-04 16:21:24 +02:00
|
|
|
translateLink = v.findViewById(R.id.translateLink);
|
2019-06-03 23:25:05 +02:00
|
|
|
appWebsite = v.findViewById(R.id.appWebsite);
|
|
|
|
appRepo = v.findViewById(R.id.appRepo);
|
|
|
|
|
|
|
|
appVerBuild.setText(getString(R.string.appVerBuild, AppUtil.getAppVersion(Objects.requireNonNull(getContext())), AppUtil.getAppBuildNo(getContext())));
|
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
donationLink.setOnClickListener(v1 -> {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
|
intent.setData(Uri.parse(getResources().getString(R.string.supportLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
donationLinkPatreon.setOnClickListener(v12 -> {
|
2019-10-04 16:21:24 +02:00
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
|
intent.setData(Uri.parse(getResources().getString(R.string.supportLinkPatreon)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
translateLink.setOnClickListener(v13 -> {
|
|
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
|
intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
appWebsite.setOnClickListener(v14 -> {
|
|
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
|
intent.setData(Uri.parse(getResources().getString(R.string.appWebsiteLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-08-09 10:23:51 +02:00
|
|
|
appRepo.setOnClickListener(v15 -> {
|
|
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
|
|
intent.setData(Uri.parse(getResources().getString(R.string.appRepoLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2019-10-22 17:27:33 +02:00
|
|
|
String commit = getResources().getString(R.string.commitPage) + tinyDb.getString("giteaVersion");
|
|
|
|
viewTextGiteaVersion.setText(commit);
|
2019-06-03 23:25:05 +02:00
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|