diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d720c32..b9c4872 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -24,8 +24,8 @@ android { applicationId = "com.fun.funnyprank" minSdk = 23 targetSdk = 34 - versionCode = 3 - versionName = "1.0.2" + versionCode = 4 + versionName = "1.0.3" setProperty( "archivesBaseName", "funnyprank_v" + versionName + "(${versionCode})_$timestamp" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c20d363..1dbc84e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,7 +3,15 @@ xmlns:tools="http://schemas.android.com/tools"> - + + + + + + + + + @@ -24,19 +44,15 @@ + + - - - - - - + + - - + android:exported="true" /> \ No newline at end of file diff --git a/app/src/main/assets/privacy.html b/app/src/main/assets/privacy.html new file mode 100644 index 0000000..6af25cd --- /dev/null +++ b/app/src/main/assets/privacy.html @@ -0,0 +1,122 @@ + + + + + + Privacy Policy + + + +

Privacy Policy

+

Date: August 14, 2024

+ +

We provide this Privacy Policy to help you understand how we collect, use, and disclose + information, including what you may provide to us or that we obtain from our products and + services. We treat your privacy very seriously. Your privacy is important to us.

+ +

Information Collection and Use

+

For a better experience, while using our Service, we may require you to provide us with certain + personally identifiable information, such as users' name, address, location, pictures, etc. The + information that we request will be retained on your device and is not collected or retained by + us in any way and used as described in this privacy policy.

+

The app does use third-party services that may collect information used to identify you.

+

Please refer to the privacy policy of the third-party service provider used by the + application:

+
    +
  • Google Play Services
  • +
  • Google Analytics for Firebase
  • +
  • Firebase Crashlytics
  • +
  • Unity
  • +
  • AppLovin
  • +
  • Pangle
  • +
  • Mintegral
  • +
  • Bigo
  • +
  • Ironsource
  • +
  • Vungle
  • +
+ +

Log Data

+

We want to inform you that whenever you use our Service, in case of an error in the app, we + collect data and information (through third-party products) on your phone called Log Data. This + Log Data may include information such as your device Internet Protocol (“IP”) address, device + name, operating system version, the configuration of the app when utilizing our Service, the + time and date of your use of the Service, and other statistics.

+ +

Cookies

+

Cookies are files with a small amount of data that are commonly used as anonymous unique + identifiers. These are sent to your browser from the websites that you visit and are stored on + your device's internal memory.

+

This Service does not use these “cookies” explicitly. However, the app may use third-party code + and libraries that use “cookies” to collect information and improve their services. You have the + option to either accept or refuse these cookies and know when a cookie is being sent to your + device. If you choose to refuse our cookies, you may not be able to use some portions of this + Service.

+ +

Service Providers

+

We may employ third-party companies and individuals due to the following reasons:

+
    +
  • To facilitate our Service
  • +
  • To provide the Service on our behalf
  • +
  • To perform Service-related services
  • +
  • To assist us in analyzing how our Service is used
  • +
+

We want to inform users of this Service that these third parties have access to their Personal + Information. The reason is to perform the tasks assigned to them on our behalf. However, they + are obligated not to disclose or use the information for any other purpose.

+ +

Security

+

We value your trust in providing us your Personal Information, thus we are striving to use + commercially acceptable means of protecting it. But remember that no method of transmission over + the internet, or method of electronic storage is 100% secure and reliable, and we cannot + guarantee its absolute security.

+ +

Links to Other Sites

+

This Service may contain links to other sites. If you click on a third-party link, you will be + directed to that site. Note that these external sites are not operated by us. Therefore, we + strongly advise you to review the Privacy Policy of these websites. We have no control over and + assume no responsibility for the content, privacy policies, or practices of any third-party + sites or services.

+ +

Children’s Privacy

+

These Services do not address anyone under the age of 13. We do not knowingly collect personally + identifiable information from children under 13 years of age. In the case we discover that a + child under 13 has provided us with personal information, we will immediately delete this from + our servers. If you are a parent or guardian and you are aware that your child has provided us + with personal information, please contact us so that we will be able to take the necessary + actions.

+ +

Changes to This Privacy Policy

+

We may update our Privacy Policy from time to time. Thus, you are advised to review this page + periodically for any changes. We will notify you of any changes by posting the new Privacy + Policy on this page.

+ +

Privacy Questions

+

We may update the Privacy Policy from time to time. When we change the policy in a material way, + a notice will be posted on our website along with the updated Privacy Policy.

+

If you have any questions or concerns about our Privacy Policy or data processing, please contact + us: alokamalinga207.

+ + diff --git a/app/src/main/java/com/fun/funnyprank/FunnyPrankSkin.java b/app/src/main/java/com/fun/funnyprank/FunnyPrankSkin.java index 0676f58..0ba1ca4 100644 --- a/app/src/main/java/com/fun/funnyprank/FunnyPrankSkin.java +++ b/app/src/main/java/com/fun/funnyprank/FunnyPrankSkin.java @@ -34,6 +34,7 @@ public class FunnyPrankSkin extends Application { public static final String AD_BROADCAST = "on_success_action"; private static final String MAX_SDK = "6GTFERcq2m3KHo37uityeCg0kfcqx3iT31OJG_a5weBmXsslFg5NuR8mlBXEqZ3ExDdXIl16PTMg0442tdRaJs"; public static Boolean initSDK = false; + private static List mydataList = new ArrayList<>(); @Override public void onCreate() { @@ -59,6 +60,30 @@ public class FunnyPrankSkin extends Application { } }); } + + + initCreate(); + } + + private void initCreate() { + Mytools.runIO(new Runnable() { + @Override + public void run() { + List allData = MydataBase.getInstance().likeDao().getAll(); + mydataList.clear(); + int[] indices = {0, 456, 111, 333, 222, 555, 444, 345, 234}; + + for (int index : indices) { + if (index < allData.size()) { + LikeData data = allData.get(index); + data.setIsrank(true); + MydataBase.getInstance().likeDao().update(data); + mydataList.add(data); + } + } + + } + }); } private void initSDk() { diff --git a/app/src/main/java/com/fun/funnyprank/activity/MainActivity.java b/app/src/main/java/com/fun/funnyprank/activity/MainActivity.java index a4c287c..db72aee 100644 --- a/app/src/main/java/com/fun/funnyprank/activity/MainActivity.java +++ b/app/src/main/java/com/fun/funnyprank/activity/MainActivity.java @@ -18,6 +18,7 @@ import com.google.android.material.tabs.TabLayout; public class MainActivity extends AppCompatActivity { ActivityMainBinding binding; + @SuppressLint("MissingInflatedId") @Override protected void onCreate(Bundle savedInstanceState) { @@ -33,11 +34,12 @@ public class MainActivity extends AppCompatActivity { }); initView(); - setmainTabIcons(binding.mainTabLayout); +// setmainTabIcons(binding.mainTabLayout); + setTabIcons(0); } private void initView() { - PageAdapter pageAdapter =new PageAdapter(getSupportFragmentManager()); + PageAdapter pageAdapter = new PageAdapter(getSupportFragmentManager()); binding.mainViewpager.setAdapter(pageAdapter); binding.mainTabLayout.setupWithViewPager(binding.mainViewpager); binding.mainViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @@ -58,6 +60,7 @@ public class MainActivity extends AppCompatActivity { }); } + private void setTabIcons(final int position) { for (int i = 0; i < binding.mainTabLayout.getTabCount(); i++) { final TabLayout.Tab tab = binding.mainTabLayout.getTabAt(i); @@ -67,7 +70,13 @@ public class MainActivity extends AppCompatActivity { tab.setIcon(position == 0 ? R.drawable.main_check : R.drawable.main_uncheck); break; case 1: - tab.setIcon(position == 0 ? R.drawable.like_uncheck : R.drawable.like_check); + tab.setIcon(position == 1 ? R.drawable.custom_check : R.drawable.custom_uncheck); + break; + case 2: + tab.setIcon(position == 2 ? R.drawable.rank_check : R.drawable.rank_uncheck); + break; + case 3: + tab.setIcon(position == 3 ? R.drawable.like_check : R.drawable.like_uncheck); break; default: break; @@ -75,6 +84,7 @@ public class MainActivity extends AppCompatActivity { } } } + private void setmainTabIcons(TabLayout tabLayout) { for (int i = 0; i < tabLayout.getTabCount(); i++) { TabLayout.Tab tab = tabLayout.getTabAt(i); diff --git a/app/src/main/java/com/fun/funnyprank/activity/PrewActivity.java b/app/src/main/java/com/fun/funnyprank/activity/PrewActivity.java index 9ecc37b..e41743f 100644 --- a/app/src/main/java/com/fun/funnyprank/activity/PrewActivity.java +++ b/app/src/main/java/com/fun/funnyprank/activity/PrewActivity.java @@ -119,22 +119,6 @@ public class PrewActivity extends AppCompatActivity { } } }); - binding.volumeleft.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - int a = binding.seekbar.getProgress(); - - binding.seekbar.setProgress(a - 10); - } - }); - binding.volumeright.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - int a = binding.seekbar.getProgress(); - - binding.seekbar.setProgress(a + 10); - } - }); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { @@ -271,22 +255,27 @@ public class PrewActivity extends AppCompatActivity { binding.preLike.setBackgroundResource(R.drawable.icon_liek_uncheck); } binding.preTitle.setText(data.getTitle()); - Glide.with(PrewActivity.this) - .asBitmap() - .load(data.getPreUrl()) - .placeholder(R.mipmap.icon_logo) - .into(new CustomTarget() { - @Override - public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { - binding.preImage.setImageBitmap(resource); - showmenu(); - } + if (name.equals("custom_url")){ + binding.preImage.setBackgroundResource(R.mipmap.save_image); + }else { + Glide.with(PrewActivity.this) + .asBitmap() + .load(data.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(new CustomTarget() { + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { + binding.preImage.setImageBitmap(resource); + showmenu(); + } - @Override - public void onLoadCleared(@Nullable Drawable placeholder) { + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + + } + }); + } - } - }); } } }); diff --git a/app/src/main/java/com/fun/funnyprank/activity/RecordActivity.java b/app/src/main/java/com/fun/funnyprank/activity/RecordActivity.java new file mode 100644 index 0000000..8b15670 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/activity/RecordActivity.java @@ -0,0 +1,98 @@ +package com.fun.funnyprank.activity; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.os.SystemClock; +import android.view.View; + +import com.fun.funnyprank.R; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.ActivityRecordBinding; +import com.fun.funnyprank.tools.AudioRecorder; + +public class RecordActivity extends AppCompatActivity { + ActivityRecordBinding binding; + private long startTime; + private long elapsedTime; + private Handler handler = new Handler(); + private Runnable runnable; + private boolean isCreate = false; + + private AudioRecorder audioRecorder; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityRecordBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + + audioRecorder = new AudioRecorder(this); + EdgeToEdge.enable(this); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_record), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + binding.recordTime.setText(R.string.time_text); + + initEvent(); + } + + private void initEvent() { + binding.recordBack.setOnClickListener(v -> finish()); + binding.recordPlay.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + createSound(); + } + }); + } + + private void createSound() { + if (!isCreate) { + audioRecorder.startRecording(); + binding.recordPlay.setBackgroundResource(R.drawable.icon_record_pause); + isCreate = true; + runnable = new Runnable() { + @SuppressLint("DefaultLocale") + @Override + public void run() { + long currentTime = SystemClock.elapsedRealtime(); + elapsedTime = currentTime - startTime; + int milliseconds = (int) (elapsedTime % 1000) / 10; + int seconds = (int) (elapsedTime / 1000) % 60; + int minutes = (int) (elapsedTime / (1000 * 60)) % 60; + binding.recordTime.setText(String.format("%d : %02d : %02d", minutes, seconds, milliseconds)); + handler.postDelayed(this, 10); + } + }; + startTime = SystemClock.elapsedRealtime(); + handler.post(runnable); + } else { + audioRecorder.stopRecording(); + binding.recordPlay.setBackgroundResource(R.drawable.icon_record_play); + isCreate = false; + handler.removeCallbacks(runnable); + Intent intent = new Intent(RecordActivity.this, SaveActivity.class); + intent.putExtra(StaticValue.KEY_Time, elapsedTime); + intent.putExtra(StaticValue.KEY_Path, audioRecorder.getTempFileName()); + intent.putExtra(StaticValue.KEY_import, 1); + startActivity(intent); + finish(); + } + } + + @Override + protected void onDestroy() { + super.onDestroy(); + handler.removeCallbacks(runnable); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/activity/SaveActivity.java b/app/src/main/java/com/fun/funnyprank/activity/SaveActivity.java new file mode 100644 index 0000000..7c1d3d2 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/activity/SaveActivity.java @@ -0,0 +1,212 @@ +package com.fun.funnyprank.activity; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +import android.annotation.SuppressLint; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.media.AudioAttributes; +import android.media.MediaPlayer; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.SystemClock; +import android.text.TextUtils; +import android.util.Log; +import android.widget.Toast; + +import com.fun.funnyprank.R; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.MydataBase; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.ActivitySaveBinding; +import com.fun.funnyprank.tools.Mytools; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +public class SaveActivity extends AppCompatActivity { + private ActivitySaveBinding binding; + private String path; + private boolean isPlayerActive = false; + private MediaPlayer mediaPlayer; + private Handler handler = new Handler(); + private Runnable timeUpdater; + private long startTime; + private long elapsedTime; + private long audioDuration; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivitySaveBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + + EdgeToEdge.enable(this); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_save), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + + + binding.saveTime.setText(R.string.time_text); + initData(); + initEvent(); + + + } + + private void togglePrank() throws IOException { + if (!isPlayerActive) { + startPrank(); + } else { + stopPrank(); + } + } + + private void stopPrank() { + isPlayerActive = false; + handler.removeCallbacks(timeUpdater); + binding.savePlay.setBackgroundResource(R.drawable.icon_play); + if (mediaPlayer != null) { + mediaPlayer.release(); + mediaPlayer = null; + } + } + + private void startPrank() throws IOException { + isPlayerActive = true; + binding.savePlay.setBackgroundResource(R.drawable.icon_pause); + mediaPlayer = new MediaPlayer(); + mediaPlayer.setAudioAttributes( + new AudioAttributes.Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) + .setUsage(AudioAttributes.USAGE_MEDIA) + .build()); + mediaPlayer.setDataSource(path); + mediaPlayer.setOnPreparedListener(mp -> { + mediaPlayer.start(); + startTimer(); + }); + mediaPlayer.setOnCompletionListener(mp -> { + handler.removeCallbacks(timeUpdater); + binding.savePlay.setBackgroundResource(R.drawable.icon_play); + isPlayerActive = false; + }); + mediaPlayer.prepareAsync(); + } + + private void startTimer() { + timeUpdater = new Runnable() { + @SuppressLint("DefaultLocale") + @Override + public void run() { + long currentTime = SystemClock.elapsedRealtime(); + elapsedTime = currentTime - startTime; + int milliseconds = (int) (elapsedTime % 1000) / 10; + int seconds = (int) (elapsedTime / 1000) % 60; + int minutes = (int) (elapsedTime / (1000 * 60)) % 60; + binding.saveTime.setText(String.format("%d : %02d : %02d", minutes, seconds, milliseconds)); + handler.postDelayed(this, 10); + } + }; + startTime = SystemClock.elapsedRealtime(); + handler.post(timeUpdater); + } + + private void initEvent() { + binding.saveBack.setOnClickListener(v -> finish()); + binding.savePlay.setOnClickListener(v -> { + try { + togglePrank(); + } catch (IOException e) { + Log.e("SaveActivity", "Error toggling prank", e); + } + }); + binding.save.setOnClickListener(v -> { + String name = binding.saveEdit.getText().toString().trim(); + if (!TextUtils.isEmpty(name)) { + saveData(name); + Toast.makeText(SaveActivity.this, getString(R.string.save_tips), Toast.LENGTH_SHORT).show(); + stopPrank(); + finish(); + } else { + Toast.makeText(SaveActivity.this, getString(R.string.save_tip), Toast.LENGTH_SHORT).show(); + } + }); + } + + private void saveData(String name) { + File cacheDir = getCacheDir(); + File sourceFile = new File(path); + File destinationFile = new File(cacheDir, name + ".mp3"); + + if (sourceFile.renameTo(destinationFile)) { + LikeData mydata = new LikeData(); + mydata.setCategoryname("custom"); + mydata.setLike(false); + mydata.setTitle(name); + mydata.setMp3Url(destinationFile.getAbsolutePath()); + mydata.setPreUrl("custom_url"); + mydata.setCategoryUrl("custom_url"); + mydata.setTime(audioDuration); + + Mytools.runIO(() -> MydataBase.getInstance().likeDao().insertCustom(mydata)); + } else { + Log.e("SaveActivity", "Failed to rename file"); + } + } + + + private String readFileFromUri(Context context, Uri uri) { + ContentResolver contentResolver = context.getContentResolver(); + try (InputStream inputStream = contentResolver.openInputStream(uri); + FileOutputStream outputStream = new FileOutputStream(new File(getCacheDir(), "temp_audio_file.mp3"))) { + + if (inputStream == null) { + Log.e("SaveActivity", "Input stream is null"); + return null; + } + + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + return new File(getCacheDir(), "temp_audio_file.mp3").getAbsolutePath(); + } catch (IOException e) { + Log.e("SaveActivity", "Error reading file from URI", e); + return null; + } + } + + private void initData() { + Intent intent = getIntent(); + audioDuration = intent.getLongExtra(StaticValue.KEY_Time, 0); + int importFlag = intent.getIntExtra(StaticValue.KEY_import, 0); + + if (importFlag == 1) { + path = intent.getStringExtra(StaticValue.KEY_Path); + Log.e("zzj", "save path is" + path); + } else { + String uriPath = intent.getStringExtra(StaticValue.KEY_Path); + Uri uri = Uri.parse(uriPath); + path = readFileFromUri(this, uri); + } + } + + @Override + protected void onStop() { + super.onStop(); + stopPrank(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/activity/SettingActivity.java b/app/src/main/java/com/fun/funnyprank/activity/SettingActivity.java new file mode 100644 index 0000000..6838dfc --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/activity/SettingActivity.java @@ -0,0 +1,69 @@ +package com.fun.funnyprank.activity; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.View; + +import com.fun.funnyprank.R; +import com.fun.funnyprank.databinding.ActivitySettingBinding; + +public class SettingActivity extends AppCompatActivity { + ActivitySettingBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivitySettingBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + EdgeToEdge.enable(this); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_setting), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + + initEvent(); + + } + + private void initEvent() { + binding.privacy.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(SettingActivity.this, WebActivity.class); + startActivity(intent); + } + }); + binding.settingBack.setOnClickListener(v -> finish()); + binding.versionText.setText("1.0.2"); + binding.rate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String url = "https://play.google.com/store/apps/details?id=com.fun.funnyprank"; + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + startActivity(intent); + } + }); + + binding.share.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent share = new Intent(Intent.ACTION_SEND); + share.setType("text/plain"); + share.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name); + String text = getString(R.string.share_title); + text = text + "\n https://play.google.com/store/apps/details?id=" + "com.fun.funnyprank"; + share.putExtra(Intent.EXTRA_TEXT, text); + startActivity(Intent.createChooser(share, "choose one")); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/activity/SplashActivity.java b/app/src/main/java/com/fun/funnyprank/activity/SplashActivity.java index 4112939..156e22a 100644 --- a/app/src/main/java/com/fun/funnyprank/activity/SplashActivity.java +++ b/app/src/main/java/com/fun/funnyprank/activity/SplashActivity.java @@ -22,6 +22,7 @@ import com.applovin.sdk.AppLovinSdk; import com.fun.funnyprank.FunnyPrankSkin; import com.fun.funnyprank.R; import com.fun.funnyprank.tools.Adcallback; +import com.fun.funnyprank.tools.CustomProgressBar; import com.fun.funnyprank.tools.Mytools; import java.util.List; @@ -30,7 +31,8 @@ public class SplashActivity extends AppCompatActivity { private CountDownTimer countDownTimer; private static List adsList; - public static boolean isAlreadyShow = false; + private boolean isAlreadyShow = false; + private float i = 0; @SuppressLint("MissingInflatedId") @Override @@ -44,9 +46,13 @@ public class SplashActivity extends AppCompatActivity { return insets; }); - countDownTimer = new CountDownTimer(11000, 100) { + CustomProgressBar customProgressBar = findViewById(R.id.splash_pg); + + countDownTimer = new CountDownTimer(10100, 100) { @Override public void onTick(long l) { + i++; + customProgressBar.setProgress(i); if (!isAlreadyShow) { showAdOrStartView(false); } @@ -74,8 +80,11 @@ public class SplashActivity extends AppCompatActivity { Mytools.setCallBcak(cachedAd, new Adcallback() { @Override public void onShowFail(MaxAd ad) { - isAlreadyShow = false; - + if (countDownTimer != null) { + countDownTimer.cancel(); + countDownTimer = null; + } + starMainactivity(); } @Override @@ -116,4 +125,13 @@ public class SplashActivity extends AppCompatActivity { startActivity(intent); finish(); } + @Override + protected void onDestroy() { + super.onDestroy(); + if (countDownTimer != null) { + countDownTimer.cancel(); + countDownTimer = null; + } + } + } \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/activity/WebActivity.java b/app/src/main/java/com/fun/funnyprank/activity/WebActivity.java new file mode 100644 index 0000000..8068b16 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/activity/WebActivity.java @@ -0,0 +1,34 @@ +package com.fun.funnyprank.activity; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +import android.os.Bundle; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +import com.fun.funnyprank.R; + +public class WebActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_web); + EdgeToEdge.enable(this); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_web), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + + WebView webView = findViewById(R.id.web); + webView.getSettings().setJavaScriptEnabled(true); + webView.setWebViewClient(new WebViewClient()); + webView.loadUrl("file:///android_asset/privacy.html"); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/adapter/CustomAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/CustomAdapter.java new file mode 100644 index 0000000..060ec27 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/adapter/CustomAdapter.java @@ -0,0 +1,196 @@ +package com.fun.funnyprank.adapter; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.recyclerview.widget.RecyclerView; + + +import com.fun.funnyprank.R; +import com.fun.funnyprank.activity.PrewActivity; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.MydataBase; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.CustomListBinding; +import com.fun.funnyprank.tools.Mytools; + +import java.util.List; + +public class CustomAdapter extends RecyclerView.Adapter { + private Activity mactivity; + private List mlist; + private boolean islike = false; + private boolean show; + + public CustomAdapter(Activity activity) { + mactivity = activity; + + } + + public void SetData(List list) { + mlist = list; + } + + public void showDelete(boolean isShow) { + show = isShow; + notifyDataSetChanged(); + } + + @NonNull + @Override + public CustomVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + CustomListBinding binding = CustomListBinding.inflate(mactivity.getLayoutInflater(), parent, false); + return new CustomVH(binding); + } + + @SuppressLint("DefaultLocale") + @Override + public void onBindViewHolder(@NonNull CustomVH holder, int position) { + LikeData customdata = mlist.get(position); + boolean like = customdata.getLike(); + if (like) { + holder.getLike().setBackgroundResource(R.drawable.icon_liek_check); + } else { + holder.getLike().setBackgroundResource(R.drawable.icon_liek_uncheck); + } + int milliseconds = (int) (customdata.getTime() % 1000) / 10; + int seconds = (int) (customdata.getTime() / 1000) % 60; + int minutes = (int) (customdata.getTime() / (1000 * 60)) % 60; + holder.getTime().setText(String.format("%d : %02d : %02d", minutes, seconds, milliseconds)); + + if (show) { + holder.getDelete().setVisibility(View.VISIBLE); + } else { + holder.getDelete().setVisibility(View.GONE); + } + holder.getDelete().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + new AlertDialog.Builder(mactivity) + .setTitle("Tips") + .setMessage("Are you sure you want to delete" + " " + customdata.getTitle()) + .setPositiveButton("Sure", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Mytools.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().likeDao().deleteCutsom(customdata.id); + } + }); + } + }) + .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }) + .show(); + + } + }); + + holder.getLike().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!islike) { + islike = true; + customdata.setLike(true); + holder.getLike().setBackgroundResource(R.drawable.icon_liek_check); + Mytools.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().likeDao().update(customdata); + } + }); + } else { + islike = false; + customdata.setLike(false); + holder.getLike().setBackgroundResource(R.drawable.icon_liek_uncheck); + Mytools.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().likeDao().update(customdata); + } + }); + } + } + }); + + holder.getImage().setImageResource(R.mipmap.save_image); + if (customdata.getTitle().length() > 3) { + String name = customdata.getTitle().substring(0, 3); + holder.getName().setText(name + "..."); + } else { + holder.getName().setText(customdata.getTitle()); + } + holder.getCustomcons().setBackgroundResource(R.drawable.custom_item_bg); + holder.getImage().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(mactivity, PrewActivity.class); + intent.putExtra(StaticValue.KEY_TITLE, customdata.getTitle()); + mactivity.startActivity(intent); + } + }); + } + + + @Override + public int getItemCount() { + return mlist.size(); + } + + public static class CustomVH extends RecyclerView.ViewHolder { + private ConstraintLayout customcons; + private TextView name, time; + private ImageView image; + private ImageView like; + private ConstraintLayout delete; + + public CustomVH(@NonNull CustomListBinding binding) { + super(binding.getRoot()); + name = binding.customName; + customcons = binding.customCons; + time = binding.customTime; + like = binding.customLike; + image = binding.customImage; + delete = binding.customItemDelete; + + } + + public ConstraintLayout getDelete() { + return delete; + } + + public ConstraintLayout getCustomcons() { + return customcons; + } + + public TextView getName() { + return name; + } + + public TextView getTime() { + return time; + } + + public ImageView getImage() { + return image; + } + + public ImageView getLike() { + return like; + } + } +} diff --git a/app/src/main/java/com/fun/funnyprank/adapter/LikeAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/LikeAdapter.java index 4b0f19f..e8e1620 100644 --- a/app/src/main/java/com/fun/funnyprank/adapter/LikeAdapter.java +++ b/app/src/main/java/com/fun/funnyprank/adapter/LikeAdapter.java @@ -44,10 +44,14 @@ public class LikeAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull LikeAdapter.LikeVH holder, int position) { LikeData likeData = mlist.get(position); - Glide.with(minflater.getContext()) - .load(likeData.getPreUrl()) - .placeholder(R.mipmap.icon_logo) - .into(holder.getImage()); + if (likeData.getPreUrl().equals("custom_url")) { + holder.getImage().setImageResource(R.mipmap.save_image); + } else { + Glide.with(minflater.getContext()) + .load(likeData.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(holder.getImage()); + } holder.getText().setText(likeData.getTitle()); if (position == getItemCount() - 1) { @@ -56,6 +60,7 @@ public class LikeAdapter extends RecyclerView.Adapter { holder.getView().setVisibility(View.GONE); } + Drawable[] randomcolor = { ContextCompat.getDrawable(minflater.getContext(), R.drawable.like_background_1), ContextCompat.getDrawable(minflater.getContext(), R.drawable.like_background_2), diff --git a/app/src/main/java/com/fun/funnyprank/adapter/ListAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/ListAdapter.java index 9c5bb20..97e93e6 100644 --- a/app/src/main/java/com/fun/funnyprank/adapter/ListAdapter.java +++ b/app/src/main/java/com/fun/funnyprank/adapter/ListAdapter.java @@ -30,7 +30,8 @@ public class ListAdapter extends RecyclerView.Adapter { private List otherdataList; private final LayoutInflater mInflater; private int mcolor; - public ListAdapter(Activity activity, List list,int color) { + + public ListAdapter(Activity activity, List list, int color) { mInflater = LayoutInflater.from(activity); otherdataList = list; mcolor = color; @@ -46,10 +47,16 @@ public class ListAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull ListAdapter.PreVH holder, int position) { LikeData otherdata = otherdataList.get(position); - Glide.with(mInflater.getContext()) - .load(otherdata.getPreUrl()) - .placeholder(R.mipmap.icon_logo) - .into(holder.getImageViewThumb()); + + if (otherdata.getPreUrl().equals("custom_url")) { + holder.getImageViewThumb().setImageResource(R.mipmap.save_image); + } else { + Glide.with(mInflater.getContext()) + .load(otherdata.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(holder.getImageViewThumb()); + } + holder.getTextView().setText(otherdata.getTitle()); Drawable backgroundDrawable = ContextCompat.getDrawable(mInflater.getContext(), R.drawable.mainlist_bg); if (backgroundDrawable != null) { @@ -74,7 +81,7 @@ public class ListAdapter extends RecyclerView.Adapter { public class PreVH extends RecyclerView.ViewHolder { PreRvItemBinding binding; private ImageView imageViewThumb; - private ConstraintLayout constraintLayout,listcons; + private ConstraintLayout constraintLayout, listcons; private TextView textView; public TextView getTextView() { diff --git a/app/src/main/java/com/fun/funnyprank/adapter/PageAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/PageAdapter.java index 822ac16..01f0a37 100644 --- a/app/src/main/java/com/fun/funnyprank/adapter/PageAdapter.java +++ b/app/src/main/java/com/fun/funnyprank/adapter/PageAdapter.java @@ -5,8 +5,10 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; +import com.fun.funnyprank.fragment.CustomFragment; import com.fun.funnyprank.fragment.LikeFragment; import com.fun.funnyprank.fragment.MainFragment; +import com.fun.funnyprank.fragment.RankFragment; import java.util.ArrayList; import java.util.List; @@ -17,6 +19,8 @@ public class PageAdapter extends FragmentPagerAdapter { public PageAdapter(@NonNull FragmentManager fm) { super(fm); fragmentList.add(new MainFragment()); + fragmentList.add(new CustomFragment()); + fragmentList.add(new RankFragment()); fragmentList.add(new LikeFragment()); } diff --git a/app/src/main/java/com/fun/funnyprank/adapter/RankAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/RankAdapter.java new file mode 100644 index 0000000..aa401d0 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/adapter/RankAdapter.java @@ -0,0 +1,166 @@ +package com.fun.funnyprank.adapter; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; +import com.fun.funnyprank.R; +import com.fun.funnyprank.activity.PrewActivity; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.MydataBase; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.RankListBinding; +import com.fun.funnyprank.tools.Mytools; + + +import java.util.List; + +public class RankAdapter extends RecyclerView.Adapter { + private Activity mactivity; + private List mlist; + private boolean islike = false; + + public RankAdapter(Activity activity) { + mactivity = activity; + + } + + public void SetData(List list) { + mlist = list; + } + + @NonNull + @Override + public RankVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + RankListBinding binding = RankListBinding.inflate(mactivity.getLayoutInflater(), parent, false); + return new RankVH(binding); + } + + @SuppressLint("DefaultLocale") + @Override + public void onBindViewHolder(@NonNull RankVH holder, int position) { + LikeData customdata = mlist.get(position); + boolean like = customdata.getLike(); + + if (position == getItemCount() - 1) { + holder.getView().setVisibility(View.VISIBLE); + } else { + holder.getView().setVisibility(View.GONE); + } + + if (like) { + holder.getLike().setBackgroundResource(R.drawable.icon_liek_check); + } else { + holder.getLike().setBackgroundResource(R.drawable.icon_liek_uncheck); + } + Glide.with(mactivity.getApplicationContext()) + .load(customdata.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(holder.getImage()); + + holder.getLike().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!islike) { + islike = true; + customdata.setLike(true); + holder.getLike().setBackgroundResource(R.drawable.icon_liek_check); + Mytools.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().likeDao().update(customdata); + } + }); + } else { + islike = false; + customdata.setLike(false); + holder.getLike().setBackgroundResource(R.drawable.icon_liek_uncheck); + Mytools.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().likeDao().update(customdata); + } + }); + } + } + }); + int id = position + 4; + holder.getId().setText(String.valueOf(id)); + if (customdata.getTitle().length() > 10) { + String name = customdata.getTitle().substring(0, 10); + holder.getName().setText(name + "..."); + } else { + holder.getName().setText(customdata.getTitle()); + } + + holder.getRela().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(mactivity, PrewActivity.class); + intent.putExtra(StaticValue.KEY_TITLE, customdata.getTitle()); + mactivity.startActivity(intent); + } + }); + + } + + + @Override + public int getItemCount() { + return mlist.size(); + } + + public static class RankVH extends RecyclerView.ViewHolder { + private TextView id; + private TextView name; + private ImageView image; + private ImageView like; + private RelativeLayout rela; + private View view; + + public View getView() { + return view; + } + + public TextView getId() { + return id; + } + + public TextView getName() { + return name; + } + + public ImageView getImage() { + return image; + } + + public ImageView getLike() { + return like; + } + + public RelativeLayout getRela() { + return rela; + } + + public RankVH(@NonNull RankListBinding binding) { + super(binding.getRoot()); + name = binding.rankItemName; + like = binding.rankItemLike; + image = binding.rankItemImage; + id = binding.rankItemId; + rela = binding.rankItemRelative; + view = binding.rankItemView; + } + + + } +} diff --git a/app/src/main/java/com/fun/funnyprank/adapter/ThumAdapter.java b/app/src/main/java/com/fun/funnyprank/adapter/ThumAdapter.java index 594412a..5de8966 100644 --- a/app/src/main/java/com/fun/funnyprank/adapter/ThumAdapter.java +++ b/app/src/main/java/com/fun/funnyprank/adapter/ThumAdapter.java @@ -30,13 +30,13 @@ import java.util.List; import java.util.Random; public class ThumAdapter extends RecyclerView.Adapter { - private List myDataList; + private List myDataList; private final LayoutInflater mInflater; private int currentIndex = 0; - public ThumAdapter(Activity activity, List list) { + public ThumAdapter(Activity activity, List list) { myDataList = list; mInflater = LayoutInflater.from(activity); } @@ -50,19 +50,25 @@ public class ThumAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull ThumVH holder, int position) { - Mydata myData = myDataList.get(position); + LikeData myData = myDataList.get(position); + if (position == getItemCount() - 1) { holder.getView().setVisibility(View.VISIBLE); - } else if (position == getItemCount()-2){ + } else if (position == getItemCount() - 2) { holder.getView().setVisibility(View.VISIBLE); - }else { + } else { holder.getView().setVisibility(View.GONE); } - Glide.with(mInflater.getContext()) - .load(myData.getCategoryUrl()) - .placeholder(R.mipmap.icon_logo) - .into(holder.getImageViewThumb()); - holder.getTextView().setText(myData.getCategoryName()); + + if (myData.getCategoryUrl().equals("custom_url")) { + holder.getImageViewThumb().setImageResource(R.mipmap.save_image); + } else { + Glide.with(mInflater.getContext()) + .load(myData.getCategoryUrl()) + .placeholder(R.mipmap.icon_logo) + .into(holder.getImageViewThumb()); + } + holder.getTextView().setText(myData.getCategoryname()); int[] randomcolor = { ContextCompat.getColor(mInflater.getContext(), R.color.color_1), @@ -75,16 +81,18 @@ public class ThumAdapter extends RecyclerView.Adapter { ContextCompat.getColor(mInflater.getContext(), R.color.color_8), ContextCompat.getColor(mInflater.getContext(), R.color.color_9), }; + int randomColor = Randomcolor(randomcolor); + int i = position % 9; Drawable backgroundDrawable1 = ContextCompat.getDrawable(mInflater.getContext(), R.drawable.mainlist_bg); if (backgroundDrawable1 != null) { - backgroundDrawable1.setColorFilter(randomColor, PorterDuff.Mode.SRC_ATOP); + backgroundDrawable1.setColorFilter(randomcolor[i], PorterDuff.Mode.SRC_ATOP); holder.getMainlistcons().setBackground(backgroundDrawable1); } holder.getConstraintLayout().setOnClickListener(v -> { Intent intent = new Intent(mInflater.getContext(), ListActivity.class); - intent.putExtra(StaticValue.KEY_CategoryName, myData.getCategoryName()); - intent.putExtra(StaticValue.KEY_Color, randomColor); + intent.putExtra(StaticValue.KEY_CategoryName, myData.getCategoryname()); + intent.putExtra(StaticValue.KEY_Color, randomcolor[i]); mInflater.getContext().startActivity(intent); }); } @@ -109,11 +117,14 @@ public class ThumAdapter extends RecyclerView.Adapter { private ImageView imageViewThumb; private ConstraintLayout constraintLayout, mainlistcons; + public ConstraintLayout getMainlistcons() { return mainlistcons; } + private TextView textView; private View view; + public ThumVH(@NonNull MainRvItemBinding binding) { super(binding.getRoot()); imageViewThumb = binding.mainRvImage; @@ -130,9 +141,11 @@ public class ThumAdapter extends RecyclerView.Adapter { public ImageView getImageViewThumb() { return imageViewThumb; } + public View getView() { return view; } + public TextView getTextView() { return textView; } diff --git a/app/src/main/java/com/fun/funnyprank/data/LikeDAO.java b/app/src/main/java/com/fun/funnyprank/data/LikeDAO.java index 875e2c7..b30e9ac 100644 --- a/app/src/main/java/com/fun/funnyprank/data/LikeDAO.java +++ b/app/src/main/java/com/fun/funnyprank/data/LikeDAO.java @@ -1,5 +1,6 @@ package com.fun.funnyprank.data; +import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Insert; import androidx.room.Query; @@ -17,12 +18,31 @@ public interface LikeDAO { @Query("select * from like_table where title =:title ") List getliketitle(String title); + @Query("select * from like_table where categoryname =:name ") List getlist(String name); @Insert void insertAll(List likeDataList); + @Query("DELETE FROM like_table WHERE id = :id") + void deleteCutsom(int id); + + @Query("select * from like_table where categoryname =:name ") + LiveData> getCustom(String name); + + @Query("select * from like_table where isRank =:isrank ") + LiveData> getRankdata(boolean isrank); + + @Query("SELECT * FROM like_table") + LiveData> livegetAll(); + + @Query("select * from like_table where islike =:islike ") + LiveData> getLikelist(boolean islike); + + @Insert + void insertCustom(LikeData mydata); + @Update void update(LikeData likeData); } diff --git a/app/src/main/java/com/fun/funnyprank/data/LikeData.java b/app/src/main/java/com/fun/funnyprank/data/LikeData.java index 9be7975..f7f6041 100644 --- a/app/src/main/java/com/fun/funnyprank/data/LikeData.java +++ b/app/src/main/java/com/fun/funnyprank/data/LikeData.java @@ -20,6 +20,24 @@ public class LikeData { public Boolean islike ; public String categoryUrl; + public Boolean isrank; + public long time; + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public Boolean getIsrank() { + return isrank; + } + + public void setIsrank(Boolean isrank) { + this.isrank = isrank; + } public String getCategoryUrl() { return categoryUrl; diff --git a/app/src/main/java/com/fun/funnyprank/data/StaticValue.java b/app/src/main/java/com/fun/funnyprank/data/StaticValue.java index 4febcf0..e1dc30f 100644 --- a/app/src/main/java/com/fun/funnyprank/data/StaticValue.java +++ b/app/src/main/java/com/fun/funnyprank/data/StaticValue.java @@ -8,4 +8,7 @@ public class StaticValue { public static String KEY_MP3URL = "key_mp3url"; public static String KEY_PREURL = "KEY_preurl"; public static String KEY_LIKE = "KEY_like"; + public static String KEY_Time = "KEY_time"; + public static String KEY_Path = "KEY_path"; + public static String KEY_import = ""; } diff --git a/app/src/main/java/com/fun/funnyprank/fragment/CustomFragment.java b/app/src/main/java/com/fun/funnyprank/fragment/CustomFragment.java new file mode 100644 index 0000000..dd281b5 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/fragment/CustomFragment.java @@ -0,0 +1,230 @@ +package com.fun.funnyprank.fragment; + +import android.Manifest; +import android.app.Dialog; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.drawable.ColorDrawable; +import android.media.MediaMetadataRetriever; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.Observer; +import androidx.recyclerview.widget.LinearLayoutManager; + +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; + +import com.fun.funnyprank.R; +import com.fun.funnyprank.activity.RecordActivity; +import com.fun.funnyprank.activity.SaveActivity; +import com.fun.funnyprank.adapter.CustomAdapter; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.Mydata; +import com.fun.funnyprank.data.MydataBase; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.FragmentCustomBinding; + +import java.io.IOException; +import java.util.List; + + +public class CustomFragment extends Fragment { + FragmentCustomBinding binding; + private CustomAdapter customAdapter; + private Dialog dialog; + private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200; + private static final int REQUEST_READ_STORAGE_PERMISSION = 500; + private static final int REQUEST_PICK_AUDIO = 300; + private String[] permissions = {Manifest.permission.RECORD_AUDIO}; + private String[] permission = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}; + private boolean show = false; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + binding = FragmentCustomBinding.inflate(getLayoutInflater()); + + initData(); + + initEvent(); + + return binding.getRoot(); + } + + private void initData() { + customAdapter = new CustomAdapter(requireActivity()); + binding.customRv.setLayoutManager(new LinearLayoutManager(requireContext())); + MydataBase.getInstance().likeDao().getCustom("custom").observe(getViewLifecycleOwner(), new Observer>() { + @Override + public void onChanged(List mydata) { + if (!mydata.isEmpty()) { + initView(mydata); + } else { + show = false; + customAdapter.showDelete(false); + binding.customDelete.setVisibility(View.GONE); + binding.addHide.setVisibility(View.VISIBLE); + binding.addTips.setVisibility(View.VISIBLE); + binding.add.setVisibility(View.GONE); + binding.customRv.setVisibility(View.GONE); + } + } + }); + } + + private void initView(List customData) { + binding.customDelete.setVisibility(View.VISIBLE); + binding.addHide.setVisibility(View.GONE); + binding.addTips.setVisibility(View.GONE); + binding.add.setVisibility(View.VISIBLE); + binding.customRv.setVisibility(View.VISIBLE); + customAdapter.SetData(customData); + binding.customRv.setAdapter(customAdapter); + } + + private void initEvent() { + binding.add.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showDialog(); + } + }); + binding.addHide.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showDialog(); + } + }); + binding.customDelete.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + show = !show; + customAdapter.showDelete(show); + } + }); + } + + private void showDialog() { + dialog = new Dialog(requireContext()); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.dialog); + dialog.setCancelable(true); + dialog.getWindow().setGravity(Gravity.BOTTOM); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.MATCH_PARENT; + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + + dialog.findViewById(R.id.dialog_import).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_MEDIA_AUDIO) + != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(requireActivity(), + new String[]{Manifest.permission.READ_MEDIA_AUDIO}, + REQUEST_READ_STORAGE_PERMISSION); + } else { + importAudio(); + } + } else { + if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED || + ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED) { + + ActivityCompat.requestPermissions(requireActivity(), permission, REQUEST_READ_STORAGE_PERMISSION); + } else { + importAudio(); + } + } + + + } + }); + dialog.findViewById(R.id.dialog_record).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.RECORD_AUDIO) + != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(requireActivity(), permissions, REQUEST_RECORD_AUDIO_PERMISSION); + } else { + Intent intent = new Intent(requireContext(), RecordActivity.class); + startActivity(intent); + } + + } + }); + + dialog.show(); + dialog.getWindow().setAttributes(lp); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (requestCode == REQUEST_PICK_AUDIO && resultCode == getActivity().RESULT_OK) { + if (data != null) { + Uri selectedAudioUri = data.getData(); + if (selectedAudioUri != null) { + long duration = getAudioDuration(requireContext(), selectedAudioUri); + Intent intent = new Intent(requireContext(), SaveActivity.class); + intent.putExtra(StaticValue.KEY_Path, selectedAudioUri.toString()); + intent.putExtra(StaticValue.KEY_Time, duration); + startActivity(intent); + } + } + } + } + + private long getAudioDuration(Context context, Uri uri) { + MediaMetadataRetriever retriever = new MediaMetadataRetriever(); + long duration = 0; + + try { + ContentResolver contentResolver = context.getContentResolver(); + retriever.setDataSource(context, uri); + String time = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); + duration = Long.parseLong(time); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + retriever.release(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + return duration; + } + + private void importAudio() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("audio/*"); + startActivityForResult(Intent.createChooser(intent, "Select Audio"), REQUEST_PICK_AUDIO); + } + + @Override + public void onStop() { + super.onStop(); + if (dialog != null) { + dialog.dismiss(); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/fragment/LikeFragment.java b/app/src/main/java/com/fun/funnyprank/fragment/LikeFragment.java index 1c54a8d..26e8f34 100644 --- a/app/src/main/java/com/fun/funnyprank/fragment/LikeFragment.java +++ b/app/src/main/java/com/fun/funnyprank/fragment/LikeFragment.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -26,8 +27,6 @@ import java.util.List; public class LikeFragment extends Fragment { FragmentLikeBinding binding; - private List list = new ArrayList<>(); - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -38,33 +37,22 @@ public class LikeFragment extends Fragment { } private void initData() { - Mytools.runIO(new Runnable() { + MydataBase.getInstance().likeDao().getLikelist(true).observe(getViewLifecycleOwner(), new Observer>() { @Override - public void run() { - list = MydataBase.getInstance().likeDao().getLikedata(true); - requireActivity().runOnUiThread(new Runnable() { - @Override - public void run() { - if (list.isEmpty()) { - binding.likeHintText.setVisibility(View.VISIBLE); - binding.likeHintImage.setVisibility(View.VISIBLE); - binding.likeRv.setVisibility(View.GONE); - } else { - binding.likeRv.setVisibility(View.VISIBLE); - binding.likeHintText.setVisibility(View.GONE); - binding.likeHintImage.setVisibility(View.GONE); - binding.likeRv.setAdapter(new LikeAdapter(requireActivity(), list)); - binding.likeRv.setLayoutManager(new LinearLayoutManager(requireContext())); - } - } - }); + public void onChanged(List mydata) { + if (mydata.isEmpty()) { + binding.likeHintText.setVisibility(View.VISIBLE); + binding.likeHintImage.setVisibility(View.VISIBLE); + binding.likeRv.setVisibility(View.GONE); + } else { + binding.likeRv.setVisibility(View.VISIBLE); + binding.likeHintImage.setVisibility(View.GONE); + binding.likeHintText.setVisibility(View.GONE); + binding.likeRv.setAdapter(new LikeAdapter(requireActivity(), mydata)); + binding.likeRv.setLayoutManager(new LinearLayoutManager(requireContext())); + } } }); } - @Override - public void onResume() { - super.onResume(); - initData(); - } } \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/fragment/MainFragment.java b/app/src/main/java/com/fun/funnyprank/fragment/MainFragment.java index 9c885b4..52cb2bd 100644 --- a/app/src/main/java/com/fun/funnyprank/fragment/MainFragment.java +++ b/app/src/main/java/com/fun/funnyprank/fragment/MainFragment.java @@ -1,32 +1,82 @@ package com.fun.funnyprank.fragment; +import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.lifecycle.Observer; import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.StaggeredGridLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.fun.funnyprank.FunnyPrankSkin; +import com.fun.funnyprank.activity.SettingActivity; import com.fun.funnyprank.adapter.ThumAdapter; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.MydataBase; import com.fun.funnyprank.databinding.FragmentMainBinding; import com.fun.funnyprank.tools.SpaceItem; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + public class MainFragment extends Fragment { FragmentMainBinding bind; + private ThumAdapter thumAdapter; + private SpaceItem spaceItem = new SpaceItem(12, 20, 12); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { bind = FragmentMainBinding.inflate(inflater, container, false); - SpaceItem spaceItem = new SpaceItem(12, 20, 12); - bind.marinRv.setAdapter(new ThumAdapter(requireActivity(), FunnyPrankSkin.getMyDataArrayList())); - bind.marinRv.setLayoutManager(new GridLayoutManager(requireContext(),2)); - bind.marinRv.addItemDecoration(spaceItem); + + initData(); + + bind.mainSetting.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(requireContext(), SettingActivity.class); + startActivity(intent); + } + }); + return bind.getRoot(); } + private void initData() { + MydataBase.getInstance().likeDao().livegetAll().observe(getViewLifecycleOwner(), new Observer>() { + @Override + public void onChanged(List list) { + initView(chekData(list)); + + } + }); + } + + private void initView(List maindata) { + thumAdapter = new ThumAdapter(requireActivity(), maindata); + bind.marinRv.setAdapter(thumAdapter); + bind.marinRv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); + bind.marinRv.addItemDecoration(spaceItem); + } + + private static List chekData(List data) { + + List main = new ArrayList<>(); + Set name = new HashSet<>(); + for (LikeData mydata : data) { + if (!name.contains(mydata.getCategoryname())) { + main.add(mydata); + name.add(mydata.getCategoryname()); + } + } + return main; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/fragment/RankFragment.java b/app/src/main/java/com/fun/funnyprank/fragment/RankFragment.java new file mode 100644 index 0000000..0aa8ed7 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/fragment/RankFragment.java @@ -0,0 +1,124 @@ +package com.fun.funnyprank.fragment; + +import android.content.Intent; +import android.os.Bundle; + +import androidx.fragment.app.Fragment; +import androidx.lifecycle.Observer; +import androidx.recyclerview.widget.LinearLayoutManager; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.bumptech.glide.Glide; +import com.fun.funnyprank.R; +import com.fun.funnyprank.activity.PrewActivity; +import com.fun.funnyprank.adapter.RankAdapter; +import com.fun.funnyprank.data.LikeData; +import com.fun.funnyprank.data.MydataBase; +import com.fun.funnyprank.data.StaticValue; +import com.fun.funnyprank.databinding.FragmentRankBinding; +import com.fun.funnyprank.tools.Mytools; + +import java.util.List; + + +public class RankFragment extends Fragment { + FragmentRankBinding binding; + private RankAdapter rankAdapter; + private boolean islike1 = false; + private boolean islike2 = false; + private boolean islike3 = false; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + binding = FragmentRankBinding.inflate(getLayoutInflater()); + + rankAdapter = new RankAdapter(requireActivity()); + binding.rankRv.setLayoutManager(new LinearLayoutManager(requireContext())); + initData(); + + return binding.getRoot(); + } + + private void initData() { + MydataBase.getInstance().likeDao().getRankdata(true).observe(getViewLifecycleOwner(), new Observer>() { + @Override + public void onChanged(List list) { + LikeData mydata1 = list.get(0); + LikeData mydata2 = list.get(1); + LikeData mydata3 = list.get(2); + + Glide.with(requireContext()) + .load(mydata1.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(binding.rankImage1); + if (mydata1.getTitle().length() > 6) { + String name = mydata1.getTitle().substring(0, 6); + binding.rankText1.setText(name + "..."); + } else { + binding.rankText1.setText(mydata1.getTitle()); + } + + binding.rankRelative1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(requireContext(), PrewActivity.class); + intent.putExtra(StaticValue.KEY_TITLE, mydata1.getTitle()); + requireContext().startActivity(intent); + } + }); + + + Glide.with(requireContext()) + .load(mydata2.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(binding.rankImage2); + if (mydata2.getTitle().length() > 6) { + String name = mydata2.getTitle().substring(0, 6); + binding.rankText2.setText(name + "..."); + } else { + binding.rankText2.setText(mydata1.getTitle()); + } + + binding.rankRelative2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(requireContext(), PrewActivity.class); + intent.putExtra(StaticValue.KEY_TITLE, mydata2.getTitle()); + requireContext().startActivity(intent); + } + }); + + + Glide.with(requireContext()) + .load(mydata3.getPreUrl()) + .placeholder(R.mipmap.icon_logo) + .into(binding.rankImage3); + if (mydata3.getTitle().length() > 6) { + String name = mydata3.getTitle().substring(0, 6); + binding.rankText3.setText(name + "..."); + } else { + binding.rankText3.setText(mydata1.getTitle()); + } + + binding.rankRelative3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(requireContext(), PrewActivity.class); + intent.putExtra(StaticValue.KEY_TITLE, mydata3.getTitle()); + requireContext().startActivity(intent); + } + }); + + + List reList = list.subList(3, 9); + rankAdapter.SetData(reList); + binding.rankRv.setAdapter(rankAdapter); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fun/funnyprank/tools/AudioRecorder.java b/app/src/main/java/com/fun/funnyprank/tools/AudioRecorder.java new file mode 100644 index 0000000..ebda63b --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/tools/AudioRecorder.java @@ -0,0 +1,58 @@ +package com.fun.funnyprank.tools; + +import android.content.Context; +import android.media.MediaRecorder; + +import java.io.File; +import java.io.IOException; + +public class AudioRecorder { + private MediaRecorder mediaRecorder; + private String tempFileName; + private String fileName; + private boolean isRecording = false; + + public AudioRecorder(Context context) { + + File dir = context.getCacheDir(); + File file = new File(dir, "temp_audio.mp3"); + tempFileName = file.getAbsolutePath(); + } + + + public void startRecording() { + if (isRecording) return; + + mediaRecorder = new MediaRecorder(); + mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); + mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); + mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); + mediaRecorder.setOutputFile(tempFileName); + + try { + mediaRecorder.prepare(); + mediaRecorder.start(); + isRecording = true; + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void stopRecording() { + if (!isRecording) return; + + try { + mediaRecorder.stop(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } finally { + mediaRecorder.release(); + mediaRecorder = null; + isRecording = false; + } + } + + public String getTempFileName() { + return tempFileName; + } +} diff --git a/app/src/main/java/com/fun/funnyprank/tools/CustomProgressBar.kt b/app/src/main/java/com/fun/funnyprank/tools/CustomProgressBar.kt new file mode 100644 index 0000000..0361ad2 --- /dev/null +++ b/app/src/main/java/com/fun/funnyprank/tools/CustomProgressBar.kt @@ -0,0 +1,62 @@ +package com.`fun`.funnyprank.tools + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.LinearGradient +import android.graphics.Paint +import android.graphics.RectF +import android.graphics.Shader +import android.util.AttributeSet +import android.view.View + +class CustomProgressBar(context: Context, attrs: AttributeSet?) : View(context, attrs) { + private var progress = 0f // 当前进度 + private val maxProgress = 100f // 最大进度 + private val progressBarHeight = 20f // 进度条高度 + private val cornerRadius = 10f // 圆角半径 + private val backgroundColor = Color.parseColor("#26FFFFFF") + private val startColor = Color.parseColor("#FF9ce8ff") // 起始颜色 + private val middleColor = Color.parseColor("#FFa4c4fb") // 中间颜色 + private val endColor = Color.parseColor("#FFbfa4ee") // 结束颜色 + private val paint = Paint() + private val paintTow = Paint() + + init { + paint.style = Paint.Style.FILL + paint.isAntiAlias = true + paintTow.style = Paint.Style.FILL + paintTow.isAntiAlias = true + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + // 绘制底色矩形 + paint.shader = null // 重置着色器 + paint.color = backgroundColor + val backgroundRect = RectF(0f, (height / 2 - progressBarHeight / 2), width.toFloat(), (height / 2 + progressBarHeight / 2)) + canvas.drawRoundRect(backgroundRect, cornerRadius, cornerRadius, paint) + + + // 计算进度条的宽度 + val progressBarWidth = (width * progress / maxProgress) + + // 创建颜色渐变对象 + val gradient = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(startColor, middleColor, endColor), null, Shader.TileMode.CLAMP) + paintTow.shader = gradient + + // 绘制带圆角的进度条矩形 + val rect = RectF(0f, (height / 2 - progressBarHeight / 2), progressBarWidth.toFloat(), (height / 2 + progressBarHeight / 2)) + canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paintTow) + } + + fun getProgress():Float{ + return progress + } + + // 设置进度 + fun setProgress(progress: Float) { + this.progress = progress + invalidate() // 请求重绘 + } +} diff --git a/app/src/main/java/com/fun/funnyprank/tools/Mytools.java b/app/src/main/java/com/fun/funnyprank/tools/Mytools.java index d845cc0..dfdc8e5 100644 --- a/app/src/main/java/com/fun/funnyprank/tools/Mytools.java +++ b/app/src/main/java/com/fun/funnyprank/tools/Mytools.java @@ -40,7 +40,7 @@ public class Mytools { ad.setListener(new MaxAdListener() { @Override public void onAdLoaded(@NonNull MaxAd maxAd) { - + Log.e("zzj", "-----------onAdLoaded------" + maxAd.getAdUnitId()); } @Override @@ -61,13 +61,13 @@ public class Mytools { @Override public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) { - Log.e("zzj","-----------onAdLoadFailed------"+maxError); + Log.e("zzj", "-----------onAdLoadFailed------" + maxError); } @Override public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) { adcallback.onShowFail(maxAd); - Log.e("zzj","-----------onAdDisplayFailed------"+maxError); + Log.e("zzj", "-----------onAdDisplayFailed------" + maxError); } }); } @@ -103,7 +103,6 @@ public class Mytools { } - public static void runIO(Runnable task) { getExecutorService().execute(task); } @@ -143,12 +142,16 @@ public class Mytools { List likeDataList = new ArrayList<>(); myData.setCategoryName(list.getString("categoryName")); myData.setCategoryUrl(list.getString("categoryUrl")); + String categoryName = list.getString("categoryName"); + String categoryUrl = list.getString("categoryUrl"); JSONArray classArray = list.getJSONArray("list"); for (int i = 0; i < classArray.length(); i++) { JSONObject item = classArray.getJSONObject(i); LikeData likeData = new LikeData(); + likeData.setCategoryUrl(categoryUrl); + likeData.setIsrank(false); likeData.setLike(false); - likeData.setCategoryname(myData.getCategoryName()); + likeData.setCategoryname(categoryName); likeData.setTitle(item.getString("title")); likeData.setMp3Url(item.getString("mp3Url")); likeData.setPreUrl(item.getString("preUrl")); diff --git a/app/src/main/res/drawable/custom_check.xml b/app/src/main/res/drawable/custom_check.xml new file mode 100644 index 0000000..97cb4d7 --- /dev/null +++ b/app/src/main/res/drawable/custom_check.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/custom_cons_bg.xml b/app/src/main/res/drawable/custom_cons_bg.xml new file mode 100644 index 0000000..74aad51 --- /dev/null +++ b/app/src/main/res/drawable/custom_cons_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/custom_delete_cons_bg.xml b/app/src/main/res/drawable/custom_delete_cons_bg.xml new file mode 100644 index 0000000..fc67569 --- /dev/null +++ b/app/src/main/res/drawable/custom_delete_cons_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/custom_item_bg.xml b/app/src/main/res/drawable/custom_item_bg.xml new file mode 100644 index 0000000..ee67733 --- /dev/null +++ b/app/src/main/res/drawable/custom_item_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/custom_uncheck.xml b/app/src/main/res/drawable/custom_uncheck.xml new file mode 100644 index 0000000..8c40b32 --- /dev/null +++ b/app/src/main/res/drawable/custom_uncheck.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/dialog_bg.xml b/app/src/main/res/drawable/dialog_bg.xml new file mode 100644 index 0000000..c68de8d --- /dev/null +++ b/app/src/main/res/drawable/dialog_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dialog_cons_bg.xml b/app/src/main/res/drawable/dialog_cons_bg.xml new file mode 100644 index 0000000..612780c --- /dev/null +++ b/app/src/main/res/drawable/dialog_cons_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/edit_bg.xml b/app/src/main/res/drawable/edit_bg.xml new file mode 100644 index 0000000..7c837a9 --- /dev/null +++ b/app/src/main/res/drawable/edit_bg.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_custom_add.xml b/app/src/main/res/drawable/icon_custom_add.xml new file mode 100644 index 0000000..32cf096 --- /dev/null +++ b/app/src/main/res/drawable/icon_custom_add.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/icon_custom_import.xml b/app/src/main/res/drawable/icon_custom_import.xml new file mode 100644 index 0000000..60a307b --- /dev/null +++ b/app/src/main/res/drawable/icon_custom_import.xml @@ -0,0 +1,39 @@ + + + + + + + diff --git a/app/src/main/res/drawable/icon_custom_record.xml b/app/src/main/res/drawable/icon_custom_record.xml new file mode 100644 index 0000000..fd1846d --- /dev/null +++ b/app/src/main/res/drawable/icon_custom_record.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/app/src/main/res/drawable/icon_custom_unlike.xml b/app/src/main/res/drawable/icon_custom_unlike.xml new file mode 100644 index 0000000..5117302 --- /dev/null +++ b/app/src/main/res/drawable/icon_custom_unlike.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_delete.xml b/app/src/main/res/drawable/icon_delete.xml new file mode 100644 index 0000000..37328a0 --- /dev/null +++ b/app/src/main/res/drawable/icon_delete.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_item_delete.xml b/app/src/main/res/drawable/icon_item_delete.xml new file mode 100644 index 0000000..e512371 --- /dev/null +++ b/app/src/main/res/drawable/icon_item_delete.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/icon_like.xml b/app/src/main/res/drawable/icon_like.xml new file mode 100644 index 0000000..abea2c6 --- /dev/null +++ b/app/src/main/res/drawable/icon_like.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_privacy.xml b/app/src/main/res/drawable/icon_privacy.xml new file mode 100644 index 0000000..681d4f8 --- /dev/null +++ b/app/src/main/res/drawable/icon_privacy.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_rate.xml b/app/src/main/res/drawable/icon_rate.xml new file mode 100644 index 0000000..70b51db --- /dev/null +++ b/app/src/main/res/drawable/icon_rate.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/icon_record_pause.xml b/app/src/main/res/drawable/icon_record_pause.xml new file mode 100644 index 0000000..9929607 --- /dev/null +++ b/app/src/main/res/drawable/icon_record_pause.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon_record_play.xml b/app/src/main/res/drawable/icon_record_play.xml new file mode 100644 index 0000000..36c96f9 --- /dev/null +++ b/app/src/main/res/drawable/icon_record_play.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon_setting.xml b/app/src/main/res/drawable/icon_setting.xml new file mode 100644 index 0000000..e1abc54 --- /dev/null +++ b/app/src/main/res/drawable/icon_setting.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/drawable/icon_share.xml b/app/src/main/res/drawable/icon_share.xml new file mode 100644 index 0000000..f35e459 --- /dev/null +++ b/app/src/main/res/drawable/icon_share.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_version.xml b/app/src/main/res/drawable/icon_version.xml new file mode 100644 index 0000000..9a1d327 --- /dev/null +++ b/app/src/main/res/drawable/icon_version.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/pre_pause.xml b/app/src/main/res/drawable/pre_pause.xml new file mode 100644 index 0000000..857b425 --- /dev/null +++ b/app/src/main/res/drawable/pre_pause.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/pre_play.xml b/app/src/main/res/drawable/pre_play.xml new file mode 100644 index 0000000..a76a251 --- /dev/null +++ b/app/src/main/res/drawable/pre_play.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/rank_1th_bg.xml b/app/src/main/res/drawable/rank_1th_bg.xml new file mode 100644 index 0000000..8e8c28f --- /dev/null +++ b/app/src/main/res/drawable/rank_1th_bg.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/rank_2th_bg.xml b/app/src/main/res/drawable/rank_2th_bg.xml new file mode 100644 index 0000000..e843fc9 --- /dev/null +++ b/app/src/main/res/drawable/rank_2th_bg.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/rank_3th_bg.xml b/app/src/main/res/drawable/rank_3th_bg.xml new file mode 100644 index 0000000..3cbe1a3 --- /dev/null +++ b/app/src/main/res/drawable/rank_3th_bg.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/rank_check.xml b/app/src/main/res/drawable/rank_check.xml new file mode 100644 index 0000000..db61ed2 --- /dev/null +++ b/app/src/main/res/drawable/rank_check.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/rank_uncheck.xml b/app/src/main/res/drawable/rank_uncheck.xml new file mode 100644 index 0000000..d55bb61 --- /dev/null +++ b/app/src/main/res/drawable/rank_uncheck.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/setting_cons_bg.xml b/app/src/main/res/drawable/setting_cons_bg.xml new file mode 100644 index 0000000..ba78cb8 --- /dev/null +++ b/app/src/main/res/drawable/setting_cons_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/tab_check.xml b/app/src/main/res/drawable/tab_check.xml new file mode 100644 index 0000000..47ff181 --- /dev/null +++ b/app/src/main/res/drawable/tab_check.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_prew.xml b/app/src/main/res/layout/activity_prew.xml index d4c7adb..242e9e5 100644 --- a/app/src/main/res/layout/activity_prew.xml +++ b/app/src/main/res/layout/activity_prew.xml @@ -126,7 +126,7 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_save.xml b/app/src/main/res/layout/activity_save.xml new file mode 100644 index 0000000..11c9b2e --- /dev/null +++ b/app/src/main/res/layout/activity_save.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml new file mode 100644 index 0000000..bc061fc --- /dev/null +++ b/app/src/main/res/layout/activity_setting.xml @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index e1cdbee..10a5e50 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -2,9 +2,9 @@ @@ -37,13 +37,14 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/logo" /> - + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_web.xml b/app/src/main/res/layout/activity_web.xml new file mode 100644 index 0000000..5bfadc2 --- /dev/null +++ b/app/src/main/res/layout/activity_web.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/custom_list.xml b/app/src/main/res/layout/custom_list.xml new file mode 100644 index 0000000..d609c71 --- /dev/null +++ b/app/src/main/res/layout/custom_list.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog.xml b/app/src/main/res/layout/dialog.xml new file mode 100644 index 0000000..c2f07eb --- /dev/null +++ b/app/src/main/res/layout/dialog.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_custom.xml b/app/src/main/res/layout/fragment_custom.xml new file mode 100644 index 0000000..f07a325 --- /dev/null +++ b/app/src/main/res/layout/fragment_custom.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 17ab152..41fbf25 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -24,14 +24,22 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + app:layout_constraintTop_toTopOf="@id/main_title"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/rank_list.xml b/app/src/main/res/layout/rank_list.xml new file mode 100644 index 0000000..dff53f3 --- /dev/null +++ b/app/src/main/res/layout/rank_list.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxxhdpi/rank_1th_image_bg.png b/app/src/main/res/mipmap-xxxhdpi/rank_1th_image_bg.png new file mode 100644 index 0000000..000a78e Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/rank_1th_image_bg.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/rank_2th_image_bg.png b/app/src/main/res/mipmap-xxxhdpi/rank_2th_image_bg.png new file mode 100644 index 0000000..d236693 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/rank_2th_image_bg.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/rank_3th_image_bg.png b/app/src/main/res/mipmap-xxxhdpi/rank_3th_image_bg.png new file mode 100644 index 0000000..4678167 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/rank_3th_image_bg.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/rank_list_image_bg.png b/app/src/main/res/mipmap-xxxhdpi/rank_list_image_bg.png new file mode 100644 index 0000000..a8dd976 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/rank_list_image_bg.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/save_image.png b/app/src/main/res/mipmap-xxxhdpi/save_image.png new file mode 100644 index 0000000..138fa64 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/save_image.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 2ad4327..d2024ae 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -24,4 +24,8 @@ #E4F5FF #494747 #FFE900 + #0C0E0E + #613EEA + #303030 + #A7A7A7 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c302a02..c0e9edd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,4 +4,26 @@ Loop My favorite At present, there is nothing \n you like Go to the homepage \n and take a look + + Hello blank fragment + No files are present at the moment. \n Let\'s create one now. + Add sound + Create sounds + Add sound + Import audio + Record sound + New Record + Settings + Please enter the content + Give your created sound a name + Stop create + Save sound + Successfully save + 00 : 00 : 00 + Ranking + Privacy Policy + Share + Rate + Version + Here is a Funny Prank \ No newline at end of file