Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7a50248
added android:exported to all the activities
AdityaKapal362 Jan 23, 2025
7807a5d
added Context.RECEIVER_EXPORTED to fix the A14 issue
AdityaKapal362 Jan 23, 2025
4a75e2f
changed to Context.RECEIVER_NOT_EXPORTED
AdityaKapal362 Jan 23, 2025
21cfc83
added foreground service media playback perm for A14
AdityaKapal362 Jan 24, 2025
631af07
removed unused codes
AdityaKapal362 Jan 24, 2025
9e10bf7
added permission checker for A14 and optimized some codes
AdityaKapal362 Jan 24, 2025
39760f5
optimized request permission for A14
AdityaKapal362 Jan 24, 2025
afdd60d
added close miniplayer button
AdityaKapal362 Jan 24, 2025
a95b74a
added stop button
AdityaKapal362 Jan 24, 2025
519d701
padding adjusted
AdityaKapal362 Jan 24, 2025
dcd8ad9
forgot to put ; for the hundred times fuuck
AdityaKapal362 Jan 24, 2025
1ec9c18
fix minor error
AdityaKapal362 Jan 24, 2025
594ca3c
fix context issue
AdityaKapal362 Jan 24, 2025
15eb80e
added zz songs downloader because the internet usage was very high uhhhh
AdityaKapal362 Jan 24, 2025
c8ed5b2
fix setup issue
AdityaKapal362 Jan 24, 2025
c962173
fix setup sort issue
AdityaKapal362 Jan 24, 2025
72bcfb8
added asynctask to download the song
AdityaKapal362 Jan 24, 2025
0bbd87d
fix asynctask issue
AdityaKapal362 Jan 24, 2025
8403c14
optimized some codes
AdityaKapal362 Jan 24, 2025
9196059
check function now return file instead of boolean
AdityaKapal362 Jan 24, 2025
ddc899a
applied zz song downloader on play
AdityaKapal362 Jan 24, 2025
dd178de
rjhenjgkrenjkg
AdityaKapal362 Jan 24, 2025
94c82b0
check function now return String instead of File
AdityaKapal362 Jan 24, 2025
ff94434
added stopForeground on song stopped
AdityaKapal362 Jan 24, 2025
8fcbf09
optimized data usage huhhh
AdityaKapal362 Jan 24, 2025
beccab6
optimized stop button on miniplayer
AdityaKapal362 Jan 24, 2025
54e2ba0
fix latest background notification issue
AdityaKapal362 Jan 24, 2025
eb2d034
fix notification update issue
AdityaKapal362 Jan 24, 2025
0a49cb1
fix notification initializePlayer issue
AdityaKapal362 Jan 24, 2025
9e4eeca
optimized media player for better performance
AdityaKapal362 Jan 24, 2025
7b0970b
applied caching on glide for smaller data usage when streaming
AdityaKapal362 Jan 24, 2025
c6b39ac
fix typo
AdityaKapal362 Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
Expand Down Expand Up @@ -54,47 +55,57 @@
android:exported="true"/>

<activity
android:name=".DebugActivity"/>
android:name=".DebugActivity"
android:exported="true"/>

<activity
android:name=".ThemesActivity"
android:exported="true"/>

<activity
android:name=".ProfileActivity"/>
android:name=".ProfileActivity"
android:exported="true"/>

<activity
android:name=".LogcatActivity"
android:exported="true"/>

<activity
android:name=".ChgpicActivity"/>
android:name=".ChgpicActivity"
android:exported="true"/>

<activity
android:name=".ThemesstrActivity"
android:exported="true"/>

<activity
android:name=".CropActivity"/>
android:name=".CropActivity"
android:exported="true"/>

<activity
android:name=".MessageActivity"/>
android:name=".MessageActivity"
android:exported="true"/>

<activity
android:name=".StreamerActivity"/>
android:name=".StreamerActivity"
android:exported="true"/>

<activity
android:name=".StreamingActivity"/>
android:name=".StreamingActivity"
android:exported="false"/>

<activity
android:name=".SwthomeActivity"
android:screenOrientation="landscape"/>
android:screenOrientation="landscape"
android:exported="true"/>

