diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 94b0478..af0f204 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -12,8 +12,9 @@ android {
namespace = "com.example.funnysounds"
compileSdk = 34
+ //com.funny.sounds.hd
defaultConfig {
- applicationId = "com.funny.sounds.hd"
+ applicationId = "com.funny.sounds.hd.test"
minSdk = 23
targetSdk = 34
versionCode = 7
@@ -51,6 +52,9 @@ dependencies {
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
+ implementation(libs.legacy.support.v4)
+ implementation(libs.lifecycle.livedata.ktx)
+ implementation(libs.lifecycle.viewmodel.ktx)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
@@ -58,8 +62,10 @@ dependencies {
implementation ("com.google.code.gson:gson:2.10.1")
implementation("com.google.android.material:material:1.11.0")
- implementation ("com.mbridge.msdk.oversea:newinterstitial:16.7.71")
- implementation ("com.mbridge.msdk.oversea:mbbid:16.7.61")
+
+ val room_version = "2.6.1"
+ implementation("androidx.room:room-runtime:$room_version")
+ annotationProcessor ("androidx.room:room-compiler:$room_version")
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
@@ -105,12 +111,12 @@ dependencies {
implementation("androidx.recyclerview:recyclerview:1.1.0")
//Tramini
- implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
+// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
//-----------------------------TopOn 聚合
// Debugger UI Tools
- implementation ("com.anythink.sdk:debugger-ui:1.0.7")
+ implementation ("com.anythink.sdk:debugger-ui:1.0.7")
diff --git a/app/google-services.json b/app/google-services.json
index 9bbc388..573ceb2 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -9,7 +9,7 @@
"client_info": {
"mobilesdk_app_id": "1:15060781613:android:cae5beb7e5d3e8946586a4",
"android_client_info": {
- "package_name": "com.funny.sounds.hd"
+ "package_name": "com.funny.sounds.hd.test"
}
},
"oauth_client": [],
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9306b1b..155b661 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -34,9 +34,9 @@
-
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/activity/DetailActivity.java b/app/src/main/java/com/example/funnysounds/activity/DetailActivity.java
index 350e581..4e080e6 100644
--- a/app/src/main/java/com/example/funnysounds/activity/DetailActivity.java
+++ b/app/src/main/java/com/example/funnysounds/activity/DetailActivity.java
@@ -1,14 +1,20 @@
package com.example.funnysounds.activity;
import android.content.Intent;
+import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
+import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
+import android.os.Handler;
+import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
+import android.widget.SeekBar;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -22,49 +28,88 @@ import com.bumptech.glide.request.target.Target;
import com.example.funnysounds.R;
import com.example.funnysounds.data.MyData;
+import com.example.funnysounds.resolve.Sounds;
+import com.example.funnysounds.room.MyRoom;
import com.example.funnysounds.topon.AdManager;
+import com.example.funnysounds.topon.onActionListener;
import com.example.funnysounds.value.StaticValue;
import java.io.IOException;
-import kotlin.Unit;
-import kotlin.jvm.functions.Function1;
-
-public class DetailActivity extends AppCompatActivity{
+public class DetailActivity extends AppCompatActivity {
private String name;
private String image;
private MyData resource;
private String media;
private TextView textView;
- private ImageView imageView,imageView2;
- MediaPlayer mediaPlayer;
+ private ImageView imageView, imageView2;
+ private MediaPlayer mediaPlayer;
protected Button btn_play_pause;
private boolean play = false;
-
+ private SeekBar volumeSeekbar;
+ private ImageView imLoop, imAddLove;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
- Log.d("----------y","-----onCreate="+Thread.currentThread().getName());
textView = findViewById(R.id.data_name);
imageView = findViewById(R.id.data_image);
imageView2 = findViewById(R.id.imageview_back);
btn_play_pause = findViewById(R.id.btn_play_pause);
+ volumeSeekbar = findViewById(R.id.seekbar);
+ imLoop = findViewById(R.id.im_loop);
+ imAddLove = findViewById(R.id.im_add_love);
goGetData();
+ initMediaPlayer();
+ setVolume(volumeSeekbar);
+
onMyclick();
}
+ public void setVolume(SeekBar seekBar) {
+ AudioManager audioManager = (AudioManager) Sounds.mAppContext.getSystemService(AppCompatActivity.AUDIO_SERVICE);
+
+ int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+ seekBar.setMax(maxVolume);
+ seekBar.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
+
+ getContentResolver().registerContentObserver(Settings.System.CONTENT_URI, true, new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ super.onChange(selfChange);
+ int maxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+ seekBar.setMax(maxVolume);
+ }
+ });
+ 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) {
+
+ }
+ });
+ }
+
private void goGetData() {
Intent intent = getIntent();
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
assert resource != null;
textView.setText(resource.getTitle());
media = resource.getMp3Url();
- Log.d("----","---media"+media);
+ Log.d("----", "---media" + media);
image = resource.getPreUrl();
Glide.with(this).load(image).addListener(new RequestListener() {
@Override
@@ -79,58 +124,81 @@ public class DetailActivity extends AppCompatActivity{
}).into(imageView);
}
+ private void initMediaPlayer() {
+ mediaPlayer = new MediaPlayer();
+ try {
+ mediaPlayer.reset();
+ mediaPlayer.setDataSource(resource.getMp3Url());
+ 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) {
+ btn_play_pause.setSelected(false);
+ }
+ });
+ } catch (IOException ioException) {
+// setLoading(false);
+ Toast.makeText(this, "Prepare Fail", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ resource.setAddLove(imAddLove.isSelected());
+ MyRoom.getInstance().getDataDao().updatePrank(resource);
+ }
+ }).start();
+ }
public void onMyclick() {
+ imAddLove.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ imAddLove.setSelected(!imAddLove.isSelected());
+ }
+ });
+ imLoop.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ imLoop.setSelected(!imLoop.isSelected());
+ mediaPlayer.setLooping(imLoop.isSelected());
+ }
+ });
btn_play_pause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if (play){
- play = false;
- // mediaPlayer.release();
- btn_play_pause.setBackgroundResource(R.mipmap.play);
- if(mediaPlayer != null){
- mediaPlayer.release();
- mediaPlayer=null;
- }
-
- }else {
- AdManager.showAD(DetailActivity.this, new Function1() {
+ btn_play_pause.setSelected(!btn_play_pause.isSelected());
+ if (btn_play_pause.isSelected()) {
+ AdManager.showTopOn(DetailActivity.this, new onActionListener() {
@Override
- public Unit invoke(Integer integer) {
- if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
- btn_play_pause.setBackgroundResource(R.mipmap.stop);
- mediaPlayer = new MediaPlayer();
- try {
- mediaPlayer.setDataSource(media);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
- @Override
- public void onPrepared(MediaPlayer mp) {
- Log.d("---------","--------finish");
- mediaPlayer.start();
- }
- });
- play = true;
- mediaPlayer.prepareAsync();
+ public void onAction() {
+ if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
+ mediaPlayer.start();
}
- return null;
+
}
});
-
-
+ } else {
+ if (mediaPlayer != null) {
+ mediaPlayer.pause();
+ }
}
}
});
imageView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(mediaPlayer != null){
- if (mediaPlayer.isPlaying()) {
- mediaPlayer.stop();
- }
- }
finish();
}
diff --git a/app/src/main/java/com/example/funnysounds/activity/IntoActivity.java b/app/src/main/java/com/example/funnysounds/activity/IntoActivity.java
index 8fdc6e7..241071f 100644
--- a/app/src/main/java/com/example/funnysounds/activity/IntoActivity.java
+++ b/app/src/main/java/com/example/funnysounds/activity/IntoActivity.java
@@ -3,29 +3,40 @@ package com.example.funnysounds.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
+import android.util.Log;
+import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import com.example.funnysounds.R;
+import com.example.funnysounds.resolve.Sounds;
+import com.example.funnysounds.topon.CountAction;
+import com.example.funnysounds.topon.GoMainAction;
import com.example.funnysounds.topon.AdManager;
-import kotlin.Unit;
-import kotlin.jvm.functions.Function0;
-
public class IntoActivity extends AppCompatActivity {
- private boolean needShow = true;
- public com.mbridge.msdk.newinterstitial.out.MBBidNewInterstitialHandler MBBidNewInterstitialHandler;
+
+
protected CountDownTimer countDownTimer;
- private Long tim = 11000L;
+ private long tim = 1000L;
+ private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_into);
- countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new Function0() {
+
+ progressBar = findViewById(R.id.progress);
+ countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new CountAction() {
@Override
- public Unit invoke() {
+ public void onCount(long millisUntilFinished) {
+ float l1 = (float)millisUntilFinished / tim;
+ float v = 100-l1 * 100;
+ progressBar.setProgress((int) v);
+ }
+ }, new GoMainAction() {
+ @Override
+ public void onGo() {
startMainActivity();
- return null;
}
});
countDownTimer.start();
@@ -35,6 +46,7 @@ public class IntoActivity extends AppCompatActivity {
private void startMainActivity() {
+ progressBar.setProgress(100);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
diff --git a/app/src/main/java/com/example/funnysounds/activity/MainActivity.java b/app/src/main/java/com/example/funnysounds/activity/MainActivity.java
index fe7fa73..b48954f 100644
--- a/app/src/main/java/com/example/funnysounds/activity/MainActivity.java
+++ b/app/src/main/java/com/example/funnysounds/activity/MainActivity.java
@@ -4,66 +4,50 @@ import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Parcelable;
-import android.util.Log;
import android.view.Gravity;
+import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.drawerlayout.widget.DrawerLayout;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.viewpager.widget.ViewPager;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+import androidx.viewpager2.adapter.FragmentStateAdapter;
+import androidx.viewpager2.widget.ViewPager2;
import com.example.funnysounds.R;
-import com.example.funnysounds.action.CategoryNameSoundsrListener;
-import com.example.funnysounds.data.CategoryList;
-import com.example.funnysounds.resolve.MySpace;
-import com.example.funnysounds.resolve.Sounds;
-import com.example.funnysounds.soundsadapter.CgNameAdapter;
-import com.example.funnysounds.value.StaticValue;
+import com.example.funnysounds.databinding.ActivityMainBinding;
+import com.example.funnysounds.fragement.CategoryFragment;
+import com.example.funnysounds.fragement.LoveFragment;
+import com.google.android.material.tabs.TabLayout;
-import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
-public class MainActivity extends AppCompatActivity implements CategoryNameSoundsrListener{
- private TextView textview_sounds;
- private TextView text_version;
- private RecyclerView recyclerview_sounds;
- private ImageView imageView_menu;
- private RelativeLayout url_lay;
- private RelativeLayout version_lay;
- private String name;
- private DrawerLayout main_layout;
+public class MainActivity extends AppCompatActivity {
+
+
+ private ActivityMainBinding vb;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- textview_sounds = findViewById(R.id.textview_sounds);
- main_layout =findViewById (R.id.main);
- recyclerview_sounds = findViewById(R.id.recyclerview_sounds);
- textview_sounds.setTypeface(Typeface.createFromAsset(getAssets(),"myfont.ttf"));
- imageView_menu = findViewById(R.id.image_menu);
- url_lay = findViewById(R.id.url_previcy);
- version_lay = findViewById(R.id.version_lay);
- text_version = findViewById(R.id.text_version);
- imageView_menu.setOnClickListener(new View.OnClickListener() {
+ vb = ActivityMainBinding.inflate(getLayoutInflater());
+ setContentView(vb.getRoot());
+ initTabVp();
+ vb.imageMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- main_layout.openDrawer(Gravity.RIGHT);
+ vb.main.openDrawer(Gravity.RIGHT);
}
});
- setRecyclerviewSounds();
- url_lay.setOnClickListener(new View.OnClickListener() {
+
+ vb.urlPrevicy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotopricy();
@@ -71,24 +55,92 @@ public class MainActivity extends AppCompatActivity implements CategoryNameSound
});
String appVersions = getAppVersions();
if (appVersions == null) {
- text_version.setText("V1.2");
+ vb.textVersion.setText("V1.2");
} else {
String format = String.format(getString(R.string.app_sounds_version), appVersions);
- text_version.setText(format);
+ vb.textVersion.setText(format);
}
- version_lay.setOnClickListener(new View.OnClickListener() {
+ 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();
+ Toast.makeText(MainActivity.this, "This Version is V1.3", Toast.LENGTH_SHORT).show();
}
});
}
+ private void initTabVp() {
+
+ int[] icons = new int[]{R.drawable.selector_home, R.drawable.selector_record, R.drawable.selector_like};
+
+ for (int i = 0; i < icons.length; i++) {
+ TabLayout.Tab tab = vb.tabLayout.newTab();
+ View custmerview = LayoutInflater.from(this).inflate(R.layout.item_tablayout, null, false);
+ ImageView iconIm = custmerview.findViewById(R.id.im_icon);
+ iconIm.setImageDrawable(ContextCompat.getDrawable(MainActivity.this, icons[i]));
+
+ tab.setCustomView(custmerview);
+ if (i == 0) {
+ setTabSelected(tab, true);
+ } else {
+ setTabSelected(tab, false);
+ }
+ vb.tabLayout.addTab(tab);
+ }
+
+ vb.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
+ @Override
+ public void onTabSelected(TabLayout.Tab tab) {
+ setTabSelected(tab, true);
+ vb.viewPager.setCurrentItem(tab.getPosition());
+
+ }
+
+ @Override
+ public void onTabUnselected(TabLayout.Tab tab) {
+ setTabSelected(tab, false);
+ }
+
+ @Override
+ public void onTabReselected(TabLayout.Tab tab) {
+
+ }
+ });
+
+ List fragmentList = new ArrayList<>();
+ fragmentList.add(CategoryFragment.newInstance());
+ fragmentList.add(LoveFragment.newInstance());
+ fragmentList.add(LoveFragment.newInstance());
+
+ vb.viewPager.setAdapter(new FragmentStateAdapter(MainActivity.this) {
+ @NonNull
+ @Override
+ public Fragment createFragment(int position) {
+ return fragmentList.get(position);
+ }
+
+ @Override
+ public int getItemCount() {
+ return fragmentList.size();
+ }
+ });
+ vb.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
+ @Override
+ public void onPageSelected(int position) {
+ super.onPageSelected(position);
+ TabLayout.Tab tabAt = vb.tabLayout.getTabAt(position);
+ if(tabAt!= null){
+ tabAt.select();
+ }
+ }
+ });
+
+ }
+
private String getAppVersions() {
String appversions = "";
try {
- PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(),0);
- appversions = ((PackageInfo)packageInfo).versionName;
+ PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
+ appversions = ((PackageInfo) packageInfo).versionName;
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException(e);
}
@@ -102,18 +154,13 @@ public class MainActivity extends AppCompatActivity implements CategoryNameSound
startActivity(intent2);
}
- private void setRecyclerviewSounds() {
- MySpace mySpace = new MySpace(10,10,15);
- GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
- recyclerview_sounds.setLayoutManager(gridLayoutManager);
- recyclerview_sounds.addItemDecoration(mySpace);
- CgNameAdapter cgNameAdapter = new CgNameAdapter(Sounds.getUserList(), MainActivity.this);
- cgNameAdapter.setCategoryNameSoundsListener(this);
- recyclerview_sounds.setAdapter(cgNameAdapter);
+
+ private void setTabSelected(TabLayout.Tab tab, boolean isSelected) {
+ View custmerview = tab.getCustomView();
+ ImageView iconIm = custmerview.findViewById(R.id.im_icon);
+ iconIm.setSelected(isSelected);
+
}
- @Override
- public void onItemClickAction(CategoryList categoryList) {
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/activity/SpecifisoundsActivity.java b/app/src/main/java/com/example/funnysounds/activity/SpecifisoundsActivity.java
index 7c762eb..9e3dcf6 100644
--- a/app/src/main/java/com/example/funnysounds/activity/SpecifisoundsActivity.java
+++ b/app/src/main/java/com/example/funnysounds/activity/SpecifisoundsActivity.java
@@ -2,7 +2,6 @@ package com.example.funnysounds.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
-import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -10,6 +9,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -19,22 +19,14 @@ import com.example.funnysounds.data.CategoryList;
import com.example.funnysounds.data.MyData;
import com.example.funnysounds.resolve.MySpace;
import com.example.funnysounds.resolve.Sounds;
-import com.example.funnysounds.soundsadapter.CgNameAdapter;
+import com.example.funnysounds.room.MyRoom;
import com.example.funnysounds.soundsadapter.DataAdapter;
import com.example.funnysounds.topon.AdManager;
+import com.example.funnysounds.topon.onActionListener;
import com.example.funnysounds.value.StaticValue;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import kotlin.Unit;
-import kotlin.jvm.functions.Function1;
-
public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSounderListener {
private ImageView imageView;
@@ -43,7 +35,7 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
private TextView cName;
private RecyclerView recyclerview_specific;
private int i;
- private List categoryLists;
+
@SuppressLint("MissingInflatedId")
@Override
@@ -56,7 +48,7 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- showad(true);
+ showad();
}
});
getData();
@@ -64,21 +56,12 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
}
- @Override
- public void onBackPressed() {
- super.onBackPressed();
- showad(false);
- }
- private void showad(boolean isFinish) {
- AdManager.showAD(SpecifisoundsActivity.this, new Function1() {
+ private void showad() {
+ AdManager.showTopOn(SpecifisoundsActivity.this, new onActionListener() {
@Override
- public Unit invoke(Integer integer) {
- if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
- if (isFinish)
- finish();
- }
- return null;
+ public void onAction() {
+ finish();
}
});
}
@@ -92,13 +75,20 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
}
public void setSpecificRecycleView() {
- MySpace mySpace = new MySpace(10, 10, 15);
+ MySpace mySpace = new MySpace(20, 20, 25);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
recyclerview_specific.setLayoutManager(gridLayoutManager);
recyclerview_specific.addItemDecoration(mySpace);
- DataAdapter dataAdapter = new DataAdapter(name.getList(), this);
+ DataAdapter dataAdapter = new DataAdapter( this);
dataAdapter.setMyDataSounderListener(this);
recyclerview_specific.setAdapter(dataAdapter);
+ MyRoom.getInstance().getDataDao().queryList(name.getCateId()).observe(this, new Observer>() {
+ @Override
+ public void onChanged(List myData) {
+ Log.d(Sounds.TAG,"------------myData"+myData.size());
+ dataAdapter.setMyDataList(myData);
+ }
+ });
}
@Override
diff --git a/app/src/main/java/com/example/funnysounds/data/CategoryList.java b/app/src/main/java/com/example/funnysounds/data/CategoryList.java
index 6867973..7f68081 100644
--- a/app/src/main/java/com/example/funnysounds/data/CategoryList.java
+++ b/app/src/main/java/com/example/funnysounds/data/CategoryList.java
@@ -1,16 +1,22 @@
package com.example.funnysounds.data;
-import java.io.Serializable;
-import java.util.List;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+import com.example.funnysounds.resolve.Sounds;
+
+import java.io.Serializable;
+
+@Entity(tableName = Sounds.TABLE_1)
public class CategoryList implements Serializable {
- private String categoryId;
+ @PrimaryKey(autoGenerate = true)
+ private long cateId;
private String categoryName;
private String categoryUrl;
- private List list;
+// private List list;
- public void setCategoryId(String categoryId) {
- this.categoryId = categoryId;
+ public void setCateId(long cateId) {
+ this.cateId = cateId;
}
public void setCategoryName(String categoryName) {
@@ -21,12 +27,10 @@ public class CategoryList implements Serializable {
this.categoryUrl = categoryUrl;
}
- public void setList(List list) {
- this.list = list;
- }
- public String getCategoryId() {
- return categoryId;
+
+ public long getCateId() {
+ return cateId;
}
public String getCategoryName() {
@@ -37,7 +41,5 @@ public class CategoryList implements Serializable {
return categoryUrl;
}
- public List getList() {
- return list;
- }
+
}
diff --git a/app/src/main/java/com/example/funnysounds/data/MyData.java b/app/src/main/java/com/example/funnysounds/data/MyData.java
index 08fc1f1..4ce848a 100644
--- a/app/src/main/java/com/example/funnysounds/data/MyData.java
+++ b/app/src/main/java/com/example/funnysounds/data/MyData.java
@@ -2,13 +2,37 @@ package com.example.funnysounds.data;
import android.net.Uri;
+import androidx.room.Entity;
+import androidx.room.ForeignKey;
+import androidx.room.Index;
+import androidx.room.PrimaryKey;
+
+import com.example.funnysounds.resolve.Sounds;
+
import java.io.Serializable;
+@Entity(tableName = Sounds.TABLE_2, foreignKeys = @ForeignKey(entity = CategoryList.class, parentColumns = "cateId", childColumns = "categoryId", onDelete = ForeignKey.CASCADE),
+ indices = @Index(value = {"id"}, unique = true))
public class MyData implements Serializable {
+
+ @PrimaryKey(autoGenerate = true)
+ private long id;
+ private long categoryId;
+
private String title;
private String mp3Url;
private String preUrl;
+ private boolean addLove;
+
+ public boolean isAddLove() {
+ return addLove;
+ }
+
+ public void setAddLove(boolean addLove) {
+ this.addLove = addLove;
+ }
+
public void setTitle(String title) {
this.title = title;
}
@@ -21,6 +45,22 @@ public class MyData implements Serializable {
this.preUrl = preUrl;
}
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getCategoryId() {
+ return categoryId;
+ }
+
+ public void setCategoryId(long categoryId) {
+ this.categoryId = categoryId;
+ }
+
public String getTitle() {
return title;
}
diff --git a/app/src/main/java/com/example/funnysounds/fragement/CategoryFragment.java b/app/src/main/java/com/example/funnysounds/fragement/CategoryFragment.java
new file mode 100644
index 0000000..f29b4a3
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/fragement/CategoryFragment.java
@@ -0,0 +1,72 @@
+package com.example.funnysounds.fragement;
+
+import androidx.lifecycle.Observer;
+import androidx.lifecycle.ViewModelProvider;
+
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.GridLayoutManager;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.example.funnysounds.R;
+import com.example.funnysounds.action.CategoryNameSoundsrListener;
+import com.example.funnysounds.activity.MainActivity;
+import com.example.funnysounds.data.CategoryList;
+import com.example.funnysounds.databinding.FragmentCategoryBinding;
+import com.example.funnysounds.resolve.MySpace;
+import com.example.funnysounds.room.MyRoom;
+import com.example.funnysounds.soundsadapter.CgNameAdapter;
+
+import java.util.List;
+
+public class CategoryFragment extends Fragment implements CategoryNameSoundsrListener {
+
+ private CategoryViewModel mViewModel;
+
+ private FragmentCategoryBinding vb;
+
+ public static CategoryFragment newInstance() {
+ return new CategoryFragment();
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ vb = FragmentCategoryBinding.inflate(inflater,container,false);
+ return vb.getRoot();
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ mViewModel = new ViewModelProvider(this).get(CategoryViewModel.class);
+ setRecyclerviewSounds();
+ }
+ private void setRecyclerviewSounds() {
+ MySpace mySpace = new MySpace(20, 20, 25);
+ GridLayoutManager gridLayoutManager = new GridLayoutManager(requireActivity(), 2);
+ vb.categoryRecycler.setLayoutManager(gridLayoutManager);
+ vb.categoryRecycler.addItemDecoration(mySpace);
+ CgNameAdapter cgNameAdapter = new CgNameAdapter(requireActivity());
+ cgNameAdapter.setCategoryNameSoundsListener(this);
+ vb.categoryRecycler.setAdapter(cgNameAdapter);
+ MyRoom.getInstance().getCategoryDao().queryAll().observe(requireActivity(), new Observer>() {
+ @Override
+ public void onChanged(List categoryLists) {
+ cgNameAdapter.setDataCategoryList(categoryLists);
+ }
+ });
+
+ }
+
+ @Override
+ public void onItemClickAction(CategoryList categoryList) {
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/fragement/CategoryViewModel.java b/app/src/main/java/com/example/funnysounds/fragement/CategoryViewModel.java
new file mode 100644
index 0000000..52be582
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/fragement/CategoryViewModel.java
@@ -0,0 +1,7 @@
+package com.example.funnysounds.fragement;
+
+import androidx.lifecycle.ViewModel;
+
+public class CategoryViewModel extends ViewModel {
+ // TODO: Implement the ViewModel
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/fragement/LoveFragment.java b/app/src/main/java/com/example/funnysounds/fragement/LoveFragment.java
new file mode 100644
index 0000000..fc13c4b
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/fragement/LoveFragment.java
@@ -0,0 +1,69 @@
+package com.example.funnysounds.fragement;
+
+import androidx.lifecycle.Observer;
+import androidx.lifecycle.ViewModelProvider;
+
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.example.funnysounds.R;
+import com.example.funnysounds.data.CategoryList;
+import com.example.funnysounds.data.MyData;
+import com.example.funnysounds.databinding.FragmentCategoryBinding;
+import com.example.funnysounds.databinding.FragmentLoveBinding;
+import com.example.funnysounds.resolve.MySpace;
+import com.example.funnysounds.room.MyRoom;
+import com.example.funnysounds.soundsadapter.CgNameAdapter;
+import com.example.funnysounds.soundsadapter.LoveAdapter;
+
+import java.util.List;
+
+public class LoveFragment extends Fragment {
+
+ private RankViewModel mViewModel;
+ private FragmentLoveBinding vb;
+
+ public static LoveFragment newInstance() {
+ return new LoveFragment();
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ vb = FragmentLoveBinding.inflate(inflater,container,false);
+ return vb.getRoot();
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ mViewModel = new ViewModelProvider(this).get(RankViewModel.class);
+
+ init();
+ }
+ private void init() {
+ MySpace mySpace = new MySpace(20, 20, 25);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity());
+ vb.loveRecycler.setLayoutManager(layoutManager);
+ vb.loveRecycler.addItemDecoration(mySpace);
+ LoveAdapter loveAdapter = new LoveAdapter(requireActivity());
+
+ vb.loveRecycler.setAdapter(loveAdapter);
+ MyRoom.getInstance().getDataDao().queryLoveList(true).observe(requireActivity(), new Observer>() {
+ @Override
+ public void onChanged(List list) {
+ loveAdapter.setMyDataList(list);
+ }
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/fragement/RankViewModel.java b/app/src/main/java/com/example/funnysounds/fragement/RankViewModel.java
new file mode 100644
index 0000000..ef562a8
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/fragement/RankViewModel.java
@@ -0,0 +1,7 @@
+package com.example.funnysounds.fragement;
+
+import androidx.lifecycle.ViewModel;
+
+public class RankViewModel extends ViewModel {
+ // TODO: Implement the ViewModel
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/resolve/Readfile.java b/app/src/main/java/com/example/funnysounds/resolve/Readfile.java
index b22e67e..2ad1aae 100644
--- a/app/src/main/java/com/example/funnysounds/resolve/Readfile.java
+++ b/app/src/main/java/com/example/funnysounds/resolve/Readfile.java
@@ -1,5 +1,16 @@
package com.example.funnysounds.resolve;
+import android.util.DisplayMetrics;
+import android.util.Log;
+
+import com.example.funnysounds.data.CategoryList;
+import com.example.funnysounds.data.MyData;
+import com.example.funnysounds.room.MyRoom;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -7,6 +18,8 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
public class Readfile {
public static String getCovertStr(InputStream stream) {
@@ -30,4 +43,49 @@ public class Readfile {
float scale = Sounds.mAppContext.getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
+
+
+
+
+
+
+ public static void getData(String jsonString) {
+ try {
+ List prankData = new ArrayList<>();
+ JSONArray jsonArray = new JSONArray(jsonString);
+ for (int i = 0; i < jsonArray.length(); i++) {
+ CategoryList data = new CategoryList();
+ List myList = new ArrayList<>();
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ String categoryName = jsonObject.getString("categoryName");
+ String categoryUrl = jsonObject.getString("categoryUrl");
+ JSONArray list = jsonObject.getJSONArray("list");
+ data.setCategoryUrl(categoryUrl);
+ data.setCategoryName(categoryName);
+ long id = MyRoom.getInstance().getCategoryDao().insertData(data);
+
+ Log.d(Sounds.TAG,"categoryName" + categoryName + "---id=" + id);
+ for (int a = 0; a < list.length(); a++) {
+ JSONObject prankList = list.getJSONObject(a);
+ String title = prankList.getString("title");
+ String mp3Url = prankList.getString("mp3Url");
+ String preUrl = prankList.getString("preUrl");
+ MyData prank = new MyData();
+ prank.setMp3Url(mp3Url);
+ prank.setTitle(title);
+ prank.setPreUrl(preUrl);
+ prank.setCategoryId(id);
+ MyRoom.getInstance().getDataDao().insertPrank(prank);
+ Log.d(Sounds.TAG,"title" + title + "---id=" + id);
+ myList.add(prank);
+ }
+// data.setPrankList(myList);
+
+ prankData.add(data);
+ }
+
+ } catch (JSONException e) {
+
+ }
+ }
}
diff --git a/app/src/main/java/com/example/funnysounds/resolve/Sounds.java b/app/src/main/java/com/example/funnysounds/resolve/Sounds.java
index 3d55323..37c296d 100644
--- a/app/src/main/java/com/example/funnysounds/resolve/Sounds.java
+++ b/app/src/main/java/com/example/funnysounds/resolve/Sounds.java
@@ -1,35 +1,26 @@
package com.example.funnysounds.resolve;
-import static android.content.ContentValues.TAG;
-
import android.app.Application;
import android.content.Context;
-import android.content.Intent;
import android.util.Log;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
-
+import androidx.lifecycle.LiveData;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
-import com.anythink.debug.api.ATDebuggerUITest;
import com.example.funnysounds.data.CategoryList;
+import com.example.funnysounds.room.MyRoom;
import com.example.funnysounds.topon.AdManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
-import com.mbridge.msdk.MBridgeSDK;
-import com.mbridge.msdk.out.MBridgeSDKFactory;
-import com.mbridge.msdk.out.SDKInitStatusListener;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
-import java.util.Map;
public class Sounds extends Application {
public static final String AD_INIT = "on_SDK_action";
public static Context mAppContext;
- public static Sounds context;
public static boolean initOK = false;
public static String TAG = "-----AD";
private static List categoryList;
@@ -38,32 +29,39 @@ public class Sounds extends Application {
private String AppKey = "a7fce863e6f891c168d9a87cbe49cb3d8";
private String debugKey = "a7fce863e6f891c168d9a87cbe49cb3d8";
+ public static final int DB_VERSION = 1;
+ public static String DB_NAME = "Funny_Sounds";
+ public static final String TABLE_1 = "table_category";
+ public static final String TABLE_2 = "table_data";
+
@Override
public void onCreate() {
super.onCreate();
mAppContext = this;
- context = this;
init();
- try {
- InputStream open = getAssets().open("prank.json");
- String covertStr = Readfile.getCovertStr(open);
- if (!covertStr.isEmpty()) {
- Gson gson = new Gson();
- categoryList = gson.fromJson(covertStr, new TypeToken>() {
- }.getType());
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+
+ List categoryLists = MyRoom.getInstance().getCategoryDao().queryAllData();
+ if (categoryLists.size() == 0) {
+ try {
+ InputStream open = getAssets().open("prank.json");
+ String covertStr = Readfile.getCovertStr(open);
+ if (!covertStr.isEmpty()) {
+ Readfile.getData(covertStr);
+ }
+ } catch (IOException e) {
+ Log.d(TAG, "-----------fail");
+ }
+ }
}
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ }).start();
+
}
- public static List getUserList() {
- if (categoryList != null) {
- return categoryList;
- }
- return categoryList;
- }
public void init() {
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
@@ -82,7 +80,7 @@ public class Sounds extends Application {
Log.e(TAG, "onErrorCallback:" + errorMsg);
}
});
- ATSDK.init( this, AppId, AppKey);
+ ATSDK.init(this, AppId, AppKey);
AdManager.loadAllAd();
// ATDebuggerUITest.showDebuggerUI(this,debugKey);
diff --git a/app/src/main/java/com/example/funnysounds/room/CategoryDao.java b/app/src/main/java/com/example/funnysounds/room/CategoryDao.java
new file mode 100644
index 0000000..0b9cb57
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/room/CategoryDao.java
@@ -0,0 +1,30 @@
+package com.example.funnysounds.room;
+
+import androidx.lifecycle.LiveData;
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.OnConflictStrategy;
+import androidx.room.Query;
+
+import com.example.funnysounds.data.CategoryList;
+
+import java.util.List;
+
+@Dao
+public interface CategoryDao {
+
+ @Insert(onConflict = OnConflictStrategy.IGNORE)
+ long insertData(CategoryList data);
+
+
+ @Query("select * from table_category order by cateId desc")
+ LiveData> queryAll();
+
+ @Query("select * from table_category order by cateId desc")
+ List queryAllData();
+
+
+
+
+
+}
diff --git a/app/src/main/java/com/example/funnysounds/room/DataDao.java b/app/src/main/java/com/example/funnysounds/room/DataDao.java
new file mode 100644
index 0000000..603ad04
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/room/DataDao.java
@@ -0,0 +1,33 @@
+package com.example.funnysounds.room;
+
+import androidx.lifecycle.LiveData;
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.OnConflictStrategy;
+import androidx.room.Query;
+import androidx.room.Update;
+
+import com.example.funnysounds.data.MyData;
+
+import java.util.List;
+
+@Dao
+public interface DataDao {
+
+ @Insert(onConflict = OnConflictStrategy.IGNORE)
+ void insertPrank(MyData data);
+
+ @Query("select * from table_data")
+ List queryAll();
+
+ @Query("select * from table_data where categoryId ==:mId")
+ LiveData> queryList(long mId);
+
+
+ @Query("select * from table_data where addLove ==:love")
+ LiveData> queryLoveList(boolean love);
+
+
+ @Update
+ void updatePrank(MyData myData);
+}
diff --git a/app/src/main/java/com/example/funnysounds/room/MyRoom.java b/app/src/main/java/com/example/funnysounds/room/MyRoom.java
new file mode 100644
index 0000000..560f9b2
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/room/MyRoom.java
@@ -0,0 +1,28 @@
+package com.example.funnysounds.room;
+
+import androidx.room.Database;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+
+import com.example.funnysounds.data.CategoryList;
+import com.example.funnysounds.data.MyData;
+import com.example.funnysounds.resolve.Sounds;
+
+
+@Database(entities = {CategoryList.class, MyData.class}, version = Sounds.DB_VERSION, exportSchema = false)
+public abstract class MyRoom extends RoomDatabase {
+
+ private static MyRoom myRoom;
+
+ public abstract DataDao getDataDao();
+
+ public abstract CategoryDao getCategoryDao();
+
+ public static MyRoom getInstance() {
+ if (MyRoom.myRoom == null) {
+ Builder myRoomBuilder = Room.databaseBuilder(Sounds.mAppContext, MyRoom.class, Sounds.DB_NAME);
+ myRoom = myRoomBuilder.build();
+ }
+ return MyRoom.myRoom;
+ }
+}
diff --git a/app/src/main/java/com/example/funnysounds/soundsadapter/CgNameAdapter.java b/app/src/main/java/com/example/funnysounds/soundsadapter/CgNameAdapter.java
index 2889dc1..b425a2f 100644
--- a/app/src/main/java/com/example/funnysounds/soundsadapter/CgNameAdapter.java
+++ b/app/src/main/java/com/example/funnysounds/soundsadapter/CgNameAdapter.java
@@ -26,13 +26,14 @@ import com.example.funnysounds.data.CategoryList;
import com.example.funnysounds.topon.AdManager;
import com.example.funnysounds.value.StaticValue;
+import java.util.ArrayList;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
public class CgNameAdapter extends RecyclerView.Adapter {
- private List dataCategoryList;
+ private List dataCategoryList = new ArrayList<>();
private Activity myContext;
private CategoryNameSoundsrListener cgNameSoundsrListener;
@@ -40,11 +41,15 @@ public class CgNameAdapter extends RecyclerView.Adapter {
this.cgNameSoundsrListener = categoryNameSoundsrListener;
}
- public CgNameAdapter(List cglist, Activity mycontext) {
- dataCategoryList = cglist;
+ public CgNameAdapter(Activity mycontext) {
myContext = mycontext;
}
+ public void setDataCategoryList(List dataCategoryList) {
+ this.dataCategoryList = dataCategoryList;
+ notifyDataSetChanged();
+ }
+
@NonNull
@Override
public CgViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@@ -58,8 +63,9 @@ public class CgNameAdapter extends RecyclerView.Adapter {
holder.getTextView().setText(categorylist.getCategoryName());
ImageView imageView = holder.getImageView();
Glide.with(myContext)
+ .asDrawable()
+ .placeholder(R.mipmap.logo)
.load(categorylist.getCategoryUrl())
- .transform(new RoundedCorners(90))
.listener(new RequestListener() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target target, boolean isFirstResource) {
@@ -83,7 +89,6 @@ public class CgNameAdapter extends RecyclerView.Adapter {
}
-
private void startSpecifiActivity(CategoryList categoryList) {
Intent intent = new Intent(myContext, SpecifisoundsActivity.class);
intent.putExtra(StaticValue.key_category_name, categoryList);
diff --git a/app/src/main/java/com/example/funnysounds/soundsadapter/DataAdapter.java b/app/src/main/java/com/example/funnysounds/soundsadapter/DataAdapter.java
index ad0efaf..dc828aa 100644
--- a/app/src/main/java/com/example/funnysounds/soundsadapter/DataAdapter.java
+++ b/app/src/main/java/com/example/funnysounds/soundsadapter/DataAdapter.java
@@ -24,44 +24,51 @@ import com.example.funnysounds.data.MyData;
import com.example.funnysounds.resolve.Readfile;
import com.example.funnysounds.value.StaticValue;
+import java.util.ArrayList;
import java.util.List;
-public class DataAdapter extends RecyclerView.Adapter{
- private List myDataList;
+public class DataAdapter extends RecyclerView.Adapter {
+ private List myDataList = new ArrayList<>();
private Context myContext;
private MyDataSounderListener myDataSounderListener;
- public DataAdapter(List myData,Context mycontext){
- myDataList = myData;
- myContext = mycontext;
+
+ public DataAdapter(Context mycontext) {
+ myContext = mycontext;
}
- public void setMyDataSounderListener(MyDataSounderListener dataSounderListener)
- {
+
+ public void setMyDataList(List myDataList) {
+ this.myDataList = myDataList;
+ notifyDataSetChanged();
+ }
+
+ public void setMyDataSounderListener(MyDataSounderListener dataSounderListener) {
this.myDataSounderListener = dataSounderListener;
}
@NonNull
@Override
- public DataViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View itemview = LayoutInflater.from(myContext).inflate(R.layout.specific_adapterlist,parent,false);
- return new DataViewHolder(itemview);
+ public CgViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View itemview = LayoutInflater.from(myContext).inflate(R.layout.sounds_adapterlist, parent, false);
+ return new CgViewHolder(itemview);
}
@Override
- public void onBindViewHolder(@NonNull DataViewHolder holder, int position) {
+ public void onBindViewHolder(@NonNull CgViewHolder holder, int position) {
MyData myData = myDataList.get(position);
- holder.getTextview_specific().setText(myData.getTitle());
- ImageView imageView = holder.getImageview_specific();
+ holder.getTextView().setText(myData.getTitle());
+ ImageView imageView = holder.getImageView();
//final MediaPlayer mediaPlayer = MediaPlayer.create(holder.itemView.getContext(), Uri.parse(myData.getMp3Url()));
Glide.with(myContext)
+ .asDrawable()
.load(myData.getPreUrl())
- .transform(new RoundedCorners(90))
+ .placeholder(R.mipmap.logo)
.into(imageView);
- holder.getLayout_specific().setOnClickListener(new View.OnClickListener() {
+ holder.getLayout_root().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(myContext, DetailActivity.class);
- intent.putExtra(StaticValue.key_resourse,myData);
+ intent.putExtra(StaticValue.key_resourse, myData);
myContext.startActivity(intent);
}
});
diff --git a/app/src/main/java/com/example/funnysounds/soundsadapter/LoveAdapter.java b/app/src/main/java/com/example/funnysounds/soundsadapter/LoveAdapter.java
new file mode 100644
index 0000000..4c11e53
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/soundsadapter/LoveAdapter.java
@@ -0,0 +1,99 @@
+package com.example.funnysounds.soundsadapter;
+
+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 androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+import com.example.funnysounds.R;
+import com.example.funnysounds.action.MyDataSounderListener;
+import com.example.funnysounds.activity.DetailActivity;
+import com.example.funnysounds.data.MyData;
+import com.example.funnysounds.databinding.ItemLoveBinding;
+import com.example.funnysounds.value.StaticValue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LoveAdapter extends RecyclerView.Adapter {
+ private List myDataList = new ArrayList<>();
+ private Context myContext;
+ private MyDataSounderListener myDataSounderListener;
+
+ public LoveAdapter(Context mycontext) {
+ myContext = mycontext;
+ }
+
+ public void setMyDataList(List myDataList) {
+ this.myDataList = myDataList;
+ notifyDataSetChanged();
+ }
+
+ public void setMyDataSounderListener(MyDataSounderListener dataSounderListener) {
+ this.myDataSounderListener = dataSounderListener;
+ }
+
+
+ @NonNull
+ @Override
+ public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+
+ ItemLoveBinding inflate = ItemLoveBinding.inflate(LayoutInflater.from(myContext), parent, false);
+
+ return new VH(inflate);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull VH holder, int position) {
+ MyData myData = myDataList.get(position);
+ holder.getVb().name.setText(myData.getTitle());
+
+
+ Glide.with(myContext)
+ .asDrawable()
+ .load(myData.getPreUrl())
+ .placeholder(R.mipmap.logo)
+ .into(holder.getVb().imSounds);
+ holder.getVb().getRoot().setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(myContext, DetailActivity.class);
+ intent.putExtra(StaticValue.key_resourse, myData);
+ myContext.startActivity(intent);
+ }
+ });
+
+ holder.getVb().imLove.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return myDataList.size();
+ }
+
+
+ public static class VH extends RecyclerView.ViewHolder {
+
+ private ItemLoveBinding vb;
+
+ public VH(@NonNull ItemLoveBinding itemView) {
+ super(itemView.getRoot());
+ vb = itemView;
+ }
+
+ public ItemLoveBinding getVb() {
+ return vb;
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/AdListener.java b/app/src/main/java/com/example/funnysounds/topon/AdListener.java
new file mode 100644
index 0000000..7532f46
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/AdListener.java
@@ -0,0 +1,10 @@
+package com.example.funnysounds.topon;
+
+public interface AdListener {
+ void loadFail(String placeId);
+ void showSuccess();
+
+ void showFail();
+
+ void showClose();
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/AdListener.kt b/app/src/main/java/com/example/funnysounds/topon/AdListener.kt
deleted file mode 100644
index 2757e4e..0000000
--- a/app/src/main/java/com/example/funnysounds/topon/AdListener.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.example.funnysounds.topon
-
-interface AdListener {
- fun showSuccess()
-
- fun showFail()
-
- fun showClose()
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/topon/AdManager.java b/app/src/main/java/com/example/funnysounds/topon/AdManager.java
new file mode 100644
index 0000000..2f7ccbf
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/AdManager.java
@@ -0,0 +1,248 @@
+package com.example.funnysounds.topon;
+
+import android.app.Activity;
+import android.os.CountDownTimer;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import com.anythink.core.api.ATAdInfo;
+import com.anythink.core.api.AdError;
+import com.anythink.interstitial.api.ATInterstitial;
+import com.anythink.interstitial.api.ATInterstitialListener;
+import com.example.funnysounds.resolve.Sounds;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class AdManager {
+
+ private static final int type_no_cache = 0;
+ private static final int type_has_cache = 1;
+ private static final int type_show_success = 2;
+ private static final int type_show_close = 3;
+ private static final int type_show_fail = 4;
+
+ /**
+ * const val place1Id = "n66a0be565fa6d"
+ * const val place2Id = "n66a0be5614478"
+ * const val place3Id = "n66a0be55b7bbe"
+ */
+
+ private static final String place1Id = "n66a0be565fa6d";
+ private static final String place2Id = "n66a0be5614478";
+ private static final String place3Id = "n66a0be55b7bbe";
+
+
+ private static boolean place1LoadFail = false;
+ private static boolean place2LoadFail = false;
+ private static boolean place3LoadFail = false;
+
+ private static boolean alreadyShow = false;
+
+ private static List list = new ArrayList<>();
+
+
+ public static void loadAllAd() {
+ if (list.size() == 0) {
+ ATInterstitial mInterstitialAd1 = new ATInterstitial(Sounds.mAppContext, place1Id);
+ ATInterstitial mInterstitialAd2 = new ATInterstitial(Sounds.mAppContext, place2Id);
+ ATInterstitial mInterstitialAd3 = new ATInterstitial(Sounds.mAppContext, place3Id);
+ list.add(mInterstitialAd1);
+ list.add(mInterstitialAd2);
+ list.add(mInterstitialAd3);
+ }
+ for (ATInterstitial ad : list) {
+ if (!ad.isAdReady()) {
+ setCallBack(ad, new AdListener() {
+ @Override
+ public void loadFail(@NonNull String placeId) {
+ if (placeId.equals(place1Id)) {
+ place1LoadFail = true;
+ }
+ if (placeId.equals(place2Id)) {
+ place2LoadFail = true;
+ }
+ if (placeId.equals(place3Id)) {
+ place3LoadFail = true;
+ }
+ }
+
+ @Override
+ public void showSuccess() {
+
+ }
+
+ @Override
+ public void showFail() {
+
+ }
+
+ @Override
+ public void showClose() {
+
+ }
+ });
+// ad.load()
+ }
+ }
+
+
+ }
+
+ private static ATInterstitial getReadyAd() {
+ Collections.shuffle(list);
+ for (ATInterstitial ad : list) {
+ if (ad.isAdReady()) {
+ Log.d(Sounds.TAG, "-has Cache------------");
+ return ad;
+ }
+ }
+ Log.d(Sounds.TAG, "-No Cache------------");
+ return null;
+ }
+
+ private static void setCallBack(ATInterstitial ad, AdListener listener) {
+ ad.setAdListener(new ATInterstitialListener() {
+
+
+ @Override
+ public void onInterstitialAdLoaded() {
+ Log.d(Sounds.TAG, "LoadLoaded " + ad.mPlacementId);
+ }
+
+ @Override
+ public void onInterstitialAdLoadFail(AdError adError) {
+ listener.loadFail(ad.mPlacementId);
+ Log.d(Sounds.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
+ }
+
+ @Override
+ public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
+
+ }
+
+ @Override
+ public void onInterstitialAdShow(ATAdInfo atAdInfo) {
+ Log.d(Sounds.TAG, "AdShow " + atAdInfo.getShowId());
+ listener.showSuccess();
+// ad.load()
+ }
+
+ @Override
+ public void onInterstitialAdClose(ATAdInfo atAdInfo) {
+ listener.showClose();
+ }
+
+ @Override
+ public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
+
+ }
+
+ @Override
+ public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
+
+ }
+
+ @Override
+ public void onInterstitialAdVideoError(AdError adError) {
+
+ }
+ });
+ }
+
+
+
+
+ public static CountDownTimer showWelcomeAd(
+ Activity activity,
+ Long totalTim,
+ CountAction countAction,
+ GoMainAction goMain
+ ) {
+
+ CountDownTimer timer = new CountDownTimer(totalTim, 50) {
+ @Override
+ public void onTick(long millisUntilFinished) {
+ countAction.onCount(millisUntilFinished);
+ if (!alreadyShow) {
+ showAD(activity, new AdStatusAction() {
+ @Override
+ public void onStatus(int adType) {
+ if (adType == type_has_cache) {
+ alreadyShow = true;
+ }
+ if (adType == type_show_close || adType == type_show_fail) {
+ goMain.onGo();
+ }
+
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onFinish() {
+ if (!alreadyShow) {
+ showTopOn(activity, new onActionListener() {
+ @Override
+ public void onAction() {
+ goMain.onGo();
+ }
+ });
+ }
+ }
+ };
+
+
+ return timer;
+ }
+
+
+
+ private static void showAD(Activity activity, AdStatusAction action) {
+ ATInterstitial readyAd = getReadyAd();
+ if (readyAd != null) {
+ action.onStatus(type_has_cache);
+ setCallBack(readyAd, new AdListener() {
+ @Override
+ public void loadFail(@NonNull String placeId) {
+
+ }
+
+ @Override
+ public void showSuccess() {
+ action.onStatus(type_show_success);
+ }
+
+ @Override
+ public void showFail() {
+ action.onStatus(type_show_fail);
+ }
+
+ @Override
+ public void showClose() {
+ action.onStatus(type_show_close);
+ }
+ });
+ readyAd.show(activity);
+ } else {
+ action.onStatus(type_no_cache);
+
+ }
+ }
+
+
+ public static void showTopOn(Activity activity, onActionListener listener) {
+ showAD(activity, new AdStatusAction() {
+ @Override
+ public void onStatus(int adType) {
+ if (adType == type_no_cache || adType == type_show_close || adType == type_show_fail) {
+ listener.onAction();
+ }
+ }
+ });
+
+ }
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/AdManager.kt b/app/src/main/java/com/example/funnysounds/topon/AdManager.kt
deleted file mode 100644
index 6f563fd..0000000
--- a/app/src/main/java/com/example/funnysounds/topon/AdManager.kt
+++ /dev/null
@@ -1,172 +0,0 @@
-package com.example.funnysounds.topon
-
-import android.app.Activity
-import android.os.CountDownTimer
-import android.util.Log
-import com.anythink.core.api.ATAdInfo
-import com.anythink.core.api.AdError
-import com.anythink.interstitial.api.ATInterstitial
-import com.anythink.interstitial.api.ATInterstitialListener
-import com.example.funnysounds.resolve.Sounds
-
-
-object AdManager {
-
-
- const val type_no_cache = 0
- const val type_has_cache = 1
- const val type_show_success = 2
- const val type_show_close = 3
- const val type_show_fail = 4
-
-
- const val place1Id = "n66a0be565fa6d"
- const val place2Id = "n66a0be5614478"
- const val place3Id = "n66a0be55b7bbe"
-
- val list = mutableListOf()
-
-
- @JvmStatic
- fun loadAllAd() {
- if (list.size <= 0) {
- val mInterstitialAd1 = ATInterstitial(Sounds.context, place1Id)
- val mInterstitialAd2 = ATInterstitial(Sounds.context, place2Id)
- val mInterstitialAd3 = ATInterstitial(Sounds.context, place3Id)
- list.add(mInterstitialAd1)
- list.add(mInterstitialAd2)
- list.add(mInterstitialAd3)
- }
- for (ad in list) {
- if (!ad.isAdReady) {
- setCallBack(ad,object : AdListener {
- override fun showSuccess() {
-
- }
-
- override fun showFail() {
-
- }
-
- override fun showClose() {
-
- }
-
- })
- ad.load()
- }
- }
-
-
- }
- @JvmStatic
- fun getReadyAd(): ATInterstitial? {
- list.shuffle()
- for (ad in list) {
- if (ad.isAdReady) {
- return ad
- }
- }
- return null
- }
-
-
- @JvmStatic
- fun showWelcomeAd(activity: Activity,totalTim: Long, goMain: () -> Unit): CountDownTimer {
- var alreadyShow = false
- var timer = object : CountDownTimer(totalTim, 100) {
- override fun onTick(millisUntilFinished: Long) {
- if (!alreadyShow) {
- showAD(activity) {
- if (it == type_has_cache) {
- alreadyShow = true
- }
- if (it == type_show_close || it == type_show_fail) {
- goMain.invoke()
- }
-
- }
- }
-
- }
-
- override fun onFinish() {
- if (!alreadyShow) {
- showAD(activity) {
- if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
- goMain.invoke()
- }
- }
- }
- }
-
- }
- return timer
- }
-
- private fun setCallBack(ad: ATInterstitial, listener: AdListener) {
- ad.setAdListener(object : ATInterstitialListener {
- override fun onInterstitialAdLoaded() {
- Log.d(Sounds.TAG, "LoadLoaded ${ad.mPlacementId}")
- }
-
- override fun onInterstitialAdLoadFail(p0: AdError?) {
- Log.d(Sounds.TAG, "LoadFail:${p0?.code} ${p0?.desc}")
- }
-
- override fun onInterstitialAdClicked(p0: ATAdInfo?) {
-
- }
-
- override fun onInterstitialAdShow(p0: ATAdInfo?) {
- Log.d(Sounds.TAG, "AdShow ${p0?.showId} ")
- listener.showSuccess()
- ad.load()
- }
-
- override fun onInterstitialAdClose(p0: ATAdInfo?) {
- listener.showClose()
- }
-
- override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
-
- }
-
- override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
-
- }
-
- override fun onInterstitialAdVideoError(p0: AdError?) {
- listener.showFail()
- }
-
- })
- }
-
-
- @JvmStatic
- fun showAD(activity: Activity, action: (type: Int) -> Unit) {
- val readyAd = getReadyAd()
- if (readyAd!= null) {
- Log.d(Sounds.TAG, "readyAd ${readyAd.mPlacementId} ")
- action.invoke(type_has_cache)
- setCallBack(readyAd,object : AdListener {
- override fun showSuccess() {
- action.invoke(type_show_success)
- }
-
- override fun showFail() {
- action.invoke(type_show_fail)
- }
-
- override fun showClose() {
- action.invoke(type_show_close)
- }
-
- })
- readyAd.show(activity)
- } else {
- action.invoke(type_no_cache)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/funnysounds/topon/AdStatusAction.java b/app/src/main/java/com/example/funnysounds/topon/AdStatusAction.java
new file mode 100644
index 0000000..c12e440
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/AdStatusAction.java
@@ -0,0 +1,5 @@
+package com.example.funnysounds.topon;
+
+public interface AdStatusAction {
+ void onStatus(int adType);
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/CountAction.java b/app/src/main/java/com/example/funnysounds/topon/CountAction.java
new file mode 100644
index 0000000..2da30de
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/CountAction.java
@@ -0,0 +1,5 @@
+package com.example.funnysounds.topon;
+
+public interface CountAction {
+ void onCount(long millisUntilFinished);
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/GoMainAction.java b/app/src/main/java/com/example/funnysounds/topon/GoMainAction.java
new file mode 100644
index 0000000..bc0a09f
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/GoMainAction.java
@@ -0,0 +1,5 @@
+package com.example.funnysounds.topon;
+
+public interface GoMainAction {
+ void onGo();
+}
diff --git a/app/src/main/java/com/example/funnysounds/topon/onActionListener.java b/app/src/main/java/com/example/funnysounds/topon/onActionListener.java
new file mode 100644
index 0000000..3237a1a
--- /dev/null
+++ b/app/src/main/java/com/example/funnysounds/topon/onActionListener.java
@@ -0,0 +1,6 @@
+package com.example.funnysounds.topon;
+
+public interface onActionListener {
+
+ void onAction();
+}
diff --git a/app/src/main/java/com/example/funnysounds/value/StaticValue.java b/app/src/main/java/com/example/funnysounds/value/StaticValue.java
index 0668071..57d56a5 100644
--- a/app/src/main/java/com/example/funnysounds/value/StaticValue.java
+++ b/app/src/main/java/com/example/funnysounds/value/StaticValue.java
@@ -2,9 +2,7 @@ package com.example.funnysounds.value;
public class StaticValue {
public static final String key_category_name = "key_category_name";
- public static final String key_data_name = "key_data_name";
- public static final String key_image = "key_image";
+
public static final String key_resourse = "key_resourse";
- public static final String MAX_INIT_ACTION = "ad_action";
- public static final String YOUR_SDK_KEY = "gtOv1uuZoSrXBVgJLKgwRTRrMdPLV_x0C1uFOPrTCBTyJzWJNcFniU1uxQBHoOdWAA7o5CWPlaCrm5qKqe5iHx";
+
}
diff --git a/app/src/main/res/drawable/bg_love.xml b/app/src/main/res/drawable/bg_love.xml
new file mode 100644
index 0000000..3047511
--- /dev/null
+++ b/app/src/main/res/drawable/bg_love.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/im_home.xml b/app/src/main/res/drawable/im_home.xml
new file mode 100644
index 0000000..2181e49
--- /dev/null
+++ b/app/src/main/res/drawable/im_home.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_home_true.xml b/app/src/main/res/drawable/im_home_true.xml
new file mode 100644
index 0000000..8c2b4ff
--- /dev/null
+++ b/app/src/main/res/drawable/im_home_true.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_loop_false.xml b/app/src/main/res/drawable/im_loop_false.xml
new file mode 100644
index 0000000..289b979
--- /dev/null
+++ b/app/src/main/res/drawable/im_loop_false.xml
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/im_loop_true.xml b/app/src/main/res/drawable/im_loop_true.xml
new file mode 100644
index 0000000..03366ef
--- /dev/null
+++ b/app/src/main/res/drawable/im_loop_true.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/im_love.xml b/app/src/main/res/drawable/im_love.xml
new file mode 100644
index 0000000..52361aa
--- /dev/null
+++ b/app/src/main/res/drawable/im_love.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_love_red.xml b/app/src/main/res/drawable/im_love_red.xml
new file mode 100644
index 0000000..da162d0
--- /dev/null
+++ b/app/src/main/res/drawable/im_love_red.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_love_red_false.xml b/app/src/main/res/drawable/im_love_red_false.xml
new file mode 100644
index 0000000..883aea3
--- /dev/null
+++ b/app/src/main/res/drawable/im_love_red_false.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_love_true.xml b/app/src/main/res/drawable/im_love_true.xml
new file mode 100644
index 0000000..342850d
--- /dev/null
+++ b/app/src/main/res/drawable/im_love_true.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_play.xml b/app/src/main/res/drawable/im_play.xml
new file mode 100644
index 0000000..f8b31d0
--- /dev/null
+++ b/app/src/main/res/drawable/im_play.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/im_record.xml b/app/src/main/res/drawable/im_record.xml
new file mode 100644
index 0000000..6a3aa17
--- /dev/null
+++ b/app/src/main/res/drawable/im_record.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_record_true.xml b/app/src/main/res/drawable/im_record_true.xml
new file mode 100644
index 0000000..9532e91
--- /dev/null
+++ b/app/src/main/res/drawable/im_record_true.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_stop.xml b/app/src/main/res/drawable/im_stop.xml
new file mode 100644
index 0000000..2d16125
--- /dev/null
+++ b/app/src/main/res/drawable/im_stop.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/im_volumehigh.xml b/app/src/main/res/drawable/im_volumehigh.xml
new file mode 100644
index 0000000..16707a3
--- /dev/null
+++ b/app/src/main/res/drawable/im_volumehigh.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/im_volumelow.xml b/app/src/main/res/drawable/im_volumelow.xml
new file mode 100644
index 0000000..6d791f8
--- /dev/null
+++ b/app/src/main/res/drawable/im_volumelow.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/progressbar.xml b/app/src/main/res/drawable/progressbar.xml
new file mode 100644
index 0000000..d51d3fa
--- /dev/null
+++ b/app/src/main/res/drawable/progressbar.xml
@@ -0,0 +1,27 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/seekbar_progress_drawable.xml b/app/src/main/res/drawable/seekbar_progress_drawable.xml
new file mode 100644
index 0000000..06a82e9
--- /dev/null
+++ b/app/src/main/res/drawable/seekbar_progress_drawable.xml
@@ -0,0 +1,18 @@
+
+
+
+-
+
+
+
+
+
+-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/seekbar_thumb.xml b/app/src/main/res/drawable/seekbar_thumb.xml
new file mode 100644
index 0000000..9714edb
--- /dev/null
+++ b/app/src/main/res/drawable/seekbar_thumb.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_add_love.xml b/app/src/main/res/drawable/selector_add_love.xml
new file mode 100644
index 0000000..228e022
--- /dev/null
+++ b/app/src/main/res/drawable/selector_add_love.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_home.xml b/app/src/main/res/drawable/selector_home.xml
new file mode 100644
index 0000000..4ef9e69
--- /dev/null
+++ b/app/src/main/res/drawable/selector_home.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_like.xml b/app/src/main/res/drawable/selector_like.xml
new file mode 100644
index 0000000..9290422
--- /dev/null
+++ b/app/src/main/res/drawable/selector_like.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_loop.xml b/app/src/main/res/drawable/selector_loop.xml
new file mode 100644
index 0000000..0c1d66a
--- /dev/null
+++ b/app/src/main/res/drawable/selector_loop.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_play.xml b/app/src/main/res/drawable/selector_play.xml
new file mode 100644
index 0000000..d5cf8e2
--- /dev/null
+++ b/app/src/main/res/drawable/selector_play.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_record.xml b/app/src/main/res/drawable/selector_record.xml
new file mode 100644
index 0000000..302edd8
--- /dev/null
+++ b/app/src/main/res/drawable/selector_record.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/svg_back.xml b/app/src/main/res/drawable/svg_back.xml
index b4934fe..c1d8d76 100644
--- a/app/src/main/res/drawable/svg_back.xml
+++ b/app/src/main/res/drawable/svg_back.xml
@@ -5,5 +5,5 @@
android:viewportHeight="1024">
+ android:fillColor="@color/white"/>
diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml
index 3ea2eae..0599d72 100644
--- a/app/src/main/res/layout/activity_detail.xml
+++ b/app/src/main/res/layout/activity_detail.xml
@@ -1,58 +1,133 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
+ android:text="@string/loop"
+ android:textColor="@color/black"
+ android:textSize="17sp" />
+
-
+ android:id="@+id/im_loop"
+ android:layout_width="26dp"
+ android:layout_height="26dp"
+ android:layout_marginStart="6dp"
+ android:src="@drawable/selector_loop" />
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_into.xml b/app/src/main/res/layout/activity_into.xml
index 788e56a..b88cd18 100644
--- a/app/src/main/res/layout/activity_into.xml
+++ b/app/src/main/res/layout/activity_into.xml
@@ -1,19 +1,24 @@
-
+
+
+
+ app:cardCornerRadius="12dp">
+
+
+
-
+
+ android:layout_marginStart="33dp"
+ android:layout_marginEnd="33dp"
+ android:layout_marginBottom="40dp"
+ android:progress="10"
+ android:layout_alignParentBottom="true"
+ android:progressDrawable="@drawable/progressbar" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ee107f7..c6f9d19 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,132 +6,159 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:background="#EEF4F4"
tools:context=".activity.MainActivity">
+
+
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+
-
-
+
+
+
+
+
+ android:textColor="@color/white"
+ android:textSize="23sp" />
-
-
-
+
+
+
+
+
+
+ android:src="@mipmap/logo" />
+
+
+
+
+ android:textSize="20sp" />
+
+ android:layout_marginStart="8dp"
+ android:src="@mipmap/privacy" />
+
+ android:layout_centerVertical="true"
+ android:src="@drawable/go_url" />
+
+
+ android:textSize="20sp" />
+
+ android:textSize="18sp" />
diff --git a/app/src/main/res/layout/activity_specifisounds.xml b/app/src/main/res/layout/activity_specifisounds.xml
index 13e04d4..e5a1d6d 100644
--- a/app/src/main/res/layout/activity_specifisounds.xml
+++ b/app/src/main/res/layout/activity_specifisounds.xml
@@ -6,37 +6,39 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:background="#EEF4F4"
tools:context=".activity.SpecifisoundsActivity">
-
-
+
+
+
-
+
-
-
+ android:layout_centerInParent="true"
+ android:text="@string/app_name"
+ android:textColor="@color/white"
+ android:textSize="23sp" />
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_category.xml b/app/src/main/res/layout/fragment_category.xml
new file mode 100644
index 0000000..cc29d57
--- /dev/null
+++ b/app/src/main/res/layout/fragment_category.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_love.xml b/app/src/main/res/layout/fragment_love.xml
new file mode 100644
index 0000000..5ca402d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_love.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_love.xml b/app/src/main/res/layout/item_love.xml
new file mode 100644
index 0000000..7fb1bf4
--- /dev/null
+++ b/app/src/main/res/layout/item_love.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_tablayout.xml b/app/src/main/res/layout/item_tablayout.xml
new file mode 100644
index 0000000..2dc271a
--- /dev/null
+++ b/app/src/main/res/layout/item_tablayout.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/sounds_adapterlist.xml b/app/src/main/res/layout/sounds_adapterlist.xml
index 99ddd45..e88d63d 100644
--- a/app/src/main/res/layout/sounds_adapterlist.xml
+++ b/app/src/main/res/layout/sounds_adapterlist.xml
@@ -6,16 +6,19 @@
android:orientation="vertical"
android:background="@drawable/list_background">
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_marginTop="15dp"
+ android:layout_gravity="center_horizontal"
+ android:id="@+id/imageview_sounds" />
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 2df09c3..36e8ef3 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -5,4 +5,15 @@
#72C8D5
#047685
#DDE9EA
+
+ #8B8F8F
+ #D3E8EC
+ #72C8D5
+
+
+ #8A8D8F
+ #f0c101
+
+ #DF3737
+ #80A1A2A3
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cfd91ce..718e3a1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -4,4 +4,5 @@
https://sites.google.com/view/funnysoundsairhorn
Version
V%s
+ Loop
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 6e0d870..387af7c 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
[versions]
-agp = "8.4.0"
+agp = "8.1.3"
kotlin = "1.9.0"
junit = "4.13.2"
junitVersion = "1.1.5"
@@ -8,6 +8,9 @@ appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.0"
constraintlayout = "2.1.4"
+legacy-support-v4 = "1.0.0"
+lifecycle-livedata-ktx = "2.8.4"
+lifecycle-viewmodel-ktx = "2.8.4"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
@@ -17,6 +20,9 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
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" }
+legacy-support-v4 = { group = "androidx.legacy", name = "legacy-support-v4", version.ref = "legacy-support-v4" }
+lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle-livedata-ktx" }
+lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-viewmodel-ktx" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }