|
3 | 3 | import android.content.Intent; |
4 | 4 | import android.net.Uri; |
5 | 5 | import android.os.Bundle; |
| 6 | +import android.view.ContextThemeWrapper; |
| 7 | +import android.widget.LinearLayout; |
6 | 8 |
|
7 | 9 | import androidx.annotation.Nullable; |
8 | 10 |
|
| 11 | +import com.google.android.material.button.MaterialButton; |
| 12 | +import com.wmods.wppenhacer.R; |
9 | 13 | import com.wmods.wppenhacer.activities.base.BaseActivity; |
10 | 14 | import com.wmods.wppenhacer.databinding.ActivityAboutBinding; |
11 | 15 |
|
12 | 16 | public class AboutActivity extends BaseActivity { |
13 | 17 |
|
| 18 | + private static final String[][] CONTRIBUTORS = { |
| 19 | + {"Dev4Mod", "https://github.com/Dev4Mod"}, |
| 20 | + {"frknkrc44", "https://github.com/frknkrc44"}, |
| 21 | + {"mubashardev", "https://github.com/mubashardev"}, |
| 22 | + {"masbentoooredoo", "https://github.com/masbentoooredoo"}, |
| 23 | + {"zhongerxll", "https://github.com/zhongerxll"}, |
| 24 | + {"BryanGIG", "https://github.com/BryanGIG"}, |
| 25 | + {"rizqi-developer", "https://github.com/rizqi-developer"}, |
| 26 | + {"pedroborraz", "https://github.com/pedroborraz"}, |
| 27 | + {"ahmedtohamy1", "https://github.com/ahmedtohamy1"}, |
| 28 | + {"mohdafix", "https://github.com/mohdafix"}, |
| 29 | + {"maulana-kurniawan", "https://github.com/maulana-kurniawan"}, |
| 30 | + {"erzachn", "https://github.com/erzachn"}, |
| 31 | + {"cvnertnc", "https://github.com/cvnertnc"}, |
| 32 | + {"rkorossy", "https://github.com/rkorossy"}, |
| 33 | + {"StupidRepo", "https://github.com/StupidRepo"}, |
| 34 | + {"Blank517", "https://github.com/Blank517"}, |
| 35 | + {"astola-studio", "https://github.com/astola-studio"}, |
| 36 | + {"Strange-IPmart", "https://github.com/Strange-IPmart"} |
| 37 | + }; |
| 38 | + |
14 | 39 |
|
15 | 40 | @Override |
16 | 41 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
17 | 42 | super.onCreate(savedInstanceState); |
18 | | - com.wmods.wppenhacer.databinding.ActivityAboutBinding binding = ActivityAboutBinding.inflate(getLayoutInflater()); |
| 43 | + ActivityAboutBinding binding = ActivityAboutBinding.inflate(getLayoutInflater()); |
19 | 44 | setContentView(binding.getRoot()); |
20 | 45 |
|
21 | | - binding.btnTelegram.setOnClickListener(v -> { |
22 | | - Intent intent = new Intent(); |
23 | | - intent.setAction(Intent.ACTION_VIEW); |
24 | | - intent.setData(Uri.parse("https://t.me/waenhancer")); |
25 | | - startActivity(intent); |
26 | | - }); |
27 | | - binding.btnGithub.setOnClickListener(view -> { |
28 | | - Intent intent = new Intent(); |
29 | | - intent.setAction(Intent.ACTION_VIEW); |
30 | | - intent.setData(Uri.parse("https://github.com/Dev4Mod/WaEnhancer")); |
31 | | - startActivity(intent); |
32 | | - }); |
33 | | - binding.btnDonate.setOnClickListener(view -> { |
34 | | - Intent intent = new Intent(); |
35 | | - intent.setAction(Intent.ACTION_VIEW); |
36 | | - intent.setData(Uri.parse("https://coindrop.to/dev4mod")); |
37 | | - startActivity(intent); |
38 | | - }); |
| 46 | + binding.btnTelegram.setOnClickListener(v -> openUrl("https://t.me/waenhancer")); |
| 47 | + binding.btnGithub.setOnClickListener(view -> openUrl("https://github.com/Dev4Mod/WaEnhancer")); |
| 48 | + |
| 49 | + int topMargin = getResources().getDimensionPixelSize(R.dimen.spacing_small); |
| 50 | + for (int i = 0; i < CONTRIBUTORS.length; i++) { |
| 51 | + String[] contributor = CONTRIBUTORS[i]; |
| 52 | + MaterialButton button = new MaterialButton(new ContextThemeWrapper(this, R.style.ModernButton_Outlined)); |
| 53 | + button.setText(contributor[0]); |
| 54 | + button.setIconResource(R.drawable.ic_github); |
| 55 | + button.setIconGravity(MaterialButton.ICON_GRAVITY_TEXT_START); |
| 56 | + button.setIconPadding(getResources().getDimensionPixelSize(R.dimen.spacing_small)); |
| 57 | + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( |
| 58 | + LinearLayout.LayoutParams.MATCH_PARENT, |
| 59 | + LinearLayout.LayoutParams.WRAP_CONTENT |
| 60 | + ); |
| 61 | + if (i > 0) { |
| 62 | + params.topMargin = topMargin; |
| 63 | + } |
| 64 | + button.setLayoutParams(params); |
| 65 | + button.setOnClickListener(v -> openUrl(contributor[1])); |
| 66 | + binding.contributorsContainer.addView(button); |
| 67 | + } |
| 68 | + |
| 69 | + } |
| 70 | + |
| 71 | + private void openUrl(String url) { |
| 72 | + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| 73 | + startActivity(intent); |
39 | 74 |
|
40 | 75 | } |
41 | 76 | } |
0 commit comments