Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Benojir committed Sep 2, 2024
1 parent 0a1ec7f commit ef69e5b
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies {
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.activity:activity:1.9.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
android:theme="@style/Base.Theme.Fogplix"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name=".activities.DonateActivity"
android:exported="false" />
<activity
android:name=".activities.SettingsActivity"
android:exported="false"
Expand Down
81 changes: 81 additions & 0 deletions app/src/main/java/com/fogplix/anime/activities/DonateActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package com.fogplix.anime.activities;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.widget.NestedScrollView;

import com.fogplix.anime.R;
import com.fogplix.anime.databinding.ActivityDonateBinding;
import com.fogplix.anime.databinding.OwnToolbarBinding;

public class DonateActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityDonateBinding binding = ActivityDonateBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

OwnToolbarBinding ownToolbarBinding = binding.ownToolbar;
ownToolbarBinding.ownToolbarTV.setVisibility(View.VISIBLE);
ownToolbarBinding.imageViewMiddle.setVisibility(View.GONE);
ownToolbarBinding.navbarRightBtn.setVisibility(View.GONE);

String donateUs = "Donate Us";
ownToolbarBinding.ownToolbarTV.setText(donateUs);
ownToolbarBinding.navbarLeftBtn.setOnClickListener(view -> onBackPressed());

binding.nestedScrollView.postDelayed(() -> {
binding.nestedScrollView.fullScroll(NestedScrollView.FOCUS_DOWN);
// Delay for 1 second then scroll back to the top
new Handler().postDelayed(() -> binding.nestedScrollView.fullScroll(NestedScrollView.FOCUS_UP), 1000); // 1000 milliseconds = 1 second
}, 1000); // Delay to ensure the layout is complete

binding.sendViaBMAC.setOnClickListener(v -> new AlertDialog.Builder(DonateActivity.this)
.setTitle("Donate Us \uD83E\uDD7A")
.setMessage("Thank you for your support. We need your help to continue our project.")
.setIcon(AppCompatResources.getDrawable(this, R.drawable.donate_icon))
.setPositiveButton("Continue", (dialog, which) -> {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.bmc_donation_link))));
dialog.dismiss();
})
.setNegativeButton("Cancel", (dialog, which) -> {
Toast.makeText(this, "We need your help.", Toast.LENGTH_SHORT).show();
dialog.dismiss();
})
.create()
.show());

binding.sendViaUPI.setOnClickListener(v -> new AlertDialog.Builder(DonateActivity.this)
.setTitle("Donate Us \uD83E\uDD7A")
.setMessage("Thank you for your support. We need your help to continue our project.\n" +
"You can give us a very small donation through UPI.\n" +
"Our UPI Id: nura57764@axl")
.setIcon(AppCompatResources.getDrawable(this, R.drawable.donate_icon))
.setPositiveButton("Copy UPI", (dialog, which) -> {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", "nura57764@axl");
if (clipboard != null) {
clipboard.setPrimaryClip(clip);
}
dialog.dismiss();
})
.setNegativeButton("Cancel", (dialog, which) -> {
Toast.makeText(this, "We need your help.", Toast.LENGTH_SHORT).show();
dialog.dismiss();
})
.create()
.show());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ protected void onCreate(Bundle savedInstanceState) {

CustomMethods.checkForUpdateOnStartApp(this);
CustomMethods.checkNewNotice(this, importantNoticeTV);
CustomMethods.checkPlayableServersStatus(this);

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

Expand Down Expand Up @@ -178,6 +177,8 @@ private void navigationViewItemClickedActions(NavigationView navigationView) {
drawerLayout.closeDrawer(GravityCompat.START);
}
}, 500);
} else if (item.getItemId() == R.id.donate_action) {
startActivity(new Intent(MainActivity.this, DonateActivity.class));
} else if (item.getItemId() == R.id.report_bug_action) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.official_telegram_group))));
} else if (item.getItemId() == R.id.share_action) {
Expand Down
Binary file added app/src/main/res/drawable/buy_me_coffee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ef69e5b

Please sign in to comment.