diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
index b268ef3..dd1eb1c 100644
--- a/.idea/deploymentTargetSelector.xml
+++ b/.idea/deploymentTargetSelector.xml
@@ -4,6 +4,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index 1370597..bcdb8b6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -34,10 +34,10 @@ android {
}
dependencies {
-
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'androidx.preference:preference:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1e93a5b..bd1366a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,10 +13,12 @@
android:name="android.hardware.touchscreen"
android:required="false" />
-
+
-
+
@@ -30,22 +32,26 @@
+ tools:targetApi="31">
+
+ android:name=".activities.FavoriteActivity"
+ android:configChanges="orientation|uiMode|screenSize|keyboardHidden"
+ android:exported="true">
+ android:name=".activities.GenreViewActivity"
+ android:configChanges="orientation|uiMode|screenSize|keyboardHidden"
+ android:exported="false">
-
+ android:screenOrientation="sensorLandscape">
@@ -110,8 +115,8 @@
-
-
diff --git a/app/src/main/java/com/fogplix/tv/activities/MainActivity.java b/app/src/main/java/com/fogplix/tv/activities/MainActivity.java
index ca94713..3501a2c 100644
--- a/app/src/main/java/com/fogplix/tv/activities/MainActivity.java
+++ b/app/src/main/java/com/fogplix/tv/activities/MainActivity.java
@@ -1,12 +1,9 @@
package com.fogplix.tv.activities;
-import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.PorterDuff;
-import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Looper;
import android.view.View;
import android.widget.ImageButton;
import android.widget.PopupMenu;
@@ -17,8 +14,6 @@
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.splashscreen.SplashScreen;
-import androidx.core.view.GravityCompat;
-import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager2.widget.ViewPager2;
@@ -26,23 +21,17 @@
import com.fogplix.tv.R;
import com.fogplix.tv.adapters.FragmentAdapter;
import com.fogplix.tv.helpers.CustomMethods;
-import com.google.android.material.navigation.NavigationView;
-import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import java.util.Objects;
public class MainActivity extends AppCompatActivity {
- private DrawerLayout drawerLayout;
private ViewPager2 viewPager2;
private TabLayout tabLayout;
private TextView importantNoticeTV;
- private NavigationView navigationView;
private boolean keepSplashScreen = true;
- private boolean doubleBackPressed = false;
- @SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -61,35 +50,55 @@ protected void onCreate(Bundle savedInstanceState) {
View ownToolbar = findViewById(R.id.ownToolbar);
- ImageButton navLeftBtn = ownToolbar.findViewById(R.id.navbarLeftBtn);
+ ImageButton favoritePageBtn = ownToolbar.findViewById(R.id.navbarLeftBtn);
+ ImageButton searchBtn = ownToolbar.findViewById(R.id.navbarRightBtn);
+ ImageButton navInfoBtn = ownToolbar.findViewById(R.id.navInfoBtn);
- navLeftBtn.setImageDrawable(AppCompatResources.getDrawable(MainActivity.this, R.drawable.favorite_48));
- navLeftBtn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, FavoriteActivity.class)));
+ favoritePageBtn.setImageDrawable(AppCompatResources.getDrawable(MainActivity.this, R.drawable.favorite_48));
+ favoritePageBtn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, FavoriteActivity.class)));
+ favoritePageBtn.setOnFocusChangeListener((v, hasFocus) -> {
+ if (hasFocus){
+ favoritePageBtn.setBackgroundResource(R.drawable.button_focused);
+ } else {
+ favoritePageBtn.setBackgroundResource(R.drawable.button_default);
+ }
+ });
- ownToolbar.findViewById(R.id.navbarRightBtn).setOnClickListener(v -> startActivity(new Intent(MainActivity.this, SearchActivity.class)));
+ searchBtn.setOnClickListener(v -> startActivity(new Intent(MainActivity.this, SearchActivity.class)));
+ searchBtn.setOnFocusChangeListener((v, hasFocus) -> {
+ if (hasFocus){
+ searchBtn.setBackgroundResource(R.drawable.button_focused);
+ } else {
+ searchBtn.setBackgroundResource(R.drawable.button_default);
+ }
+ });
- ImageButton navInfoBtn = ownToolbar.findViewById(R.id.navInfoBtn);
navInfoBtn.setOnClickListener(v -> {
-
PopupMenu popupMenu = new PopupMenu(MainActivity.this, navInfoBtn);
popupMenu.getMenuInflater().inflate(R.menu.top_right_popup_menu, popupMenu.getMenu());
-
- // Set up the click listener for the menu items
popupMenu.setOnMenuItemClickListener(item -> {
-
- if (item.getItemId() == R.id.show_version){
+ if (item.getItemId() == R.id.open_settings){
+ startActivity(new Intent(MainActivity.this, SettingsActivity.class));
+ return true;
+ } else if (item.getItemId() == R.id.show_version){
Toast.makeText(this, BuildConfig.VERSION_NAME, Toast.LENGTH_SHORT).show();
return true;
} else {
return false;
}
});
-
- // Show the popup menu
popupMenu.show();
});
+ navInfoBtn.setOnFocusChangeListener((v, hasFocus) -> {
+ if (hasFocus){
+ navInfoBtn.setBackgroundResource(R.drawable.button_focused);
+ } else {
+ navInfoBtn.setBackgroundResource(R.drawable.button_default);
+ }
+ });
+
////////////////////////////////////////////////////////////////////////////////////////////
CustomMethods.checkForUpdateOnStartApp(this);
@@ -98,22 +107,11 @@ protected void onCreate(Bundle savedInstanceState) {
if (!CustomMethods.isInternetOn(this)) {
Toast.makeText(this, "No internet connection.", Toast.LENGTH_LONG).show();
- doubleBackPressed = true;
- onBackPressed();
+ finish();
}
////////////////////////////////////////////////////////////////////////////////////////////
- View headView = navigationView.getHeaderView(0);
-
- ((TextView) headView.findViewById(R.id.header_layout_version_tv)).setText("Version: " + BuildConfig.VERSION_NAME);
-
- headView.findViewById(R.id.closeDrawerBtn).setOnClickListener(v -> drawerLayout.closeDrawers());
-
- navigationViewItemClickedActions(navigationView);
-
- ////////////////////////////////////////////////////////////////////////////////////////////
-
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentAdapter fragmentAdapter = new FragmentAdapter(fragmentManager, getLifecycle(), tabLayout.getTabCount());
viewPager2.setAdapter(fragmentAdapter);
@@ -149,65 +147,11 @@ public void onPageSelected(int position) {
});
}
-
-// ----------------------------------------------------------------------------------------------
-
- private void navigationViewItemClickedActions(NavigationView navigationView) {
-
- navigationView.setNavigationItemSelectedListener(item -> {
-
- if (item.getItemId() == R.id.favorite_anime_menu_item) {
-
- startActivity(new Intent(getApplicationContext(), FavoriteActivity.class));
-
- new Handler().postDelayed(() -> {
- if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
- drawerLayout.closeDrawer(GravityCompat.START);
- }
- }, 500);
- } else if (item.getItemId() == R.id.report_bug_action) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.official_telegram_group))));
- } else if (item.getItemId() == R.id.share_action) {
- Intent intent1 = new Intent(Intent.ACTION_SEND);
- intent1.setType("text/plain");
- intent1.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.app_sharing_message) + "\n" + getString(R.string.official_website));
- startActivity(Intent.createChooser(intent1, "Share via"));
- } else if (item.getItemId() == R.id.more_apps_action) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.more_apps))));
- } else if (item.getItemId() == R.id.visit_website) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.official_website))));
- } else if (item.getItemId() == R.id.visit_telegram) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.official_telegram_channel))));
- }
- return false;
- });
- }
-
-// ----------------------------------------------------------------------------------------------
-
- @Override
- public void onBackPressed() {
-
- if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
- drawerLayout.closeDrawer(GravityCompat.START);
- } else {
- if (doubleBackPressed) {
- super.onBackPressed();
- } else {
- this.doubleBackPressed = true;
- Snackbar.make(drawerLayout, "Double press to exit!", Snackbar.LENGTH_LONG).show();
-
- new Handler(Looper.getMainLooper()).postDelayed(() -> doubleBackPressed = false, 2000);
- }
- }
- }
// ----------------------------------------------------------------------------------------------
private void initVars() {
- drawerLayout = findViewById(R.id.home_page_drawerlayout);
viewPager2 = findViewById(R.id.fragmentContainerViewPager2Main);
tabLayout = findViewById(R.id.tabLayout);
- navigationView = findViewById(R.id.navigation_drawer);
importantNoticeTV = findViewById(R.id.important_notice_tv);
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/fogplix/tv/activities/SettingsActivity.java b/app/src/main/java/com/fogplix/tv/activities/SettingsActivity.java
new file mode 100644
index 0000000..b0794b0
--- /dev/null
+++ b/app/src/main/java/com/fogplix/tv/activities/SettingsActivity.java
@@ -0,0 +1,39 @@
+package com.fogplix.tv.activities;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageButton;
+
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceFragmentCompat;
+
+import com.fogplix.tv.R;
+
+public class SettingsActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.settings_activity);
+ if (savedInstanceState == null) {
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.settings, new SettingsFragment())
+ .commit();
+ }
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(false);
+ }
+
+ findViewById(R.id.backButton).setOnClickListener(v -> onBackPressed());
+ }
+
+ public static class SettingsFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.root_preferences, rootKey);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fogplix/tv/adapters/EpisodesButtonsAdapter.java b/app/src/main/java/com/fogplix/tv/adapters/EpisodesButtonsAdapter.java
index e32a6a4..61afa9d 100644
--- a/app/src/main/java/com/fogplix/tv/adapters/EpisodesButtonsAdapter.java
+++ b/app/src/main/java/com/fogplix/tv/adapters/EpisodesButtonsAdapter.java
@@ -2,6 +2,7 @@
import android.app.Activity;
import android.content.Context;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -64,11 +65,11 @@ public void onBindViewHolder(@NonNull MyCustomViewHolder holder, int position) {
holder.episodeButton.setBackgroundColor(context.getColor(R.color.black));
}
- holder.episodeButton.setOnFocusChangeListener((view, b) -> {
+ holder.episodeButton.setOnFocusChangeListener((view, hasFocus) -> {
- if (b){
+ if (hasFocus){
holder.episodeButton.setTextColor(context.getColor(R.color.white));
- holder.episodeButton.setBackgroundColor(context.getColor(R.color.orange));
+ holder.episodeButton.setBackgroundColor(context.getColor(R.color.red));
} else {
if (episodeId.equals(databaseHandler.getLastWatchedEpisodeId(animeId))){
holder.episodeButton.setTextColor(context.getColor(R.color.white));
@@ -81,7 +82,7 @@ public void onBindViewHolder(@NonNull MyCustomViewHolder holder, int position) {
});
}
catch (Exception e) {
- e.printStackTrace();
+ Log.e("MADARA", "onBindViewHolder: ", e);
}
}
diff --git a/app/src/main/java/com/fogplix/tv/adapters/ItemsListAdapter.java b/app/src/main/java/com/fogplix/tv/adapters/ItemsListAdapter.java
index c5ca0c6..038eb85 100644
--- a/app/src/main/java/com/fogplix/tv/adapters/ItemsListAdapter.java
+++ b/app/src/main/java/com/fogplix/tv/adapters/ItemsListAdapter.java
@@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -33,6 +34,7 @@
public class ItemsListAdapter extends RecyclerView.Adapter {
+ private static final String TAG = "MADARA";
private final JSONArray allAnime;
private final Activity activity;
@@ -92,7 +94,7 @@ public void onBindViewHolder(@NonNull MyCustomViewHolder holder, int position) {
holder.releaseDateTV.setText(allAnime.getJSONObject(holder.getBindingAdapterPosition()).getString("releasedDate"));
}
} catch (Exception e) {
- e.printStackTrace();
+ Log.e(TAG, "onBindViewHolder: ", e);
Toast.makeText(activity, "JSON Error", Toast.LENGTH_SHORT).show();
CustomMethods.errorAlert(activity, "Error", e.getMessage(), "Ok", true);
}
@@ -128,7 +130,7 @@ public void onBindViewHolder(@NonNull MyCustomViewHolder holder, int position) {
intent.putExtra("episodeId", allAnime.getJSONObject(holder.getBindingAdapterPosition()).getString("episodeId"));
activity.startActivity(intent);
} catch (Exception e) {
- e.printStackTrace();
+ Log.e(TAG, "onBindViewHolder: ", e);
Toast.makeText(activity, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
@@ -211,7 +213,7 @@ public void onBindViewHolder(@NonNull MyCustomViewHolder holder, int position) {
bottomSheetDialog.show();
}
} catch (Exception e) {
- e.printStackTrace();
+ Log.e(TAG, "onBindViewHolder: ", e);
}
return true;
});
@@ -231,7 +233,7 @@ public long getItemId(int position) {
// Return a unique and stable ID for the item.
return item.getLong("id");
} catch (JSONException e) {
- e.printStackTrace();
+ Log.e(TAG, "onBindViewHolder: ", e);
return RecyclerView.NO_ID;
}
}
diff --git a/app/src/main/java/com/fogplix/tv/fragments/RecentUploadsFragment.java b/app/src/main/java/com/fogplix/tv/fragments/RecentUploadsFragment.java
index b1dfae7..fa8dfeb 100644
--- a/app/src/main/java/com/fogplix/tv/fragments/RecentUploadsFragment.java
+++ b/app/src/main/java/com/fogplix/tv/fragments/RecentUploadsFragment.java
@@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -22,6 +23,7 @@
import org.json.JSONArray;
public class RecentUploadsFragment extends Fragment {
+ private static final String TAG = "MADARA";
private FragmentRecentUploadsBinding binding;
private Activity activity;
private GridLayoutManager layoutManager;
@@ -75,9 +77,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
binding = FragmentRecentUploadsBinding.inflate(inflater, container, false);
- binding.loadMoreAnimeBtn.setOnFocusChangeListener((view, b) -> {
- if (b){
- binding.loadMoreAnimeBtn.setBackgroundColor(activity.getColor(R.color.orange));
+ binding.loadMoreAnimeBtn.setOnFocusChangeListener((view, hasFocus) -> {
+ if (hasFocus){
+ binding.loadMoreAnimeBtn.setBackgroundColor(activity.getColor(R.color.red));
} else {
binding.loadMoreAnimeBtn.setBackgroundColor(activity.getColor(R.color.fade_blue));
}
@@ -137,7 +139,7 @@ public void onScrapeComplete(JSONArray resultAnime) {
}
} catch (Exception e){
- e.printStackTrace();
+ Log.e(TAG, "onScrapeComplete: ", e);
CustomMethods.errorAlert(activity, "Json Error", e.getMessage(), "OK", true);
}
}
diff --git a/app/src/main/java/com/fogplix/tv/helpers/Scraper.java b/app/src/main/java/com/fogplix/tv/helpers/Scraper.java
index 34f5a23..dced549 100644
--- a/app/src/main/java/com/fogplix/tv/helpers/Scraper.java
+++ b/app/src/main/java/com/fogplix/tv/helpers/Scraper.java
@@ -1,10 +1,13 @@
package com.fogplix.tv.helpers;
import android.app.Activity;
+import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
+import androidx.preference.PreferenceManager;
+
import com.fogplix.tv.R;
import com.fogplix.tv.callbacks.AnimeScraperCallback;
import com.fogplix.tv.callbacks.DetailsScraperCallback;
@@ -18,6 +21,8 @@
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.Objects;
public class Scraper {
@@ -26,20 +31,32 @@ public class Scraper {
private RecentScraperCallback recentScraperCallback = null;
private DetailsScraperCallback detailsScraperCallback = null;
private AnimeScraperCallback animeScraperCallback = null;
+ private final SharedPreferences sharedPreferences;
+ private final boolean isProxyEnabled;
+ private final String proxyBrowserLink;
public Scraper(Activity activity, RecentScraperCallback recentScraperCallback) {
this.activity = activity;
this.recentScraperCallback = recentScraperCallback;
+ sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ isProxyEnabled = sharedPreferences.getBoolean("use_proxy", false);
+ proxyBrowserLink = activity.getString(R.string.proxy_browser_link);
}
public Scraper(Activity activity, DetailsScraperCallback detailsScraperCallback) {
this.activity = activity;
this.detailsScraperCallback = detailsScraperCallback;
+ sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ isProxyEnabled = sharedPreferences.getBoolean("use_proxy", false);
+ proxyBrowserLink = activity.getString(R.string.proxy_browser_link);
}
public Scraper(Activity activity, AnimeScraperCallback animeScraperCallback) {
this.activity = activity;
this.animeScraperCallback = animeScraperCallback;
+ sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ isProxyEnabled = sharedPreferences.getBoolean("use_proxy", false);
+ proxyBrowserLink = activity.getString(R.string.proxy_browser_link);
}
public void scrapeRecent(int page, int type) {
@@ -79,10 +96,10 @@ public void scrapeRecent(int page, int type) {
animeImg = Objects.requireNonNull(allListTag.select("img").first()).attr("src").trim();
- if (document.getElementsByClass("ic-DUB").size() > 0) {
+ if (!document.getElementsByClass("ic-DUB").isEmpty()) {
subOrDub = "DUB";
}
- if (document.getElementsByClass("ic-SUB").size() > 0) {
+ if (!document.getElementsByClass("ic-SUB").isEmpty()) {
subOrDub = "SUB";
}
@@ -103,21 +120,27 @@ public void scrapeRecent(int page, int type) {
new Handler(Looper.getMainLooper()).post(() -> recentScraperCallback.onScrapeComplete(allAnime));
} catch (Exception e) {
- e.printStackTrace();
+// e.printStackTrace();
new Handler(Looper.getMainLooper()).post(() -> recentScraperCallback.onScrapeFailed(e.getMessage()));
}
}).start();
}
- public void scrapeAnime(String url){
+ public void scrapeAnime(String url) {
new Thread(() -> {
try {
JSONArray allAnime = new JSONArray();
- Document document = Jsoup.connect(url)
+ String finalUrl = url;
+
+ if (isProxyEnabled){
+ finalUrl = proxyBrowserLink + URLEncoder.encode(finalUrl, "UTF-8");
+ }
+
+ Document document = Jsoup.connect(finalUrl)
.userAgent(activity.getString(R.string.user_agent))
.get();
@@ -130,7 +153,7 @@ public void scrapeAnime(String url){
String animeRelease = liTag.select(".released").text().toLowerCase();
animeRelease = animeRelease.replace("released:", "").trim();
String animeId = Objects.requireNonNull(liTag.select("a").first()).attr("href").trim();
- animeId = animeId.replace("/category/","");
+ animeId = animeId.replace("/category/", "");
String episodeId = animeId + "-episode-1";
JSONObject object = new JSONObject();
@@ -145,8 +168,8 @@ public void scrapeAnime(String url){
new Handler(Looper.getMainLooper()).post(() -> animeScraperCallback.onScrapeComplete(allAnime));
- } catch (Exception e){
- e.printStackTrace();
+ } catch (Exception e) {
+// e.printStackTrace();
new Handler(Looper.getMainLooper()).post(() -> animeScraperCallback.onScrapeFailed(e.getMessage()));
}
}).start();
@@ -158,9 +181,9 @@ public void scrapeDetails(String animeId, String episodeID) {
String episodeId2;
- if (episodeID == null || episodeID.isEmpty()){
+ if (episodeID == null || episodeID.isEmpty()) {
episodeId2 = animeId + "-episode-1";
- } else{
+ } else {
episodeId2 = episodeID;
}
@@ -168,6 +191,14 @@ public void scrapeDetails(String animeId, String episodeID) {
Connection.Response response;
String detailsUrl = activity.getString(R.string.gogoanime_url) + "/category/" + animeId;
+ if (isProxyEnabled){
+ try {
+ detailsUrl = proxyBrowserLink + URLEncoder.encode(detailsUrl, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ detailsUrl = proxyBrowserLink + detailsUrl;
+ }
+ }
+
try {
response = Jsoup.connect(detailsUrl)
.userAgent(activity.getString(R.string.user_agent))
@@ -178,13 +209,21 @@ public void scrapeDetails(String animeId, String episodeID) {
String episodePageUrl = activity.getString(R.string.gogoanime_url) + "/" + episodeId2;
+ if (isProxyEnabled){
+ try {
+ episodePageUrl = proxyBrowserLink + URLEncoder.encode(episodePageUrl, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ episodePageUrl = proxyBrowserLink + episodePageUrl;
+ }
+ }
+
try {
Document episodePageDoc = Jsoup.connect(episodePageUrl)
.userAgent(activity.getString(R.string.user_agent))
.header("Accept-Language", "en-GB,en;q=0.5")
.get();
- Element animeIdContainerDiv = episodePageDoc.getElementsByClass("tv-info").first();
+ Element animeIdContainerDiv = episodePageDoc.getElementsByClass("anime-info").first();
assert animeIdContainerDiv != null;
Element aTag = animeIdContainerDiv.getElementsByTag("a").first();
@@ -198,7 +237,7 @@ public void scrapeDetails(String animeId, String episodeID) {
.execute();
} catch (Exception ex) {
- Log.d("Uchiha", "onCreate ex: " + ex.getMessage());
+ Log.e("MADARA", "scrapeDetails: ", ex);
response = null;
}
}
@@ -233,7 +272,7 @@ public void scrapeDetails(String animeId, String episodeID) {
JSONArray episodesArray = new JSONArray();
- for (Element liTag: liTags) {
+ for (Element liTag : liTags) {
String episodeId = Objects.requireNonNull(liTag.select("a").first()).attr("href").replace("/", "").trim();
String episodeNum = CustomMethods.extractEpisodeNumberFromId(episodeId);
@@ -258,6 +297,7 @@ public void scrapeDetails(String animeId, String episodeID) {
String status = "";
String synopsis = innerHtml.select("div.description").text();
+
JSONArray genresArray = new JSONArray();
Elements allPTags = innerHtml.select(".type");
@@ -271,6 +311,7 @@ public void scrapeDetails(String animeId, String episodeID) {
if (spanTagValue.toLowerCase().contains("type")) {
type = pTagDoc.text().replace(spanTagValue, "").trim();
}
+
if (spanTagValue.toLowerCase().contains("genre")) {
Elements genres = pTagDoc.getElementsByTag("a");
@@ -297,10 +338,10 @@ public void scrapeDetails(String animeId, String episodeID) {
animeInfoJObj.put("totalEpisodes", lastEpisode);
animeInfoJObj.put("episodesList", episodesArray);
- new Handler(Looper.getMainLooper()).post(()->detailsScraperCallback.onScrapingComplete(animeInfoJObj));
+ new Handler(Looper.getMainLooper()).post(() -> detailsScraperCallback.onScrapingComplete(animeInfoJObj));
}
- } catch (Exception e){
- new Handler(Looper.getMainLooper()).post(()->detailsScraperCallback.onScrapingFailed(e.getMessage()));
+ } catch (Exception e) {
+ new Handler(Looper.getMainLooper()).post(() -> detailsScraperCallback.onScrapingFailed(e.getMessage()));
}
}).start();
}
diff --git a/app/src/main/java/com/fogplix/tv/helpers/ViewDialog.java b/app/src/main/java/com/fogplix/tv/helpers/ViewDialog.java
index 6022461..013357d 100644
--- a/app/src/main/java/com/fogplix/tv/helpers/ViewDialog.java
+++ b/app/src/main/java/com/fogplix/tv/helpers/ViewDialog.java
@@ -146,163 +146,6 @@ public void onFailed(String error) {
Toast.makeText(activity, "This server is not working currently. Try another server.", Toast.LENGTH_SHORT).show();
}
});
-
-// ------------------------------------------------------------------------------------------
-
- server_2_btn.setOnClickListener(view -> {
-
- HPSharedPreference hpSharedPreference = new HPSharedPreference(activity);
-
- boolean server_status = hpSharedPreference.getPlayableServersStatus("server_2");
-
- if (server_status) {
-
- String consumet_api = activity.getString(R.string.consumet_streaming_link_api) + episodeId;
-
- ProgressDialog pd = new ProgressDialog(activity);
- pd.setMessage("Generating playable link...");
- pd.setCancelable(false);
- pd.show();
-
-
- StringRequest objectRequest1 = new StringRequest(Request.Method.GET, consumet_api, response -> {
-
- try {
-
- JSONObject object = new JSONObject(response);
-
- if (object.has("message")) {
- pd.dismiss();
- CustomMethods.errorAlert(activity, "Error", object.getString("error"), "Ok", true);
- } else {
-
- String refererUrl = object.getJSONObject("headers").getString("Referer");
- String videoHLSUrl = "";
- String videoHLSUrl2 = "";
-
- JSONArray sources = object.getJSONArray("sources");
-
- for (int i = 0; i < sources.length(); i++) {
-
- JSONObject source_obj = sources.getJSONObject(i);
-
- if (source_obj.getString("quality").equalsIgnoreCase("default")) {
- videoHLSUrl = source_obj.getString("url");
- }
-
- if (source_obj.getString("quality").equalsIgnoreCase("backup")) {
- videoHLSUrl2 = source_obj.getString("url");
- }
- }
-
- pd.dismiss();
-
- Intent intent = new Intent(activity, PlayerActivity.class);
- intent.putExtra("episodeId", episodeId);
- intent.putExtra("animeId", animeId);
- intent.putExtra("animeTitle", animeTitle);
- intent.putExtra("refererUrl", refererUrl);
- intent.putExtra("videoHLSUrl", videoHLSUrl);
- intent.putExtra("videoHLSUrl2", videoHLSUrl2);
- activity.startActivity(intent);
-
- dialog.dismiss();
- }
- } catch (Exception e) {
- e.printStackTrace();
- Toast.makeText(activity, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
- CustomMethods.errorAlert(activity, "Error (Try another server)", e.getMessage() + "\n", "Ok", false);
- }
- }, error -> {
- pd.dismiss();
- CustomMethods.errorAlert(activity, "Error (Try another server.)", error.getMessage(), "Ok", false);
- });
-
- Cache cache = new DiskBasedCache(activity.getCacheDir(), 1024 * 1024); // 1MB cap
- Network network = new BasicNetwork(new HurlStack());
-
-
- RequestQueue queue = new RequestQueue(cache, network);
- objectRequest1.setRetryPolicy((new DefaultRetryPolicy(0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)));
- queue.add(objectRequest1);
- queue.start();
-
- dialog.dismiss();
- } else {
- Toast.makeText(activity, "This server is not working currently. Try another server.", Toast.LENGTH_SHORT).show();
- }
- });
-
-// ------------------------------------------------------------------------------------------
-
- server_3_btn.setOnClickListener(v -> {
-
- HPSharedPreference hpSharedPreference = new HPSharedPreference(activity);
-
- boolean server_status = hpSharedPreference.getPlayableServersStatus("server_3");
-
- if (server_status) {
-
- String vidcdn_api = activity.getString(R.string.VIDCDN_API_URL) + episodeId;
-
- ProgressDialog pd = new ProgressDialog(activity);
- pd.setMessage("Generating playable link...");
- pd.setCancelable(false);
- pd.show();
-
- StringRequest objectRequest1 = new StringRequest(Request.Method.GET, vidcdn_api, response -> {
-
- try {
-
- JSONObject object = new JSONObject(response);
-
- if (object.has("error")) {
- pd.dismiss();
- CustomMethods.errorAlert(activity, "Error", object.getString("error"), "Ok", true);
- } else {
-
- String refererUrl = object.getString("Referer");
- String videoHLSUrl = object.getJSONArray("sources").getJSONObject(0).getString("file");
- String videoHLSUrl2 = object.getJSONArray("sources_bk").getJSONObject(0).getString("file");
-
- pd.dismiss();
-
- Intent intent = new Intent(activity, PlayerActivity.class);
- intent.putExtra("episodeId", episodeId);
- intent.putExtra("animeId", animeId);
- intent.putExtra("animeTitle", animeTitle);
- intent.putExtra("refererUrl", refererUrl);
- intent.putExtra("videoHLSUrl", videoHLSUrl);
- intent.putExtra("videoHLSUrl2", videoHLSUrl2);
- activity.startActivity(intent);
-
- dialog.dismiss();
- }
- } catch (Exception e) {
- e.printStackTrace();
- Toast.makeText(activity, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
- CustomMethods.errorAlert(activity, "Error (Try another server)", e.getMessage() + "\n", "Ok", true);
- }
- }, error -> {
- pd.dismiss();
- CustomMethods.errorAlert(activity, "Error (Try another server.)", error.getMessage(), "Ok", true);
- });
-
- Cache cache = new DiskBasedCache(activity.getCacheDir(), 1024 * 1024); // 1MB cap
- Network network = new BasicNetwork(new HurlStack());
-
-
- RequestQueue queue = new RequestQueue(cache, network);
- objectRequest1.setRetryPolicy((new DefaultRetryPolicy(0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)));
- queue.add(objectRequest1);
- queue.start();
-
- dialog.dismiss();
- } else {
- Toast.makeText(activity, "This server is not working currently. Try another server.", Toast.LENGTH_SHORT).show();
- }
- });
-
// ------------------------------------------------------------------------------------------
dialog.show();
diff --git a/app/src/main/res/drawable/action_bar_logo.png b/app/src/main/res/drawable/action_bar_logo.png
index 6052cbe..534a6e3 100644
Binary files a/app/src/main/res/drawable/action_bar_logo.png and b/app/src/main/res/drawable/action_bar_logo.png differ
diff --git a/app/src/main/res/drawable/button_default.xml b/app/src/main/res/drawable/button_default.xml
new file mode 100644
index 0000000..db896f7
--- /dev/null
+++ b/app/src/main/res/drawable/button_default.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_focused.xml b/app/src/main/res/drawable/button_focused.xml
new file mode 100644
index 0000000..4bdff9b
--- /dev/null
+++ b/app/src/main/res/drawable/button_focused.xml
@@ -0,0 +1,21 @@
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
diff --git a/app/src/main/res/drawable/round_transparent_ripple_button.xml b/app/src/main/res/drawable/round_transparent_ripple_button.xml
new file mode 100644
index 0000000..199ce26
--- /dev/null
+++ b/app/src/main/res/drawable/round_transparent_ripple_button.xml
@@ -0,0 +1,13 @@
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index c9c231b..06f7c7b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,121 +1,97 @@
-
+
+
+
+
-
-
+ android:layout_below="@+id/important_notice_tv">
-
-
-
-
-
+
+
-
-
+ android:icon="@drawable/subtitles_24"
+ android:text="@string/subbed" />
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/own_toolbar.xml b/app/src/main/res/layout/own_toolbar.xml
index 2e048de..93f7a3a 100644
--- a/app/src/main/res/layout/own_toolbar.xml
+++ b/app/src/main/res/layout/own_toolbar.xml
@@ -10,7 +10,11 @@
+ android:backgroundTint="@color/red">
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/top_right_popup_menu.xml b/app/src/main/res/menu/top_right_popup_menu.xml
index a4f1c5c..a091ea3 100644
--- a/app/src/main/res/menu/top_right_popup_menu.xml
+++ b/app/src/main/res/menu/top_right_popup_menu.xml
@@ -1,6 +1,10 @@