<activity
android:name=".FilepickerActivity"/>
android:name=".FilepickerActivity"
android:exported="true"/>

<activity
android:name=".UpdateappActivity"/>
android:name=".UpdateappActivity"
android:exported="true"/>

<activity
android:name=".WizardActivity"
Expand All @@ -109,18 +120,19 @@
android:exported="true"/>

<activity
android:name=".LyricsActivity"/>
android:name=".LyricsActivity"
android:exported="true"/>

<service
android:name="tw.music.streamer.service.ZryteZenePlay"
android:foregroundServiceType="mediaPlayback"
android:icon="@drawable/ic_launcher"
android:label="ZryteZene Background Service"
android:exported="true"/>
android:exported="false"/>

<receiver
android:name="tw.music.streamer.receiver.ZryteZeneBroadcastReceiver"
android:exported="true">
android:exported="false">
<intent-filter>
<action android:name="ZZ_PLAY" />
<action android:name="ZZ_PAUSE" />
Expand Down
102 changes: 16 additions & 86 deletions app/src/main/java/tw/music/streamer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
Expand All @@ -29,6 +30,7 @@
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import com.bumptech.glide.Glide;
import com.google.android.gms.tasks.OnCompleteListener;
Expand Down Expand Up @@ -464,28 +466,6 @@ public void onCancelled(DatabaseError _param1) {
};
prof_img.addChildEventListener(_prof_img_child_listener);

/*objectanim3.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator _param1) {

}

@Override
public void onAnimationEnd(Animator _param1) {
internetchecker.startRequestNetwork(RequestNetworkController.GET, "https://www.google.com", "A", _internetchecker_request_listener);
}

@Override
public void onAnimationCancel(Animator _param1) {

}

@Override
public void onAnimationRepeat(Animator _param1) {

}
});*/

_internetchecker_request_listener = new RequestNetwork.RequestListener() {
@Override
public void onResponse(String _param1, String _param2) {
Expand All @@ -500,12 +480,6 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
/*objectanim3.setTarget(linear4);
objectanim3.setPropertyName("translationY");
objectanim3.setFloatValues(SketchwareUtil.getDip(getApplicationContext(), -75), (float) (0));
objectanim3.setDuration(500);
objectanim3.setInterpolator(new DecelerateInterpolator());
objectanim3.start();*/
internetchecker.startRequestNetwork(RequestNetworkController.GET, "https://www.google.com", "A", _internetchecker_request_listener);
}
});
Expand All @@ -527,12 +501,6 @@ public void onErrorResponse(String _param1, String _param2) {
_isNoInternet = true;
textview4.setText("Please enable your internet!");
_randomEmoteUwU();
/*objectanim3.setTarget(linear4);
objectanim3.setPropertyName("translationY");
objectanim3.setFloatValues((float) (0), SketchwareUtil.getDip(getApplicationContext(), -75));
objectanim3.setDuration(500);
objectanim3.setInterpolator(new DecelerateInterpolator());
objectanim3.start();*/
internetchecker.startRequestNetwork(RequestNetworkController.GET, "https://www.google.com", "A", _internetchecker_request_listener);
}
}
Expand Down Expand Up @@ -635,7 +603,6 @@ public void onComplete(Task<Void> _param1) {
}

