创建仓库
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
59
app/build.gradle.kts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
}
|
||||||
|
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
|
android {
|
||||||
|
namespace = "com.prank.happypranksounds"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.prank.happypranksounds"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 35
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0.0"
|
||||||
|
setProperty("archivesBaseName", "Happy Prank Sounds_V" + versionName + "(${versionCode})_$timestamp")
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation(libs.appcompat)
|
||||||
|
implementation(libs.material)
|
||||||
|
implementation(libs.activity)
|
||||||
|
implementation(libs.constraintlayout)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.ext.junit)
|
||||||
|
androidTestImplementation(libs.espresso.core)
|
||||||
|
|
||||||
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||||
|
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
||||||
|
|
||||||
|
implementation ("androidx.room:room-runtime:2.6.1")
|
||||||
|
annotationProcessor ("androidx.room:room-compiler:2.6.1")
|
||||||
|
|
||||||
|
implementation("com.airbnb.android:lottie:6.5.0")
|
||||||
|
}
|
||||||
33
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-keepclassmembers class com.prank.happypranksounds.MyApplication {
|
||||||
|
public static final java.lang.String DATABASE_NAME;
|
||||||
|
public static final int DATABASE_VERSION;
|
||||||
|
}
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@androidx.room.Query <methods>;
|
||||||
|
}
|
||||||
|
-keep class com.prank.happypranksounds.data.database.AppDatabase { *; }
|
||||||
|
-keep class com.prank.happypranksounds.data.entity.HappyData { *; }
|
||||||
|
-keep class com.prank.happypranksounds.data.dao.HappyDataDao { *; }
|
||||||
|
-dontwarn javax.annotation.Nullable
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.prank.happypranksounds;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals("com.prank.happypranksounds", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
53
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="32" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="32" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".MyApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.HappyPrankSounds"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.SplashActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.SaveActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.RecordActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.SoundActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.CategoryActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.MainActivity"
|
||||||
|
android:exported="false">
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
1
app/src/main/assets/Animation.json
Normal file
3745
app/src/main/assets/prank.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package com.prank.happypranksounds;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.dao.HappyDataDao;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.data.database.AppDatabase;
|
||||||
|
import com.prank.happypranksounds.data.repository.HappyRepository;
|
||||||
|
import com.prank.happypranksounds.util.JsonParser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MyApplication extends Application {
|
||||||
|
|
||||||
|
public static MyApplication myApplication;
|
||||||
|
public static final String DATABASE_NAME = "Database";
|
||||||
|
public static final int DATABASE_VERSION = 1;
|
||||||
|
private static final String PREF_NAME = "preferences";
|
||||||
|
private static final String KEY_INITIALIZED = "initDatabase";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
myApplication = this;
|
||||||
|
|
||||||
|
SharedPreferences preferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||||
|
boolean init = preferences.getBoolean(KEY_INITIALIZED, false);
|
||||||
|
|
||||||
|
if (!init) {
|
||||||
|
initDatabase();
|
||||||
|
preferences.edit().putBoolean(KEY_INITIALIZED, true).apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDatabase() {
|
||||||
|
HappyDataDao happyDataDao = AppDatabase.getInstance(getContext()).happyDataDao();
|
||||||
|
HappyRepository happyRepository = new HappyRepository(happyDataDao);
|
||||||
|
List<HappyData> happyDataList = JsonParser.parseJson("prank.json");
|
||||||
|
happyRepository.insertAll(happyDataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Context getContext() {
|
||||||
|
return myApplication.getApplicationContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.prank.happypranksounds.callback;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
public class HappyCallback extends ItemTouchHelper.SimpleCallback {
|
||||||
|
|
||||||
|
private final OnItemSwipeListener listener;
|
||||||
|
|
||||||
|
public HappyCallback(OnItemSwipeListener listener) {
|
||||||
|
super(0, ItemTouchHelper.LEFT);
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
|
int position = viewHolder.getAdapterPosition();
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onItemSwiped(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnItemSwipeListener {
|
||||||
|
void onItemSwiped(int position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.prank.happypranksounds.data.dao;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface HappyDataDao {
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insertAll(List<HappyData> happyDataList);
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
void insert(HappyData happyData);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(HappyData happyData);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void delete(HappyData happyData);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM HappyData WHERE id IN (SELECT MIN(id) FROM HappyData GROUP BY categoryName)")
|
||||||
|
LiveData<List<HappyData>> getFirstCategory();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM HappyData WHERE categoryName = :name")
|
||||||
|
LiveData<List<HappyData>> getCategoryList(String name);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM HappyData WHERE isFavorite = 1")
|
||||||
|
LiveData<List<HappyData>> getFavorite();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM HappyData WHERE isExternal = 1")
|
||||||
|
LiveData<List<HappyData>> getExternal();
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(*) FROM HappyData WHERE mp3Url = :uri")
|
||||||
|
int getCount(String uri);
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.prank.happypranksounds.data.database;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.room.Database;
|
||||||
|
import androidx.room.Room;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.MyApplication;
|
||||||
|
import com.prank.happypranksounds.data.dao.HappyDataDao;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
|
||||||
|
@Database(entities = {HappyData.class}, version = MyApplication.DATABASE_VERSION, exportSchema = false)
|
||||||
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
|
|
||||||
|
public abstract HappyDataDao happyDataDao();
|
||||||
|
|
||||||
|
private static volatile AppDatabase INSTANCE;
|
||||||
|
|
||||||
|
public static AppDatabase getInstance(Context context) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
synchronized (AppDatabase.class) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||||
|
AppDatabase.class, MyApplication.DATABASE_NAME)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.prank.happypranksounds.data.entity;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class HappyData implements Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private String categoryName;
|
||||||
|
private String categoryUrl;
|
||||||
|
private String title;
|
||||||
|
private String mp3Url;
|
||||||
|
private String preUrl;
|
||||||
|
private boolean isFavorite;
|
||||||
|
private boolean isExternal;
|
||||||
|
|
||||||
|
public HappyData(String categoryName, String categoryUrl, String title, String mp3Url, String preUrl, boolean isFavorite, boolean isExternal) {
|
||||||
|
this.categoryName = categoryName;
|
||||||
|
this.categoryUrl = categoryUrl;
|
||||||
|
this.title = title;
|
||||||
|
this.mp3Url = mp3Url;
|
||||||
|
this.preUrl = preUrl;
|
||||||
|
this.isFavorite = isFavorite;
|
||||||
|
this.isExternal = isExternal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoryName() {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryName(String categoryName) {
|
||||||
|
this.categoryName = categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoryUrl() {
|
||||||
|
return categoryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryUrl(String categoryUrl) {
|
||||||
|
this.categoryUrl = categoryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMp3Url() {
|
||||||
|
return mp3Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMp3Url(String mp3Url) {
|
||||||
|
this.mp3Url = mp3Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreUrl() {
|
||||||
|
return preUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreUrl(String preUrl) {
|
||||||
|
this.preUrl = preUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFavorite() {
|
||||||
|
return isFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFavorite(boolean favorite) {
|
||||||
|
isFavorite = favorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExternal() {
|
||||||
|
return isExternal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternal(boolean external) {
|
||||||
|
isExternal = external;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.prank.happypranksounds.data.repository;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.dao.HappyDataDao;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class HappyRepository {
|
||||||
|
private final HappyDataDao happyDataDao;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public HappyRepository(HappyDataDao happyDataDao) {
|
||||||
|
this.happyDataDao = happyDataDao;
|
||||||
|
this.executorService = Executors.newSingleThreadExecutor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertAll(List<HappyData> happyDataList) {
|
||||||
|
executorService.execute(() -> happyDataDao.insertAll(happyDataList));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(HappyData happyData) {
|
||||||
|
executorService.execute(() -> happyDataDao.insert(happyData));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(HappyData happyData) {
|
||||||
|
executorService.execute(() -> happyDataDao.update(happyData));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(HappyData happyData) {
|
||||||
|
executorService.execute(() -> happyDataDao.delete(happyData));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getFavorite() {
|
||||||
|
return happyDataDao.getFavorite();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getFirstCategory() {
|
||||||
|
return happyDataDao.getFirstCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getCategoryList(String name) {
|
||||||
|
return happyDataDao.getCategoryList(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getExternal() {
|
||||||
|
return happyDataDao.getExternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCountAsync(String uri, CountCallback callback) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
int count = happyDataDao.getCount(uri);
|
||||||
|
new Handler(Looper.getMainLooper()).post(() -> callback.onCountFetched(count));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface CountCallback {
|
||||||
|
void onCountFetched(int count);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
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 androidx.lifecycle.Observer;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivityCategoryBinding;
|
||||||
|
import com.prank.happypranksounds.ui.adapter.SoundAdapter;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
import com.prank.happypranksounds.util.ItemDecoration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CategoryActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivityCategoryBinding binding;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
private SoundAdapter adapter;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
binding = ActivityCategoryBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
|
||||||
|
name = getIntent().getStringExtra("name");
|
||||||
|
if (name == null) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
|
||||||
|
binding.recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
|
||||||
|
adapter = new SoundAdapter(new ArrayList<>(), happyViewModel, this, 1);
|
||||||
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
ItemDecoration itemDecoration = new ItemDecoration(16, 19, 10);
|
||||||
|
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
|
||||||
|
binding.title.setText(name);
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
|
loadCategoryList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadCategoryList() {
|
||||||
|
happyViewModel
|
||||||
|
.getCategoryList(name)
|
||||||
|
.observe(this, new Observer<List<HappyData>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<HappyData> happyDataList) {
|
||||||
|
adapter.updateData(happyDataList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivityMainBinding;
|
||||||
|
import com.prank.happypranksounds.databinding.TabItemBinding;
|
||||||
|
import com.prank.happypranksounds.ui.adapter.MainAdapter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
private ActivityMainBinding binding;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
MainAdapter adapter = new MainAdapter(this);
|
||||||
|
binding.viewpager.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
binding.viewpager.setUserInputEnabled(false);
|
||||||
|
|
||||||
|
new TabLayoutMediator(binding.tabLayout, binding.viewpager, (tab, position) -> {
|
||||||
|
TabItemBinding tabItemBinding = TabItemBinding.inflate(LayoutInflater.from(this));
|
||||||
|
tab.setCustomView(tabItemBinding.getRoot());
|
||||||
|
setTab(tabItemBinding, position);
|
||||||
|
}).attach();
|
||||||
|
|
||||||
|
binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
updateTab(tab, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
updateTab(tab, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
||||||
|
if (tab.getCustomView() != null) {
|
||||||
|
TabItemBinding tabBinding = TabItemBinding.bind(tab.getCustomView());
|
||||||
|
|
||||||
|
int iconResId = getIconResource(tab.getPosition(), isSelected);
|
||||||
|
tabBinding.image.setImageResource(iconResId);
|
||||||
|
|
||||||
|
int textColor = isSelected ? R.color.black : R.color.white;
|
||||||
|
tabBinding.text.setTextColor(ContextCompat.getColor(MainActivity.this, textColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTab(TabItemBinding tabItemBinding, int position) {
|
||||||
|
int iconResId = getIconResource(position, false);
|
||||||
|
int textColorResId = R.color.white;
|
||||||
|
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
tabItemBinding.text.setText(R.string.category);
|
||||||
|
iconResId = R.drawable.category;
|
||||||
|
textColorResId = R.color.black;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
tabItemBinding.text.setText(R.string.sound);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tabItemBinding.text.setText(R.string.collection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tabItemBinding.image.setImageResource(iconResId);
|
||||||
|
tabItemBinding.text.setTextColor(ContextCompat.getColor(this, textColorResId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIconResource(int position, boolean isSelected) {
|
||||||
|
switch (position) {
|
||||||
|
case 1:
|
||||||
|
return isSelected ? R.drawable.sound : R.drawable.un_sound;
|
||||||
|
case 2:
|
||||||
|
return isSelected ? R.drawable.collection : R.drawable.un_collection;
|
||||||
|
default:
|
||||||
|
return isSelected ? R.drawable.category : R.drawable.un_category;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,174 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.media.MediaRecorder;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivityRecordBinding;
|
||||||
|
import com.prank.happypranksounds.util.HappySoundUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class RecordActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivityRecordBinding binding;
|
||||||
|
private boolean isStarted;
|
||||||
|
private long time;
|
||||||
|
private final Handler handler = new Handler();
|
||||||
|
private MediaRecorder mediaRecorder;
|
||||||
|
private File outputFile;
|
||||||
|
|
||||||
|
private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200;
|
||||||
|
|
||||||
|
private final Runnable updateTimeTask = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
long elapsedTime = currentTime - time;
|
||||||
|
binding.time.setText(HappySoundUtil.formatTime(elapsedTime));
|
||||||
|
handler.postDelayed(this, 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityRecordBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (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.record.setOnClickListener(v -> {
|
||||||
|
if (ContextCompat.checkSelfPermission(RecordActivity.this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(RecordActivity.this, new String[]{Manifest.permission.RECORD_AUDIO}, REQUEST_RECORD_AUDIO_PERMISSION);
|
||||||
|
} else {
|
||||||
|
toggleRecording();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.back.setOnClickListener(v -> onBackPressed());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleRecording() {
|
||||||
|
if (isStarted) {
|
||||||
|
stopRecording();
|
||||||
|
} else {
|
||||||
|
startRecording();
|
||||||
|
}
|
||||||
|
isStarted = !isStarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startRecording() {
|
||||||
|
try {
|
||||||
|
mediaRecorder = new MediaRecorder();
|
||||||
|
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||||
|
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
|
||||||
|
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
|
||||||
|
|
||||||
|
String fileName = "recording_" + System.currentTimeMillis() + ".m4a";
|
||||||
|
outputFile = new File(getFilesDir(), fileName);
|
||||||
|
mediaRecorder.setOutputFile(outputFile.getAbsolutePath());
|
||||||
|
|
||||||
|
mediaRecorder.prepare();
|
||||||
|
mediaRecorder.start();
|
||||||
|
|
||||||
|
time = System.currentTimeMillis();
|
||||||
|
handler.post(updateTimeTask);
|
||||||
|
binding.animation.playAnimation();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "Recording failed", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopRecording() {
|
||||||
|
if (mediaRecorder != null) {
|
||||||
|
try {
|
||||||
|
mediaRecorder.stop();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "Recording failed", Toast.LENGTH_SHORT).show();
|
||||||
|
} finally {
|
||||||
|
mediaRecorder.release();
|
||||||
|
mediaRecorder = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.removeCallbacks(updateTimeTask);
|
||||||
|
binding.animation.cancelAnimation();
|
||||||
|
binding.animation.setFrame(0);
|
||||||
|
binding.time.setText(R.string._00_00_00);
|
||||||
|
|
||||||
|
Intent intent = new Intent(RecordActivity.this, SaveActivity.class);
|
||||||
|
intent.putExtra("soundPath", outputFile.getAbsolutePath());
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (isStarted) {
|
||||||
|
stopRecordingAndDeleteFile();
|
||||||
|
}
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopRecordingAndDeleteFile() {
|
||||||
|
if (mediaRecorder != null) {
|
||||||
|
try {
|
||||||
|
mediaRecorder.stop();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "Recording stopped unexpectedly", Toast.LENGTH_SHORT).show();
|
||||||
|
} finally {
|
||||||
|
mediaRecorder.release();
|
||||||
|
mediaRecorder = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFile() {
|
||||||
|
if (outputFile != null && outputFile.exists()) {
|
||||||
|
boolean deleted = outputFile.delete();
|
||||||
|
if (!deleted) {
|
||||||
|
Toast.makeText(this, "Failed to delete recording file", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (mediaRecorder != null) {
|
||||||
|
mediaRecorder.release();
|
||||||
|
mediaRecorder = null;
|
||||||
|
}
|
||||||
|
handler.removeCallbacks(updateTimeTask);
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,221 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivitySaveBinding;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
import com.prank.happypranksounds.util.HappySoundUtil;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class SaveActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivitySaveBinding binding;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
private String soundPath;
|
||||||
|
private String inputText;
|
||||||
|
private MediaPlayer mediaPlayer;
|
||||||
|
private boolean isPlaying;
|
||||||
|
private boolean isSaved;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivitySaveBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
soundPath = getIntent().getStringExtra("soundPath");
|
||||||
|
if (soundPath == null) {
|
||||||
|
Toast.makeText(this, "The audio file path is invalid", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File audioFile = new File(soundPath);
|
||||||
|
if (!audioFile.exists()) {
|
||||||
|
Toast.makeText(this, "Audio file does not exist", Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
setupBackButton();
|
||||||
|
setupPlayButton();
|
||||||
|
setupSaveButton();
|
||||||
|
displayAudioDuration();
|
||||||
|
handleBackPressOnPhysicalButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupBackButton() {
|
||||||
|
binding.back.setOnClickListener(v -> handleBackPressed());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupPlayButton() {
|
||||||
|
binding.play.setOnClickListener(v -> playOrPauseAudio());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupSaveButton() {
|
||||||
|
binding.save.setOnClickListener(v -> {
|
||||||
|
inputText = binding.editText.getText().toString().trim();
|
||||||
|
|
||||||
|
if (inputText.isEmpty()) {
|
||||||
|
showToast(R.string.name_is_empty);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveData();
|
||||||
|
navigateToMainActivity();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveData() {
|
||||||
|
HappyData happyData = new HappyData(inputText, soundPath, inputText, soundPath, "", false, true);
|
||||||
|
happyViewModel.insert(happyData);
|
||||||
|
isSaved = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateToMainActivity() {
|
||||||
|
Intent intent = new Intent(SaveActivity.this, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showToast(int resId) {
|
||||||
|
Toast.makeText(getApplicationContext(), resId, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBackPressOnPhysicalButton() {
|
||||||
|
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
handleBackPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayAudioDuration() {
|
||||||
|
if (soundPath != null) {
|
||||||
|
initializeMediaPlayer(true);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "The audio file path is invalid", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playOrPauseAudio() {
|
||||||
|
if (isPlaying) {
|
||||||
|
mediaPlayer.pause();
|
||||||
|
binding.play.setImageResource(R.drawable.play);
|
||||||
|
isPlaying = false;
|
||||||
|
} else {
|
||||||
|
if (mediaPlayer == null) {
|
||||||
|
initializeMediaPlayer(false);
|
||||||
|
} else {
|
||||||
|
mediaPlayer.start();
|
||||||
|
binding.play.setImageResource(R.drawable.pause);
|
||||||
|
isPlaying = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
mediaPlayer.setOnCompletionListener(mp -> {
|
||||||
|
Toast.makeText(this, "Play completed", Toast.LENGTH_SHORT).show();
|
||||||
|
binding.play.setImageResource(R.drawable.play);
|
||||||
|
isPlaying = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeMediaPlayer(boolean forDuration) {
|
||||||
|
if (mediaPlayer == null) {
|
||||||
|
mediaPlayer = new MediaPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mediaPlayer.setDataSource(soundPath);
|
||||||
|
mediaPlayer.prepareAsync();
|
||||||
|
|
||||||
|
if (forDuration) {
|
||||||
|
mediaPlayer.setOnPreparedListener(mp -> {
|
||||||
|
int duration = mediaPlayer.getDuration();
|
||||||
|
binding.time.setText(HappySoundUtil.formatTime(duration));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
mediaPlayer.setOnPreparedListener(mp -> {
|
||||||
|
mediaPlayer.start();
|
||||||
|
binding.play.setImageResource(R.drawable.pause);
|
||||||
|
isPlaying = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mediaPlayer.setOnErrorListener((mp, what, extra) -> {
|
||||||
|
Toast.makeText(this, "Unable to play audio", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "Unable to load audio", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBackPressed() {
|
||||||
|
deleteFile();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFile() {
|
||||||
|
if (soundPath == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(soundPath);
|
||||||
|
if (file.exists()) {
|
||||||
|
boolean deleted = file.delete();
|
||||||
|
if (!deleted) {
|
||||||
|
Toast.makeText(this, "Failed to delete audio file", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
if (isPlaying) {
|
||||||
|
mediaPlayer.stop();
|
||||||
|
}
|
||||||
|
mediaPlayer.release();
|
||||||
|
mediaPlayer = null;
|
||||||
|
}
|
||||||
|
if (!isSaved) {
|
||||||
|
deleteFile();
|
||||||
|
}
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,222 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.SeekBar;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
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 androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivitySoundBinding;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class SoundActivity extends AppCompatActivity {
|
||||||
|
private ActivitySoundBinding binding;
|
||||||
|
private MediaPlayer mediaPlayer;
|
||||||
|
private AudioManager audioManager;
|
||||||
|
private int maxVolume, currentVolume;
|
||||||
|
private boolean isPlaying = false;
|
||||||
|
private boolean isLooping = false;
|
||||||
|
private HappyData happyData;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
|
||||||
|
private final BroadcastReceiver volumeReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (Objects.equals(intent.getAction(), "android.media.VOLUME_CHANGED_ACTION")) {
|
||||||
|
int currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
|
||||||
|
binding.seekBar.setProgress(currentVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
binding = ActivitySoundBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
happyData = (HappyData) getIntent().getSerializableExtra("audioData");
|
||||||
|
if (happyData == null) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
|
||||||
|
IntentFilter filter = new IntentFilter("android.media.VOLUME_CHANGED_ACTION");
|
||||||
|
registerReceiver(volumeReceiver, filter);
|
||||||
|
|
||||||
|
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
|
||||||
|
maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||||
|
currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
binding.title.setText(happyData.getTitle());
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
|
binding.favorite.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
updateFavorite(happyData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.loop.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
isLooping = !isLooping;
|
||||||
|
binding.loop.setImageResource(isLooping ? R.drawable.loop : R.drawable.un_loop);
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
mediaPlayer.setLooping(isLooping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binding.play.setOnClickListener(v -> playAudio());
|
||||||
|
binding.seekBar.setMax(maxVolume);
|
||||||
|
binding.seekBar.setProgress(currentVolume);
|
||||||
|
binding.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||||
|
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loadImage();
|
||||||
|
loadIsFavorite(happyData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playAudio() {
|
||||||
|
String audioUrl = happyData.getMp3Url();
|
||||||
|
|
||||||
|
if (mediaPlayer == null) {
|
||||||
|
mediaPlayer = new MediaPlayer();
|
||||||
|
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (audioUrl.startsWith("content://")) {
|
||||||
|
Uri audioUri = Uri.parse(audioUrl);
|
||||||
|
mediaPlayer.setDataSource(this, audioUri);
|
||||||
|
} else {
|
||||||
|
mediaPlayer.setDataSource(audioUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
mediaPlayer.prepareAsync();
|
||||||
|
|
||||||
|
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||||
|
@Override
|
||||||
|
public void onPrepared(MediaPlayer mp) {
|
||||||
|
mediaPlayer.start();
|
||||||
|
binding.play.setImageResource(R.drawable.pause);
|
||||||
|
isPlaying = true;
|
||||||
|
mediaPlayer.setLooping(isLooping);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onError(MediaPlayer mp, int what, int extra) {
|
||||||
|
Toast.makeText(SoundActivity.this, "Error playing audio", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||||
|
@Override
|
||||||
|
public void onCompletion(MediaPlayer mp) {
|
||||||
|
if (!isLooping) {
|
||||||
|
binding.play.setImageResource(R.drawable.play);
|
||||||
|
isPlaying = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(SoundActivity.this, "Error setting data source", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isPlaying) {
|
||||||
|
mediaPlayer.pause();
|
||||||
|
binding.play.setImageResource(R.drawable.play);
|
||||||
|
} else {
|
||||||
|
mediaPlayer.start();
|
||||||
|
binding.play.setImageResource(R.drawable.pause);
|
||||||
|
}
|
||||||
|
isPlaying = !isPlaying;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadIsFavorite(HappyData happyData) {
|
||||||
|
boolean isFavorite = happyData.isFavorite();
|
||||||
|
updateFavoriteIcon(isFavorite);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadImage() {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(happyData.getPreUrl())
|
||||||
|
.placeholder(R.mipmap.placeholder)
|
||||||
|
.error(R.mipmap.placeholder)
|
||||||
|
.transform(new RoundedCorners(16))
|
||||||
|
.into(binding.image);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFavorite(HappyData happyData) {
|
||||||
|
boolean isFavorite = happyViewModel.toggleFavorite(happyData);
|
||||||
|
updateFavoriteIcon(isFavorite);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFavoriteIcon(boolean isFavorite) {
|
||||||
|
binding.favorite.setImageResource(isFavorite ? R.drawable.favorite : R.drawable.un_favorite);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
unregisterReceiver(volumeReceiver);
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
mediaPlayer.release();
|
||||||
|
mediaPlayer = null;
|
||||||
|
}
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.prank.happypranksounds.ui.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
|
||||||
|
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 com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.databinding.ActivitySplashBinding;
|
||||||
|
|
||||||
|
public class SplashActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivitySplashBinding binding;
|
||||||
|
private static final long TOTAL_TIME = 1000;
|
||||||
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
Glide.with(this)
|
||||||
|
.load(R.mipmap.placeholder)
|
||||||
|
.transform(new RoundedCorners(16))
|
||||||
|
.into(binding.image);
|
||||||
|
|
||||||
|
countDownTimer = new CountDownTimer(TOTAL_TIME, 1000) {
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
int progress = (int) (millisUntilFinished / 1000);
|
||||||
|
binding.progress.setProgress(progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
startMain();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
countDownTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startMain() {
|
||||||
|
binding.progress.setProgress(100);
|
||||||
|
|
||||||
|
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (countDownTimer != null) {
|
||||||
|
countDownTimer.cancel();
|
||||||
|
}
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.prank.happypranksounds.ui.adapter;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.ui.fragment.CategoryFragment;
|
||||||
|
import com.prank.happypranksounds.ui.fragment.FavoriteFragment;
|
||||||
|
import com.prank.happypranksounds.ui.fragment.SoundFragment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainAdapter extends FragmentStateAdapter {
|
||||||
|
|
||||||
|
private final List<Fragment> fragmentList;
|
||||||
|
|
||||||
|
public MainAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||||
|
super(fragmentActivity);
|
||||||
|
fragmentList = new ArrayList<>();
|
||||||
|
fragmentList.add(new CategoryFragment());
|
||||||
|
fragmentList.add(new SoundFragment());
|
||||||
|
fragmentList.add(new FavoriteFragment());
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
return fragmentList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return fragmentList.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,159 @@
|
|||||||
|
package com.prank.happypranksounds.ui.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
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.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.ui.activity.CategoryActivity;
|
||||||
|
import com.prank.happypranksounds.ui.activity.SoundActivity;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SoundAdapter extends RecyclerView.Adapter<SoundAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<HappyData> happyDataList;
|
||||||
|
private final HappyViewModel happyViewModel;
|
||||||
|
private final Context context;
|
||||||
|
private final int type;
|
||||||
|
|
||||||
|
private static final int PLACEHOLDER_IMAGE = R.mipmap.placeholder;
|
||||||
|
private static final int FAVORITE_ICON = R.drawable.favorite;
|
||||||
|
private static final int UN_FAVORITE_ICON = R.drawable.un_favorite;
|
||||||
|
|
||||||
|
public SoundAdapter(List<HappyData> happyDataList, HappyViewModel happyViewModel, Context context, int type) {
|
||||||
|
this.context = context;
|
||||||
|
this.happyViewModel = happyViewModel;
|
||||||
|
this.happyDataList = happyDataList;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateData(List<HappyData> newAudioDataList) {
|
||||||
|
this.happyDataList = newAudioDataList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.item_happy, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
HappyData happyData = happyDataList.get(position);
|
||||||
|
String name = getNameByType(happyData);
|
||||||
|
holder.bind(happyData, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return happyDataList != null ? happyDataList.size() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getNameByType(HappyData happyData) {
|
||||||
|
if (type == 0) {
|
||||||
|
return happyData.getCategoryName();
|
||||||
|
} else if (type == 1) {
|
||||||
|
return happyData.getTitle();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView imageView;
|
||||||
|
ImageView favorite;
|
||||||
|
TextView textView;
|
||||||
|
ConstraintLayout constraintLayout;
|
||||||
|
|
||||||
|
ViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.image_view);
|
||||||
|
favorite = itemView.findViewById(R.id.favorite);
|
||||||
|
textView = itemView.findViewById(R.id.textView);
|
||||||
|
constraintLayout = itemView.findViewById(R.id.main);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(HappyData happyData, String name) {
|
||||||
|
textView.setVisibility(View.VISIBLE);
|
||||||
|
setItemText(name);
|
||||||
|
loadImageBasedOnType(happyData);
|
||||||
|
setFavorite(happyData);
|
||||||
|
setClickListeners(happyData, name);
|
||||||
|
loadFavoriteUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFavoriteUI() {
|
||||||
|
if (type == 0) {
|
||||||
|
favorite.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
favorite.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadImageBasedOnType(HappyData happyData) {
|
||||||
|
String imagePath = (type == 0) ? happyData.getCategoryUrl() : happyData.getPreUrl();
|
||||||
|
loadImage(imagePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadImage(String imagePath) {
|
||||||
|
Glide.with(context)
|
||||||
|
.load(imagePath)
|
||||||
|
.placeholder(PLACEHOLDER_IMAGE)
|
||||||
|
.error(PLACEHOLDER_IMAGE)
|
||||||
|
.transform(new RoundedCorners(32))
|
||||||
|
.into(imageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setItemText(String name) {
|
||||||
|
textView.setText(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFavorite(@NonNull HappyData happyData) {
|
||||||
|
int favoriteIcon = happyData.isFavorite() ? FAVORITE_ICON : UN_FAVORITE_ICON;
|
||||||
|
favorite.setImageResource(favoriteIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setClickListeners(final HappyData happyData, String name) {
|
||||||
|
imageView.setOnClickListener(v -> {
|
||||||
|
Intent intent = getIntentBasedOnType(happyData, name);
|
||||||
|
context.startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
favorite.setOnClickListener(v -> toggleFavorite(happyData));
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private Intent getIntentBasedOnType(HappyData happyData, String name) {
|
||||||
|
Intent intent;
|
||||||
|
if (type == 0) {
|
||||||
|
intent = new Intent(context, CategoryActivity.class);
|
||||||
|
intent.putExtra("name", name);
|
||||||
|
} else {
|
||||||
|
intent = new Intent(context, SoundActivity.class);
|
||||||
|
intent.putExtra("audioData", happyData);
|
||||||
|
}
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleFavorite(@NonNull HappyData happyData) {
|
||||||
|
boolean newStatus = !happyData.isFavorite();
|
||||||
|
happyData.setFavorite(newStatus);
|
||||||
|
happyViewModel.update(happyData);
|
||||||
|
favorite.setImageResource(newStatus ? FAVORITE_ICON : UN_FAVORITE_ICON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.prank.happypranksounds.ui.fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.databinding.FragmentCategoryBinding;
|
||||||
|
import com.prank.happypranksounds.ui.adapter.SoundAdapter;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
import com.prank.happypranksounds.util.ItemDecoration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CategoryFragment extends Fragment {
|
||||||
|
|
||||||
|
private FragmentCategoryBinding binding;
|
||||||
|
private SoundAdapter adapter;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
binding = FragmentCategoryBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
|
||||||
|
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
|
||||||
|
adapter = new SoundAdapter(new ArrayList<>(), happyViewModel, requireContext(), 0);
|
||||||
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
ItemDecoration itemDecoration = new ItemDecoration(16, 19, 10);
|
||||||
|
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
loadFirstCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFirstCategory() {
|
||||||
|
happyViewModel
|
||||||
|
.getFirstCategory()
|
||||||
|
.observe(getViewLifecycleOwner(), new Observer<List<HappyData>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<HappyData> happyDataList) {
|
||||||
|
if (happyDataList != null) {
|
||||||
|
adapter.updateData(happyDataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.prank.happypranksounds.ui.fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.databinding.FragmentFavoriteBinding;
|
||||||
|
import com.prank.happypranksounds.ui.adapter.SoundAdapter;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
import com.prank.happypranksounds.util.ItemDecoration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FavoriteFragment extends Fragment {
|
||||||
|
|
||||||
|
private FragmentFavoriteBinding binding;
|
||||||
|
private SoundAdapter adapter;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
binding = FragmentFavoriteBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
|
||||||
|
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||||
|
|
||||||
|
adapter = new SoundAdapter(new ArrayList<>(), happyViewModel, requireContext(), 1);
|
||||||
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
ItemDecoration itemDecoration = new ItemDecoration(16, 19, 10);
|
||||||
|
binding.recyclerView.addItemDecoration(itemDecoration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
loadFavorite();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFavorite() {
|
||||||
|
happyViewModel
|
||||||
|
.getFavorite()
|
||||||
|
.observe(getViewLifecycleOwner(), new Observer<List<HappyData>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<HappyData> happyDataList) {
|
||||||
|
if (happyDataList != null) {
|
||||||
|
updateUIForEmptyData(happyDataList);
|
||||||
|
adapter.updateData(happyDataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUIForEmptyData(List<HappyData> dataList) {
|
||||||
|
if (dataList.isEmpty()) {
|
||||||
|
binding.favoriteText.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.favoriteText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,206 @@
|
|||||||
|
package com.prank.happypranksounds.ui.fragment;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import com.prank.happypranksounds.R;
|
||||||
|
import com.prank.happypranksounds.callback.HappyCallback;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.data.repository.HappyRepository;
|
||||||
|
import com.prank.happypranksounds.databinding.FragmentSoundBinding;
|
||||||
|
import com.prank.happypranksounds.ui.activity.RecordActivity;
|
||||||
|
import com.prank.happypranksounds.ui.adapter.SoundAdapter;
|
||||||
|
import com.prank.happypranksounds.ui.viewmodel.HappyViewModel;
|
||||||
|
import com.prank.happypranksounds.util.HappySoundUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SoundFragment extends Fragment implements HappyCallback.OnItemSwipeListener {
|
||||||
|
|
||||||
|
private FragmentSoundBinding binding;
|
||||||
|
private SoundAdapter adapter;
|
||||||
|
private HappyViewModel happyViewModel;
|
||||||
|
private Uri audioUri;
|
||||||
|
private String fileName;
|
||||||
|
private List<HappyData> happyDataList = new ArrayList<>();
|
||||||
|
private static final int REQUEST_CODE_READ_MEDIA_AUDIO = 1001;
|
||||||
|
private static final int REQUEST_CODE_PICK_AUDIO = 1002;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
binding = FragmentSoundBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
happyViewModel = new ViewModelProvider(this).get(HappyViewModel.class);
|
||||||
|
|
||||||
|
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
|
||||||
|
adapter = new SoundAdapter(happyDataList, happyViewModel, requireContext(), 1);
|
||||||
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
HappyCallback callback = new HappyCallback(this);
|
||||||
|
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
|
||||||
|
itemTouchHelper.attachToRecyclerView(binding.recyclerView);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
binding.add.setOnClickListener(v -> {
|
||||||
|
showCustomBottomSheetDialog();
|
||||||
|
});
|
||||||
|
loadExt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadExt() {
|
||||||
|
happyViewModel.getExternal().observe(getViewLifecycleOwner(), dataList -> {
|
||||||
|
updateUIForEmptyData(dataList);
|
||||||
|
happyDataList = dataList;
|
||||||
|
adapter.updateData(dataList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUIForEmptyData(List<HappyData> dataList) {
|
||||||
|
if (dataList.isEmpty()) {
|
||||||
|
binding.soundText.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.soundText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showCustomBottomSheetDialog() {
|
||||||
|
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(requireContext());
|
||||||
|
View dialogView = LayoutInflater.from(requireContext()).inflate(R.layout.sound_dialog, null);
|
||||||
|
|
||||||
|
bottomSheetDialog.setCanceledOnTouchOutside(false);
|
||||||
|
|
||||||
|
dialogView.findViewById(R.id.import_audio).setOnClickListener(v -> onImportAudioClicked(bottomSheetDialog));
|
||||||
|
dialogView.findViewById(R.id.create).setOnClickListener(v -> onCreateClicked(bottomSheetDialog));
|
||||||
|
dialogView.findViewById(R.id.cancel_button).setOnClickListener(v -> bottomSheetDialog.dismiss());
|
||||||
|
|
||||||
|
bottomSheetDialog.setContentView(dialogView);
|
||||||
|
bottomSheetDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onImportAudioClicked(BottomSheetDialog bottomSheetDialog) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
openAudioPicker();
|
||||||
|
} else {
|
||||||
|
if (ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(requireActivity(),
|
||||||
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
REQUEST_CODE_READ_MEDIA_AUDIO);
|
||||||
|
} else {
|
||||||
|
openAudioPicker();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCreateClicked(BottomSheetDialog bottomSheetDialog) {
|
||||||
|
Intent intent = new Intent(getActivity(), RecordActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
switch (requestCode) {
|
||||||
|
case REQUEST_CODE_READ_MEDIA_AUDIO:
|
||||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
openAudioPicker();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireContext(), "Permission denied to read your audio files", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openAudioPicker() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
|
intent.setType("audio/*");
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
startActivityForResult(intent, REQUEST_CODE_PICK_AUDIO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (requestCode != REQUEST_CODE_PICK_AUDIO || resultCode != RESULT_OK || data == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
audioUri = data.getData();
|
||||||
|
if (audioUri == null) {
|
||||||
|
Toast.makeText(requireContext(), "The file could not be found.", Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName = HappySoundUtil.getFileName(audioUri, requireActivity());
|
||||||
|
|
||||||
|
try {
|
||||||
|
happyViewModel.getCountAsync(audioUri.toString(), new HappyRepository.CountCallback() {
|
||||||
|
@Override
|
||||||
|
public void onCountFetched(int count) {
|
||||||
|
if (count > 0) {
|
||||||
|
Toast.makeText(requireContext(), "This file has been imported and cannot be imported again", Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
|
happyViewModel.insert(new HappyData(fileName, audioUri.toString(), fileName, audioUri.toString(), "", false, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(requireContext(), "Failed to insert database: " + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemSwiped(int position) {
|
||||||
|
deleteItem(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteItem(int position) {
|
||||||
|
HappyData happyData = happyDataList.get(position);
|
||||||
|
try {
|
||||||
|
happyViewModel.delete(happyData);
|
||||||
|
Toast.makeText(getContext(), "Sound deleted successfully.", Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(getContext(), "Failed to delete sound.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.prank.happypranksounds.ui.viewmodel;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.data.dao.HappyDataDao;
|
||||||
|
import com.prank.happypranksounds.data.database.AppDatabase;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
import com.prank.happypranksounds.data.repository.HappyRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HappyViewModel extends AndroidViewModel {
|
||||||
|
private final HappyRepository happyRepository;
|
||||||
|
|
||||||
|
public HappyViewModel(@NonNull Application application) {
|
||||||
|
super(application);
|
||||||
|
HappyDataDao wallpaperInfoDao = AppDatabase.getInstance(application).happyDataDao();
|
||||||
|
happyRepository = new HappyRepository(wallpaperInfoDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(HappyData happyData) {
|
||||||
|
happyRepository.insert(happyData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(HappyData happyData) {
|
||||||
|
happyRepository.update(happyData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(HappyData happyData) {
|
||||||
|
happyRepository.delete(happyData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getFavorite() {
|
||||||
|
return happyRepository.getFavorite();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getFirstCategory() {
|
||||||
|
return happyRepository.getFirstCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getCategoryList(String name) {
|
||||||
|
return happyRepository.getCategoryList(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean toggleFavorite(@NonNull HappyData happyData) {
|
||||||
|
boolean isFavorite = !happyData.isFavorite();
|
||||||
|
happyData.setFavorite(isFavorite);
|
||||||
|
happyRepository.update(happyData);
|
||||||
|
return isFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<HappyData>> getExternal() {
|
||||||
|
return happyRepository.getExternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCountAsync(String uri, HappyRepository.CountCallback callback) {
|
||||||
|
happyRepository.getCountAsync(uri, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.prank.happypranksounds.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class HappySoundUtil {
|
||||||
|
|
||||||
|
public static String getFileName(Uri uri, Activity activity) {
|
||||||
|
String result = null;
|
||||||
|
if (Objects.equals(uri.getScheme(), "content")) {
|
||||||
|
try (Cursor cursor = activity.getContentResolver().query(uri, null, null, null, null)) {
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
int displayNameIndex = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||||
|
if (displayNameIndex != -1) {
|
||||||
|
result = cursor.getString(displayNameIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result == null) {
|
||||||
|
result = uri.getPath();
|
||||||
|
assert result != null;
|
||||||
|
int cut = result.lastIndexOf('/');
|
||||||
|
if (cut != -1) {
|
||||||
|
result = result.substring(cut + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatTime(long elapsedTime) {
|
||||||
|
int seconds = (int) (elapsedTime / 1000) % 60;
|
||||||
|
int minutes = (int) ((elapsedTime / (1000 * 60)) % 60);
|
||||||
|
int hours = (int) ((elapsedTime / (1000 * 60 * 60)) % 24);
|
||||||
|
return String.format(Locale.getDefault(),"%02d:%02d:%02d", hours, minutes, seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.prank.happypranksounds.util;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.MyApplication;
|
||||||
|
|
||||||
|
public class ItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
|
private final int v;
|
||||||
|
private final int h;
|
||||||
|
private final int ex;
|
||||||
|
|
||||||
|
public ItemDecoration(int v, int h, int ex) {
|
||||||
|
this.v = Math.round(dpToPx(v));
|
||||||
|
this.h = Math.round(dpToPx(h));
|
||||||
|
this.ex = Math.round(dpToPx(ex));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state);
|
||||||
|
int spanCount = 1;
|
||||||
|
int spanSize = 1;
|
||||||
|
int spanIndex = 0;
|
||||||
|
|
||||||
|
int childAdapterPosition = parent.getChildAdapterPosition(view);
|
||||||
|
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||||
|
if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||||
|
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
|
||||||
|
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||||
|
spanCount = staggeredGridLayoutManager.getSpanCount();
|
||||||
|
if (layoutParams.isFullSpan()) {
|
||||||
|
spanSize = spanCount;
|
||||||
|
}
|
||||||
|
spanIndex = layoutParams.getSpanIndex();
|
||||||
|
} else if (layoutManager instanceof GridLayoutManager) {
|
||||||
|
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
|
||||||
|
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||||
|
spanCount = gridLayoutManager.getSpanCount();
|
||||||
|
spanSize = gridLayoutManager.getSpanSizeLookup().getSpanSize(childAdapterPosition);
|
||||||
|
spanIndex = layoutParams.getSpanIndex();
|
||||||
|
} else if (layoutManager instanceof LinearLayoutManager) {
|
||||||
|
outRect.left = v;
|
||||||
|
outRect.right = v;
|
||||||
|
outRect.bottom = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spanSize == spanCount) {
|
||||||
|
outRect.left = v + ex;
|
||||||
|
outRect.right = v + ex;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
int itemAllSpacing = (v * (spanCount + 1) + ex * 2) / spanCount;
|
||||||
|
int left = v * (spanIndex + 1) - itemAllSpacing * spanIndex + ex;
|
||||||
|
int right = itemAllSpacing - left;
|
||||||
|
outRect.left = left;
|
||||||
|
outRect.right = right;
|
||||||
|
|
||||||
|
}
|
||||||
|
outRect.bottom = h;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float dpToPx(float dpValue) {
|
||||||
|
float density = MyApplication.getContext().getResources().getDisplayMetrics().density;
|
||||||
|
return density * dpValue + 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.prank.happypranksounds.util;
|
||||||
|
|
||||||
|
import com.prank.happypranksounds.MyApplication;
|
||||||
|
import com.prank.happypranksounds.data.entity.HappyData;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JsonParser {
|
||||||
|
|
||||||
|
private static String loadJSONFromAsset(String fileName) {
|
||||||
|
StringBuilder jsonString = new StringBuilder();
|
||||||
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(MyApplication.getContext().getAssets().open(fileName)))) {
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
jsonString.append(line);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return jsonString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<HappyData> parseJson(String fileName) {
|
||||||
|
List<HappyData> audioDataList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
String jsonString = loadJSONFromAsset(fileName);
|
||||||
|
if (jsonString.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("JSON file is empty or invalid.");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray jsonArray = new JSONArray(jsonString);
|
||||||
|
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
JSONObject categoryObject = jsonArray.getJSONObject(i);
|
||||||
|
|
||||||
|
String name = categoryObject.getString("categoryName");
|
||||||
|
String url = categoryObject.getString("categoryUrl");
|
||||||
|
|
||||||
|
JSONArray listArray = categoryObject.getJSONArray("list");
|
||||||
|
|
||||||
|
for (int j = 0; j < listArray.length(); j++) {
|
||||||
|
JSONObject itemObject = listArray.getJSONObject(j);
|
||||||
|
|
||||||
|
String title = itemObject.getString("title");
|
||||||
|
String mp3Url = itemObject.getString("mp3Url");
|
||||||
|
String preUrl = itemObject.getString("preUrl");
|
||||||
|
|
||||||
|
audioDataList.add(new HappyData(name, url, title, mp3Url, preUrl, false,false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return audioDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/add.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M0,512.1a511.9,511.9 0,1 1,511.9 511.9,511.9 511.9,0 0,1 -511.9,-511.9zM128,512.1a383.9,383.9 0,1 0,383.9 -383.9,384.3 384.3,0 0,0 -383.9,383.9zM447.9,736.1v-160L287.9,576.1a64,64 0,1 1,0 -128L447.9,448.1v-160a64,64 0,0 1,128 0v160h160a64,64 0,0 1,0 128L575.9,576.1v160a64,64 0,1 1,-128 0z"
|
||||||
|
android:fillColor="#8F9BB3"/>
|
||||||
|
</vector>
|
||||||
20
app/src/main/res/drawable/back.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="32dp"
|
||||||
|
android:height="32dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M5.799,24H41.799"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M17.799,36L5.799,24L17.799,12"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
30
app/src/main/res/drawable/category.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M18,6H8C6.895,6 6,6.895 6,8V18C6,19.105 6.895,20 8,20H18C19.105,20 20,19.105 20,18V8C20,6.895 19.105,6 18,6Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M18,28H8C6.895,28 6,28.895 6,30V40C6,41.105 6.895,42 8,42H18C19.105,42 20,41.105 20,40V30C20,28.895 19.105,28 18,28Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M40,6H30C28.895,6 28,6.895 28,8V18C28,19.105 28.895,20 30,20H40C41.105,20 42,19.105 42,18V8C42,6.895 41.105,6 40,6Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M40,28H30C28.895,28 28,28.895 28,30V40C28,41.105 28.895,42 30,42H40C41.105,42 42,41.105 42,40V30C42,28.895 41.105,28 40,28Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"/>
|
||||||
|
</vector>
|
||||||
15
app/src/main/res/drawable/close.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="32dp"
|
||||||
|
android:height="32dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M872.8,756 L872.9,756 872.9,755.6Z"
|
||||||
|
android:fillColor="#FF000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M927.8,512c0,-229.3 -186.6,-415.8 -415.8,-415.8 -229.3,0 -415.9,186.5 -415.9,415.8 0,229.3 186.5,415.8 415.9,415.8C741.3,927.8 927.8,741.3 927.8,512M512,868.2c-196.4,0 -356.2,-159.8 -356.2,-356.2 0,-196.4 159.8,-356.2 356.2,-356.2 196.3,0 356.1,159.8 356.1,356.2C868.2,708.3 708.4,868.2 512,868.2"
|
||||||
|
android:fillColor="#FF000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M682.4,642.2 L553.8,513.3 682.3,386.2c11.7,-11.5 11.7,-30.3 0.2,-42 -11.5,-11.7 -30.4,-11.8 -42,-0.2L511.9,471.2 385.2,344.1c-11.6,-11.6 -30.4,-11.7 -42,-0.1 -11.6,11.6 -11.6,30.4 -0.1,42l126.5,126.9L342.1,639.1c-11.7,11.5 -11.8,30.3 -0.2,42 5.8,5.9 13.4,8.8 21.1,8.8 7.5,0 15.1,-2.9 20.9,-8.6l127.7,-126.3L640.3,684.2c5.8,5.8 13.4,8.7 21.1,8.7 7.6,0 15.2,-2.9 21,-8.7C693.9,672.7 694,653.9 682.4,642.2"
|
||||||
|
android:fillColor="#FF000000"/>
|
||||||
|
</vector>
|
||||||
36
app/src/main/res/drawable/collection.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M10.858,9.858C7.239,13.477 5,18.477 5,24C5,29.523 7.239,34.523 10.858,38.142"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M39.142,38.142C42.761,34.523 45,29.523 45,24C45,18.477 42.761,13.477 39.142,9.858"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M34.899,33.9C37.433,31.366 39,27.866 39,24C39,20.134 37.433,16.634 34.899,14.101"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M15.101,14.101C12.567,16.634 11,20.134 11,24C11,27.866 12.567,31.366 15.101,33.9"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M28.182,20C30.291,20 32,21.612 32,23.6C32,26.188 29.455,28.4 28.182,29.6C27.333,30.4 26.273,31.2 25,32C23.727,31.2 22.667,30.4 21.818,29.6C20.545,28.4 18,26.188 18,23.6C18,21.612 19.709,20 21.818,20C23.146,20 24.316,20.639 25,21.609C25.684,20.639 26.854,20 28.182,20Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/down.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="20.4dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1306"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M614.4,7.8L227.3,275.8L42.6,275.8C19.1,275.8 0,294 0,316.5v391c0,22.5 19.1,40.7 42.6,40.7h184.7L614.4,1016.2c28.2,19.5 67.7,0.3 67.7,-33L682.1,40.8c0,-33.3 -39.5,-52.5 -67.7,-33zM596.8,903.4L266.2,674.5l-0.5,-0.3c-0.7,-0.5 -1.4,-0.9 -2.1,-1.3 -0.5,-0.3 -1,-0.6 -1.5,-0.9s-1.5,-0.7 -2.2,-1.1 -1.1,-0.5 -1.6,-0.8 -1.4,-0.5 -2.1,-0.8 -1.2,-0.5 -1.9,-0.7 -1.3,-0.4 -1.9,-0.5 -1.5,-0.4 -2.1,-0.5 -1.2,-0.2 -1.8,-0.3 -1.6,-0.3 -2.4,-0.4c-0.6,0 -1.2,-0.1 -1.7,-0.1 -0.8,0 -1.7,-0.1 -2.5,-0.1L85.3,666.8L85.3,357.2h155.9a44,44 0,0 0,25 -7.7L596.8,120.6zM909.6,512v56.4h397v-56.4z"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/edit_background.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!-- rounded_edittext.xml -->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#EEF1FF" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/yellow" />
|
||||||
|
</shape>
|
||||||
13
app/src/main/res/drawable/favorite.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M15,8C8.925,8 4,12.925 4,19C4,30 17,40 24,42.326C31,40 44,30 44,19C44,12.925 39.075,8 33,8C29.28,8 25.991,9.847 24,12.674C22.009,9.847 18.72,8 15,8Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#d0021b"
|
||||||
|
android:strokeColor="#d0021b"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
||||||
21
app/src/main/res/drawable/import_sound.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M906.5,756.8H632.9c-23,0 -43.2,-20.2 -43.2,-43.2s20.2,-43.2 43.2,-43.2h273.6c23,0 43.2,20.2 43.2,43.2s-20.2,43.2 -43.2,43.2z"
|
||||||
|
android:fillColor="#409EFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M631.3,756.8c-11.6,0 -23,-2.9 -28.8,-11.6 -17.3,-17.3 -17.3,-43.2 0,-60.5L732.2,555.2c17.3,-17.3 43.2,-17.3 60.5,0s17.3,43.2 0,60.5L663,745.4c-11.6,8.6 -23,11.5 -31.7,11.5z"
|
||||||
|
android:fillColor="#409EFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M761.4,886.4c-11.6,0 -23,-2.9 -28.8,-11.6L603,745.4c-17.3,-17.3 -17.3,-43.2 0,-60.5s43.2,-17.3 60.5,0l129.6,129.5c17.3,17.3 17.3,43.2 0,60.5 -8.7,5.7 -20.3,11.5 -31.7,11.5z"
|
||||||
|
android:fillColor="#409EFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M851.9,932.5a126.7,126.7 0,0 1,-89.3 37.5c-34.6,0 -63.4,-11.6 -89.3,-37.5L546.5,802.9c-17.3,-17.3 -28.8,-40.3 -34.6,-63.4 -2.9,-8.6 -2.9,-17.3 -2.9,-25.9s0,-17.3 2.9,-25.9c5.7,-23 17.3,-46.1 34.6,-63.4L676,494.6c48.4,-49.4 127.7,-50 177,-1.5l1.5,1.5c17.6,17.6 52,62.2 67.3,82.1 1.4,1.8 4.1,2.3 5.9,0.8 1,-0.8 1.6,-2 1.6,-3.4V280.1c0,-65.6 -53.8,-119.4 -119.4,-119.4H314.6c-65.6,0 -119.4,53.8 -119.4,119.4v573.3c0,65.6 53.8,119.4 119.4,119.4h492.6c65.6,0 119.4,-53.8 119.4,-119.4 0,-2.4 -1.8,-4.2 -4.2,-4.2a4,4 0,0 0,-3.4 1.7c-14.7,20.2 -47.6,64.1 -67.2,81.5z"
|
||||||
|
android:fillColor="#409EFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M131.8,823.1V212.5c0,-66.3 54.7,-120.9 120.9,-120.9h524.2C756.8,68.5 725.1,51.2 690.6,51.2H189.4C126.1,51.2 74.2,103 74.2,166.4v584.6c0,43.2 23,80.6 60.5,100.8 -3,-11.5 -3,-20.1 -3,-28.7z"
|
||||||
|
android:fillColor="#409EFF"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/loop.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M170.7,724.4c-17.4,0 -31.8,-14.2 -31.8,-31.6 0,-17.6 14.4,-31.8 31.8,-31.8h82.4c43.3,0 93.9,-56.2 146,-123l9.2,12.2c10.4,13.3 20.3,26.6 30.3,39.7 -58.7,73.6 -118.7,134.5 -185.5,134.5h-82.4zM879.5,344.8l-52.4,52.4v0.2l-52.3,52.4c-7.5,7.2 -19.4,7.2 -27.1,0 -4.1,-4.1 -5.9,-9.7 -5.4,-14.9L742.3,363.1h-77.8c-43.3,0 -93.6,56.2 -146,123l-9,-12.2c-10.4,-13.3 -20.3,-26.6 -30.7,-39.7 59.1,-73.6 119.1,-134.7 185.7,-134.7h77.8v-72.9c0,-10.4 8.6,-19.2 19,-19.2 5.2,0 10.4,2.5 13.5,5.6l52.3,52.6 52.4,52.1c7.4,7.7 7.4,19.6 0.5,27.1h-0.4v-0zM839.3,331.3c-19.9,-19.4 -39.5,-39.3 -59.1,-58.9v117.8c19.6,-19.6 39.3,-39 59.1,-58.9zM879.5,706.1h0.5c7,-7.4 7,-19.6 -0.5,-26.9l-52.4,-52.3 -52.3,-52.4c-3.2,-3.6 -8.4,-5.8 -13.5,-5.8 -10.4,0 -19,8.6 -19,19v73.3h-77.8c-53,0 -116.6,-84.2 -180.3,-168.1 -73.6,-96.6 -146.7,-193.4 -231.1,-193.4h-82.4c-17.4,0 -31.8,14.4 -31.8,31.8 0,17.6 14.4,31.8 31.8,31.8h82.4c53,0 116.9,84.2 180.5,168.1 73.3,96.6 146.7,193.2 230.8,193.2h77.8v71.7c-0.4,5.4 1.4,10.8 5.4,14.9 7.7,7.4 19.6,7.4 27.1,0l52.3,-52.6 52.4,-52.3zM839.3,692.8c-19.9,19.4 -39.5,39 -59.1,59.1L780.2,633.7l20.1,20.3 39,38.8z"
|
||||||
|
android:fillColor="#FF000000"/>
|
||||||
|
</vector>
|
||||||
15
app/src/main/res/drawable/microphone.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M801.7,364.8a32,32 0,0 0,-32 32v91.4c0,129.3 -115.6,234.4 -257.7,234.4S254.3,617.4 254.3,488.2V393.2a32,32 0,0 0,-64 0v95c0,157.9 133.2,286.2 300.7,296.4v111.5H357.6c-16.1,0 -29.2,14.3 -29.2,32.1 0,17.7 13.1,31.9 29.2,31.9h319c16.1,0 29.2,-14.3 29.2,-31.9 0,-17.7 -13.1,-32.1 -29.2,-32.1H554.9v-113.5c157,-19.8 278.8,-143.5 278.8,-294.5V396.8c0,-17.7 -14.3,-32 -32,-32z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M602.2,502m-49.9,0a49.9,49.9 0,1 0,99.7 0,49.9 49.9,0 1,0 -99.7,0Z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M517.1,69.9a199,199 0,0 0,-198.8 198.8v211.1a199,199 0,0 0,198.8 198.8,199.1 199.1,0 0,0 198.9,-198.8L716,268.7A199,199 0,0 0,517.1 69.9zM652,297.2L382.3,297.2v-28.5c0,-74.4 60.5,-134.8 134.8,-134.8a135,135 0,0 1,134.9 134.8v28.5z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/pause.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M512,967.1c-250.3,0 -455.1,-204.8 -455.1,-455.1s204.8,-455.1 455.1,-455.1 455.1,204.8 455.1,455.1 -204.8,455.1 -455.1,455.1zM512,910.2c221.9,0 398.2,-176.4 398.2,-398.2s-176.4,-398.2 -398.2,-398.2 -398.2,176.4 -398.2,398.2 176.4,398.2 398.2,398.2zM426.7,284.4c17.1,0 28.4,11.4 28.4,28.4v398.2c0,17.1 -11.4,28.4 -28.4,28.4s-28.4,-11.4 -28.4,-28.4v-398.2c0,-17.1 11.4,-28.4 28.4,-28.4zM597.3,284.4c17.1,0 28.4,11.4 28.4,28.4v398.2c0,17.1 -11.4,28.4 -28.4,28.4s-28.4,-11.4 -28.4,-28.4v-398.2c0,-17.1 11.4,-28.4 28.4,-28.4z"
|
||||||
|
android:fillColor="#FF000000"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/play.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M512,37.9C251.2,37.9 37.9,251.3 37.9,512s213.4,474.1 474.1,474.1 474.1,-213.4 474.1,-474.1S772.7,37.9 512,37.9zM512,946.6c-239,0 -434.6,-195.6 -434.6,-434.6 0,-239 195.6,-434.6 434.6,-434.6 239,0 434.6,195.6 434.6,434.6 0,239 -195.6,434.6 -434.6,434.6z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M660.7,444.4L499.2,338.9c-54.5,-35.8 -101,-11.9 -101,53.7v238.6c0,65.6 44.4,89.5 101,53.7l161.5,-105.4c54.5,-39.8 54.5,-99.4 0,-135.3z"/>
|
||||||
|
</vector>
|
||||||
20
app/src/main/res/drawable/progress_gradient.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="5dp" />
|
||||||
|
<solid android:color="#D3D3D3" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="5dp" />
|
||||||
|
<gradient
|
||||||
|
android:startColor="#4891FF"
|
||||||
|
android:endColor="#6CE89E"
|
||||||
|
android:angle="0" />
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
9
app/src/main/res/drawable/progress_thumb.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#4C9AF7" />
|
||||||
|
<stroke android:color="@color/white" android:width="4dp"/>
|
||||||
|
<size
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp" />
|
||||||
|
</shape>
|
||||||
21
app/src/main/res/drawable/record.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M906.1,471.9c0,-38.3 -31.1,-69.4 -69.4,-69.4H296.6c-38.3,0 -69.4,31.1 -69.4,69.4v372.4c0,38.3 31.1,69.4 69.4,69.4h540.1c38.3,0 69.4,-31.1 69.4,-69.4v-372.4z"
|
||||||
|
android:fillColor="#FFCB01"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M352.4,604.2m-107,0a107,107 0,1 0,214.1 0,107 107,0 1,0 -214.1,0Z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M566.6,525.1h216.8a23.8,23.8 0,0 0,0 -47.6H566.6c-13.1,0 -23.8,10.7 -23.8,23.8 0,13.1 10.7,23.8 23.8,23.8zM566.6,731.4h216.8a23.8,23.8 0,0 0,0 -47.6H566.6c-13.1,0 -23.8,10.7 -23.8,23.8 0,13.1 10.7,23.8 23.8,23.8z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M937.9,371.9c0,-64.5 -52.4,-116.9 -116.9,-116.9L205.9,255.1c-64.5,0 -116.9,52.4 -116.9,116.9v456.7c0,64.5 52.4,116.9 116.9,116.9h615.1c64.5,0 116.9,-52.4 116.9,-116.9v-456.7zM874.4,371.9v456.7a53.4,53.4 0,0 1,-53.4 53.4L205.9,881.9a53.4,53.4 0,0 1,-53.4 -53.4v-456.7a53.4,53.4 0,0 1,53.4 -53.4h615.1a53.4,53.4 0,0 1,53.4 53.4z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M249.5,305.2l343.4,-180.8a23.8,23.8 0,0 0,10 -32.2,23.8 23.8,0 0,0 -32.2,-10L227.3,263.1a23.8,23.8 0,0 0,22.2 42.1z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/rounded_rectangle_gradient.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="45"
|
||||||
|
android:endColor="#C5CAE9"
|
||||||
|
android:startColor="#FFEB3B"
|
||||||
|
android:type="linear"
|
||||||
|
android:useLevel="false" />
|
||||||
|
<corners android:radius="16sp" />
|
||||||
|
</shape>
|
||||||
15
app/src/main/res/drawable/save.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="16dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M701.3,316.1c15.9,0 28.8,-13.3 28.8,-29.8v-57.6c0,-16.4 -12.9,-29.8 -28.8,-29.8s-28.8,13.3 -28.8,29.8v57.6c0,16.5 12.9,29.8 28.8,29.8z"
|
||||||
|
android:fillColor="#00D8A0"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M820.6,960H203.8c-77.2,0 -140,-62.8 -140,-140V203.2c0,-77.2 62.8,-140 140,-140h616.7c77.2,0 140,62.8 140,140v616.7c0.1,77.3 -62.7,140.1 -139.9,140.1zM203.8,103.2c-55.2,0 -100,44.9 -100,100v616.7c0,55.2 44.9,100 100,100h616.7c55.2,0 100,-44.9 100,-100V203.2c0,-55.2 -44.9,-100 -100,-100H203.8z"
|
||||||
|
android:fillColor="#1A1A1A"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M764.7,442.1H261.9c-39,0 -70.7,-31.7 -70.7,-70.7V79.9h40v291.5c0,16.9 13.8,30.7 30.7,30.7h502.8c16.9,0 30.7,-13.8 30.7,-30.7V79.9h40v291.5c0,39 -31.7,70.7 -70.7,70.7z"
|
||||||
|
android:fillColor="#1A1A1A"/>
|
||||||
|
</vector>
|
||||||
13
app/src/main/res/drawable/sound.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M42.5,16.387C41.552,14.086 40.187,12.001 38.5,10.225C34.856,6.391 29.707,4 24,4C12.954,4 4,12.954 4,24H14L19,32L28,14L35,24H44C44,35.046 35.046,44 24,44C18.549,44 13.608,41.819 10,38.283C8.18,36.499 6.699,34.369 5.664,32"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FF000000"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
30
app/src/main/res/drawable/un_category.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M18,6H8C6.895,6 6,6.895 6,8V18C6,19.105 6.895,20 8,20H18C19.105,20 20,19.105 20,18V8C20,6.895 19.105,6 18,6Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M18,28H8C6.895,28 6,28.895 6,30V40C6,41.105 6.895,42 8,42H18C19.105,42 20,41.105 20,40V30C20,28.895 19.105,28 18,28Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M40,6H30C28.895,6 28,6.895 28,8V18C28,19.105 28.895,20 30,20H40C41.105,20 42,19.105 42,18V8C42,6.895 41.105,6 40,6Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M40,28H30C28.895,28 28,28.895 28,30V40C28,41.105 28.895,42 30,42H40C41.105,42 42,41.105 42,40V30C42,28.895 41.105,28 40,28Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"/>
|
||||||
|
</vector>
|
||||||
36
app/src/main/res/drawable/un_collection.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M10.858,9.858C7.239,13.477 5,18.477 5,24C5,29.523 7.239,34.523 10.858,38.142"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M39.142,38.142C42.761,34.523 45,29.523 45,24C45,18.477 42.761,13.477 39.142,9.858"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M34.899,33.9C37.433,31.366 39,27.866 39,24C39,20.134 37.433,16.634 34.899,14.101"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M15.101,14.101C12.567,16.634 11,20.134 11,24C11,27.866 12.567,31.366 15.101,33.9"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M28.182,20C30.291,20 32,21.612 32,23.6C32,26.188 29.455,28.4 28.182,29.6C27.333,30.4 26.273,31.2 25,32C23.727,31.2 22.667,30.4 21.818,29.6C20.545,28.4 18,26.188 18,23.6C18,21.612 19.709,20 21.818,20C23.146,20 24.316,20.639 25,21.609C25.684,20.639 26.854,20 28.182,20Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"/>
|
||||||
|
</vector>
|
||||||
13
app/src/main/res/drawable/un_favorite.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M15,8C8.925,8 4,12.925 4,19C4,30 17,40 24,42.326C31,40 44,30 44,19C44,12.925 39.075,8 33,8C29.28,8 25.991,9.847 24,12.674C22.009,9.847 18.72,8 15,8Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#333"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/un_loop.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M170.7,724.4c-17.4,0 -31.8,-14.2 -31.8,-31.6 0,-17.6 14.4,-31.8 31.8,-31.8h82.4c43.3,0 93.9,-56.2 146,-123l9.2,12.2c10.4,13.3 20.3,26.6 30.3,39.7 -58.7,73.6 -118.7,134.5 -185.5,134.5h-82.4zM879.5,344.8l-52.4,52.4v0.2l-52.3,52.4c-7.5,7.2 -19.4,7.2 -27.1,0 -4.1,-4.1 -5.9,-9.7 -5.4,-14.9L742.3,363.1h-77.8c-43.3,0 -93.6,56.2 -146,123l-9,-12.2c-10.4,-13.3 -20.3,-26.6 -30.7,-39.7 59.1,-73.6 119.1,-134.7 185.7,-134.7h77.8v-72.9c0,-10.4 8.6,-19.2 19,-19.2 5.2,0 10.4,2.5 13.5,5.6l52.3,52.6 52.4,52.1c7.4,7.7 7.4,19.6 0.5,27.1h-0.4v-0zM839.3,331.3c-19.9,-19.4 -39.5,-39.3 -59.1,-58.9v117.8c19.6,-19.6 39.3,-39 59.1,-58.9zM879.5,706.1h0.5c7,-7.4 7,-19.6 -0.5,-26.9l-52.4,-52.3 -52.3,-52.4c-3.2,-3.6 -8.4,-5.8 -13.5,-5.8 -10.4,0 -19,8.6 -19,19v73.3h-77.8c-53,0 -116.6,-84.2 -180.3,-168.1 -73.6,-96.6 -146.7,-193.4 -231.1,-193.4h-82.4c-17.4,0 -31.8,14.4 -31.8,31.8 0,17.6 14.4,31.8 31.8,31.8h82.4c53,0 116.9,84.2 180.5,168.1 73.3,96.6 146.7,193.2 230.8,193.2h77.8v71.7c-0.4,5.4 1.4,10.8 5.4,14.9 7.7,7.4 19.6,7.4 27.1,0l52.3,-52.6 52.4,-52.3zM839.3,692.8c-19.9,19.4 -39.5,39 -59.1,59.1L780.2,633.7l20.1,20.3 39,38.8z"
|
||||||
|
android:fillColor="#717071"/>
|
||||||
|
</vector>
|
||||||
13
app/src/main/res/drawable/un_sound.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="48"
|
||||||
|
android:viewportHeight="48">
|
||||||
|
<path
|
||||||
|
android:pathData="M42.5,16.387C41.552,14.086 40.187,12.001 38.5,10.225C34.856,6.391 29.707,4 24,4C12.954,4 4,12.954 4,24H14L19,32L28,14L35,24H44C44,35.046 35.046,44 24,44C18.549,44 13.608,41.819 10,38.283C8.18,36.499 6.699,34.369 5.664,32"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="4"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#FFFFFFFF"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/up.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="20.2dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="1294"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M614.4,7.8l-387.1,267.9L42.7,275.7c-23.5,0 -42.7,18.2 -42.7,40.7v391c0,22.5 19.1,40.7 42.7,40.7h184.7l387.1,267.9c28.2,19.5 67.7,0.3 67.7,-33L682.1,40.8c0,-33.3 -39.5,-52.5 -67.7,-33zM596.8,903.4L266.2,674.5a5.3,5.3 0,0 0,-0.5 -0.3c-0.7,-0.5 -1.5,-0.9 -2.1,-1.3 -0.5,-0.3 -1,-0.6 -1.5,-0.9s-1.5,-0.7 -2.1,-1.1 -1.1,-0.5 -1.6,-0.8 -1.4,-0.5 -2.1,-0.8 -1.3,-0.5 -1.9,-0.6 -1.3,-0.4 -1.9,-0.5 -1.5,-0.4 -2.1,-0.5 -1.2,-0.2 -1.8,-0.3 -1.6,-0.3 -2.4,-0.4c-0.6,0 -1.1,-0.1 -1.7,-0.1 -0.8,0 -1.7,-0.1 -2.5,-0.1L85.3,666.7L85.3,357.2h155.8a44.1,44.1 0,0 0,25 -7.8l330.6,-228.9zM1124.3,512L1124.3,341.5h-56.8v170.5h-170.5v56.8h170.5v170.5h56.8L1124.2,568.8h170.5v-56.8z"/>
|
||||||
|
</vector>
|
||||||
40
app/src/main/res/layout/activity_category.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.activity.CategoryActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/title"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/title" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
44
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@mipmap/background"
|
||||||
|
tools:context=".ui.activity.MainActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/tab_layout"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tab_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
|
app:tabRippleColor="@android:color/transparent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
69
app/src/main/res/layout/activity_record.xml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.activity.RecordActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="@string/create_sound"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:text="@string/_00_00_00"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="44sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/animation"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:id="@+id/animation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:lottie_fileName="Animation.json"
|
||||||
|
app:lottie_loop="true" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/record"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:layout_marginBottom="100dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:src="@drawable/microphone"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
107
app/src/main/res/layout/activity_save.xml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.activity.SaveActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="@string/_00_00_00"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_marginTop="150dp"
|
||||||
|
android:src="@mipmap/placeholder"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/play"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/play"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:background="@drawable/edit_background"
|
||||||
|
android:gravity="center"
|
||||||
|
android:hint="@string/please_enter_your_name"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/save"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/play" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/save"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="75dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:src="@drawable/save" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/add_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/save"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
133
app/src/main/res/layout/activity_sound.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.activity.SoundActivity">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/line"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintGuide_percent="0.80" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginTop="75dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="75dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/seek_bar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/back" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/favorite"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/un_favorite"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/image"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/image" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="50dp"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@mipmap/placeholder"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/view"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/view"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/loop"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/un_loop"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/view"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/back"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/back" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seek_bar"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:maxHeight="5dp"
|
||||||
|
android:progress="50"
|
||||||
|
android:progressDrawable="@drawable/progress_gradient"
|
||||||
|
android:thumb="@drawable/progress_thumb"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/line"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/min"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:src="@drawable/down"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/seek_bar"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/seek_bar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/seek_bar" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/max"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:src="@drawable/up"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/seek_bar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/seek_bar"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/seek_bar" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/play"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/play"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/seek_bar" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
49
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.activity.SplashActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:src="@mipmap/ic_launcher"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.388" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="5dp"
|
||||||
|
android:layout_marginStart="53dp"
|
||||||
|
android:layout_marginEnd="53dp"
|
||||||
|
android:layout_marginBottom="80dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="0"
|
||||||
|
android:progressDrawable="@drawable/progress_gradient"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
13
app/src/main/res/layout/fragment_category.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.fragment.CategoryFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
29
app/src/main/res/layout/fragment_favorite.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:context=".ui.fragment.FavoriteFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/favorite_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineSpacingExtra="8dp"
|
||||||
|
android:text="@string/oops_no_favorites_yet_make_some"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
72
app/src/main/res/layout/fragment_sound.xml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.fragment.SoundFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/add"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:src="@drawable/add" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/add_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/create_sound"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sound_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineSpacingExtra="8dp"
|
||||||
|
android:text="@string/uh_oh_the_sound_s_on_vacation_n_come_on_give_it_a_jolt_of_fun"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/add"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
50
app/src/main/res/layout/item_happy.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:backgroundTint="@color/white">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/textView"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/favorite"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:src="@drawable/un_favorite"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
97
app/src/main/res/layout/sound_dialog.xml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sound_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="@string/choose_method"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/all_option"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/sound_title">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/import_audio"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:src="@drawable/import_sound" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Import"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/create"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:src="@drawable/record" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Record"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/cancel_button"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:backgroundTint="#F2F2F2"
|
||||||
|
android:src="@drawable/close"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/all_option" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
32
app/src/main/res/layout/tab_item.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="5dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/background.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/placeholder.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.HappyPrankSounds" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your dark theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
7
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="gray">#757575</color>
|
||||||
|
<color name="yellow">#FFEB3B</color>
|
||||||
|
</resources>
|
||||||
16
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Happy Prank Sounds</string>
|
||||||
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
<string name="category">Category</string>
|
||||||
|
<string name="sound">Sound</string>
|
||||||
|
<string name="collection">Collection</string>
|
||||||
|
<string name="name_is_empty">The name cannot be empty</string>
|
||||||
|
<string name="uh_oh_the_sound_s_on_vacation_n_come_on_give_it_a_jolt_of_fun">Uh-oh! The sound’s on vacation! \n🎶 Come on, give it a jolt of fun! ⚡🎧</string>
|
||||||
|
<string name="create_sound">Create sound</string>
|
||||||
|
<string name="_00_00_00">00:00:00</string>
|
||||||
|
<string name="save">Save</string>
|
||||||
|
<string name="choose_method">Choose Method</string>
|
||||||
|
<string name="please_enter_your_name">Please enter your name</string>
|
||||||
|
<string name="oops_no_favorites_yet_make_some">Oops! No favorites yet. 🌟 Make some!</string>
|
||||||
|
</resources>
|
||||||
9
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.HappyPrankSounds" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your light theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.HappyPrankSounds" parent="Base.Theme.HappyPrankSounds" />
|
||||||
|
</resources>
|
||||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.prank.happypranksounds;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
build.gradle.kts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
}
|
||||||
21
gradle.properties
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
22
gradle/libs.versions.toml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "8.8.1"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.2.1"
|
||||||
|
espressoCore = "3.6.1"
|
||||||
|
appcompat = "1.7.0"
|
||||||
|
material = "1.12.0"
|
||||||
|
activity = "1.10.0"
|
||||||
|
constraintlayout = "2.2.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||||
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Fri Feb 07 17:03:22 CST 2025
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
app_name=Happy Prank Sounds
|
||||||
|
package_name=com.prank.happypranksounds
|
||||||
|
keystoreFile=app/HappyPrankSounds.jks
|
||||||
|
key_alias=HappyPrankSoundskey0
|
||||||
|
key_store_password=HappyPrankSounds
|
||||||
|
key_password=HappyPrankSounds
|
||||||
24
settings.gradle.kts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "Happy Prank Sounds"
|
||||||
|
include(":app")
|
||||||
|
|
||||||