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;
|
2020-07-07 19:15:01 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.fragment.app.Fragment;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.R;
|
2020-09-26 07:54:31 +02:00
|
|
|
import org.mian.gitnex.databinding.FragmentAboutBinding;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Author M M Arif
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class AboutFragment extends Fragment {
|
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
@Override
|
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
FragmentAboutBinding viewBinding = FragmentAboutBinding.inflate(inflater, container, false);
|
2019-06-03 23:25:05 +02:00
|
|
|
TinyDB tinyDb = new TinyDB(getContext());
|
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
viewBinding.appVersion.setText(AppUtil.getAppVersion(requireContext()));
|
|
|
|
viewBinding.userServerVersion.setText(tinyDb.getString("giteaVersion"));
|
|
|
|
viewBinding.appBuild.setText(String.valueOf(AppUtil.getAppBuildNo(requireContext())));
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
viewBinding.donationLinkLiberapay.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-09-26 07:54:31 +02:00
|
|
|
viewBinding.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-09-26 07:54:31 +02:00
|
|
|
viewBinding.translateLink.setOnClickListener(v13 -> {
|
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.crowdInLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
viewBinding.appWebsite.setOnClickListener(v14 -> {
|
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.appWebsiteLink)));
|
|
|
|
startActivity(intent);
|
2019-06-03 23:25:05 +02:00
|
|
|
});
|
|
|
|
|
2020-09-26 17:05:51 +02:00
|
|
|
if(AppUtil.isPro(requireContext())) {
|
|
|
|
|
|
|
|
viewBinding.supportHeader.setVisibility(View.GONE);
|
|
|
|
viewBinding.dividerSupport.setVisibility(View.GONE);
|
|
|
|
viewBinding.donationLinkLiberapay.setVisibility(View.GONE);
|
|
|
|
viewBinding.donationLinkPatreon.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
2020-09-26 07:54:31 +02:00
|
|
|
return viewBinding.getRoot();
|
2019-06-03 23:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|