Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Benojir committed Sep 11, 2024
1 parent 779c33d commit e032ce5
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 140 deletions.
23 changes: 14 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}

android {
Expand All @@ -10,9 +11,10 @@ android {
defaultConfig {
applicationId "com.fogplix.tv"
minSdk 27
//noinspection OldTargetApi
targetSdk 34
versionCode 6
versionName "1.6"
versionCode 7
versionName "1.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -38,20 +40,23 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'

implementation 'com.google.firebase:firebase-messaging:24.0.0'
implementation 'com.google.firebase:firebase-crashlytics:19.0.3'
implementation 'com.google.firebase:firebase-analytics:22.1.0'
implementation 'com.google.firebase:firebase-messaging:24.0.1'

implementation 'com.android.volley:volley:1.2.1'
implementation "com.github.bumptech.glide:glide:4.16.0"
implementation 'com.github.bosphere.android-fadingedgelayout:fadingedgelayout:1.0.0'
implementation 'org.jsoup:jsoup:1.16.1'

implementation 'androidx.media3:media3-exoplayer:1.3.1'
implementation 'androidx.media3:media3-exoplayer-dash:1.3.1'
implementation 'androidx.media3:media3-exoplayer-hls:1.3.1'
implementation 'androidx.media3:media3-ui:1.3.1'
implementation 'androidx.media3:media3-exoplayer:1.4.1'
implementation 'androidx.media3:media3-exoplayer-dash:1.4.1'
implementation 'androidx.media3:media3-exoplayer-hls:1.4.1'
implementation 'androidx.media3:media3-ui:1.4.1'

implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'org.jsoup:jsoup:1.16.1'
}
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@
android:configChanges="orientation|uiMode|screenSize|keyboardHidden"
android:exported="false"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"></activity>
android:screenOrientation="sensorLandscape"
tools:ignore="DiscouragedApi" />
<activity
android:name=".activities.DetailsActivity"
android:configChanges="uiMode|orientation|screenSize"
android:configChanges="orientation|uiMode|screenSize|keyboardHidden"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/com/fogplix/tv/activities/GenreViewActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -20,6 +21,7 @@

public class GenreViewActivity extends AppCompatActivity {

private static final String TAG = "MADARA";
private ActivityGenreViewBinding binding;
private GridLayoutManager layoutManager;
private ItemsListAdapter rvAdapter;
Expand All @@ -39,6 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
ownToolbarBinding.ownToolbarTV.setVisibility(View.VISIBLE);
ownToolbarBinding.imageViewMiddle.setVisibility(View.GONE);
ownToolbarBinding.navbarRightBtn.setVisibility(View.GONE);
ownToolbarBinding.navInfoBtn.setVisibility(View.GONE);

genre = getIntent().getStringExtra("genre");

Expand All @@ -47,6 +50,15 @@ protected void onCreate(Bundle savedInstanceState) {
ownToolbarBinding.ownToolbarTV.setText(CustomMethods.capitalize(genreName));
}

ownToolbarBinding.navbarLeftBtn.setOnClickListener(view -> onBackPressed());
ownToolbarBinding.navbarLeftBtn.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
ownToolbarBinding.navbarLeftBtn.setBackgroundResource(R.drawable.button_focused);
} else {
ownToolbarBinding.navbarLeftBtn.setBackgroundResource(R.drawable.button_default);
}
});

int screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;

rvAdapter = new ItemsListAdapter(GenreViewActivity.this, allAnime);
Expand Down Expand Up @@ -82,10 +94,6 @@ protected void onCreate(Bundle savedInstanceState) {
page = page + 1;
loadAnime(page);
});

////////////////////////////////////////////////////////////////////////////////////////////

ownToolbarBinding.navbarLeftBtn.setOnClickListener(view -> onBackPressed());
}