private void initializeLogic() {
//overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
try {
packageInfo = MainActivity.this.getPackageManager().getPackageInfo(getPackageName(), 0);
textview6.setText(" " + packageInfo.versionName);
Expand All @@ -650,19 +617,20 @@ private void initializeLogic() {
linear7.setVisibility(View.GONE);
textview11.setVisibility(View.GONE);
image_user.setColorFilter(0xFF2196F3, PorterDuff.Mode.MULTIPLY);
textview1.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf");
textview1.setTypeface(tf, 0);
textview2.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesansbold.ttf"), 0);
textview3.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesansbold.ttf"), 0);
textview4.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview5.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview6.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview7.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview8.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview9.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview10.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview11.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
einput_name.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
button1.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/googlesans.ttf"), 0);
textview4.setTypeface(tf, 0);
textview5.setTypeface(tf, 0);
textview6.setTypeface(tf, 0);
textview7.setTypeface(tf, 0);
textview8.setTypeface(tf, 0);
textview9.setTypeface(tf, 0);
textview10.setTypeface(tf, 0);
textview11.setTypeface(tf, 0);
einput_name.setTypeface(tf, 0);
button1.setTypeface(tf, 0);
_shape(SketchwareUtil.getDip(getApplicationContext(), (int) (2.5d)), SketchwareUtil.getDip(getApplicationContext(), (int) (2.5d)), SketchwareUtil.getDip(getApplicationContext(), (int) (2.5d)), SketchwareUtil.getDip(getApplicationContext(), (int) (2.5d)), "#2196F3", "#FFFFFF", 0, button1);
lineartm.setTranslationY(SketchwareUtil.getDip(getApplicationContext(), -75));
if (data.getString("fvsAsc", "").equals("")) {
Expand Down Expand Up @@ -787,8 +755,8 @@ private void initializeLogic() {
}

private boolean _checkPermission() {
if (Build.VERSION.SDK_INT < 33) {
return !(androidx.core.content.ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE) == android.content.pm.PackageManager.PERMISSION_DENIED);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
return (ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK) == PackageManager.PERMISSION_GRANTED);
} else {
return true;
}
Expand All @@ -802,7 +770,6 @@ public void onBackPressed() {
@Override
public void onStart() {
super.onStart();
//_DarkMode();
}

@Override
Expand Down Expand Up @@ -930,43 +897,6 @@ private void _shape(final double _tl, final double _tr, final double _bl, final
_view.setBackground(s);
}


private void _DarkMode() {
int nightModeFlags = getResources().getConfiguration().uiMode & android.content.res.Configuration.UI_MODE_NIGHT_MASK;
if (nightModeFlags == android.content.res.Configuration.UI_MODE_NIGHT_YES) {
linear1.setBackgroundColor(0xFF252525);
linear2.setBackgroundColor(0xFF252525);
linear6.setBackgroundColor(0xFF252525);
einput_name.setTextColor(0xFFFFFFFF);
textview4.setTextColor(0xFFFFFFFF);
textview7.setTextColor(0xFFFFFFFF);
textview8.setTextColor(0xFFFFFFFF);
textview9.setTextColor(0xFFFFFFFF);
getWindow().setStatusBarColor(Color.parseColor("#252525"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().getDecorView().setSystemUiVisibility(0);
}
_customNav("#252525");
} else {
linear1.setBackgroundColor(0xFFFFFFFF);
linear2.setBackgroundColor(0xFFFFFFFF);
linear6.setBackgroundColor(0xFFFFFFFF);
einput_name.setTextColor(0xFF000000);
textview4.setTextColor(0xFF000000);
textview7.setTextColor(0xFF000000);
textview8.setTextColor(0xFF000000);
textview9.setTextColor(0xFF000000);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().setStatusBarColor(Color.parseColor("#FFFFFF"));
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} else {
getWindow().setStatusBarColor(Color.parseColor("#BDBDBD"));
}
_customNav("#FFFFFF");
}
}


private void _chkChglog() {
if (data.getString("lastVersion", "").equals("")) {
_dispChglog();
Expand Down
27 changes: 20 additions & 7 deletions app/src/main/java/tw/music/streamer/StreamingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;

import com.google.firebase.auth.FirebaseAuth;
Expand Down Expand Up @@ -52,7 +53,7 @@ public class StreamingActivity extends AppCompatActivity {
private LinearLayoutManager lm1;
private GridLayoutManager lm2;
private TextView user_welcome, taptext1, taptext2, taptext3, taptext4, mp_title, mp_artist;
private ImageView user_icon, tapicon1, tapicon2, tapicon3, mp_play, mp_icon, bg_drop;
private ImageView user_icon, tapicon1, tapicon2, tapicon3, mp_play, mp_icon, mp_close, bg_drop;
private LinearLayout menu_bar, tapbar1, tapbar2, tapbar3, tapbar4, mp_base;
private ProgressBar mp_bar;

Expand Down Expand Up @@ -131,7 +132,7 @@ private void initFirebaseListener(final Context z) {
if (a.isSuccessful()) {
DataSnapshot b = a.getResult();
if (b.exists() && b.hasChild("url")) {
Glide.with(z).load(b.child("url").getValue(String.class)).apply(RequestOptions.circleCropTransform()).into(user_icon);
Glide.with(z).load(b.child("url").getValue(String.class)).diskCacheStrategy(DiskCacheStrategy.ALL).apply(RequestOptions.circleCropTransform()).into(user_icon);
}
}
});
Expand All @@ -157,6 +158,7 @@ private void initLayout() {
mp_base = findViewById(R.id.zzmp1_base);
mp_play = findViewById(R.id.zzmp1_play);
mp_icon = findViewById(R.id.zzmp1_icon);
mp_close = findViewById(R.id.zzmp1_stop);
mp_title = findViewById(R.id.zzmp1_title);
mp_artist = findViewById(R.id.zzmp1_artist);
tapbar1 = findViewById(R.id.sbmb1);
Expand Down Expand Up @@ -208,6 +210,16 @@ public void onClick(View b) {
}
}
});
mp_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View b) {
mp_base.setVisibility(View.GONE);
bg_drop.setVisibility(View.GONE);
Intent c = new Intent(getApplicationContext(), ZryteZenePlay.class);
stopService(c);
zz = new ZryteZeneAdaptor(getApplicationContext());
}
});
}

