增加录音和导入音频功能
This commit is contained in:
parent
af051d6f52
commit
1ba04def83
@ -62,6 +62,7 @@ dependencies {
|
|||||||
implementation ("com.google.code.gson:gson:2.10.1")
|
implementation ("com.google.code.gson:gson:2.10.1")
|
||||||
implementation("com.google.android.material:material:1.11.0")
|
implementation("com.google.android.material:material:1.11.0")
|
||||||
|
|
||||||
|
implementation ("com.airbnb.android:lottie:5.2.0")
|
||||||
|
|
||||||
val room_version = "2.6.1"
|
val room_version = "2.6.1"
|
||||||
implementation("androidx.room:room-runtime:$room_version")
|
implementation("androidx.room:room-runtime:$room_version")
|
||||||
|
|||||||
@ -3,11 +3,14 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||||
android:maxSdkVersion="32" />
|
android:maxSdkVersion="32" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
android:maxSdkVersion="32" />
|
android:maxSdkVersion="32" />
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".resolve.Sounds"
|
android:name=".resolve.Sounds"
|
||||||
@ -20,12 +23,21 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.FunnySounds"
|
android:theme="@style/Theme.FunnySounds"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".activity.SaveRecordActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.RecordAudioActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.DetailActivity"
|
android:name=".activity.DetailActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.SpecifisoundsActivity"
|
android:name=".activity.SpecifisoundsActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.WebActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.IntoActivity"
|
android:name=".activity.IntoActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
@ -38,9 +50,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<!-- <activity-->
|
|
||||||
<!-- android:name=".activity.StartPageActivity"-->
|
|
||||||
<!-- android:exported="false" />-->
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
110
app/src/main/assets/Funny_Sounds_Privacy.html
Normal file
110
app/src/main/assets/Funny_Sounds_Privacy.html
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Privacy Policy for Funny Sounds: Air Horn</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin: 20px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
h1, h2 {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #1a0dab;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Privacy Policy for Funny Sounds: Air Horn</h1>
|
||||||
|
<p><strong>July 10, 2024</strong></p>
|
||||||
|
<p>ZT Tools ("we", "our", "us") operates the Funny Sounds: Air Horn mobile application (the
|
||||||
|
"Service").</p>
|
||||||
|
<p>This page informs you of our policies regarding the collection, use, and disclosure of personal
|
||||||
|
data when you use our Service and the choices you have associated with that data.</p>
|
||||||
|
|
||||||
|
<h2>Information Collection and Use</h2>
|
||||||
|
<p>For a better experience while using our Service, we may require you to provide us with certain
|
||||||
|
personally identifiable information, including but not limited to your name, email address, and
|
||||||
|
usage data. The information that we request will be retained on your device and is not collected
|
||||||
|
by us in any way.</p>
|
||||||
|
<p>The app does use third-party services that may collect information used to identify you.</p>
|
||||||
|
|
||||||
|
<h2>Log Data</h2>
|
||||||
|
<p>We want to inform you that whenever you use our Service, in a case of an error in the app, we
|
||||||
|
collect data and information (through third-party products) on your phone called Log Data. This
|
||||||
|
Log Data may include information such as your device Internet Protocol (“IP”) address, device
|
||||||
|
name, operating system version, the configuration of the app when utilizing our Service, the
|
||||||
|
time and date of your use of the Service, and other statistics.</p>
|
||||||
|
|
||||||
|
<h2>Cookies</h2>
|
||||||
|
<p>Cookies are files with a small amount of data that are commonly used as anonymous unique
|
||||||
|
identifiers. These are sent to your browser from the websites that you visit and are stored on
|
||||||
|
your device's internal memory. This Service does not use these “cookies” explicitly. However,
|
||||||
|
the app may use third-party code and libraries that use “cookies” to collect information and
|
||||||
|
improve their services. You have the option to either accept or refuse these cookies and know
|
||||||
|
when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be
|
||||||
|
able to use some portions of this Service.</p>
|
||||||
|
|
||||||
|
<h2>Service Providers</h2>
|
||||||
|
<p>We may employ third-party companies and individuals for the following reasons:</p>
|
||||||
|
<ul>
|
||||||
|
<li>To facilitate our Service;</li>
|
||||||
|
<li>To provide the Service on our behalf;</li>
|
||||||
|
<li>To perform Service-related services; or</li>
|
||||||
|
<li>To assist us in analyzing how our Service is used.</li>
|
||||||
|
</ul>
|
||||||
|
<p>We want to inform users of this Service that these third parties have access to their Personal
|
||||||
|
Information. The reason is to perform the tasks assigned to them on our behalf. However, they
|
||||||
|
are obligated not to disclose or use the information for any other purpose.</p>
|
||||||
|
|
||||||
|
<h2>Security</h2>
|
||||||
|
<p>We value your trust in providing us with your Personal Information, and we strive to use
|
||||||
|
commercially acceptable means of protecting it. However, remember that no method of transmission
|
||||||
|
over the internet or method of electronic storage is 100% secure and reliable, and we cannot
|
||||||
|
guarantee its absolute security.</p>
|
||||||
|
|
||||||
|
<h2>Links to Other Sites</h2>
|
||||||
|
<p>This Service may contain links to other sites. If you click on a third-party link, you will be
|
||||||
|
directed to that site. Note that these external sites are not operated by us. Therefore, we
|
||||||
|
strongly advise you to review the Privacy Policy of these websites. We have no control over and
|
||||||
|
assume no responsibility for the content, privacy policies, or practices of any third-party
|
||||||
|
sites or services.</p>
|
||||||
|
|
||||||
|
<h2>Children’s Privacy</h2>
|
||||||
|
<p>These Services do not address anyone under the age of 13. We do not knowingly collect personally
|
||||||
|
identifiable information from children under 13 years of age. In the case we discover that a
|
||||||
|
child under 13 has provided us with personal information, we immediately delete this from our
|
||||||
|
servers. If you are a parent or guardian and you are aware that your child has provided us with
|
||||||
|
personal information, please contact us so that we can take the necessary actions.</p>
|
||||||
|
|
||||||
|
<h2>Changes to This Privacy Policy</h2>
|
||||||
|
<p>We may update our Privacy Policy from time to time. Thus, you are advised to review this page
|
||||||
|
periodically for any changes. We will notify you of any changes by posting the new Privacy
|
||||||
|
Policy on this page.</p>
|
||||||
|
|
||||||
|
<h2>Contact Us</h2>
|
||||||
|
<p>If you have any questions or concerns about our Privacy Policy or data processing, please contact
|
||||||
|
us at: <a href="mailto:WarrenThorCUIu@gmail.com">WarrenThorCUIu@gmail.com</a>.</p>
|
||||||
|
|
||||||
|
<p>ZT Tools</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -66,6 +66,9 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
imLoop = findViewById(R.id.im_loop);
|
imLoop = findViewById(R.id.im_loop);
|
||||||
imAddLove = findViewById(R.id.im_add_love);
|
imAddLove = findViewById(R.id.im_add_love);
|
||||||
pbLoading = findViewById(R.id.loading);
|
pbLoading = findViewById(R.id.loading);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
|
||||||
|
if (resource == null) return;
|
||||||
goGetData();
|
goGetData();
|
||||||
initMediaPlayer();
|
initMediaPlayer();
|
||||||
setVolume(volumeSeekbar);
|
setVolume(volumeSeekbar);
|
||||||
@ -74,21 +77,21 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVolume(SeekBar seekBar) {
|
public void setVolume(SeekBar seekBar) {
|
||||||
AudioManager audioManager = (AudioManager) Sounds.mAppContext.getSystemService(AppCompatActivity.AUDIO_SERVICE);
|
AudioManager audioManager = (AudioManager) Sounds.mAppContext.getSystemService(AppCompatActivity.AUDIO_SERVICE);
|
||||||
|
|
||||||
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||||
seekBar.setMax(maxVolume);
|
seekBar.setMax(maxVolume);
|
||||||
seekBar.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
|
seekBar.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
|
||||||
|
|
||||||
getContentResolver().registerContentObserver(Settings.System.CONTENT_URI, true, new ContentObserver(new Handler()) {
|
getContentResolver().registerContentObserver(Settings.System.CONTENT_URI, true, new ContentObserver(new Handler()) {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange) {
|
public void onChange(boolean selfChange) {
|
||||||
super.onChange(selfChange);
|
super.onChange(selfChange);
|
||||||
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
|
||||||
seekBar.setMax(maxVolume);
|
seekBar.setMax(maxVolume);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||||
@ -108,9 +111,7 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void goGetData() {
|
private void goGetData() {
|
||||||
Intent intent = getIntent();
|
|
||||||
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
|
|
||||||
assert resource != null;
|
|
||||||
textView.setText(resource.getTitle());
|
textView.setText(resource.getTitle());
|
||||||
media = resource.getMp3Url();
|
media = resource.getMp3Url();
|
||||||
Log.d("----", "---media" + media);
|
Log.d("----", "---media" + media);
|
||||||
@ -121,9 +122,9 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
imAddLove.setSelected(myData.isAddLove());
|
imAddLove.setSelected(myData.isAddLove());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!resource.isSyStem()){
|
if (!resource.isSyStem()) {
|
||||||
imageView.setImageResource(R.mipmap.default_covert);
|
imageView.setImageResource(R.mipmap.default_covert);
|
||||||
}else {
|
} else {
|
||||||
Glide.with(this).load(resource.getPreUrl()).addListener(new RequestListener<Drawable>() {
|
Glide.with(this).load(resource.getPreUrl()).addListener(new RequestListener<Drawable>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||||
@ -141,20 +142,18 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void initMediaPlayer() {
|
private void initMediaPlayer() {
|
||||||
mediaPlayer = new MediaPlayer();
|
mediaPlayer = new MediaPlayer();
|
||||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
|
||||||
try {
|
try {
|
||||||
mediaPlayer.reset();
|
|
||||||
String mp3Url = resource.getMp3Url();
|
String mp3Url = resource.getMp3Url();
|
||||||
//content://com.android.providers.media.documents/document/audio%3A1000000468
|
//content://com.android.providers.media.documents/document/audio%3A1000000468
|
||||||
if(resource.isSyStem()){
|
if (resource.isSyStem()) {
|
||||||
mediaPlayer.setDataSource(mp3Url);
|
mediaPlayer.setDataSource(mp3Url);
|
||||||
}else {
|
} else {
|
||||||
Uri parse = Uri.parse(mp3Url);
|
Uri parse = Uri.parse(mp3Url);
|
||||||
Log.d(Sounds.TAG,"--------Uri--="+parse);
|
Log.d(Sounds.TAG, "--------Uri--=" + parse);
|
||||||
mediaPlayer.setDataSource(this,parse);
|
mediaPlayer.setDataSource(this, parse);
|
||||||
|
|
||||||
}
|
}
|
||||||
mediaPlayer.prepareAsync();
|
mediaPlayer.prepare();
|
||||||
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPrepared(MediaPlayer mp) {
|
public void onPrepared(MediaPlayer mp) {
|
||||||
@ -170,15 +169,15 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
Log.d(Sounds.TAG,"-----------ioException="+ioException.getCause());
|
Log.d(Sounds.TAG, "-----------ioException=" + ioException.getMessage());
|
||||||
Toast.makeText(this, getString(R.string.load_fail), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getString(R.string.load_fail), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLoading(boolean isLoading){
|
private void setLoading(boolean isLoading) {
|
||||||
if(isLoading){
|
if (isLoading) {
|
||||||
pbLoading.setVisibility(View.VISIBLE);
|
pbLoading.setVisibility(View.VISIBLE);
|
||||||
}else {
|
} else {
|
||||||
pbLoading.setVisibility(View.GONE);
|
pbLoading.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,8 +223,8 @@ public class DetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (mediaPlayer != null) {
|
if (mediaPlayer != null && mediaPlayer.isPlaying()) {
|
||||||
mediaPlayer.pause();
|
mediaPlayer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,12 +61,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String format = String.format(getString(R.string.app_sounds_version), appVersions);
|
String format = String.format(getString(R.string.app_sounds_version), appVersions);
|
||||||
vb.textVersion.setText(format);
|
vb.textVersion.setText(format);
|
||||||
}
|
}
|
||||||
vb.versionLay.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
Toast.makeText(MainActivity.this, "This Version is V1.3", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTabVp() {
|
private void initTabVp() {
|
||||||
@ -141,10 +136,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTitle(int position) {
|
private void updateTitle(int position) {
|
||||||
if (position == 1) {
|
if (position == 0) {
|
||||||
vb.textviewSounds.setText(getString(R.string.favorites));
|
|
||||||
}else {
|
|
||||||
vb.textviewSounds.setText(getString(R.string.app_name));
|
vb.textviewSounds.setText(getString(R.string.app_name));
|
||||||
|
}else if (position == 1) {
|
||||||
|
vb.textviewSounds.setText(getString(R.string.create_sounds));
|
||||||
|
}else if (position == 2) {
|
||||||
|
vb.textviewSounds.setText(getString(R.string.favorites));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,9 +157,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void gotopricy() {
|
private void gotopricy() {
|
||||||
String url = getString(R.string.url_privacy);
|
Intent intent2 = new Intent(MainActivity.this, WebActivity.class);
|
||||||
Intent intent2 = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent2.setData(Uri.parse(url));
|
|
||||||
startActivity(intent2);
|
startActivity(intent2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.example.funnysounds.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.media.MediaRecorder;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.example.funnysounds.R;
|
||||||
|
import com.example.funnysounds.databinding.ActivityRecordAudioBinding;
|
||||||
|
import com.example.funnysounds.resolve.Utils;
|
||||||
|
import com.example.funnysounds.value.StaticValue;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class RecordAudioActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivityRecordAudioBinding vb;
|
||||||
|
private boolean isRecording = false;
|
||||||
|
private MediaRecorder recorder;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityRecordAudioBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
vb.top.imAddLove.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
vb.top.dataName.setText(getString(R.string.new_record));
|
||||||
|
vb.top.imageviewBack.setOnClickListener((view) -> finish());
|
||||||
|
initMediaRecorder();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMediaRecorder() {
|
||||||
|
fileName = String.valueOf(System.currentTimeMillis());
|
||||||
|
File file = Utils.getAudioFile(fileName);
|
||||||
|
recorder = new MediaRecorder();
|
||||||
|
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||||
|
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
|
||||||
|
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
|
||||||
|
recorder.setOutputFile(file.getAbsolutePath());
|
||||||
|
prepare();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prepare() {
|
||||||
|
try {
|
||||||
|
recorder.prepare();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("MediaRecorder", "prepare() failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void start() {
|
||||||
|
try {
|
||||||
|
recorder.start();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Log.e("MediaRecorder", "start() failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stop() {
|
||||||
|
recorder.stop();
|
||||||
|
recorder.release();
|
||||||
|
recorder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
vb.animationView.setRepeatCount(Integer.MAX_VALUE);
|
||||||
|
vb.tvBtnRecord.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
isRecording = !isRecording;
|
||||||
|
if (isRecording) {
|
||||||
|
vb.tvBtnRecord.setText(getString(R.string.stop_record));
|
||||||
|
vb.chronometer.setBase(SystemClock.elapsedRealtime());
|
||||||
|
vb.chronometer.start();
|
||||||
|
vb.animationView.playAnimation();
|
||||||
|
start();
|
||||||
|
} else {
|
||||||
|
// TODO: 2024/9/4
|
||||||
|
vb.animationView.cancelAnimation();
|
||||||
|
vb.chronometer.stop();
|
||||||
|
stop();
|
||||||
|
Intent intent = new Intent(RecordAudioActivity.this, SaveRecordActivity.class);
|
||||||
|
intent.putExtra(StaticValue.key_record_path, fileName);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
package com.example.funnysounds.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.funnysounds.R;
|
||||||
|
import com.example.funnysounds.action.IOListener;
|
||||||
|
import com.example.funnysounds.data.MyData;
|
||||||
|
import com.example.funnysounds.databinding.ActivitySaveRecordBinding;
|
||||||
|
import com.example.funnysounds.resolve.Readfile;
|
||||||
|
import com.example.funnysounds.resolve.Sounds;
|
||||||
|
import com.example.funnysounds.resolve.Utils;
|
||||||
|
import com.example.funnysounds.room.MyRoom;
|
||||||
|
import com.example.funnysounds.value.StaticValue;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class SaveRecordActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private ActivitySaveRecordBinding vb;
|
||||||
|
private String fileName;
|
||||||
|
private MediaPlayer mediaPlayer;
|
||||||
|
private File audioFile;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivitySaveRecordBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
setLoading(true);
|
||||||
|
vb.top.dataName.setText(getString(R.string.save_sound));
|
||||||
|
vb.top.imAddLove.setVisibility(View.GONE);
|
||||||
|
vb.top.imageviewBack.setOnClickListener((view) -> finish());
|
||||||
|
init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
fileName = getIntent().getStringExtra(StaticValue.key_record_path);
|
||||||
|
initMediaPlayer();
|
||||||
|
vb.btnPlayPause.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
vb.btnPlayPause.setSelected(!vb.btnPlayPause.isSelected());
|
||||||
|
if (vb.btnPlayPause.isSelected()) {
|
||||||
|
if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
|
||||||
|
mediaPlayer.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
mediaPlayer.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vb.tvBtnRecord.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
String newName = vb.etName.getText().toString();
|
||||||
|
if (newName.isEmpty()) {
|
||||||
|
Toast.makeText(SaveRecordActivity.this, getString(R.string.input_name), Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
File newFile = Utils.getAudioFile(newName);
|
||||||
|
boolean b = audioFile.renameTo(newFile);
|
||||||
|
if (b) {
|
||||||
|
addRoom(newFile,newName);
|
||||||
|
Toast.makeText(SaveRecordActivity.this, getString(R.string.rename_success), Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(SaveRecordActivity.this, getString(R.string.rename_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addRoom(File newFile,String newName){
|
||||||
|
MyData myData = new MyData();
|
||||||
|
myData.setCategoryId(1);
|
||||||
|
myData.setSyStem(false);
|
||||||
|
myData.setTitle(newName);
|
||||||
|
myData.setMp3Url(newFile.getAbsolutePath());
|
||||||
|
Readfile.onSwitchIO(new IOListener() {
|
||||||
|
@Override
|
||||||
|
public void onRunIOAction() {
|
||||||
|
MyRoom.getInstance().getDataDao().insertPrank(myData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMediaPlayer() {
|
||||||
|
mediaPlayer = new MediaPlayer();
|
||||||
|
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||||
|
try {
|
||||||
|
mediaPlayer.reset();
|
||||||
|
Log.d(Sounds.TAG, "-------path=" + fileName);
|
||||||
|
audioFile = Utils.getAudioFile(fileName);
|
||||||
|
mediaPlayer.setDataSource(audioFile.getAbsolutePath());
|
||||||
|
mediaPlayer.prepareAsync();
|
||||||
|
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||||
|
@Override
|
||||||
|
public void onPrepared(MediaPlayer mp) {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||||
|
@Override
|
||||||
|
public void onCompletion(MediaPlayer mp) {
|
||||||
|
vb.btnPlayPause.setSelected(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
setLoading(false);
|
||||||
|
Log.d(Sounds.TAG, "-----------ioException=" + ioException.getCause());
|
||||||
|
Toast.makeText(this, getString(R.string.load_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLoading(boolean isloading) {
|
||||||
|
if (isloading) {
|
||||||
|
vb.btnPlayPause.setVisibility(View.GONE);
|
||||||
|
vb.loading.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
vb.loading.setVisibility(View.GONE);
|
||||||
|
vb.btnPlayPause.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -44,7 +44,8 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
|
|||||||
setContentView(R.layout.activity_specifisounds);
|
setContentView(R.layout.activity_specifisounds);
|
||||||
recyclerview_specific = findViewById(R.id.recyclerview_specific);
|
recyclerview_specific = findViewById(R.id.recyclerview_specific);
|
||||||
imageView = findViewById(R.id.imageview_back);
|
imageView = findViewById(R.id.imageview_back);
|
||||||
cName = findViewById(R.id.categoryname);
|
cName = findViewById(R.id.data_name);
|
||||||
|
findViewById(R.id.im_add_love).setVisibility(View.GONE);
|
||||||
imageView.setOnClickListener(new View.OnClickListener() {
|
imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.example.funnysounds.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.funnysounds.R;
|
||||||
|
import com.example.funnysounds.databinding.ActivityWebBinding;
|
||||||
|
|
||||||
|
|
||||||
|
public class WebActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivityWebBinding vb;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityWebBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
vb.top.imAddLove.setVisibility(View.GONE);
|
||||||
|
vb.top.dataName.setText(getString(R.string.privacy_policy));
|
||||||
|
vb.top.imageviewBack.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
vb.web.getSettings().setJavaScriptEnabled(true);
|
||||||
|
vb.web.setWebViewClient(new WebViewClient());
|
||||||
|
vb.web.loadUrl("file:///android_asset/Funny_Sounds_Privacy.html");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,6 +27,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
|
|
||||||
import com.example.funnysounds.action.IOListener;
|
import com.example.funnysounds.action.IOListener;
|
||||||
import com.example.funnysounds.action.RecordDialogClickListener;
|
import com.example.funnysounds.action.RecordDialogClickListener;
|
||||||
|
import com.example.funnysounds.activity.RecordAudioActivity;
|
||||||
import com.example.funnysounds.data.MyData;
|
import com.example.funnysounds.data.MyData;
|
||||||
import com.example.funnysounds.databinding.FragmentRecordBinding;
|
import com.example.funnysounds.databinding.FragmentRecordBinding;
|
||||||
import com.example.funnysounds.dialog.RecordDialog;
|
import com.example.funnysounds.dialog.RecordDialog;
|
||||||
@ -34,7 +35,6 @@ import com.example.funnysounds.resolve.MySpace;
|
|||||||
import com.example.funnysounds.resolve.Readfile;
|
import com.example.funnysounds.resolve.Readfile;
|
||||||
import com.example.funnysounds.resolve.Sounds;
|
import com.example.funnysounds.resolve.Sounds;
|
||||||
import com.example.funnysounds.room.MyRoom;
|
import com.example.funnysounds.room.MyRoom;
|
||||||
import com.example.funnysounds.soundsadapter.LoveAdapter;
|
|
||||||
import com.example.funnysounds.soundsadapter.RecordAdapter;
|
import com.example.funnysounds.soundsadapter.RecordAdapter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -48,6 +48,13 @@ public class RecordFragment extends Fragment {
|
|||||||
private RecordDialog dialog;
|
private RecordDialog dialog;
|
||||||
private String[] permission1 = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
private String[] permission1 = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||||
private String[] permission2 = {Manifest.permission.READ_MEDIA_AUDIO};
|
private String[] permission2 = {Manifest.permission.READ_MEDIA_AUDIO};
|
||||||
|
|
||||||
|
private String[] permission_recordAudio = {Manifest.permission.RECORD_AUDIO};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 import 1 record
|
||||||
|
*/
|
||||||
|
private int clickType = 0;
|
||||||
private ActivityResultLauncher<Intent> audioSelectLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
private ActivityResultLauncher<Intent> audioSelectLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(ActivityResult o) {
|
public void onActivityResult(ActivityResult o) {
|
||||||
@ -71,7 +78,7 @@ public class RecordFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 处理选中的音频URI
|
// 处理选中的音频URI
|
||||||
Log.d(Sounds.TAG, "--------audioUri=" + audioUri+"---audioPathFromUri="+name +"--------decode-----"+decode);
|
Log.d(Sounds.TAG, "--------audioUri=" + audioUri + "---audioPathFromUri=" + name + "--------decode-----" + decode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -84,12 +91,15 @@ public class RecordFragment extends Fragment {
|
|||||||
boolean isOK = true;
|
boolean isOK = true;
|
||||||
for (String key : o.keySet()) {
|
for (String key : o.keySet()) {
|
||||||
Boolean aBoolean = o.get(key);
|
Boolean aBoolean = o.get(key);
|
||||||
Log.d(Sounds.TAG, "-----key="+key+"---aBoolean=" + aBoolean);
|
Log.d(Sounds.TAG, "-----key=" + key + "---aBoolean=" + aBoolean);
|
||||||
if (aBoolean != null)
|
if (aBoolean != null)
|
||||||
isOK = aBoolean;
|
isOK = aBoolean;
|
||||||
}
|
}
|
||||||
if(isOK){
|
if (isOK) {
|
||||||
selectAudio();
|
if (clickType == 0)
|
||||||
|
selectAudio();
|
||||||
|
else
|
||||||
|
goRecord();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -123,11 +133,14 @@ public class RecordFragment extends Fragment {
|
|||||||
dialog = RecordDialog.newInstance(new RecordDialogClickListener() {
|
dialog = RecordDialog.newInstance(new RecordDialogClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onImport() {
|
public void onImport() {
|
||||||
checkPermissionAudio();
|
clickType = 0;
|
||||||
|
checkPermissionImportAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecord() {
|
public void onRecord() {
|
||||||
|
clickType = 1;
|
||||||
|
checkPermissionRecordAudio();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -136,7 +149,18 @@ public class RecordFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void checkPermissionAudio() {
|
|
||||||
|
private void checkPermissionRecordAudio() {
|
||||||
|
int i = ContextCompat.checkSelfPermission(requireActivity(), permission_recordAudio[0]);
|
||||||
|
if (i != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
permissionLauncher.launch(permission_recordAudio);
|
||||||
|
} else {
|
||||||
|
goRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkPermissionImportAudio() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
int i = ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_MEDIA_AUDIO);
|
int i = ContextCompat.checkSelfPermission(requireActivity(), Manifest.permission.READ_MEDIA_AUDIO);
|
||||||
if (i != PackageManager.PERMISSION_GRANTED) {
|
if (i != PackageManager.PERMISSION_GRANTED) {
|
||||||
@ -152,8 +176,6 @@ public class RecordFragment extends Fragment {
|
|||||||
selectAudio();
|
selectAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectAudio() {
|
private void selectAudio() {
|
||||||
@ -162,6 +184,11 @@ public class RecordFragment extends Fragment {
|
|||||||
audioSelectLauncher.launch(Intent.createChooser(intent, "Select Audio"));
|
audioSelectLauncher.launch(Intent.createChooser(intent, "Select Audio"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void goRecord() {
|
||||||
|
Intent intent = new Intent(requireActivity(), RecordAudioActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
MySpace mySpace = new MySpace(20, 20, 25);
|
MySpace mySpace = new MySpace(20, 20, 25);
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity());
|
LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity());
|
||||||
|
|||||||
10
app/src/main/java/com/example/funnysounds/resolve/Utils.java
Normal file
10
app/src/main/java/com/example/funnysounds/resolve/Utils.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.funnysounds.resolve;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
public static File getAudioFile(String name) {
|
||||||
|
return new File(Sounds.mAppContext.getExternalCacheDir(), name + ".amr");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.example.funnysounds.room;
|
|||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.room.Dao;
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
import androidx.room.OnConflictStrategy;
|
import androidx.room.OnConflictStrategy;
|
||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
@ -34,4 +35,7 @@ public interface DataDao {
|
|||||||
LiveData<MyData> queryAudioIsLove(long mid);
|
LiveData<MyData> queryAudioIsLove(long mid);
|
||||||
@Update
|
@Update
|
||||||
void updatePrank(MyData myData);
|
void updatePrank(MyData myData);
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void deletePrank(MyData myData);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.example.funnysounds.soundsadapter;
|
package com.example.funnysounds.soundsadapter;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -69,7 +71,21 @@ public class RecordAdapter extends RecyclerView.Adapter<RecordAdapter.VH> {
|
|||||||
}else {
|
}else {
|
||||||
holder.getVb().imSounds.setImageResource(R.mipmap.default_covert);
|
holder.getVb().imSounds.setImageResource(R.mipmap.default_covert);
|
||||||
}
|
}
|
||||||
|
holder.getVb().imDelete.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.d(Sounds.TAG,"---------holder.getAdapterPosition()="+holder.getAdapterPosition());
|
||||||
|
notifyItemRemoved(holder.getAdapterPosition());
|
||||||
|
Toast.makeText(myContext, myContext.getString(R.string.deleted_successfully), Toast.LENGTH_SHORT).show();
|
||||||
|
Readfile.onSwitchIO(new IOListener() {
|
||||||
|
@Override
|
||||||
|
public void onRunIOAction() {
|
||||||
|
MyRoom.getInstance().getDataDao().deletePrank(myData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
holder.getVb().getRoot().setOnClickListener(new View.OnClickListener() {
|
holder.getVb().getRoot().setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|||||||
@ -5,4 +5,7 @@ public class StaticValue {
|
|||||||
|
|
||||||
public static final String key_resourse = "key_resourse";
|
public static final String key_resourse = "key_resourse";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String key_record_path= "key_path";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
24
app/src/main/res/drawable/im_delete.xml
Normal file
24
app/src/main/res/drawable/im_delete.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M192,256h640a64,64 0,0 1,64 64v576a64,64 0,0 1,-64 64L192,960a64,64 0,0 1,-64 -64L128,320a64,64 0,0 1,64 -64zM192,352v512a32,32 0,0 0,32 32h576a32,32 0,0 0,32 -32L832,352a32,32 0,0 0,-32 -32L224,320a32,32 0,0 0,-32 32z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M480,416m32,0l0,0q32,0 32,32l0,288q0,32 -32,32l0,0q-32,0 -32,-32l0,-288q0,-32 32,-32Z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M320,448m32,0l0,0q32,0 32,32l0,224q0,32 -32,32l0,0q-32,0 -32,-32l0,-224q0,-32 32,-32Z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M640,448m32,0l0,0q32,0 32,32l0,224q0,32 -32,32l0,0q-32,0 -32,-32l0,-224q0,-32 32,-32Z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M128,128m32,0l704,0q32,0 32,32l0,0q0,32 -32,32l-704,0q-32,0 -32,-32l0,0q0,-32 32,-32Z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M448,64h128a32,32 0,0 1,32 32v64a32,32 0,0 1,-32 32h-128a32,32 0,0 1,-32 -32V96a32,32 0,0 1,32 -32z"
|
||||||
|
android:fillColor="@color/delete_color"/>
|
||||||
|
</vector>
|
||||||
7
app/src/main/res/drawable/shape_edit_record_name.xml
Normal file
7
app/src/main/res/drawable/shape_edit_record_name.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<stroke android:color="@color/tab_true" android:width="2dp"/>
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
@ -7,42 +7,8 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".activity.DetailActivity">
|
tools:context=".activity.DetailActivity">
|
||||||
|
|
||||||
<RelativeLayout
|
<include layout="@layout/comon_layout_top"/>
|
||||||
android:id="@+id/main_top"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:background="@color/sounds_main">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageview_back"
|
|
||||||
android:layout_width="44dp"
|
|
||||||
android:layout_height="44dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:src="@drawable/svg_back" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/data_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="23sp" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/im_add_love"
|
|
||||||
android:layout_width="42dp"
|
|
||||||
android:layout_height="42dp"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginEnd="12dp"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:src="@drawable/selector_add_love" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/data_image"
|
android:id="@+id/data_image"
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
tools:openDrawer="right"
|
||||||
tools:context=".activity.MainActivity">
|
tools:context=".activity.MainActivity">
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +75,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right"
|
||||||
|
android:clickable="true"
|
||||||
android:background="@color/white">
|
android:background="@color/white">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
@ -109,9 +111,9 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="@string/privacy"
|
android:text="@string/privacy_policy"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="17sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/version_key"
|
android:id="@+id/version_key"
|
||||||
@ -124,7 +126,6 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/version_lay"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_below="@id/url_previcy"
|
android:layout_below="@id/url_previcy"
|
||||||
@ -142,7 +143,7 @@
|
|||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="@string/app_version"
|
android:text="@string/app_version"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="17sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_version"
|
android:id="@+id/text_version"
|
||||||
@ -153,7 +154,7 @@
|
|||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp" />
|
android:textSize="15sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
50
app/src/main/res/layout/activity_record_audio.xml
Normal file
50
app/src/main/res/layout/activity_record_audio.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout 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=".activity.RecordAudioActivity">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/top"
|
||||||
|
layout="@layout/comon_layout_top" />
|
||||||
|
|
||||||
|
<Chronometer
|
||||||
|
android:id="@+id/chronometer"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/top"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="63dp"
|
||||||
|
android:countDown="false"
|
||||||
|
android:format="@string/record_time_format"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
|
android:id="@+id/animation_view"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:layout_below="@id/chronometer"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
app:lottie_rawRes="@raw/anima" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_btn_record"
|
||||||
|
android:layout_width="220dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_below="@id/animation_view"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@drawable/bg_button"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:text="@string/start_record"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
82
app/src/main/res/layout/activity_save_record.xml
Normal file
82
app/src/main/res/layout/activity_save_record.xml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout 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=".activity.SaveRecordActivity">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/top"
|
||||||
|
layout="@layout/comon_layout_top" />
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/covert"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_below="@id/top"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="35dp"
|
||||||
|
android:background="@drawable/list_background"
|
||||||
|
android:padding="30dp"
|
||||||
|
android:src="@mipmap/default_covert" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_below="@id/covert"
|
||||||
|
android:layout_marginStart="44dp"
|
||||||
|
android:layout_marginTop="75dp"
|
||||||
|
android:layout_marginEnd="44dp"
|
||||||
|
android:background="@drawable/shape_edit_record_name"
|
||||||
|
android:hint="@string/edit_name"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="15dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
|
||||||
|
<android.widget.Button
|
||||||
|
android:id="@+id/btn_play_pause"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_below="@id/et_name"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:background="@drawable/selector_play"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_btn_record"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="25dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="25dp"
|
||||||
|
android:layout_marginBottom="54dp"
|
||||||
|
android:background="@drawable/bg_button"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:text="@string/save_sound"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/et_name"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:indeterminateTint="@color/loading_color" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@ -8,32 +8,8 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".activity.SpecifisoundsActivity">
|
tools:context=".activity.SpecifisoundsActivity">
|
||||||
|
|
||||||
<RelativeLayout
|
<include layout="@layout/comon_layout_top"/>
|
||||||
android:id="@+id/main_top"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:background="@color/sounds_main">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageview_back"
|
|
||||||
android:layout_width="44dp"
|
|
||||||
android:layout_height="44dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:src="@drawable/svg_back" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/categoryname"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="23sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
|||||||
21
app/src/main/res/layout/activity_web.xml
Normal file
21
app/src/main/res/layout/activity_web.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout 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/activity_web"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".activity.WebActivity">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/top"
|
||||||
|
layout="@layout/comon_layout_top" />
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/web"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
38
app/src/main/res/layout/comon_layout_top.xml
Normal file
38
app/src/main/res/layout/comon_layout_top.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/main_top"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:background="@color/sounds_main">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageview_back"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/svg_back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/data_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="23sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/im_add_love"
|
||||||
|
android:layout_width="42dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:src="@drawable/selector_add_love" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@ -16,6 +16,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="@string/no_favorites" />
|
android:text="@string/no_favorites"
|
||||||
|
android:textColor="@color/text_color_gray"
|
||||||
|
android:textSize="17sp" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@ -17,7 +17,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginStart="36dp"
|
android:layout_marginStart="36dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="36dp"
|
android:layout_marginEnd="36dp"
|
||||||
|
|||||||
@ -29,6 +29,15 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/im_delete"
|
||||||
|
android:layout_width="55dp"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:paddingStart="15dp"
|
||||||
|
android:paddingEnd="15dp"
|
||||||
|
android:src="@drawable/im_delete" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
2716
app/src/main/res/raw/anima.json
Normal file
2716
app/src/main/res/raw/anima.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,4 +21,6 @@
|
|||||||
<color name="add_btn_bg">#8072C8D5</color>
|
<color name="add_btn_bg">#8072C8D5</color>
|
||||||
|
|
||||||
<color name="loading_color">#FB310D</color>
|
<color name="loading_color">#FB310D</color>
|
||||||
|
<color name="delete_color">#FB310D</color>
|
||||||
|
<color name="ss">#8768FF</color>
|
||||||
</resources>
|
</resources>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<string name="app_name">Funny Sounds</string>
|
<string name="app_name">Funny Sounds</string>
|
||||||
<string name="privacy">privacy</string>
|
<string name="privacy">privacy</string>
|
||||||
<string name="url_privacy">https://sites.google.com/view/funnysoundsairhorn</string>
|
<string name="url_privacy">https://sites.google.com/view/funnysoundsairhorn</string>
|
||||||
<string name="app_version">version</string>
|
<string name="app_version">Version</string>
|
||||||
<string name="app_sounds_version">V%s</string>
|
<string name="app_sounds_version">V%s</string>
|
||||||
<string name="loop">Loop</string>
|
<string name="loop">Loop</string>
|
||||||
<string name="remove">Removed from favorite</string>
|
<string name="remove">Removed from favorite</string>
|
||||||
@ -14,4 +14,16 @@
|
|||||||
<string name="import_audio">import audio</string>
|
<string name="import_audio">import audio</string>
|
||||||
<string name="record_audio">Record sound</string>
|
<string name="record_audio">Record sound</string>
|
||||||
<string name="load_fail">Loading failed, please try again</string>
|
<string name="load_fail">Loading failed, please try again</string>
|
||||||
|
<string name="new_record">New record</string>
|
||||||
|
<string name="record_time_format">%s:%s:%s</string>
|
||||||
|
<string name="start_record">Start recording</string>
|
||||||
|
<string name="stop_record">Stop recording</string>
|
||||||
|
<string name="edit_name">Give your created sound a name</string>
|
||||||
|
<string name="save_sound">Save sound</string>
|
||||||
|
<string name="input_name">Please enter a name for your audio</string>
|
||||||
|
<string name="rename_fail">Failed to rename the file, please try again</string>
|
||||||
|
<string name="rename_success">Save file successfully</string>
|
||||||
|
<string name="create_sounds">Create sounds</string>
|
||||||
|
<string name="deleted_successfully">Deleted successfully</string>
|
||||||
|
<string name="privacy_policy">Privacy Policy</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue
Block a user