增加音量加减、循环播放及收藏功能
This commit is contained in:
parent
7e6a79d9c6
commit
b1f86a18a6
@ -12,8 +12,9 @@ android {
|
|||||||
namespace = "com.example.funnysounds"
|
namespace = "com.example.funnysounds"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
|
//com.funny.sounds.hd
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.funny.sounds.hd"
|
applicationId = "com.funny.sounds.hd.test"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 7
|
versionCode = 7
|
||||||
@ -51,6 +52,9 @@ dependencies {
|
|||||||
implementation(libs.material)
|
implementation(libs.material)
|
||||||
implementation(libs.activity)
|
implementation(libs.activity)
|
||||||
implementation(libs.constraintlayout)
|
implementation(libs.constraintlayout)
|
||||||
|
implementation(libs.legacy.support.v4)
|
||||||
|
implementation(libs.lifecycle.livedata.ktx)
|
||||||
|
implementation(libs.lifecycle.viewmodel.ktx)
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.ext.junit)
|
androidTestImplementation(libs.ext.junit)
|
||||||
androidTestImplementation(libs.espresso.core)
|
androidTestImplementation(libs.espresso.core)
|
||||||
@ -58,8 +62,10 @@ 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.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"))
|
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
|
||||||
@ -105,12 +111,12 @@ dependencies {
|
|||||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||||
|
|
||||||
//Tramini
|
//Tramini
|
||||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||||
//-----------------------------TopOn 聚合
|
//-----------------------------TopOn 聚合
|
||||||
|
|
||||||
|
|
||||||
// Debugger UI Tools
|
// Debugger UI Tools
|
||||||
implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:15060781613:android:cae5beb7e5d3e8946586a4",
|
"mobilesdk_app_id": "1:15060781613:android:cae5beb7e5d3e8946586a4",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.funny.sounds.hd"
|
"package_name": "com.funny.sounds.hd.test"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [],
|
||||||
|
|||||||
@ -34,9 +34,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<!-- <activity-->
|
||||||
android:name=".activity.StartPageActivity"
|
<!-- android:name=".activity.StartPageActivity"-->
|
||||||
android:exported="false" />
|
<!-- android:exported="false" />-->
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -1,14 +1,20 @@
|
|||||||
package com.example.funnysounds.activity;
|
package com.example.funnysounds.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.database.ContentObserver;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -22,49 +28,88 @@ import com.bumptech.glide.request.target.Target;
|
|||||||
import com.example.funnysounds.R;
|
import com.example.funnysounds.R;
|
||||||
import com.example.funnysounds.data.MyData;
|
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.AdManager;
|
||||||
|
import com.example.funnysounds.topon.onActionListener;
|
||||||
import com.example.funnysounds.value.StaticValue;
|
import com.example.funnysounds.value.StaticValue;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import kotlin.Unit;
|
public class DetailActivity extends AppCompatActivity {
|
||||||
import kotlin.jvm.functions.Function1;
|
|
||||||
|
|
||||||
public class DetailActivity extends AppCompatActivity{
|
|
||||||
private String name;
|
private String name;
|
||||||
private String image;
|
private String image;
|
||||||
private MyData resource;
|
private MyData resource;
|
||||||
private String media;
|
private String media;
|
||||||
private TextView textView;
|
private TextView textView;
|
||||||
private ImageView imageView,imageView2;
|
private ImageView imageView, imageView2;
|
||||||
MediaPlayer mediaPlayer;
|
private MediaPlayer mediaPlayer;
|
||||||
protected Button btn_play_pause;
|
protected Button btn_play_pause;
|
||||||
private boolean play = false;
|
private boolean play = false;
|
||||||
|
private SeekBar volumeSeekbar;
|
||||||
|
private ImageView imLoop, imAddLove;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_detail);
|
setContentView(R.layout.activity_detail);
|
||||||
Log.d("----------y","-----onCreate="+Thread.currentThread().getName());
|
|
||||||
textView = findViewById(R.id.data_name);
|
textView = findViewById(R.id.data_name);
|
||||||
imageView = findViewById(R.id.data_image);
|
imageView = findViewById(R.id.data_image);
|
||||||
imageView2 = findViewById(R.id.imageview_back);
|
imageView2 = findViewById(R.id.imageview_back);
|
||||||
btn_play_pause = findViewById(R.id.btn_play_pause);
|
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();
|
goGetData();
|
||||||
|
initMediaPlayer();
|
||||||
|
setVolume(volumeSeekbar);
|
||||||
|
|
||||||
onMyclick();
|
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() {
|
private void goGetData() {
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
|
resource = (MyData) intent.getSerializableExtra(StaticValue.key_resourse);
|
||||||
assert resource != null;
|
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);
|
||||||
image = resource.getPreUrl();
|
image = resource.getPreUrl();
|
||||||
Glide.with(this).load(image).addListener(new RequestListener<Drawable>() {
|
Glide.with(this).load(image).addListener(new RequestListener<Drawable>() {
|
||||||
@Override
|
@Override
|
||||||
@ -79,58 +124,81 @@ public class DetailActivity extends AppCompatActivity{
|
|||||||
}).into(imageView);
|
}).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() {
|
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() {
|
btn_play_pause.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (play){
|
btn_play_pause.setSelected(!btn_play_pause.isSelected());
|
||||||
play = false;
|
if (btn_play_pause.isSelected()) {
|
||||||
// mediaPlayer.release();
|
AdManager.showTopOn(DetailActivity.this, new onActionListener() {
|
||||||
btn_play_pause.setBackgroundResource(R.mipmap.play);
|
|
||||||
if(mediaPlayer != null){
|
|
||||||
mediaPlayer.release();
|
|
||||||
mediaPlayer=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
AdManager.showAD(DetailActivity.this, new Function1<Integer, Unit>() {
|
|
||||||
@Override
|
@Override
|
||||||
public Unit invoke(Integer integer) {
|
public void onAction() {
|
||||||
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
|
if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
|
||||||
btn_play_pause.setBackgroundResource(R.mipmap.stop);
|
mediaPlayer.start();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (mediaPlayer != null) {
|
||||||
|
mediaPlayer.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
imageView2.setOnClickListener(new View.OnClickListener() {
|
imageView2.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(mediaPlayer != null){
|
|
||||||
if (mediaPlayer.isPlaying()) {
|
|
||||||
mediaPlayer.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,29 +3,40 @@ package com.example.funnysounds.activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.example.funnysounds.R;
|
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 com.example.funnysounds.topon.AdManager;
|
||||||
|
|
||||||
import kotlin.Unit;
|
|
||||||
import kotlin.jvm.functions.Function0;
|
|
||||||
|
|
||||||
public class IntoActivity extends AppCompatActivity {
|
public class IntoActivity extends AppCompatActivity {
|
||||||
private boolean needShow = true;
|
|
||||||
public com.mbridge.msdk.newinterstitial.out.MBBidNewInterstitialHandler MBBidNewInterstitialHandler;
|
|
||||||
protected CountDownTimer countDownTimer;
|
protected CountDownTimer countDownTimer;
|
||||||
private Long tim = 11000L;
|
private long tim = 1000L;
|
||||||
|
private ProgressBar progressBar;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_into);
|
setContentView(R.layout.activity_into);
|
||||||
countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new Function0<Unit>() {
|
|
||||||
|
progressBar = findViewById(R.id.progress);
|
||||||
|
countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new CountAction() {
|
||||||
@Override
|
@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();
|
startMainActivity();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
countDownTimer.start();
|
countDownTimer.start();
|
||||||
@ -35,6 +46,7 @@ public class IntoActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
private void startMainActivity() {
|
private void startMainActivity() {
|
||||||
|
progressBar.setProgress(100);
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@ -4,66 +4,50 @@ import android.annotation.SuppressLint;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
import com.example.funnysounds.R;
|
import com.example.funnysounds.R;
|
||||||
import com.example.funnysounds.action.CategoryNameSoundsrListener;
|
import com.example.funnysounds.databinding.ActivityMainBinding;
|
||||||
import com.example.funnysounds.data.CategoryList;
|
import com.example.funnysounds.fragement.CategoryFragment;
|
||||||
import com.example.funnysounds.resolve.MySpace;
|
import com.example.funnysounds.fragement.LoveFragment;
|
||||||
import com.example.funnysounds.resolve.Sounds;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.example.funnysounds.soundsadapter.CgNameAdapter;
|
|
||||||
import com.example.funnysounds.value.StaticValue;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements CategoryNameSoundsrListener{
|
public class MainActivity extends AppCompatActivity {
|
||||||
private TextView textview_sounds;
|
|
||||||
private TextView text_version;
|
|
||||||
private RecyclerView recyclerview_sounds;
|
private ActivityMainBinding vb;
|
||||||
private ImageView imageView_menu;
|
|
||||||
private RelativeLayout url_lay;
|
|
||||||
private RelativeLayout version_lay;
|
|
||||||
private String name;
|
|
||||||
private DrawerLayout main_layout;
|
|
||||||
|
|
||||||
@SuppressLint("MissingInflatedId")
|
@SuppressLint("MissingInflatedId")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
vb = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
textview_sounds = findViewById(R.id.textview_sounds);
|
setContentView(vb.getRoot());
|
||||||
main_layout =findViewById (R.id.main);
|
initTabVp();
|
||||||
recyclerview_sounds = findViewById(R.id.recyclerview_sounds);
|
vb.imageMenu.setOnClickListener(new View.OnClickListener() {
|
||||||
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() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
gotopricy();
|
gotopricy();
|
||||||
@ -71,24 +55,92 @@ public class MainActivity extends AppCompatActivity implements CategoryNameSound
|
|||||||
});
|
});
|
||||||
String appVersions = getAppVersions();
|
String appVersions = getAppVersions();
|
||||||
if (appVersions == null) {
|
if (appVersions == null) {
|
||||||
text_version.setText("V1.2");
|
vb.textVersion.setText("V1.2");
|
||||||
} else {
|
} else {
|
||||||
String format = String.format(getString(R.string.app_sounds_version), appVersions);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
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<Fragment> 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() {
|
private String getAppVersions() {
|
||||||
String appversions = "";
|
String appversions = "";
|
||||||
try {
|
try {
|
||||||
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(),0);
|
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
appversions = ((PackageInfo)packageInfo).versionName;
|
appversions = ((PackageInfo) packageInfo).versionName;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -102,18 +154,13 @@ public class MainActivity extends AppCompatActivity implements CategoryNameSound
|
|||||||
startActivity(intent2);
|
startActivity(intent2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRecyclerviewSounds() {
|
|
||||||
MySpace mySpace = new MySpace(10,10,15);
|
private void setTabSelected(TabLayout.Tab tab, boolean isSelected) {
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
|
View custmerview = tab.getCustomView();
|
||||||
recyclerview_sounds.setLayoutManager(gridLayoutManager);
|
ImageView iconIm = custmerview.findViewById(R.id.im_icon);
|
||||||
recyclerview_sounds.addItemDecoration(mySpace);
|
iconIm.setSelected(isSelected);
|
||||||
CgNameAdapter cgNameAdapter = new CgNameAdapter(Sounds.getUserList(), MainActivity.this);
|
|
||||||
cgNameAdapter.setCategoryNameSoundsListener(this);
|
|
||||||
recyclerview_sounds.setAdapter(cgNameAdapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClickAction(CategoryList categoryList) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -2,7 +2,6 @@ package com.example.funnysounds.activity;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -10,6 +9,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
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.data.MyData;
|
||||||
import com.example.funnysounds.resolve.MySpace;
|
import com.example.funnysounds.resolve.MySpace;
|
||||||
import com.example.funnysounds.resolve.Sounds;
|
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.soundsadapter.DataAdapter;
|
||||||
import com.example.funnysounds.topon.AdManager;
|
import com.example.funnysounds.topon.AdManager;
|
||||||
|
import com.example.funnysounds.topon.onActionListener;
|
||||||
import com.example.funnysounds.value.StaticValue;
|
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 java.util.List;
|
||||||
|
|
||||||
import kotlin.Unit;
|
|
||||||
import kotlin.jvm.functions.Function1;
|
|
||||||
|
|
||||||
public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSounderListener {
|
public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSounderListener {
|
||||||
|
|
||||||
private ImageView imageView;
|
private ImageView imageView;
|
||||||
@ -43,7 +35,7 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
|
|||||||
private TextView cName;
|
private TextView cName;
|
||||||
private RecyclerView recyclerview_specific;
|
private RecyclerView recyclerview_specific;
|
||||||
private int i;
|
private int i;
|
||||||
private List<CategoryList> categoryLists;
|
|
||||||
|
|
||||||
@SuppressLint("MissingInflatedId")
|
@SuppressLint("MissingInflatedId")
|
||||||
@Override
|
@Override
|
||||||
@ -56,7 +48,7 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
|
|||||||
imageView.setOnClickListener(new View.OnClickListener() {
|
imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showad(true);
|
showad();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getData();
|
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) {
|
private void showad() {
|
||||||
AdManager.showAD(SpecifisoundsActivity.this, new Function1<Integer, Unit>() {
|
AdManager.showTopOn(SpecifisoundsActivity.this, new onActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public Unit invoke(Integer integer) {
|
public void onAction() {
|
||||||
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
|
finish();
|
||||||
if (isFinish)
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -92,13 +75,20 @@ public class SpecifisoundsActivity extends AppCompatActivity implements MyDataSo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpecificRecycleView() {
|
public void setSpecificRecycleView() {
|
||||||
MySpace mySpace = new MySpace(10, 10, 15);
|
MySpace mySpace = new MySpace(20, 20, 25);
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
|
||||||
recyclerview_specific.setLayoutManager(gridLayoutManager);
|
recyclerview_specific.setLayoutManager(gridLayoutManager);
|
||||||
recyclerview_specific.addItemDecoration(mySpace);
|
recyclerview_specific.addItemDecoration(mySpace);
|
||||||
DataAdapter dataAdapter = new DataAdapter(name.getList(), this);
|
DataAdapter dataAdapter = new DataAdapter( this);
|
||||||
dataAdapter.setMyDataSounderListener(this);
|
dataAdapter.setMyDataSounderListener(this);
|
||||||
recyclerview_specific.setAdapter(dataAdapter);
|
recyclerview_specific.setAdapter(dataAdapter);
|
||||||
|
MyRoom.getInstance().getDataDao().queryList(name.getCateId()).observe(this, new Observer<List<MyData>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<MyData> myData) {
|
||||||
|
Log.d(Sounds.TAG,"------------myData"+myData.size());
|
||||||
|
dataAdapter.setMyDataList(myData);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,16 +1,22 @@
|
|||||||
package com.example.funnysounds.data;
|
package com.example.funnysounds.data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import androidx.room.Entity;
|
||||||
import java.util.List;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import com.example.funnysounds.resolve.Sounds;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity(tableName = Sounds.TABLE_1)
|
||||||
public class CategoryList implements Serializable {
|
public class CategoryList implements Serializable {
|
||||||
private String categoryId;
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private long cateId;
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
private String categoryUrl;
|
private String categoryUrl;
|
||||||
private List<MyData> list;
|
// private List<MyData> list;
|
||||||
|
|
||||||
public void setCategoryId(String categoryId) {
|
public void setCateId(long cateId) {
|
||||||
this.categoryId = categoryId;
|
this.cateId = cateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategoryName(String categoryName) {
|
public void setCategoryName(String categoryName) {
|
||||||
@ -21,12 +27,10 @@ public class CategoryList implements Serializable {
|
|||||||
this.categoryUrl = categoryUrl;
|
this.categoryUrl = categoryUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(List<MyData> list) {
|
|
||||||
this.list = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCategoryId() {
|
|
||||||
return categoryId;
|
public long getCateId() {
|
||||||
|
return cateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategoryName() {
|
public String getCategoryName() {
|
||||||
@ -37,7 +41,5 @@ public class CategoryList implements Serializable {
|
|||||||
return categoryUrl;
|
return categoryUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MyData> getList() {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,37 @@ package com.example.funnysounds.data;
|
|||||||
|
|
||||||
import android.net.Uri;
|
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;
|
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 {
|
public class MyData implements Serializable {
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private long id;
|
||||||
|
private long categoryId;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
private String mp3Url;
|
private String mp3Url;
|
||||||
private String preUrl;
|
private String preUrl;
|
||||||
|
|
||||||
|
private boolean addLove;
|
||||||
|
|
||||||
|
public boolean isAddLove() {
|
||||||
|
return addLove;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddLove(boolean addLove) {
|
||||||
|
this.addLove = addLove;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
@ -21,6 +45,22 @@ public class MyData implements Serializable {
|
|||||||
this.preUrl = preUrl;
|
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() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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<List<CategoryList>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<CategoryList> categoryLists) {
|
||||||
|
cgNameAdapter.setDataCategoryList(categoryLists);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickAction(CategoryList categoryList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.funnysounds.fragement;
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
public class CategoryViewModel extends ViewModel {
|
||||||
|
// TODO: Implement the ViewModel
|
||||||
|
}
|
||||||
@ -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<List<MyData>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<MyData> list) {
|
||||||
|
loveAdapter.setMyDataList(list);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.funnysounds.fragement;
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
public class RankViewModel extends ViewModel {
|
||||||
|
// TODO: Implement the ViewModel
|
||||||
|
}
|
||||||
@ -1,5 +1,16 @@
|
|||||||
package com.example.funnysounds.resolve;
|
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.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -7,6 +18,8 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Readfile {
|
public class Readfile {
|
||||||
public static String getCovertStr(InputStream stream) {
|
public static String getCovertStr(InputStream stream) {
|
||||||
@ -30,4 +43,49 @@ public class Readfile {
|
|||||||
float scale = Sounds.mAppContext.getResources().getDisplayMetrics().density;
|
float scale = Sounds.mAppContext.getResources().getDisplayMetrics().density;
|
||||||
return (int) (dp * scale + 0.5f);
|
return (int) (dp * scale + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void getData(String jsonString) {
|
||||||
|
try {
|
||||||
|
List<CategoryList> prankData = new ArrayList<>();
|
||||||
|
JSONArray jsonArray = new JSONArray(jsonString);
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
CategoryList data = new CategoryList();
|
||||||
|
List<MyData> 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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +1,26 @@
|
|||||||
package com.example.funnysounds.resolve;
|
package com.example.funnysounds.resolve;
|
||||||
|
|
||||||
import static android.content.ContentValues.TAG;
|
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
|
||||||
import com.anythink.core.api.ATSDK;
|
import com.anythink.core.api.ATSDK;
|
||||||
import com.anythink.core.api.NetTrafficeCallback;
|
import com.anythink.core.api.NetTrafficeCallback;
|
||||||
import com.anythink.debug.api.ATDebuggerUITest;
|
|
||||||
import com.example.funnysounds.data.CategoryList;
|
import com.example.funnysounds.data.CategoryList;
|
||||||
|
import com.example.funnysounds.room.MyRoom;
|
||||||
import com.example.funnysounds.topon.AdManager;
|
import com.example.funnysounds.topon.AdManager;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
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.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Sounds extends Application {
|
public class Sounds extends Application {
|
||||||
public static final String AD_INIT = "on_SDK_action";
|
public static final String AD_INIT = "on_SDK_action";
|
||||||
public static Context mAppContext;
|
public static Context mAppContext;
|
||||||
public static Sounds context;
|
|
||||||
public static boolean initOK = false;
|
public static boolean initOK = false;
|
||||||
public static String TAG = "-----AD";
|
public static String TAG = "-----AD";
|
||||||
private static List<CategoryList> categoryList;
|
private static List<CategoryList> categoryList;
|
||||||
@ -38,32 +29,39 @@ public class Sounds extends Application {
|
|||||||
private String AppKey = "a7fce863e6f891c168d9a87cbe49cb3d8";
|
private String AppKey = "a7fce863e6f891c168d9a87cbe49cb3d8";
|
||||||
private String debugKey = "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
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
mAppContext = this;
|
mAppContext = this;
|
||||||
context = this;
|
|
||||||
init();
|
init();
|
||||||
try {
|
|
||||||
InputStream open = getAssets().open("prank.json");
|
new Thread(new Runnable() {
|
||||||
String covertStr = Readfile.getCovertStr(open);
|
@Override
|
||||||
if (!covertStr.isEmpty()) {
|
public void run() {
|
||||||
Gson gson = new Gson();
|
|
||||||
categoryList = gson.fromJson(covertStr, new TypeToken<List<CategoryList>>() {
|
List<CategoryList> categoryLists = MyRoom.getInstance().getCategoryDao().queryAllData();
|
||||||
}.getType());
|
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) {
|
}).start();
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CategoryList> getUserList() {
|
|
||||||
if (categoryList != null) {
|
|
||||||
return categoryList;
|
|
||||||
}
|
|
||||||
return categoryList;
|
|
||||||
}
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||||
@ -82,7 +80,7 @@ public class Sounds extends Application {
|
|||||||
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ATSDK.init( this, AppId, AppKey);
|
ATSDK.init(this, AppId, AppKey);
|
||||||
AdManager.loadAllAd();
|
AdManager.loadAllAd();
|
||||||
// ATDebuggerUITest.showDebuggerUI(this,debugKey);
|
// ATDebuggerUITest.showDebuggerUI(this,debugKey);
|
||||||
|
|
||||||
|
|||||||
@ -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<List<CategoryList>> queryAll();
|
||||||
|
|
||||||
|
@Query("select * from table_category order by cateId desc")
|
||||||
|
List<CategoryList> queryAllData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
33
app/src/main/java/com/example/funnysounds/room/DataDao.java
Normal file
33
app/src/main/java/com/example/funnysounds/room/DataDao.java
Normal file
@ -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<MyData> queryAll();
|
||||||
|
|
||||||
|
@Query("select * from table_data where categoryId ==:mId")
|
||||||
|
LiveData<List<MyData>> queryList(long mId);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("select * from table_data where addLove ==:love")
|
||||||
|
LiveData<List<MyData>> queryLoveList(boolean love);
|
||||||
|
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void updatePrank(MyData myData);
|
||||||
|
}
|
||||||
28
app/src/main/java/com/example/funnysounds/room/MyRoom.java
Normal file
28
app/src/main/java/com/example/funnysounds/room/MyRoom.java
Normal file
@ -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<MyRoom> myRoomBuilder = Room.databaseBuilder(Sounds.mAppContext, MyRoom.class, Sounds.DB_NAME);
|
||||||
|
myRoom = myRoomBuilder.build();
|
||||||
|
}
|
||||||
|
return MyRoom.myRoom;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,13 +26,14 @@ import com.example.funnysounds.data.CategoryList;
|
|||||||
import com.example.funnysounds.topon.AdManager;
|
import com.example.funnysounds.topon.AdManager;
|
||||||
import com.example.funnysounds.value.StaticValue;
|
import com.example.funnysounds.value.StaticValue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
||||||
private List<CategoryList> dataCategoryList;
|
private List<CategoryList> dataCategoryList = new ArrayList<>();
|
||||||
private Activity myContext;
|
private Activity myContext;
|
||||||
private CategoryNameSoundsrListener cgNameSoundsrListener;
|
private CategoryNameSoundsrListener cgNameSoundsrListener;
|
||||||
|
|
||||||
@ -40,11 +41,15 @@ public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
|||||||
this.cgNameSoundsrListener = categoryNameSoundsrListener;
|
this.cgNameSoundsrListener = categoryNameSoundsrListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CgNameAdapter(List<CategoryList> cglist, Activity mycontext) {
|
public CgNameAdapter(Activity mycontext) {
|
||||||
dataCategoryList = cglist;
|
|
||||||
myContext = mycontext;
|
myContext = mycontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDataCategoryList(List<CategoryList> dataCategoryList) {
|
||||||
|
this.dataCategoryList = dataCategoryList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public CgViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public CgViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@ -58,8 +63,9 @@ public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
|||||||
holder.getTextView().setText(categorylist.getCategoryName());
|
holder.getTextView().setText(categorylist.getCategoryName());
|
||||||
ImageView imageView = holder.getImageView();
|
ImageView imageView = holder.getImageView();
|
||||||
Glide.with(myContext)
|
Glide.with(myContext)
|
||||||
|
.asDrawable()
|
||||||
|
.placeholder(R.mipmap.logo)
|
||||||
.load(categorylist.getCategoryUrl())
|
.load(categorylist.getCategoryUrl())
|
||||||
.transform(new RoundedCorners(90))
|
|
||||||
.listener(new RequestListener<Drawable>() {
|
.listener(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) {
|
||||||
@ -83,7 +89,6 @@ public class CgNameAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void startSpecifiActivity(CategoryList categoryList) {
|
private void startSpecifiActivity(CategoryList categoryList) {
|
||||||
Intent intent = new Intent(myContext, SpecifisoundsActivity.class);
|
Intent intent = new Intent(myContext, SpecifisoundsActivity.class);
|
||||||
intent.putExtra(StaticValue.key_category_name, categoryList);
|
intent.putExtra(StaticValue.key_category_name, categoryList);
|
||||||
|
|||||||
@ -24,44 +24,51 @@ import com.example.funnysounds.data.MyData;
|
|||||||
import com.example.funnysounds.resolve.Readfile;
|
import com.example.funnysounds.resolve.Readfile;
|
||||||
import com.example.funnysounds.value.StaticValue;
|
import com.example.funnysounds.value.StaticValue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DataAdapter extends RecyclerView.Adapter<DataViewHolder>{
|
public class DataAdapter extends RecyclerView.Adapter<CgViewHolder> {
|
||||||
private List<MyData> myDataList;
|
private List<MyData> myDataList = new ArrayList<>();
|
||||||
private Context myContext;
|
private Context myContext;
|
||||||
private MyDataSounderListener myDataSounderListener;
|
private MyDataSounderListener myDataSounderListener;
|
||||||
public DataAdapter(List<MyData> myData,Context mycontext){
|
|
||||||
myDataList = myData;
|
public DataAdapter(Context mycontext) {
|
||||||
myContext = mycontext;
|
myContext = mycontext;
|
||||||
}
|
}
|
||||||
public void setMyDataSounderListener(MyDataSounderListener dataSounderListener)
|
|
||||||
{
|
public void setMyDataList(List<MyData> myDataList) {
|
||||||
|
this.myDataList = myDataList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyDataSounderListener(MyDataSounderListener dataSounderListener) {
|
||||||
this.myDataSounderListener = dataSounderListener;
|
this.myDataSounderListener = dataSounderListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public DataViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public CgViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View itemview = LayoutInflater.from(myContext).inflate(R.layout.specific_adapterlist,parent,false);
|
View itemview = LayoutInflater.from(myContext).inflate(R.layout.sounds_adapterlist, parent, false);
|
||||||
return new DataViewHolder(itemview);
|
return new CgViewHolder(itemview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull DataViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull CgViewHolder holder, int position) {
|
||||||
MyData myData = myDataList.get(position);
|
MyData myData = myDataList.get(position);
|
||||||
holder.getTextview_specific().setText(myData.getTitle());
|
holder.getTextView().setText(myData.getTitle());
|
||||||
ImageView imageView = holder.getImageview_specific();
|
ImageView imageView = holder.getImageView();
|
||||||
//final MediaPlayer mediaPlayer = MediaPlayer.create(holder.itemView.getContext(), Uri.parse(myData.getMp3Url()));
|
//final MediaPlayer mediaPlayer = MediaPlayer.create(holder.itemView.getContext(), Uri.parse(myData.getMp3Url()));
|
||||||
Glide.with(myContext)
|
Glide.with(myContext)
|
||||||
|
.asDrawable()
|
||||||
.load(myData.getPreUrl())
|
.load(myData.getPreUrl())
|
||||||
.transform(new RoundedCorners(90))
|
.placeholder(R.mipmap.logo)
|
||||||
.into(imageView);
|
.into(imageView);
|
||||||
holder.getLayout_specific().setOnClickListener(new View.OnClickListener() {
|
holder.getLayout_root().setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(myContext, DetailActivity.class);
|
Intent intent = new Intent(myContext, DetailActivity.class);
|
||||||
intent.putExtra(StaticValue.key_resourse,myData);
|
intent.putExtra(StaticValue.key_resourse, myData);
|
||||||
myContext.startActivity(intent);
|
myContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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<LoveAdapter.VH> {
|
||||||
|
private List<MyData> myDataList = new ArrayList<>();
|
||||||
|
private Context myContext;
|
||||||
|
private MyDataSounderListener myDataSounderListener;
|
||||||
|
|
||||||
|
public LoveAdapter(Context mycontext) {
|
||||||
|
myContext = mycontext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyDataList(List<MyData> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.funnysounds.topon;
|
||||||
|
|
||||||
|
public interface AdListener {
|
||||||
|
void loadFail(String placeId);
|
||||||
|
void showSuccess();
|
||||||
|
|
||||||
|
void showFail();
|
||||||
|
|
||||||
|
void showClose();
|
||||||
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package com.example.funnysounds.topon
|
|
||||||
|
|
||||||
interface AdListener {
|
|
||||||
fun showSuccess()
|
|
||||||
|
|
||||||
fun showFail()
|
|
||||||
|
|
||||||
fun showClose()
|
|
||||||
}
|
|
||||||
248
app/src/main/java/com/example/funnysounds/topon/AdManager.java
Normal file
248
app/src/main/java/com/example/funnysounds/topon/AdManager.java
Normal file
@ -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<ATInterstitial> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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<ATInterstitial>()
|
|
||||||
|
|
||||||
|
|
||||||
@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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.example.funnysounds.topon;
|
||||||
|
|
||||||
|
public interface AdStatusAction {
|
||||||
|
void onStatus(int adType);
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.example.funnysounds.topon;
|
||||||
|
|
||||||
|
public interface CountAction {
|
||||||
|
void onCount(long millisUntilFinished);
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.example.funnysounds.topon;
|
||||||
|
|
||||||
|
public interface GoMainAction {
|
||||||
|
void onGo();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.example.funnysounds.topon;
|
||||||
|
|
||||||
|
public interface onActionListener {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -2,9 +2,7 @@ package com.example.funnysounds.value;
|
|||||||
|
|
||||||
public class StaticValue {
|
public class StaticValue {
|
||||||
public static final String key_category_name = "key_category_name";
|
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 key_resourse = "key_resourse";
|
||||||
public static final String MAX_INIT_ACTION = "ad_action";
|
|
||||||
public static final String YOUR_SDK_KEY = "gtOv1uuZoSrXBVgJLKgwRTRrMdPLV_x0C1uFOPrTCBTyJzWJNcFniU1uxQBHoOdWAA7o5CWPlaCrm5qKqe5iHx";
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
app/src/main/res/drawable/bg_love.xml
Normal file
7
app/src/main/res/drawable/bg_love.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">
|
||||||
|
<corners android:radius="12dp"/>
|
||||||
|
<solid android:color="@color/sounds_main"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/im_home.xml
Normal file
9
app/src/main/res/drawable/im_home.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M555.5,118l312.9,224.6A117.3,117.3 0,0 1,917.3 437.9V800c0,64.8 -52.5,117.3 -117.3,117.3H640V746.7c0,-70.7 -57.3,-128 -128,-128s-128,57.3 -128,128v170.7H224c-64.8,0 -117.3,-52.5 -117.3,-117.3V437.9a117.3,117.3 0,0 1,48.9 -95.3l312.9,-224.6a74.7,74.7 0,0 1,87.1 0z"
|
||||||
|
android:fillColor="@color/tab_false"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_home_true.xml
Normal file
9
app/src/main/res/drawable/im_home_true.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M555.5,118l312.9,224.6A117.3,117.3 0,0 1,917.3 437.9V800c0,64.8 -52.5,117.3 -117.3,117.3H640V746.7c0,-70.7 -57.3,-128 -128,-128s-128,57.3 -128,128v170.7H224c-64.8,0 -117.3,-52.5 -117.3,-117.3V437.9a117.3,117.3 0,0 1,48.9 -95.3l312.9,-224.6a74.7,74.7 0,0 1,87.1 0z"
|
||||||
|
android:fillColor="@color/tab_true"/>
|
||||||
|
</vector>
|
||||||
11
app/src/main/res/drawable/im_loop_false.xml
Normal file
11
app/src/main/res/drawable/im_loop_false.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:strokeColor="@color/black"
|
||||||
|
android:strokeWidth="16"
|
||||||
|
android:pathData="M896,960H128c-35.2,0 -64,-28.8 -64,-64V128c0,-35.2 28.8,-64 64,-64h768c35.2,0 64,28.8 64,64v768c0,35.2 -28.8,64 -64,64z" />
|
||||||
|
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/im_loop_true.xml
Normal file
12
app/src/main/res/drawable/im_loop_true.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/tab_true"
|
||||||
|
android:pathData="M896,960H128c-35.2,0 -64,-28.8 -64,-64V128c0,-35.2 28.8,-64 64,-64h768c35.2,0 64,28.8 64,64v768c0,35.2 -28.8,64 -64,64z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M738,308.4L422.3,624.1 286,487.8l-45.3,45.3L377,669.4l-1,1 45.3,45.2 362,-362z" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_love.xml
Normal file
9
app/src/main/res/drawable/im_love.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/tab_false"
|
||||||
|
android:pathData="M692.5,125.5c-67.1,0 -131.5,23.7 -180.5,65.9 -49.1,-42.2 -113.4,-65.9 -180.5,-65.9 -145.9,0 -264.6,107.9 -264.6,240.4 0,236.4 415.1,516.2 432.8,528 4.5,3 9.9,4.5 15.1,4.5 5.4,0 10.7,-1.6 15.3,-4.7 17.4,-11.9 427.2,-292.7 427.2,-527.9C957.1,233.4 838.4,125.5 692.5,125.5z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_love_red.xml
Normal file
9
app/src/main/res/drawable/im_love_red.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/add_love"
|
||||||
|
android:pathData="M692.5,125.5c-67.1,0 -131.5,23.7 -180.5,65.9 -49.1,-42.2 -113.4,-65.9 -180.5,-65.9 -145.9,0 -264.6,107.9 -264.6,240.4 0,236.4 415.1,516.2 432.8,528 4.5,3 9.9,4.5 15.1,4.5 5.4,0 10.7,-1.6 15.3,-4.7 17.4,-11.9 427.2,-292.7 427.2,-527.9C957.1,233.4 838.4,125.5 692.5,125.5z"/>
|
||||||
|
</vector>
|
||||||
10
app/src/main/res/drawable/im_love_red_false.xml
Normal file
10
app/src/main/res/drawable/im_love_red_false.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<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="M692.5,125.5c-67.1,0 -131.5,23.7 -180.5,65.9 -49.1,-42.2 -113.4,-65.9 -180.5,-65.9 -145.9,0 -264.6,107.9 -264.6,240.4 0,236.4 415.1,516.2 432.8,528 4.5,3 9.9,4.5 15.1,4.5 5.4,0 10.7,-1.6 15.3,-4.7 17.4,-11.9 427.2,-292.7 427.2,-527.9C957.1,233.4 838.4,125.5 692.5,125.5z"
|
||||||
|
android:strokeWidth="16"
|
||||||
|
android:strokeColor="@color/white" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_love_true.xml
Normal file
9
app/src/main/res/drawable/im_love_true.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/tab_true"
|
||||||
|
android:pathData="M692.5,125.5c-67.1,0 -131.5,23.7 -180.5,65.9 -49.1,-42.2 -113.4,-65.9 -180.5,-65.9 -145.9,0 -264.6,107.9 -264.6,240.4 0,236.4 415.1,516.2 432.8,528 4.5,3 9.9,4.5 15.1,4.5 5.4,0 10.7,-1.6 15.3,-4.7 17.4,-11.9 427.2,-292.7 427.2,-527.9C957.1,233.4 838.4,125.5 692.5,125.5z"/>
|
||||||
|
</vector>
|
||||||
11
app/src/main/res/drawable/im_play.xml
Normal file
11
app/src/main/res/drawable/im_play.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/sounds_main"
|
||||||
|
android:pathData="M512.1 63.9c-247.4 0-447.9 200.5-447.9 447.9 0 247.4 200.5 447.9 447.9 447.9S960 759.2 960 511.8c0.1-247.4-200.5-447.9-447.9-447.9z m210.5 480.2L413.7 722.4c-24.9 14.4-56-3.6-56-32.3V333.5c0-28.7 31.1-46.7 56-32.3l308.8 178.3c24.9 14.3 24.9 50.3 0.1 64.6z" />
|
||||||
|
</vector>
|
||||||
|
|
||||||
9
app/src/main/res/drawable/im_record.xml
Normal file
9
app/src/main/res/drawable/im_record.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/tab_false"
|
||||||
|
android:pathData="M526.3,644.1c123.9,0 223.7,-97.3 223.7,-221.2L750.1,238.1c0,-123.9 -99.8,-221.2 -223.7,-221.2s-223.7,97.3 -223.7,221.2v184.8c0,123.9 97.3,221.2 223.7,221.2zM876.5,376.8c0,-22 -19.5,-41.5 -44,-41.5s-41.5,19.5 -41.5,41.5c0,4.6 0,9.7 2.6,12.3v31.7c0,143.4 -119.3,262.7 -267.8,262.7 -145.9,0 -267.8,-119.3 -267.8,-262.7L258,384c0,-2.6 2.6,-4.6 2.6,-9.7 0,-22 -19.5,-41.5 -41.5,-41.5 -24.6,0 -41.5,19.5 -41.5,41.5L177.7,435.2c0,177.7 133.6,318.5 304.1,343v82.9L365.6,861.2c-24.6,0 -44,19.5 -44,44s19.5,41.5 44,41.5h316.4c26.6,0 41.5,-16.9 41.5,-41.5 0,-22 -16.9,-44 -41.5,-44h-116.7L565.2,778.2c175.1,-19.5 311.3,-165.4 311.3,-343L876.5,376.8z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_record_true.xml
Normal file
9
app/src/main/res/drawable/im_record_true.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="64dp"
|
||||||
|
android:height="64dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/tab_true"
|
||||||
|
android:pathData="M526.3,644.1c123.9,0 223.7,-97.3 223.7,-221.2L750.1,238.1c0,-123.9 -99.8,-221.2 -223.7,-221.2s-223.7,97.3 -223.7,221.2v184.8c0,123.9 97.3,221.2 223.7,221.2zM876.5,376.8c0,-22 -19.5,-41.5 -44,-41.5s-41.5,19.5 -41.5,41.5c0,4.6 0,9.7 2.6,12.3v31.7c0,143.4 -119.3,262.7 -267.8,262.7 -145.9,0 -267.8,-119.3 -267.8,-262.7L258,384c0,-2.6 2.6,-4.6 2.6,-9.7 0,-22 -19.5,-41.5 -41.5,-41.5 -24.6,0 -41.5,19.5 -41.5,41.5L177.7,435.2c0,177.7 133.6,318.5 304.1,343v82.9L365.6,861.2c-24.6,0 -44,19.5 -44,44s19.5,41.5 44,41.5h316.4c26.6,0 41.5,-16.9 41.5,-41.5 0,-22 -16.9,-44 -41.5,-44h-116.7L565.2,778.2c175.1,-19.5 311.3,-165.4 311.3,-343L876.5,376.8z" />
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/im_stop.xml
Normal file
12
app/src/main/res/drawable/im_stop.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<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="M874.1,149.9a510.1,510.1 0,1 0,109.7 162.7,511.4 511.4,0 0,0 -109.7,-162.7z"
|
||||||
|
android:fillColor="@color/sounds_main"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M418,281.5a41,41 0,0 0,-41.8 40.2v385.1a41.9,41.9 0,0 0,83.7 0v-385.1a41.2,41.2 0,0 0,-41.9 -40.2zM606,281.5a41,41 0,0 0,-41.8 40.2v385.1a41.9,41.9 0,0 0,83.7 0v-385.1a41.2,41.2 0,0 0,-41.9 -40.2z"
|
||||||
|
android:fillColor="#FFFFFF"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_volumehigh.xml
Normal file
9
app/src/main/res/drawable/im_volumehigh.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M469.3,106.7v810.7a21.3,21.3 0,0 1,-36.4 15.1L225.8,725.3L53.3,725.3a53.4,53.4 0,0 1,-53.3 -53.3L0,352a53.4,53.4 0,0 1,53.3 -53.3h172.5l207.1,-207.1A21.3,21.3 0,0 1,469.3 106.7zM616.1,402.9a21.3,21.3 0,0 0,-3.5 30,127.4 127.4,0 0,1 0,158.3 21.3,21.3 0,0 0,33.5 26.4,170.7 170.7,0 0,0 0,-211.2 21.3,21.3 0,0 0,-30 -3.5zM828.3,383.6A339.4,339.4 0,0 0,753.3 270.7a346.6,346.6 0,0 0,-22 -20.2,21.3 21.3,0 1,0 -27.4,32.7c6.7,5.6 13.1,11.6 19.3,17.7C779.6,357.2 810.7,432.2 810.7,512s-31.1,154.8 -87.5,211.2c-6.2,6.2 -12.7,12.1 -19.3,17.7a21.3,21.3 0,1 0,27.4 32.7,346.6 346.6,0 0,0 22,-20.2 341.7,341.7 0,0 0,75 -369.8z"
|
||||||
|
android:fillColor="@color/black"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/im_volumelow.xml
Normal file
9
app/src/main/res/drawable/im_volumelow.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M469.3,106.7v810.7a21.3,21.3 0,0 1,-36.4 15.1L225.8,725.3L53.3,725.3a53.4,53.4 0,0 1,-53.3 -53.3L0,352a53.4,53.4 0,0 1,53.3 -53.3h172.5l207.1,-207.1A21.3,21.3 0,0 1,469.3 106.7zM646.1,406.4a21.3,21.3 0,0 0,-33.5 26.4,127.4 127.4,0 0,1 0,158.3 21.3,21.3 0,0 0,33.5 26.4,170.7 170.7,0 0,0 0,-211.2z"
|
||||||
|
android:fillColor="@color/black"/>
|
||||||
|
</vector>
|
||||||
27
app/src/main/res/drawable/progressbar.xml
Normal file
27
app/src/main/res/drawable/progressbar.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
<solid android:color="@color/background" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
<gradient
|
||||||
|
android:angle="0"
|
||||||
|
android:endColor="@color/end"
|
||||||
|
android:startColor="@color/start" />
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
18
app/src/main/res/drawable/seekbar_progress_drawable.xml
Normal file
18
app/src/main/res/drawable/seekbar_progress_drawable.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/seekbar_bg" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<scale android:scaleWidth="100%">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="@color/tab_true" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</scale>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
10
app/src/main/res/drawable/seekbar_thumb.xml
Normal file
10
app/src/main/res/drawable/seekbar_thumb.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@color/tab_true" />
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="17dp"
|
||||||
|
android:height="17dp" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
5
app/src/main/res/drawable/selector_add_love.xml
Normal file
5
app/src/main/res/drawable/selector_add_love.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_love_red"/>
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_love_red_false"/>
|
||||||
|
</selector>
|
||||||
5
app/src/main/res/drawable/selector_home.xml
Normal file
5
app/src/main/res/drawable/selector_home.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_home_true"/>
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_home"/>
|
||||||
|
</selector>
|
||||||
5
app/src/main/res/drawable/selector_like.xml
Normal file
5
app/src/main/res/drawable/selector_like.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_love_true"/>
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_love"/>
|
||||||
|
</selector>
|
||||||
5
app/src/main/res/drawable/selector_loop.xml
Normal file
5
app/src/main/res/drawable/selector_loop.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_loop_true"/>
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_loop_false"/>
|
||||||
|
</selector>
|
||||||
6
app/src/main/res/drawable/selector_play.xml
Normal file
6
app/src/main/res/drawable/selector_play.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_play"/>
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_stop"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
5
app/src/main/res/drawable/selector_record.xml
Normal file
5
app/src/main/res/drawable/selector_record.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="true" android:drawable="@drawable/im_record_true"/>
|
||||||
|
<item android:state_selected="false" android:drawable="@drawable/im_record"/>
|
||||||
|
</selector>
|
||||||
@ -5,5 +5,5 @@
|
|||||||
android:viewportHeight="1024">
|
android:viewportHeight="1024">
|
||||||
<path
|
<path
|
||||||
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||||
android:fillColor="@color/black"/>
|
android:fillColor="@color/white"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@ -1,58 +1,133 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
tools:context=".activity.DetailActivity">
|
tools:context=".activity.DetailActivity">
|
||||||
<LinearLayout
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/main_top"
|
||||||
android:layout_width="match_parent"
|
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
|
||||||
|
android:id="@+id/data_image"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_below="@id/main_top"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="@drawable/list_background"
|
||||||
|
android:padding="50dp"
|
||||||
|
android:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
|
|
||||||
|
<android.widget.Button
|
||||||
|
android:id="@+id/btn_play_pause"
|
||||||
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_below="@id/data_image"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:background="@drawable/selector_play"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_loop"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/btn_play_pause"
|
||||||
|
android:layout_marginStart="25dp"
|
||||||
|
android:layout_marginTop="52dp"
|
||||||
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:background="@drawable/back_circle">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageview_back"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:src="@drawable/svg_back" />
|
|
||||||
</FrameLayout>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="60dp"
|
android:text="@string/loop"
|
||||||
android:id="@+id/data_name"
|
android:textColor="@color/black"
|
||||||
android:textStyle="italic"
|
android:textSize="17sp" />
|
||||||
android:textSize="25sp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/list_background"
|
|
||||||
android:layout_gravity="center">
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="200dp"
|
android:id="@+id/im_loop"
|
||||||
android:layout_height="200dp"
|
android:layout_width="26dp"
|
||||||
android:layout_gravity="center"
|
android:layout_height="26dp"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginStart="6dp"
|
||||||
android:background="#E8F1F3"
|
android:src="@drawable/selector_loop" />
|
||||||
android:id="@+id/data_image"/>
|
|
||||||
<android.widget.Button
|
|
||||||
android:id="@+id/btn_play_pause"
|
|
||||||
android:layout_width="50dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:background="@drawable/myselector"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/layout_loop"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:paddingStart="25dp"
|
||||||
|
android:paddingEnd="25dp">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/low"
|
||||||
|
android:layout_width="26dp"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
android:src="@drawable/im_volumelow" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekbar"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:layout_toStartOf="@id/high"
|
||||||
|
android:layout_toEndOf="@id/low"
|
||||||
|
android:maxHeight="4dp"
|
||||||
|
android:progress="10"
|
||||||
|
android:progressDrawable="@drawable/seekbar_progress_drawable"
|
||||||
|
android:thumb="@drawable/seekbar_thumb" />
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/high"
|
||||||
|
android:layout_width="26dp"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:src="@drawable/im_volumehigh" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
@ -1,19 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/main"
|
android:id="@+id/main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
tools:context=".activity.IntoActivity">
|
|
||||||
<ImageView
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/logo"
|
android:id="@+id/logo"
|
||||||
android:layout_width="80dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="80dp"
|
android:layout_height="wrap_content"
|
||||||
android:src="@mipmap/logo"
|
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="230dp"
|
android:layout_marginTop="230dp"
|
||||||
/>
|
app:cardCornerRadius="12dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:src="@mipmap/logo" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
@ -21,30 +26,26 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/logo"
|
android:layout_below="@id/logo"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="45dp"
|
android:layout_marginTop="25dp"
|
||||||
android:text="Funny"
|
android:text="@string/app_name"
|
||||||
android:textColor="@color/sounds_text"
|
android:textColor="@color/black"
|
||||||
android:textSize="40sp"
|
android:textSize="25sp"
|
||||||
android:textStyle="italic" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/name2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/name"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Sounds"
|
|
||||||
android:textColor="@color/sounds_text"
|
|
||||||
android:textSize="50sp"
|
|
||||||
android:textStyle="italic" />
|
android:textStyle="italic" />
|
||||||
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/progress"
|
||||||
android:layout_height="wrap_content"
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
android:layout_below="@id/name2"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="6dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginStart="33dp"
|
||||||
android:indeterminateTint="@color/sounds_main" />
|
android:layout_marginEnd="33dp"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:progress="10"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:progressDrawable="@drawable/progressbar" />
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -6,132 +6,159 @@
|
|||||||
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"
|
||||||
android:background="#EEF4F4"
|
|
||||||
tools:context=".activity.MainActivity">
|
tools:context=".activity.MainActivity">
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/main_top"
|
android:id="@+id/main_top"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="15dp"
|
|
||||||
android:background="@color/sounds_main">
|
android:background="@color/sounds_main">
|
||||||
<ImageView
|
|
||||||
android:layout_width="50dp"
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_height="50dp"
|
|
||||||
android:src="@mipmap/logo"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
app:cardCornerRadius="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
|
||||||
|
android:src="@mipmap/logo" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<TextView
|
||||||
android:id="@+id/textview_sounds"
|
android:id="@+id/textview_sounds"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:textSize="35sp"
|
android:textColor="@color/white"
|
||||||
android:layout_centerHorizontal="true"
|
android:textSize="23sp" />
|
||||||
android:textColor="@color/sounds_text"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_menu"
|
android:id="@+id/image_menu"
|
||||||
android:layout_width="30dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
android:src="@drawable/menu" />
|
android:src="@drawable/menu" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
<LinearLayout
|
|
||||||
android:layout_below="@+id/main_top"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerview_sounds"
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/view_pager"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="10dp" />
|
android:layout_height="0dp"
|
||||||
</LinearLayout>
|
android:layout_above="@id/tab_layout"
|
||||||
|
android:layout_below="@id/main_top" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tab_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
app:tabIndicatorHeight="0dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
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:background="@color/white">
|
android:background="@color/white">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/right_logo"
|
android:id="@+id/right_logo"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="50dp"
|
||||||
android:src="@mipmap/logo"/>
|
android:src="@mipmap/logo" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/right_logo"
|
android:layout_below="@id/right_logo"
|
||||||
android:layout_marginTop="50dp">
|
android:layout_marginTop="50dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/url_previcy"
|
android:id="@+id/url_previcy"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:background="@drawable/menu_background"
|
android:background="@drawable/menu_background"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_previcy"
|
android:id="@+id/text_previcy"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/privacy"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
|
android:text="@string/privacy"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:layout_gravity="center"/>
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:src="@mipmap/privacy"/>
|
android:layout_marginStart="8dp"
|
||||||
|
android:src="@mipmap/privacy" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/version_key"
|
android:id="@+id/version_key"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:src="@drawable/go_url"/>
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/go_url" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/version_lay"
|
android:id="@+id/version_lay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:layout_below="@id/url_previcy"
|
android:layout_below="@id/url_previcy"
|
||||||
android:background="@drawable/menu_background"
|
|
||||||
android:layout_marginTop="60dp"
|
android:layout_marginTop="60dp"
|
||||||
|
android:background="@drawable/menu_background"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/version"
|
android:id="@+id/version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/app_version"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
|
android:text="@string/app_version"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp" />
|
||||||
android:layout_gravity="center"/>
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/text_version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_centerHorizontal="true"
|
android:textSize="18sp" />
|
||||||
android:textSize="18sp"
|
|
||||||
android:id="@+id/text_version"/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@ -6,37 +6,39 @@
|
|||||||
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"
|
||||||
android:background="#EEF4F4"
|
|
||||||
tools:context=".activity.SpecifisoundsActivity">
|
tools:context=".activity.SpecifisoundsActivity">
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
<RelativeLayout
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/main_top"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_width="match_parent"
|
||||||
android:orientation="horizontal">
|
android:layout_height="70dp"
|
||||||
<FrameLayout
|
android:background="@color/sounds_main">
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:background="@drawable/back_circle">
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageview_back"
|
android:id="@+id/imageview_back"
|
||||||
android:layout_width="30dp"
|
android:layout_width="44dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="44dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:src="@drawable/svg_back" />
|
android:src="@drawable/svg_back" />
|
||||||
</FrameLayout>
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/categoryname"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="60dp"
|
android:layout_centerInParent="true"
|
||||||
android:id="@+id/categoryname"
|
android:text="@string/app_name"
|
||||||
android:textStyle="italic"
|
android:textColor="@color/white"
|
||||||
android:textSize="25sp"/>
|
android:textSize="23sp" />
|
||||||
</LinearLayout>
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
</RelativeLayout>
|
||||||
android:id="@+id/recyclerview_specific"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_width="match_parent"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:layout_height="wrap_content" />
|
android:id="@+id/recyclerview_specific"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
14
app/src/main/res/layout/fragment_category.xml
Normal file
14
app/src/main/res/layout/fragment_category.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="25dp"
|
||||||
|
tools:context=".fragement.CategoryFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/category_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
14
app/src/main/res/layout/fragment_love.xml
Normal file
14
app/src/main/res/layout/fragment_love.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".fragement.LoveFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/love_recycler"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
44
app/src/main/res/layout/item_love.xml
Normal file
44
app/src/main/res/layout/item_love.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/layout_root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/list_background"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/im_sounds"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:background="@drawable/bg_love"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="43dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_toEndOf="@id/im_sounds"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/im_love"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:padding="11dp"
|
||||||
|
android:src="@drawable/im_love_red" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
16
app/src/main/res/layout/item_tablayout.xml
Normal file
16
app/src/main/res/layout/item_tablayout.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/im_icon"
|
||||||
|
android:layout_width="25dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -6,16 +6,19 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/list_background">
|
android:background="@drawable/list_background">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="80dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="80dp"
|
||||||
android:id="@+id/imageview_sounds"
|
android:layout_marginTop="15dp"
|
||||||
android:scaleType="fitXY" />
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:id="@+id/imageview_sounds" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="50dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
android:id="@+id/textview_categoryname"/>
|
android:id="@+id/textview_categoryname"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -5,4 +5,15 @@
|
|||||||
<color name="sounds_main">#72C8D5</color>
|
<color name="sounds_main">#72C8D5</color>
|
||||||
<color name="sounds_text">#047685</color>
|
<color name="sounds_text">#047685</color>
|
||||||
<color name="color_trans">#DDE9EA</color>
|
<color name="color_trans">#DDE9EA</color>
|
||||||
|
|
||||||
|
<color name="background">#8B8F8F</color>
|
||||||
|
<color name="start">#D3E8EC</color>
|
||||||
|
<color name="end">#72C8D5</color>
|
||||||
|
|
||||||
|
|
||||||
|
<color name="tab_false">#8A8D8F</color>
|
||||||
|
<color name="tab_true">#f0c101</color>
|
||||||
|
|
||||||
|
<color name="add_love">#DF3737</color>
|
||||||
|
<color name="seekbar_bg">#80A1A2A3</color>
|
||||||
</resources>
|
</resources>
|
||||||
@ -4,4 +4,5 @@
|
|||||||
<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>
|
||||||
</resources>
|
</resources>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.4.0"
|
agp = "8.1.3"
|
||||||
kotlin = "1.9.0"
|
kotlin = "1.9.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.1.5"
|
junitVersion = "1.1.5"
|
||||||
@ -8,6 +8,9 @@ appcompat = "1.7.0"
|
|||||||
material = "1.12.0"
|
material = "1.12.0"
|
||||||
activity = "1.9.0"
|
activity = "1.9.0"
|
||||||
constraintlayout = "2.1.4"
|
constraintlayout = "2.1.4"
|
||||||
|
legacy-support-v4 = "1.0.0"
|
||||||
|
lifecycle-livedata-ktx = "2.8.4"
|
||||||
|
lifecycle-viewmodel-ktx = "2.8.4"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
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" }
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
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]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user