private void initLogic(final Context a) {
Expand Down Expand Up @@ -283,17 +295,17 @@ public void onReceive(Context context, Intent intent) {
}
};
IntentFilter filr = new IntentFilter(ZryteZenePlay.ACTION_UPDATE);
registerReceiver(zzreceiver, filr);
registerReceiver(zzreceiver, filr, Context.RECEIVER_NOT_EXPORTED);
zz.requestAction("request-media");
}

private void playFromZZSongs(int a) {
mp_artist.setText(zz_songs.get(a).song_artist);
mp_title.setText(zz_songs.get(a).song_name);
mp_play.setImageResource(R.drawable.ic_pause_white);
Glide.with(getApplicationContext()).load(zz_songs.get(a).url_icon).transform(new RoundedCorners(dip(5))).into(mp_icon);
Glide.with(getApplicationContext()).load(zz_songs.get(a).url_icon).diskCacheStrategy(DiskCacheStrategy.ALL).transform(new RoundedCorners(dip(5))).into(mp_icon);
mp_base.setVisibility(View.VISIBLE);
Glide.with(getApplicationContext()).load(zz_songs.get(a).url_cover).into(bg_drop);
Glide.with(getApplicationContext()).load(zz_songs.get(a).url_cover).diskCacheStrategy(DiskCacheStrategy.ALL).into(bg_drop);
mp_bar.setProgressTintList(ColorStateList.valueOf(Color.parseColor(zz_songs.get(a).color1)));
zz.play(zz_songs.get(a));
}
Expand All @@ -303,11 +315,12 @@ private void loadSongFromKey(String a) {
if (b.isSuccessful()) {
DataSnapshot c = b.getResult();
if (c.exists()) {
bg_drop.setVisibility(View.VISIBLE);
mp_artist.setText(c.child("artist").getValue(String.class));
mp_title.setText(c.child("title").getValue(String.class));
Glide.with(getApplicationContext()).load(c.child("icon").getValue(String.class)).transform(new RoundedCorners(dip(5))).into(mp_icon);
Glide.with(getApplicationContext()).load(c.child("icon").getValue(String.class)).diskCacheStrategy(DiskCacheStrategy.ALL).transform(new RoundedCorners(dip(5))).into(mp_icon);
mp_base.setVisibility(View.VISIBLE);
Glide.with(getApplicationContext()).load(c.child("cover").getValue(String.class)).into(bg_drop);
Glide.with(getApplicationContext()).load(c.child("cover").getValue(String.class)).diskCacheStrategy(DiskCacheStrategy.ALL).into(bg_drop);
mp_bar.setProgressTintList(ColorStateList.valueOf(Color.parseColor(c.child("color-bline").getValue(String.class))));
}
}
Expand Down
Loading
Loading