// ----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -135,7 +143,7 @@ public void onScrapeComplete(JSONArray resultAnime) {
}

} catch (JSONException e){
e.printStackTrace();
Log.e(TAG, "onScrapeComplete: ", e);
CustomMethods.errorAlert(GenreViewActivity.this, "Error (Json)", e.getMessage(), "OK", false);
}
}
Expand Down
24 changes: 10 additions & 14 deletions app/src/main/java/com/fogplix/tv/activities/PlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ protected void onCreate(Bundle savedInstanceState) {

//------------------------------------------------------------------------------------------

if (preferences.getBoolean("85s_skipping_button", false)) {
skipIntroOutroBtn.setVisibility(View.VISIBLE);
skipIntroOutroBtn.setText("Skip 85s");
}

//------------------------------------------------------------------------------------------

episodeLoadingTV.setText("Loading episode " + CustomMethods.extractEpisodeNumberFromId(episodeId));

GenerateDirectLink generateDirectLink = new GenerateDirectLink(this);
Expand Down Expand Up @@ -227,9 +220,15 @@ public void onFailed(String error) {
//+++++++++++++++++++++++ Below section is handing button actions ++++++++++++++++++++++++++

skipIntroOutroBtn.setOnClickListener(v -> {
if (preferences.getBoolean("85s_skipping_button", false)) {
long currentVideoPosition = exoPlayer.getCurrentPosition();
exoPlayer.seekTo(currentVideoPosition + 85000);
long currentVideoPosition = exoPlayer.getCurrentPosition();
exoPlayer.seekTo(currentVideoPosition + 85000);
});

skipIntroOutroBtn.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
skipIntroOutroBtn.setTextColor(getColor(R.color.green));
} else {
skipIntroOutroBtn.setTextColor(getColor(R.color.white));
}
});

Expand Down Expand Up @@ -479,10 +478,7 @@ public void onPlaybackStateChanged(int playbackState) {
}

if (playbackState == Player.STATE_READY) {
if (preferences.getBoolean("85s_skipping_button", false)) {
skipIntroOutroBtn.setVisibility(View.VISIBLE);
}

skipIntroOutroBtn.setVisibility(View.VISIBLE);
exoPlayerView.setVisibility(View.VISIBLE);
bufferingProgressBar.setVisibility(View.GONE);
videoNameTV.setText(animeTitle.trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ public void onBindViewHolder(@NonNull GenreCardAdapter.MyCustomViewHolder holder
return false;
});

holder.itemView.setOnFocusChangeListener((view, b) -> {
if (b) {
holder.cardView.setCardBackgroundColor(context.getColor(R.color.orange));
holder.itemView.setOnFocusChangeListener((view, hasFocus) -> {
if (hasFocus) {
holder.cardView.setCardBackgroundColor(context.getColor(R.color.white));
holder.genreTV.setTextColor(context.getColor(R.color.black));
} else {
holder.cardView.setCardBackgroundColor(color);
holder.genreTV.setTextColor(context.getColor(R.color.white));
}
});
}
Expand Down
24 changes: 2 additions & 22 deletions app/src/main/java/com/fogplix/tv/helpers/CustomMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,6 @@ public static void errorAlert(Activity activity, String errorTitle, String error
}
}

public static void warningAlert(Activity activity, String warningTitle, String warningBody, String actionButton, boolean shouldGoBack) {
if (!activity.isFinishing()) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(warningTitle);
builder.setMessage(warningBody);
builder.setIcon(R.drawable.warning);
builder.setPositiveButton(actionButton, (dialogInterface, i) -> {
if (shouldGoBack) {
activity.finish();
} else {
dialogInterface.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}

//--------------------------------------------------------------------------------------------------

public static void checkNewNotice(Context context, TextView textView) {
Expand All @@ -164,8 +146,7 @@ public static void checkNewNotice(Context context, TextView textView) {
new Thread(() -> {

try {
String newNoticeJSON =
Jsoup.connect(context.getString(R.string.new_notice_json_link))
String newNoticeJSON = Jsoup.connect(context.getString(R.string.new_notice_json_link))
.timeout(30000)
.ignoreContentType(true)
.execute().body();
Expand Down Expand Up @@ -212,8 +193,7 @@ public static void checkForUpdateOnStartApp(Activity activity) {
new Thread(() -> {

try {
String versionInfoJSON =
Jsoup.connect(activity.getString(R.string.version_page_link))
String versionInfoJSON = Jsoup.connect(activity.getString(R.string.version_page_link))
.timeout(30000)
.ignoreContentType(true)
.execute().body();
Expand Down
52 changes: 46 additions & 6 deletions app/src/main/res/layout/exoplayer_controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
<ImageButton
android:id="@+id/backButton"
style="@style/ExoStyledControls.Button.Bottom.RepeatToggle"
android:nextFocusRight="@id/previous_episode"
android:nextFocusDown="@id/exo_play_pause"
android:nextFocusForward="@id/previous_episode"
android:src="@drawable/arrow_back_48"
tools:ignore="ContentDescription" />
tools:ignore="ContentDescription,DuplicateSpeakableTextCheck" />

<TextView
android:id="@+id/animeNameTV"
Expand Down Expand Up @@ -93,28 +96,44 @@
android:id="@+id/previous_episode"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:layout_marginHorizontal="25dp"
android:src="@drawable/skip_previous_24" />
android:nextFocusRight="@id/backward_10"
android:nextFocusDown="@id/exo_progress"
android:nextFocusForward="@id/backward_10"
android:src="@drawable/skip_previous_24"
tools:ignore="DuplicateSpeakableTextCheck" />

<ImageButton
android:id="@+id/backward_10"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:layout_marginHorizontal="0dp"
android:nextFocusForward="@id/exo_play_pause"
android:nextFocusRight="@id/exo_play_pause"
android:nextFocusDown="@id/exo_progress"
android:src="@drawable/replay_10_24" />

<ImageButton
android:id="@id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:nextFocusForward="@id/forward_10"
android:nextFocusRight="@id/forward_10"
android:nextFocusDown="@id/exo_progress"
android:layout_marginHorizontal="30dp" />

<ImageButton
android:id="@+id/forward_10"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:nextFocusForward="@id/next_episode"
android:nextFocusRight="@id/next_episode"
android:nextFocusDown="@id/exo_progress"
android:layout_marginHorizontal="0dp"
android:src="@drawable/forward_10_24" />

<ImageButton
android:id="@+id/next_episode"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:nextFocusForward="@id/skipIntroOutroBtn"
android:nextFocusRight="@id/skipIntroOutroBtn"
android:nextFocusDown="@id/exo_progress"
android:layout_marginHorizontal="25dp"
android:src="@drawable/skip_next_24" />

Expand All @@ -125,12 +144,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/exo_progress"
android:visibility="gone"
android:visibility="visible"
android:layout_alignParentEnd="true"
android:textColor="@color/white"
android:layout_marginHorizontal="15dp"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:text="Skip" />
android:nextFocusForward="@id/exo_progress"
android:nextFocusRight="@id/exo_progress"
android:nextFocusDown="@id/exo_progress"
android:nextFocusLeft="@id/next_episode"
android:nextFocusUp="@id/exo_play_pause"
android:textAllCaps="false"
android:text="SKIP 85s" />

<androidx.media3.ui.DefaultTimeBar
android:id="@id/exo_progress"
Expand All @@ -143,6 +168,9 @@
app:played_color="@color/red"
app:scrubber_color="@color/red"
app:scrubber_enabled_size="10dp"
android:nextFocusForward="@id/fit_screen_btn"
android:nextFocusRight="@id/fit_screen_btn"
android:nextFocusDown="@id/fit_screen_btn"
app:unplayed_color="#80555555" />

<FrameLayout
Expand Down Expand Up @@ -186,20 +214,32 @@
<ImageButton
android:id="@+id/fit_screen_btn"
style="@style/ExoStyledControls.Button.Bottom.RepeatToggle"
android:nextFocusForward="@id/quality_selection_btn"
android:nextFocusRight="@id/quality_selection_btn"
android:nextFocusDown="@id/backButton"
android:src="@drawable/crop_free" />

<ImageButton
android:id="@+id/quality_selection_btn"
style="@style/ExoStyledControls.Button.Bottom.RepeatToggle"
android:nextFocusForward="@id/exo_subtitle"
android:nextFocusRight="@id/exo_subtitle"
android:nextFocusDown="@id/backButton"
android:src="@drawable/hd_48px_xml" />

<ImageButton
android:id="@id/exo_subtitle"
style="@style/ExoStyledControls.Button.Bottom.CC" />
style="@style/ExoStyledControls.Button.Bottom.CC"
android:nextFocusForward="@id/exo_settings"
android:nextFocusRight="@id/exo_settings"
android:nextFocusDown="@id/backButton"/>

<ImageButton
android:id="@id/exo_settings"
style="@style/ExoStyledControls.Button.Bottom.Settings" />
style="@style/ExoStyledControls.Button.Bottom.Settings"
android:nextFocusForward="@id/backButton"
android:nextFocusRight="@id/backButton"
android:nextFocusDown="@id/backButton"/>

</LinearLayout>

Expand Down
Loading

0 comments on commit e032ce5

Please sign in to comment.