All in one video downloader java development project
I build this application in java for my college submision project.
There is only java programe code i will give you android application source code in the post end.
In this peoject i have many folder but i give you only java code below here.
Project Structure
- All in One Video Downloader
- .idea
- app
- libs
- src
- appupdater
- build
- gradle
- androidTest
- main
- assets
- java
- com
- flowincode
- allinonevideodownloader
- adapters
- extraFeatures
- facebookstorysaver
- fragments
- inappbilling
- Interface
- models
- reciver
- restapiclientsstuff
- service
- statussaver
- tasks
- tiktok_methods
- utils
We used Kotlin (.kt) Language for Main Activity
MainActivity.kt
@file:Suppress("DEPRECATION")
package com.infusiblecoder.allinonevideodownloader
import android.app.AlertDialog
import android.app.Dialog
import android.app.ProgressDialog
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.graphics.Typeface
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.*
import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager
import com.android.billingclient.api.*
import com.android.billingclient.api.BillingClient.BillingResponseCode
import com.github.javiersantos.appupdater.AppUpdaterUtils
import com.github.javiersantos.appupdater.enums.AppUpdaterError
import com.google.android.gms.ads.MobileAds
import com.google.android.material.tabs.TabLayout
import com.infusiblecoder.allinonevideodownloader.extraFeatures.ExtraFeaturesFragment
import com.infusiblecoder.allinonevideodownloader.fragments.download
import com.infusiblecoder.allinonevideodownloader.statussaver.StatusSaverMainFragment
import com.infusiblecoder.allinonevideodownloader.tasks.downloadVideo
import com.infusiblecoder.allinonevideodownloader.utils.AdsManager
import com.infusiblecoder.allinonevideodownloader.utils.Constants
import com.infusiblecoder.allinonevideodownloader.utils.LocaleHelper
import com.infusiblecoder.allinonevideodownloader.utils.SharedPrefsForInstagram.context
import com.infusiblecoder.allinonevideodownloader.utils.iUtils
import com.infusiblecoder.allinonevideodownloader.utils.iUtils.writeUpdateLogFile
import com.ironsource.mediationsdk.IronSource
import ir.heydarii.appupdater.AppUpdaterDialog
import ir.heydarii.appupdater.pojo.Store
import ir.heydarii.appupdater.pojo.UpdaterStoreList
import java.util.*
@Suppress("DEPRECATION")
class MainActivity : AppCompatActivity() {
var myString: String? = ""
val REQUEST_PERMISSION_CODE = 1001
val REQUEST_PERMISSION = android.Manifest.permission.WRITE_EXTERNAL_STORAGE
private var tabLayout: TabLayout? = null
var viewPager: ViewPager? = null
var fbAdView: com.facebook.ads.AdView? = null
lateinit var progressDralogGenaratinglink: ProgressDialog
private var billingClient: BillingClient? = null
private var skuDetails: SkuDetails? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requestWindowFeature(Window.FEATURE_NO_TITLE)
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
setContentView(R.layout.activity_main)
MobileAds.initialize(this)
// setupBillingClient()
IronSource.init(
this,
resources.getString(R.string.ironsource_app_id),
IronSource.AD_UNIT.INTERSTITIAL
)
setUpBillingClient1()
//0,2
progressDralogGenaratinglink = ProgressDialog(this)
progressDralogGenaratinglink.setMessage(resources.getString(R.string.genarating_download_link))
progressDralogGenaratinglink.setCancelable(false)
val adContainer = findViewById(R.id.banner_container)
val random = Random()
var num = random.nextInt(2)
Log.e("myhdasbdhf ", num.toString())
// Get intent, action and MIME type
val action = intent.action
var type = intent.type
if (Intent.ACTION_SEND == action && type != null) {
if ("text/plain" == type) {
handleSendText(intent) // Handle text being sent
}
}
// val isAvailable = BillingProcessor.isIabServiceAvailable(this)
// if (!isAvailable) {
// Toast.makeText(this, "Billing Service Not Avaliable", Toast.LENGTH_SHORT).show()
// }
if (Constants.show_Ads) {
val prefs: SharedPreferences = getSharedPreferences(
"whatsapp_pref",
Context.MODE_PRIVATE
)
val pp =
prefs.getString("inappads", "nnn") //"No name defined" is the default value.
if (pp.equals("nnn")) {
AdsManager.loadBannerAd(this, adContainer)
} else {
adContainer.visibility = View.GONE
}
}
if (!isNeedGrantPermission()) {
setlayout()
}
}
fun getMyData(): String? {
return myString
}
fun setmydata(mysa: String) {
this.myString = mysa
}
override fun onStart() {
super.onStart()
try {
if (iUtils.isNetworkConnected(this@MainActivity)) {
val appUpdaterUtils: AppUpdaterUtils = AppUpdaterUtils(this)
.withListener(object : AppUpdaterUtils.UpdateListener {
override fun onSuccess(
update: com.github.javiersantos.appupdater.objects.Update?,
isUpdateAvailable: Boolean?
) {
println("appupdater error bb " + isUpdateAvailable)
println("appupdater error uuu " + update!!.latestVersion)
if (isUpdateAvailable!!) {
if (Build.VERSION.SDK_INT >= 30 && !iUtils.checkUpdateLogFileIfExists()) {
launchUpdateDialogAndroid11()
} else {
launchUpdateDialog(update.latestVersion)
}
} else {
if (Build.VERSION.SDK_INT >= 30 && !iUtils.checkUpdateLogFileIfExists()) {
launchUpdateDialogAndroid11()
}
}
}
override fun onFailed(error: AppUpdaterError?) {
}
})
appUpdaterUtils.start()
}
} catch (e: Exception) {
}
}
private fun launchUpdateDialog(onlineVersion: String) {
try {
AlertDialog.Builder(context)
.setTitle(getString(R.string.updqteavaliable))
.setCancelable(false)
.setMessage(
getString(R.string.update) + " " + onlineVersion + " " + getString(R.string.updateisavaliabledownload) + getString(
R.string.app_name
)
)
.setPositiveButton(
resources.getString(R.string.update_now)
)
{ dialog, _ ->
dialog.dismiss()
// startActivity(
// Intent(
// Intent.ACTION_VIEW,
// Uri.parse("https://play.google.com/store/apps/details?id=$packageName")
// )
// )
try {
val list = ArrayList()
val typeface = Typeface.createFromAsset(assets, "sintony-regular.otf")
//Todo comment the below line if you want to update apk from outside the playstore
list.add(
UpdaterStoreList(
Store.DIRECT_URL,
getString(R.string.clicktodownload),
R.drawable.ic_appicon,
Constants.App_Extrnal_Download_Url,
BuildConfig.APPLICATION_ID
)
)
//Todo uncomment the below line if you want to update apk from the playstore
// list.add(UpdaterStoreList(Store.GOOGLE_PLAY, "Download From Google Play", packageName = BuildConfig.APPLICATION_ID))
AppUpdaterDialog
.getInstance(
getString(R.string.updqteavaliable),
getString(R.string.update) + " " + onlineVersion + " " + getString(R.string.updateisavaliabledownload),
list,
true,
typeface
)
.show(supportFragmentManager, "TAG")
} catch (e: Exception) {
}
}.setNegativeButton(
resources.getString(R.string.cancel)
)
{ dialog, _ ->
dialog.dismiss()
}
.setIcon(R.drawable.ic_appicon)
.show()
} catch (e: java.lang.Exception) {
println("appupdater error rrrr " + e)
e.printStackTrace()
}
}
private fun launchUpdateDialogAndroid11() {
try {
AlertDialog.Builder(context)
.setTitle(getString(R.string.updqteavaliable))
.setCancelable(false)
.setMessage(
getString(R.string.android11usermessage)
)
.setPositiveButton(
resources.getString(R.string.update_now)
)
{ dialog, _ ->
dialog.dismiss()
try {
val list = ArrayList()
val typeface = Typeface.createFromAsset(assets, "sintony-regular.otf")
list.add(
UpdaterStoreList(
Store.DIRECT_URL,
getString(R.string.clicktodownload),
R.drawable.ic_appicon,
Constants.App_Extrnal_Download_Url,
BuildConfig.APPLICATION_ID
)
)
AppUpdaterDialog
.getInstance(
getString(R.string.updqteavaliable),
"",
list,
true,
typeface
)
.show(supportFragmentManager, "TAG")
writeUpdateLogFile();
} catch (e: Exception) {
}
}.setNegativeButton(
resources.getString(R.string.cancel)
)
{ dialog, _ ->
dialog.dismiss()
}
.setIcon(R.drawable.ic_appicon)
.show()
} catch (e: java.lang.Exception) {
println("appupdater error rrrr " + e)
e.printStackTrace()
}
}
fun handleSendText(intent: Intent) {
try {
this.intent = null
var url = intent.getStringExtra(Intent.EXTRA_TEXT)
if (url.equals("") && iUtils.checkURL(url)) {
iUtils.ShowToast(
this@MainActivity,
this@MainActivity.resources?.getString(R.string.enter_valid)
)
return
}
if (url?.contains("myjosh.in")!!) {
Log.e("downloadFileName", url.substring(url.indexOf("http")) + "")
url = url.substring(url.indexOf("http"))
url = url.substring(
url.indexOf("http://share.myjosh.in/"),
url.indexOf("Download Josh for more videos like this!")
)
downloadVideo.Start(this, url.trim(), false)
Log.e("downloadFileName12", url.trim())
} else if (url.contains("chingari")) {
url = url.substring(
url.indexOf("https://chingari.io/"),
url.indexOf("For more such entertaining")
)
downloadVideo.Start(this, url.trim(), false)
Log.e("downloadFileName12", url.trim())
} else if (url.contains("bemate")) {
url = url.substring(
url.indexOf("https"),
url.length
)
downloadVideo.Start(this, url.trim(), false)
Log.e("downloadFileName12", url.trim())
} else if (url.contains("instagram.com")) {
val bundle = Bundle()
bundle.putString("myinstaurl", url)
val fragobj = download()
fragobj.arguments = bundle
this.setmydata(url)
Log.e("downloadFileName12", url)
} else if (url.contains("sck.io") || url.contains("snackvideo")) {
var myurl = url
try {
if (myurl.length > 30) {
myurl = myurl.substring(
myurl.indexOf("http"),
myurl.indexOf("Click this")
)
}
} catch (e: Exception) {
}
downloadVideo.Start(this, myurl?.trim(), false)
Log.e("downloadFileName12", myurl!!.toString())
} else {
url = url.substring(
url.indexOf("https"),
url.length
)
// downloadVideo.Start(this, url.trim() ?: url, false)
val myurl = url
url = ""
val bundle = Bundle()
bundle.putString("myinstaurl", myurl)
val fragobj = download()
fragobj.arguments = bundle
this.setmydata(myurl)
// Log.e("downloadFileName12", url)
//
//
// Log.e("downloadFileName", (url.substring(url.indexOf("http")).trim() ?: url) + "")
}
} catch (e: Exception) {
}
}
fun setlayout() {
viewPager = findViewById(R.id.viewpager)
setupViewPager(viewPager!!)
tabLayout = findViewById(R.id.tabs)
tabLayout!!.setupWithViewPager(viewPager)
setupTabIcons()
}
fun setupTabIcons() {
tabLayout?.getTabAt(0)?.setIcon(R.drawable.ic_download_color_24dp)
// tabLayout?.getTabAt(1)?.setIcon(R.drawable.ic_gallery_color_24dp)
tabLayout?.getTabAt(1)?.setIcon(R.drawable.statuspic)
tabLayout?.getTabAt(2)?.setIcon(R.drawable.ic_puzzle)
}
private fun setupViewPager(viewPager: ViewPager) {
val adapter = ViewPagerAdapter(supportFragmentManager)
adapter.addFragment(download(), getString(R.string.download_fragment))
// adapter.addFragment(DummyFragment(), getString(R.string.gallery_fragment))
adapter.addFragment(StatusSaverMainFragment(), getString(R.string.StatusSaver))
adapter.addFragment(ExtraFeaturesFragment(), getString(R.string.extrafeatures))
viewPager.adapter = adapter
}
private fun isNeedGrantPermission(): Boolean {
try {
if (iUtils.hasMarsallow()) {
if (ContextCompat.checkSelfPermission(
this,
REQUEST_PERMISSION
) != PackageManager.PERMISSION_GRANTED
) {
if (ActivityCompat.shouldShowRequestPermissionRationale(
this@MainActivity,
REQUEST_PERMISSION
)
) {
val msg =
String.format(
getString(R.string.format_request_permision),
getString(R.string.app_name)
)
val localBuilder = AlertDialog.Builder(this@MainActivity)
localBuilder.setTitle(getString(R.string.permission_title))
localBuilder
.setMessage(msg).setNeutralButton(
getString(R.string.grant_option)
) { _, _ ->
ActivityCompat.requestPermissions(
this@MainActivity,
arrayOf(REQUEST_PERMISSION),
REQUEST_PERMISSION_CODE
)
}
.setNegativeButton(
getString(R.string.cancel_option)
) { paramAnonymousDialogInterface, _ ->
paramAnonymousDialogInterface.dismiss()
finish()
}
localBuilder.show()
} else {
ActivityCompat.requestPermissions(
this,
arrayOf(REQUEST_PERMISSION),
REQUEST_PERMISSION_CODE
)
}
return true
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return false
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
try {
if (requestCode == REQUEST_PERMISSION_CODE) {
if (grantResults != null && grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//
setlayout()
} else {
iUtils.ShowToast(this@MainActivity, getString(R.string.info_permission_denied))
finish()
}
}
} catch (e: Exception) {
e.printStackTrace()
iUtils.ShowToast(this@MainActivity, getString(R.string.info_permission_denied))
finish()
}
}
internal inner class ViewPagerAdapter(manager: FragmentManager) :
FragmentPagerAdapter(manager) {
private val mFragmentList = ArrayList()
private val mFragmentTitleList = ArrayList()
override fun getItem(position: Int): Fragment {
return mFragmentList[position]
}
override fun getCount(): Int {
return mFragmentList.size
}
fun addFragment(fragment: Fragment, title: String) {
mFragmentList.add(fragment)
mFragmentTitleList.add(title)
}
override fun getPageTitle(position: Int): CharSequence {
return mFragmentTitleList[position]
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.main, menu)
val prefs: SharedPreferences = getSharedPreferences(
"whatsapp_pref",
Context.MODE_PRIVATE
)
val name = prefs.getString("whatsapp", "main") //"No name defined" is the default value.
val pp = prefs.getString("inappads", "nnn") //"No name defined" is the default value.
//
// if (name == "main") {
// menu.findItem(R.id.action_shwbusinesswhatsapp).isVisible = true
//
// menu.findItem(R.id.action_shwmainwhatsapp).isVisible = false
//
// } else if (name == "bus") {
// menu.findItem(R.id.action_shwbusinesswhatsapp).isVisible = false
//
// menu.findItem(R.id.action_shwmainwhatsapp).isVisible = true
//
// }
if (pp.equals("nnn")) {
menu.findItem(R.id.action_removeads).isVisible = true
} else if (pp.equals("ppp")) {
menu.findItem(R.id.action_removeads).isVisible = false
}
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_privacy -> {
// AlertDialog.Builder(this)
// .setTitle(getString(R.string.privacy))
// .setMessage(R.string.privacy_message)
// .setPositiveButton(
// android.R.string.yes
// ) { dialog, _ -> dialog.dismiss() }
// .setIcon(R.drawable.ic_info_black_24dp)
// .show()
val browserIntent =
Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.privacy_policy_url)))
startActivity(browserIntent)
true
}
R.id.action_downloadtiktok -> {
val intent = Intent(this, TikTokDownloadWebview::class.java)
startActivity(intent)
true
}
R.id.action_rate -> {
AlertDialog.Builder(this)
.setTitle(getString(R.string.RateAppTitle))
.setMessage(getString(R.string.RateApp))
.setCancelable(false)
.setPositiveButton(
getString(R.string.rate_dialog)
) { _, _ ->
val appPackageName = packageName
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("market://details?id=$appPackageName")
)
)
} catch (anfe: android.content.ActivityNotFoundException) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=$appPackageName")
)
)
}
}
.setNegativeButton(getString(R.string.later_btn), null).show()
true
}
R.id.ic_whatapp -> {
val launchIntent = packageManager.getLaunchIntentForPackage("com.whatsapp")
if (launchIntent != null) {
startActivity(launchIntent)
// finish()
} else {
iUtils.ShowToast(
this,
this.resources.getString(R.string.appnotinstalled)
)
}
true
}
R.id.action_language -> {
val dialog = Dialog(this)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setCancelable(true)
dialog.setContentView(R.layout.dialog_change_language)
val l_english = dialog.findViewById(R.id.l_english) as TextView
l_english.setOnClickListener {
LocaleHelper.setLocale(application, "en")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "en")
editor.apply()
recreate()
dialog.dismiss()
}
val l_arabic = dialog.findViewById(R.id.l_arabic) as TextView
l_arabic.setOnClickListener {
LocaleHelper.setLocale(application, "ar")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_LTR
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "ar")
editor.apply()
recreate()
dialog.dismiss()
}
val l_urdu = dialog.findViewById(R.id.l_urdu) as TextView
l_urdu.setOnClickListener {
LocaleHelper.setLocale(application, "ur")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_LTR
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "ur")
editor.apply()
recreate()
dialog.dismiss()
}
val l_german = dialog.findViewById(R.id.l_german) as TextView
l_german.setOnClickListener {
LocaleHelper.setLocale(application, "de")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "de")
editor.apply()
recreate()
dialog.dismiss()
}
val l_turkey = dialog.findViewById(R.id.l_turkey) as TextView
l_turkey.setOnClickListener {
LocaleHelper.setLocale(application, "tr")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "tr")
editor.apply()
recreate()
dialog.dismiss()
}
val l_portougese = dialog.findViewById(R.id.l_portougese) as TextView
l_portougese.setOnClickListener {
LocaleHelper.setLocale(application, "pt")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "pt")
editor.apply()
recreate()
dialog.dismiss()
}
val l_chinese = dialog.findViewById(R.id.l_chinese) as TextView
l_chinese.setOnClickListener {
LocaleHelper.setLocale(application, "zh")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "zh")
editor.apply()
recreate()
dialog.dismiss()
}
val l_hindi = dialog.findViewById(R.id.l_hindi) as TextView
l_hindi.setOnClickListener {
LocaleHelper.setLocale(application, "hi")
window.decorView.layoutDirection = View.LAYOUT_DIRECTION_RTL
val editor: SharedPreferences.Editor = getSharedPreferences(
"lang_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("lang", "hi")
editor.apply()
recreate()
dialog.dismiss()
}
dialog.show()
true
}
// R.id.action_shwbusinesswhatsapp -> {
//
//
// val editor: SharedPreferences.Editor = getSharedPreferences(
// "whatsapp_pref",
// Context.MODE_PRIVATE
// ).edit()
// editor.putString("whatsapp", "bus")
//
// editor.apply()
//
// if (Build.VERSION.SDK_INT >= 11) {
// recreate()
// } else {
// val intent = intent
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
// finish()
// overridePendingTransition(0, 0)
// startActivity(intent)
// overridePendingTransition(0, 0)
// }
//
//
//
// true
// }
//
//
// R.id.action_shwmainwhatsapp -> {
//
//
// val editor: SharedPreferences.Editor = getSharedPreferences(
// "whatsapp_pref",
// Context.MODE_PRIVATE
// ).edit()
// editor.putString("whatsapp", "main")
//
// editor.apply()
//
//
// if (Build.VERSION.SDK_INT >= 11) {
// recreate()
// } else {
// val intent = intent
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION)
// finish()
// overridePendingTransition(0, 0)
// startActivity(intent)
// overridePendingTransition(0, 0)
// }
//
//
//
// true
// }
R.id.action_removeads -> {
//TODO ads
// bp!!.purchase(MainActivity@ this, getString(R.string.productidcode));
// querySkuDetails()
skuDetails?.let {
val billingFlowParams = BillingFlowParams.newBuilder()
.setSkuDetails(it)
.build()
billingClient?.launchBillingFlow(this, billingFlowParams)?.responseCode
} ?: noSKUMessage()
true
}
else -> super.onOptionsItemSelected(item)
}
}
override fun onBackPressed() {
val dialog = Dialog(this)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setCancelable(false)
dialog.setContentView(R.layout.custom_dialog_ad_exit)
val yesBtn = dialog.findViewById(R.id.btn_exitdialog_yes) as Button
val noBtn = dialog.findViewById(R.id.btn_exitdialog_no) as Button
//TODO ENABLE EXIT DIALOG AD BY UNCOMMENTING IT
// val adviewnew = dialog.findViewById(R.id.adView_dia) as AdView
// val adRequest = AdRequest.Builder().build()
// adviewnew.loadAd(adRequest)
yesBtn.setOnClickListener {
System.exit(0)
}
noBtn.setOnClickListener { dialog.dismiss() }
dialog.show()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
println("proddddd11111222 $resultCode __" + data)
if (requestCode == 200 && resultCode == RESULT_OK) {
println("proddddd11111 $resultCode __" + data)
}
//
//
//
// if (!bp!!.handleActivityResult(requestCode, resultCode, data)) {
// super.onActivityResult(requestCode, resultCode, data)
// }
try {
} catch (ex: Exception) {
ex.printStackTrace()
}
}
private fun noSKUMessage() {
Toast.makeText(
this@MainActivity, "No SKU Found", Toast.LENGTH_SHORT
).show()
}
private fun setUpBillingClient1() {
billingClient = BillingClient.newBuilder(this)
.setListener(purchaseUpdateListener)
.enablePendingPurchases()
.build()
startConnection()
}
private fun startConnection() {
billingClient?.startConnection(object : BillingClientStateListener {
override fun onBillingSetupFinished(billingResult: BillingResult) {
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
// The BillingClient is ready. You can query purchases here.
Log.v("TAG_INAPP", "Setup Billing Done")
queryAvaliableProducts()
}
}
override fun onBillingServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
})
}
private fun queryAvaliableProducts() {
val skuList = ArrayList()
skuList.add(getString(R.string.productidcode))
val params = SkuDetailsParams.newBuilder()
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP)
billingClient?.querySkuDetailsAsync(params.build()) { billingResult, skuDetailsList ->
// Process the result.
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && !skuDetailsList.isNullOrEmpty()) {
for (skuDetails in skuDetailsList) {
Log.v("TAG_INAPP", "skuDetailsList : ${skuDetailsList}")
//This list should contain the products added above
updateUI(skuDetails)
}
}
}
}
private fun updateUI(skuDetails: SkuDetails?) {
skuDetails?.let {
this.skuDetails = it
// txt_product_name?.text = skuDetails.title
// txt_product_description?.text = skuDetails.description
showUIElements()
}
}
private fun showUIElements() {
// txt_product_name?.visibility = View.VISIBLE
// txt_product_description?.visibility = View.VISIBLE
// txt_product_buy?.visibility = View.VISIBLE
}
private val purchaseUpdateListener =
PurchasesUpdatedListener { billingResult, purchases ->
Log.v("TAG_INAPP", "billingResult responseCode : ${billingResult.responseCode}")
if (billingResult.responseCode == BillingResponseCode.OK && purchases != null) {
for (purchase in purchases) {
// handlePurchase(purchase)
//handleConsumedPurchases(purchase)
handleNonConcumablePurchase(purchase)
}
} else if (billingResult.responseCode == BillingResponseCode.USER_CANCELED) {
// Handle an error caused by a user cancelling the purchase flow.
} else if (billingResult.responseCode == BillingResponseCode.ITEM_UNAVAILABLE) {
Toast.makeText(
this@MainActivity, "ITEM_UNAVAILABLE", Toast.LENGTH_SHORT
).show()
} else if (billingResult.responseCode == BillingResponseCode.ITEM_ALREADY_OWNED) {
AlertDialog.Builder(context)
.setTitle(getString(R.string.itemowned))
.setMessage(getString(R.string.adsareremoved))
.setIcon(R.drawable.ic_appicon)
.show()
Toast.makeText(
this@MainActivity, getString(R.string.itemowned), Toast.LENGTH_SHORT
).show()
val editor: SharedPreferences.Editor = getSharedPreferences(
"whatsapp_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("inappads", "ppp")
editor.apply()
} else {
Toast.makeText(
this@MainActivity, "Error has occured", Toast.LENGTH_SHORT
).show()
}
}
private fun handleConsumedPurchases(purchase: Purchase) {
Log.d("TAG_INAPP", "handleConsumablePurchasesAsync foreach it is $purchase")
if (purchase.skus.equals(getString(R.string.productidcode))) {
val params =
ConsumeParams.newBuilder().setPurchaseToken(purchase.purchaseToken).build()
billingClient?.consumeAsync(params) { billingResult, _ ->
when (billingResult.responseCode) {
BillingClient.BillingResponseCode.OK -> {
AlertDialog.Builder(context)
.setTitle(getString(R.string.purchasedone))
.setMessage(getString(R.string.adsareremoved))
.setIcon(R.drawable.ic_appicon)
.show()
Toast.makeText(
this@MainActivity, getString(R.string.purchasedone), Toast.LENGTH_SHORT
).show()
val editor: SharedPreferences.Editor = getSharedPreferences(
"whatsapp_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("inappads", "ppp")
editor.apply()
// Update the appropriate tables/databases to grant user the items
Log.d(
"TAG_INAPP",
" Update the appropriate tables/databases to grant user the items"
)
}
else -> {
Log.w("TAG_INAPP", billingResult.debugMessage)
}
}
}
}
}
private fun handleNonConcumablePurchase(purchase: Purchase) {
Log.v("TAG_INAPP", "handlePurchase : ${purchase}")
if (purchase.skus.equals(getString(R.string.productidcode))) {
if (purchase.purchaseState == Purchase.PurchaseState.PURCHASED) {
if (!purchase.isAcknowledged) {
val acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.purchaseToken).build()
billingClient?.acknowledgePurchase(acknowledgePurchaseParams) { billingResult ->
val billingResponseCode = billingResult.responseCode
val billingDebugMessage = billingResult.debugMessage
Log.v("TAG_INAPP", "response code: $billingResponseCode")
Log.v("TAG_INAPP", "debugMessage : $billingDebugMessage")
AlertDialog.Builder(context)
.setTitle(getString(R.string.purchasedone))
.setMessage(getString(R.string.adsareremoved))
.setIcon(R.drawable.ic_appicon)
.show()
Toast.makeText(
this@MainActivity, getString(R.string.purchasedone), Toast.LENGTH_SHORT
).show()
val editor: SharedPreferences.Editor = getSharedPreferences(
"whatsapp_pref",
Context.MODE_PRIVATE
).edit()
editor.putString("inappads", "ppp")
editor.apply()
}
}
}
}
}
override fun attachBaseContext(base: Context) {
super.attachBaseContext(LocaleHelper.onAttach(base))
}
}
AllSupportedApps.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityAllSupportedBinding;
import com.infusiblecoder.allinonevideodownloader.models.RecDisplayAllWebsites_Model;
import com.infusiblecoder.allinonevideodownloader.utils.Constants;
import com.infusiblecoder.allinonevideodownloader.utils.LocaleHelper;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class AllSupportedApps extends AppCompatActivity {
ArrayList recDisplayAllWebsitesModelArrayList;
ArrayList recDisplayAllWebsitesModelArrayList_otherwebsites;
private ActivityAllSupportedBinding binding;
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityAllSupportedBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
getSupportActionBar().setTitle(getResources().getString(R.string.listandstatus));
recDisplayAllWebsitesModelArrayList = new ArrayList<>();
recDisplayAllWebsitesModelArrayList_otherwebsites = new ArrayList<>();
try {
JSONArray jsonArray = new JSONArray(loadWebsiteJSONFromAsset());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObjectdata = jsonArray.getJSONObject(i);
System.out.println("dsakdjasdjasd " + jsonObjectdata.getString("website_name"));
if (i < 8) {
if (!Constants.showyoutube && jsonObjectdata.getString("website_name").contains("Youtube")) {
continue;
}
// if (!Constants.showyoutube) {
// continue;
//// break;
//
// }
recDisplayAllWebsitesModelArrayList
.add(new RecDisplayAllWebsites_Model(jsonObjectdata.getString("website_pic_url"), jsonObjectdata.getString("website_name"), jsonObjectdata.getString("website_status"), jsonObjectdata.getString("show_status")));
} else {
recDisplayAllWebsitesModelArrayList_otherwebsites
.add(new RecDisplayAllWebsites_Model(jsonObjectdata.getString("website_pic_url"), jsonObjectdata.getString("website_name"), jsonObjectdata.getString("website_status"), jsonObjectdata.getString("show_status")));
}
//}
}
} catch (Exception e) {
System.out.println("dsakdjasdjasd " + e.getMessage());
}
RecDisplayAllWebsitesAdapter recDisplayAllWebsitesAdapter = new RecDisplayAllWebsitesAdapter(this, recDisplayAllWebsitesModelArrayList);
binding.recviewSocialnetwork.setAdapter(recDisplayAllWebsitesAdapter);
binding.recviewSocialnetwork.setLayoutManager(new GridLayoutManager(this, 4));
RecDisplayAllWebsitesAdapter recDisplayAllWebsitesAdapter_otherwesites = new RecDisplayAllWebsitesAdapter(this, recDisplayAllWebsitesModelArrayList_otherwebsites);
binding.recviewOthernetwork.setAdapter(recDisplayAllWebsitesAdapter_otherwesites);
binding.recviewOthernetwork.setLayoutManager(new GridLayoutManager(this, 4));
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public String loadWebsiteJSONFromAsset() {
String json = null;
try {
InputStream is = getAssets().open("supported_websites.json");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
json = new String(buffer, StandardCharsets.UTF_8);
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return json;
}
class RecDisplayAllWebsitesAdapter extends RecyclerView.Adapter {
Context context;
ArrayList recDisplayAllWebsitesModelArrayList;
public RecDisplayAllWebsitesAdapter(Context context, ArrayList recDisplayAllWebsitesModelArrayList) {
this.context = context;
this.recDisplayAllWebsitesModelArrayList = recDisplayAllWebsitesModelArrayList;
}
@NonNull
@Override
public RecDisplayAllWebsitesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new RecDisplayAllWebsitesViewHolder(LayoutInflater.from(context).inflate(R.layout.recdisplayallwebsites_item, null, false));
}
@Override
public void onBindViewHolder(@NonNull RecDisplayAllWebsitesViewHolder holder, int position) {
if (recDisplayAllWebsitesModelArrayList.get(position).getWebsitesshowtatue().equals("true")) {
Glide.with(context)
.load(recDisplayAllWebsitesModelArrayList
.get(position)
.getWebsiteurl())
.into(holder.imgRecDisplayAllWebsites);
holder.txtviewRecDisplayAllWebsites.setText(recDisplayAllWebsitesModelArrayList.get(position).getWebsitename());
if (recDisplayAllWebsitesModelArrayList.get(position).getWebsitestatue().equals("false")) {
holder.statusimg.setVisibility(View.VISIBLE);
} else {
holder.statusimg.setVisibility(View.INVISIBLE);
}
}
}
@Override
public int getItemCount() {
return recDisplayAllWebsitesModelArrayList.size();
}
class RecDisplayAllWebsitesViewHolder extends RecyclerView.ViewHolder {
private final ImageView imgRecDisplayAllWebsites;
private final ImageView statusimg;
private final TextView txtviewRecDisplayAllWebsites;
public RecDisplayAllWebsitesViewHolder(View view) {
super(view);
imgRecDisplayAllWebsites = view.findViewById(R.id.img_RecDisplayAllWebsites);
txtviewRecDisplayAllWebsites = view.findViewById(R.id.txtview_RecDisplayAllWebsites);
statusimg = view.findViewById(R.id.statusimg);
}
}
}
@Override
protected void attachBaseContext(Context newBase) {
newBase = LocaleHelper.onAttach(newBase);
super.attachBaseContext(newBase);
}
}
AppController.java
package com.infusiblecoder.allinonevideodownloader;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import androidx.multidex.MultiDexApplication;
import com.facebook.ads.AudienceNetworkAds;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.infusiblecoder.allinonevideodownloader.utils.AppOpenManager;
import com.infusiblecoder.allinonevideodownloader.utils.LocaleHelper;
import com.ironsource.mediationsdk.IronSource;
import com.onesignal.OneSignal;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class Appcontroller extends MultiDexApplication {
AppOpenManager appOpenManager;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(LocaleHelper.onAttach(base));
}
@Override
public void onCreate() {
super.onCreate();
MobileAds.initialize(
this,
new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
});
appOpenManager = new AppOpenManager(this);
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
// OneSignal Initialization
OneSignal.initWithContext(this);
OneSignal.setAppId(getString(R.string.onsignalappid));
AudienceNetworkAds.initialize(this);
SharedPreferences prefs = getSharedPreferences("lang_pref", MODE_PRIVATE);
// System.out.println("qqqqqqqqqqqqqqqqq = "+Locale.getDefault().getLanguage());
String lang = prefs.getString("lang", Locale.getDefault().getLanguage());//"No name defined" is the default value.
//
// List locales = new ArrayList<>();
// locales.add(Locale.ENGLISH);
// locales.add(new Locale("ar", "ARABIC"));
// locales.add(new Locale("ur", "URDU"));
// locales.add(new Locale("tr", "Turkish"));
// locales.add(new Locale("hi", "Hindi"));
LocaleHelper.setLocale(getApplicationContext(), lang);
}
}
BulkDownloader_ProfileActivity.java
package com.infusiblecoder.allinonevideodownloader;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.bumptech.glide.Glide;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.infusiblecoder.allinonevideodownloader.adapters.ListAllProfilePostsInstagramUserAdapter;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityBulkDownloaderProfileBinding;
import com.infusiblecoder.allinonevideodownloader.models.bulkdownloader.EdgeInfo;
import com.infusiblecoder.allinonevideodownloader.models.bulkdownloader.UserProfileDataModelBottomPart;
import com.infusiblecoder.allinonevideodownloader.utils.SharedPrefsForInstagram;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.infusiblecoder.allinonevideodownloader.R.string.youneedloginfirest;
@Keep
public class BulkDownloader_ProfileActivity extends AppCompatActivity {
private String myUserName;
private String myUserPKID;
private ActivityBulkDownloaderProfileBinding binding;
public static String INSTAGRAM_endcursorval = "";
private List storyModelInstaItemList;
ListAllProfilePostsInstagramUserAdapter listAllProfilePostsInstagramUserAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityBulkDownloaderProfileBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
storyModelInstaItemList = new ArrayList<>();
listAllProfilePostsInstagramUserAdapter = new ListAllProfilePostsInstagramUserAdapter(BulkDownloader_ProfileActivity.this, storyModelInstaItemList);
binding.recyclerviewProfileLong.setLayoutManager(new GridLayoutManager(BulkDownloader_ProfileActivity.this, 3));
binding.recyclerviewProfileLong.setAdapter(listAllProfilePostsInstagramUserAdapter);
if (getIntent() != null) {
myUserName = getIntent().getStringExtra("username");
myUserPKID = getIntent().getStringExtra("pkid");
loadAllprofileData(myUserName, myUserPKID);
}
binding.recyclerviewProfileLong.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState == RecyclerView.SCROLL_STATE_IDLE) {
binding.floatingloadmore.setVisibility(View.VISIBLE);
Toast.makeText(BulkDownloader_ProfileActivity.this, R.string.taptoloadmore, Toast.LENGTH_SHORT).show();
}
}
});
binding.floatingloadmore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
binding.floatingloadmore.setVisibility(View.GONE);
loadAllPostsData();
}
});
}
void loadAllprofileData(String username, String pkid) {
SharedPrefsForInstagram sharedPrefsFor = new SharedPrefsForInstagram(BulkDownloader_ProfileActivity.this);
Map map = sharedPrefsFor.getPreference(SharedPrefsForInstagram.PREFERENCE);
if (map != null) {
String cookie = "ds_user_id=" + map.get(SharedPrefsForInstagram.PREFERENCE_USERID) + "; sessionid=" + map.get(SharedPrefsForInstagram.PREFERENCE_SESSIONID);
AndroidNetworking.get("https://www.instagram.com/{username}/?__a=1")
.addPathParameter("username", username)
.setPriority(Priority.LOW)
.addHeaders("Cookie", cookie)
.addHeaders(
"User-Agent",
"\"Instagram 9.5.2 (iPhone7,2; iPhone OS 9_3_3; en_US; en-US; scale=2.00; 750x1334) AppleWebKit/420+\""
)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
// binding.dfsadasdas.setText(response.toString());
System.out.println("hvjksdhfhdkd userpkid 00 " + pkid + " username " + username);
// System.out.println("hvjksdhfhdkd usernamedata click idis" + response.toString());
//4162923872
//3401888503
try {
JSONObject userdata = response.getJSONObject("graphql").getJSONObject("user");
binding.profileFollowersNumberTextview.setText(userdata.getJSONObject("edge_followed_by").getString("count"));
binding.profileFollowingNumberTextview.setText(userdata.getJSONObject("edge_follow").getString("count"));
binding.profilePostNumberTextview.setText(userdata.getJSONObject("edge_owner_to_timeline_media").getString("count"));
binding.profileLongIdTextview.setText(userdata.getString("username"));
// ObjectMapper om = new ObjectMapper();
// UserProfileTopData root = om.readValue(response.toString(), UserProfileTopData.class);
// System.out.println("hvjksdhfhdkd followed by " + root.getGraphql().getUser().getEdge_followed_by().getCount());
// binding.profileLongIdTextview.setText(root.getGraphql().getUser().getUsername());
// binding.profileFollowersNumberTextview.setText(root.getGraphql().getUser().getEdge_followed_by().getCount() + "");
// binding.profileFollowingNumberTextview.setText(root.getGraphql().getUser().getEdge_follow().getCount() + "");
// binding.profilePostNumberTextview.setText(root.getGraphql().getUser().getEdge_owner_to_timeline_media().getCount() + "");
if (userdata.getBoolean("is_verified")) {
binding.profileLongApprovedImageview.setVisibility(View.VISIBLE);
} else {
binding.profileLongApprovedImageview.setVisibility(View.GONE);
}
if (userdata.getBoolean("is_private")) {
binding.rowSearchPrivateImageviewPrivate.setVisibility(View.VISIBLE);
} else {
binding.rowSearchPrivateImageviewPrivate.setVisibility(View.GONE);
}
Glide.with(BulkDownloader_ProfileActivity.this).load(userdata.getString("profile_pic_url")).into(binding.profileLongCircle);
// System.out.println("hvjksdhfhdkd endcursoris= " + root.getLogging_page_id());
// System.out.println("hvjksdhfhdkd endcursoris img = " + root.getGraphql().getUser().getProfile_pic_url());
} catch (Exception e) {
System.out.println("hvjksdhfhdkd eeee errr 00 " + e.getMessage());
e.printStackTrace();
}
}
@Override
public void onError(ANError anError) {
System.out.println("hvjksdhfhdkd eeee" + anError.getResponse());
}
});
loadAllPostsData();
} else {
Toast.makeText(this, youneedloginfirest, Toast.LENGTH_LONG).show();
}
}
void loadAllPostsData() {
binding.profileLongProgress.setVisibility(View.VISIBLE);
SharedPrefsForInstagram sharedPrefsFor = new SharedPrefsForInstagram(BulkDownloader_ProfileActivity.this);
Map map = sharedPrefsFor.getPreference(SharedPrefsForInstagram.PREFERENCE);
if (map != null) {
String cookie = "ds_user_id=" + map.get(SharedPrefsForInstagram.PREFERENCE_USERID) + "; sessionid=" + map.get(SharedPrefsForInstagram.PREFERENCE_SESSIONID);
AndroidNetworking.get("https://instagram.com/graphql/query/?query_id=17888483320059182&id={userid}&first=20&after={end_cursor}")
.addPathParameter("userid", myUserPKID)
.addPathParameter("end_cursor", INSTAGRAM_endcursorval)//QVFCX1U4TzBuSXhyZTNyMzBZSmpXYVljazN2UHo1NEhqYko5NDF1R0FMSWU3U25hcVVPcjdkVnVuT3cxb2drZ2VRbFFuVXV4eGIzRGZ3RFM0QkJwOW1wMg==
.setPriority(Priority.LOW)
.addHeaders("Cookie", cookie)
.addHeaders(
"User-Agent",
"\"Instagram 9.5.2 (iPhone7,2; iPhone OS 9_3_3; en_US; en-US; scale=2.00; 750x1334) AppleWebKit/420+\""
)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
binding.profileLongProgress.setVisibility(View.GONE);
System.out.println("hvjksdhfhdkd profiledataaaaa " + response.toString());
System.out.println("hvjksdhfhdkd userpkid " + myUserPKID + " username");
// System.out.println("hvjksdhfhdkd model click idis" + response.toString());
//4162923872
//3401888503
// binding.dfsadasdas.setText(response.toString());
try {
ObjectMapper om = new ObjectMapper();
UserProfileDataModelBottomPart root = om.readValue(response.toString(), UserProfileDataModelBottomPart.class);
storyModelInstaItemList.addAll(root.getData().getUser().getEdge_owner_to_timeline_media().getEdges());
INSTAGRAM_endcursorval = root.getData().getUser().getEdge_owner_to_timeline_media().getPage_info().getEnd_cursor();
} catch (Exception e) {
System.out.println("hvjksdhfhdkd eeee errrrrrrr" + e.getMessage());
}
listAllProfilePostsInstagramUserAdapter.notifyDataSetChanged();
}
@Override
public void onError(ANError anError) {
binding.profileLongProgress.setVisibility(View.GONE);
System.out.println("hvjksdhfhdkd eeee" + anError.getResponse());
}
});
} else {
binding.profileLongProgress.setVisibility(View.GONE);
Toast.makeText(this, youneedloginfirest, Toast.LENGTH_LONG).show();
}
}
@Override
public void onBackPressed() {
INSTAGRAM_endcursorval = "";
//startActivity(new Intent(BulkDownloader_ProfileActivity.this,InstagramBulkDownloader.class));
finish();
}
}
FullImageActivity.java
package com.infusiblecoder.allinonevideodownloader;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityFullViewBinding;
public class FullImageActivity extends AppCompatActivity {
private ActivityFullViewBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
binding = ActivityFullViewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
initViews();
if (getIntent().getStringExtra("myimgfile") != null && getIntent().getStringExtra("isfbimage") != null) {
String filepath = getIntent().getStringExtra("myimgfile");
String is = getIntent().getStringExtra("isfbimage");
if (is.equals("true")) {
showImage(filepath);
} else {
Glide.with(this)
.load(filepath)
.into(binding.imageviewFullimg);
}
} else if (getIntent().getStringExtra("myimgfile") != null) {
String filepath = getIntent().getStringExtra("myimgfile");
Glide.with(this)
.load(filepath)
.into(binding.imageviewFullimg);
}
}
public void showImage(String str) {
Glide.with(this).asBitmap().load(str).addListener(new RequestListener() {
public boolean onLoadFailed(GlideException glideException, Object obj, Target target, boolean z) {
Toast.makeText(FullImageActivity.this, "Cant get image", Toast.LENGTH_SHORT).show();
return false;
}
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) {
FullImageActivity.this.runOnUiThread(new Runnable() {
public void run() {
binding.imageviewFullimg.setImageBitmap(resource);
}
});
return false;
}
}).submit();
}
public void initViews() {
binding.imgclose.setOnClickListener(v -> {
onBackPressed();
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
}
return super.onOptionsItemSelected(item);
}
}
GalleryActivity.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.infusiblecoder.allinonevideodownloader.fragments.AudiogalleryGallery;
import com.infusiblecoder.allinonevideodownloader.fragments.GalleryFragmentMainGallery;
import com.infusiblecoder.allinonevideodownloader.fragments.InstagalleryImagesGallery;
import com.infusiblecoder.allinonevideodownloader.fragments.StatusSaverGallery;
import com.infusiblecoder.allinonevideodownloader.utils.AdsManager;
import com.infusiblecoder.allinonevideodownloader.utils.Constants;
import org.jetbrains.annotations.NotNull;
public class GalleryActivity extends AppCompatActivity {
TabLayout tabLayout;
ViewPager viewPager;
private String nn;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery);
tabLayout = (TabLayout) findViewById(R.id.tabsgallery);
viewPager = (ViewPager) findViewById(R.id.viewpagergallery);
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.gallery_fragment_statussaver)).setIcon(R.drawable.ic_gallery_color_24dp));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.StatusSaver_gallery)).setIcon(R.drawable.statuspic));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.instaimage)).setIcon(R.drawable.ic_image));
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.audios)).setIcon(R.drawable.ic_music_note_24dp));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
final MyAdapter adapter = new MyAdapter(this, getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
SharedPreferences prefs = getSharedPreferences("whatsapp_pref",
Context.MODE_PRIVATE);
nn = prefs.getString("inappads", "nnn");//"No name defined" is the default value.
if (Constants.show_Ads) {
if (nn.equals("nnn")) {
AdsManager.loadInterstitialAd(this);
AdsManager.loadBannerAd(this, findViewById(R.id.banner_container));
} else {
findViewById(R.id.banner_container).setVisibility(View.GONE);
}
}
}
public class MyAdapter extends FragmentPagerAdapter {
private Context myContext;
int totalTabs;
public MyAdapter(Context context, FragmentManager fm, int totalTabs) {
super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
myContext = context;
this.totalTabs = totalTabs;
}
@NotNull
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new GalleryFragmentMainGallery();
case 1:
return new StatusSaverGallery();
case 2:
return new InstagalleryImagesGallery();
case 3:
return new AudiogalleryGallery();
default:
return null;
}
}
@Override
public int getCount() {
return totalTabs;
}
}
}
GetLinkThroughWebview.java
package com.infusiblecoder.allinonevideodownloader;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityGetLinkThroughWebviewBinding;
import com.infusiblecoder.allinonevideodownloader.models.DlApismodels.VideoModel;
import com.infusiblecoder.allinonevideodownloader.tasks.downloadFile;
import com.infusiblecoder.allinonevideodownloader.utils.iUtils;
import org.json.JSONObject;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.infusiblecoder.allinonevideodownloader.tasks.downloadVideo.fromService;
import static com.infusiblecoder.allinonevideodownloader.tasks.downloadVideo.pd;
public class GetLinkThroughWebview extends AppCompatActivity {
String url = "";
ProgressDialog progressDialog;
boolean isOnetime = false;
private ArrayList videoModelArrayList = new ArrayList<>();
private ActivityGetLinkThroughWebviewBinding binding;
Handler handler;
Runnable runnable;
@SuppressLint("JavascriptInterface")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityGetLinkThroughWebviewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
progressDialog = new ProgressDialog(GetLinkThroughWebview.this);
progressDialog.setMessage(getString(R.string.nodeifittakeslonger));
progressDialog.show();
url = "https://audiomack.com/lightskinkeisha/song/fdh";
handler = new Handler();
// url = "https://audiomack.com/embed/song/lightskinkeisha/fdh?background=1";
if (getIntent().hasExtra("myurlis")) {
url = getIntent().getStringExtra("myurlis");
if (url.contains("audiomack")) {
String[] urlarray = url.split("/");
System.out.println("length ksdjjfsdfsd 6" + urlarray[5]);
System.out.println("length ksdjjfsdfsd 5" + urlarray[3]);
url = "https://audiomack.com/embed/song/" + urlarray[3] + "/" + urlarray[5] + "?background=1";
System.out.println("length ksdjjfsdfsd 77 =" + url);
}
} else {
url = "https://audiomack.com/embed/song/lightskinkeisha/fdh?background=1";
}
if (android.os.Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.browser, true);
} else {
CookieManager.getInstance().setAcceptCookie(true);
}
binding.browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
binding.browser.getSettings().setJavaScriptEnabled(true);
binding.browser.getSettings().getAllowFileAccess();
// binding.browser.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 10;TXY567) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/8399.0.9993.96 Mobile Safari/599.36");
binding.browser.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
runnable = new Runnable() {
@Override
public void run() {
if (url.contains("audiomack")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('audio')[0].getAttribute(\"src\"));");
} else if (url.contains("zili")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("bemate")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("xhamster")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("byte.co")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[1].getAttribute(\"src\"));");
} else if (url.contains("vidlit")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('source')[0].getAttribute(\"src\"));");
} else if (url.contains("veer.tv")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("fthis.gr")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('source')[0].getAttribute(\"src\"));");
} else if (url.contains("fw.tv") || url.contains("firework.tv")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('source')[0].getAttribute(\"src\"));");
} else if (url.contains("rumble")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("traileraddict")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
} else if (url.contains("zingmp3")) {
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('audio')[0].getAttribute(\"src\"));");
} else {
progressDialog.dismiss();
handler.removeCallbacks(this);
iUtils.ShowToast(GetLinkThroughWebview.this, getResources().getString(R.string.somthing));
Intent intent = new Intent();
setResult(2, intent);
finish();
}
handler.postDelayed(this, 1000);
}
};
handler.postDelayed(runnable, 1000);
}
});
binding.browser.loadUrl(url);
}
public class ParseM3u8 extends AsyncTask
GetTiktokLinkThroughWebview
package com.infusiblecoder.allinonevideodownloader;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityGetLinkThroughWebviewBinding;
import com.infusiblecoder.allinonevideodownloader.models.DlApismodels.VideoModel;
import com.infusiblecoder.allinonevideodownloader.utils.iUtils;
import java.util.ArrayList;
import static com.infusiblecoder.allinonevideodownloader.tasks.downloadVideo.fromService;
import static com.infusiblecoder.allinonevideodownloader.tasks.downloadVideo.pd;
public class GetTiktokLinkThroughWebview extends AppCompatActivity {
String url = "";
ProgressDialog progressDialog;
boolean isOnetime = false;
private ArrayList videoModelArrayList = new ArrayList<>();
private ActivityGetLinkThroughWebviewBinding binding;
@SuppressLint("JavascriptInterface")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityGetLinkThroughWebviewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
progressDialog = new ProgressDialog(GetTiktokLinkThroughWebview.this);
progressDialog.setMessage("Loading.... Note if it takes longer then 1 min close the app and retry");
progressDialog.show();
url = "https://audiomack.com/lightskinkeisha/song/fdh";
// url = "https://audiomack.com/embed/song/lightskinkeisha/fdh?background=1";
if (getIntent().hasExtra("myurlis")) {
url = getIntent().getStringExtra("myurlis");
} else {
url = "https://audiomack.com/embed/song/lightskinkeisha/fdh?background=1";
}
if (Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.browser, true);
} else {
CookieManager.getInstance().setAcceptCookie(true);
}
binding.browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
binding.browser.getSettings().setJavaScriptEnabled(true);
// binding.browser.clearFormData();
// binding.browser.getSettings().setSaveFormData(true);
// binding.browser.getSettings().setAppCacheMaxSize(5242880);
// binding.browser.getSettings().setAllowFileAccess(true);
// binding.browser.getSettings().setAppCacheEnabled(true);
// binding.browser.getSettings().getAllowFileAccess();
// binding.browser.getSettings().setDefaultTextEncodingName("UTF-8");
// binding.browser.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
// binding.browser.getSettings().setDatabaseEnabled(true);
// binding.browser.getSettings().setBuiltInZoomControls(false);
// binding.browser.getSettings().setSupportZoom(false);
// binding.browser.getSettings().setUseWideViewPort(true);
// binding.browser.getSettings().setDomStorageEnabled(true);
// binding.browser.getSettings().setAllowFileAccess(true);
// binding.browser.getSettings().setLoadWithOverviewMode(true);
// binding.browser.getSettings().setLoadsImagesAutomatically(true);
// binding.browser.getSettings().setBlockNetworkImage(false);
// binding.browser.getSettings().setBlockNetworkLoads(false);
// binding.browser.getSettings().setLoadWithOverviewMode(true);
// this.config = {
// baseURL: 'https://api2.musical.ly/',
// host: 'api2.musical.ly',
// userAgent: `com.zhiliaoapp.musically/${reqParams.manifest_version_code}`
// + ` (Linux; U; Android ${reqParams.os_version}; ${reqParams.language}_${reqParams.region};`
// + ` ${reqParams.device_type}; Build/NHG47Q; Cronet/58.0.2991.0)`,
// ...apiConfig,
// } as API.TikTokAPIConfig;
// binding.browser.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 10;TXY567) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/8399.0.9993.96 Mobile Safari/599.36");
// binding.browser.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
binding.browser.getSettings().setUserAgentString("com.zhiliaoapp.musically/2018052132 (Linux; U; Android 8.0.0; en_US; Pixel 2; Build/ABCXYZ; Cronet/58.0.2991.0)");
// binding.browser.getSettings().setUserAgentString("com.zhiliaoapp.musically/2018052132 (Linux; Android 10;TXY567; en_US; SM-J700F; Build/MMB29K; Cronet/58.0.2991.0)");
binding.browser.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (url.contains("tiktok")) {
// binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementById('RENDER_DATA').textContent);");
binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('html')[0].textContent+'');");
//binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('video')[0].getAttribute(\"src\"));");
// binding.browser.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.querySelectorAll(\"script[id='__NEXT_DATA__']\")[0].innerHTML));");
} else {
progressDialog.dismiss();
if (!fromService) {
pd.dismiss();
iUtils.ShowToast(GetTiktokLinkThroughWebview.this, getResources().getString(R.string.somthing));
}
Intent intent = new Intent();
setResult(2, intent);
finish();
}
}
}, 1000);
}
});
binding.browser.loadUrl(url);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void onPausing() {
if (binding.browser != null) {
binding.browser.evaluateJavascript("javascript:document.querySelector('video').pause();", new ValueCallback() {
public void onReceiveValue(Object obj) {
}
});
}
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void onResuming() {
if (binding.browser != null) {
binding.browser.evaluateJavascript("javascript:document.querySelector('video').play();", new ValueCallback() {
public void onReceiveValue(Object obj) {
}
});
}
}
class MyJavaScriptInterface {
@SuppressWarnings("unused")
@JavascriptInterface
public void showHTML(final String myurl, final String html) {
progressDialog.dismiss();
System.out.println("myhtml res uu =" + myurl);
System.out.println("myhtml res =" + html);
if (!isOnetime) {
isOnetime = true;
if (myurl.contains("tiktok")) {
try {
// String afterDecode = URLDecoder.decode(html, "UTF-8");
//
//
// JSONObject jsonObject = new JSONObject(afterDecode);
//
// String video_id = jsonObject
// .getJSONObject("rpcRes")
// .getJSONObject("res")
// .getJSONObject("ItemInfo")
// .getJSONObject("ItemStruct")
// .getJSONObject("Video")
// .getJSONObject("PlayAddr")
// .getString("Uri");
//
//
// String ddurl = "https://api2-16-h2.musical.ly/aweme/v1/play/?video_id=" + video_id + "&vr_type=0&is_play_url=1&source=PackSourceEnum_PUBLISH&media_type=4&ratio=default&improve_bitrate=1";
//
// System.out.println("wojfdjhfdjh 111 " + ddurl);
// new downloadFile().Downloading(GetTiktokLinkThroughWebview.this, html, "Tiktok_" + System.currentTimeMillis(), ".mp4");
} catch (Exception e) {
e.printStackTrace();
}
// new downloadFile().Downloading(GetTiktokLinkThroughWebview.this, html, "Audiomack_" + System.currentTimeMillis(), ".mp3");
} else {
progressDialog.dismiss();
if (!fromService) {
pd.dismiss();
iUtils.ShowToast(GetTiktokLinkThroughWebview.this, getResources().getString(R.string.somthing));
}
// Intent intent = new Intent();
// setResult(2, intent);
// finish();
}
System.out.println("htmlissss vid_url=" + html + " url=" + myurl);
// Intent intent = new Intent();
// intent.putExtra("MESSAGE", html);
// setResult(2, intent);
// finish();
}
}
}
// public class HttpHelper {
// public static final OkHttpClient a = new Builder().connectTimeout(20, TimeUnit.SECONDS).writeTimeout(20, TimeUnit.SECONDS).readTimeout(20, TimeUnit.SECONDS).retryOnConnectionFailure(true).proxy(Proxy.NO_PROXY).build();
// public static final Request.Builder b = new Request.Builder().addHeader("Connection", "close").addHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36");
//
// static {
// System.loadLibrary("native-lib");
// }
//
// public static void a(String str, Context context, Callback callback) {
// StringBuilder stringBuilder;
// String stringBuilder2;
// Object a;
// Exception e;
// MediaType parse;
// String str2;
// TreeMap treeMap;
// Excluder excluder;
// ww0 com_video_downloader_no_watermark_tiktok_ui_view_ww0;
// bw0 com_video_downloader_no_watermark_tiktok_ui_view_bw0;
// HashMap hashMap;
// HashMap hashMap2;
// Collection collection;
// Collection arrayList;
// Collection collection2;
// Collection arrayList2;
// boolean z;
// boolean z2;
// boolean z3;
// boolean z4;
// int i;
// List list;
// List arrayList3;
// iw0 com_video_downloader_no_watermark_tiktok_ui_view_iw0;
// String str3 = "params";
// String str4 = "videoUrl";
// String str5 = "headStr";
// String str6 = "utf-8";
// StringBuilder stringBuilder3 = new StringBuilder();
// stringBuilder3.append("app_language=AS");
// stringBuilder3.append("&language=AS");
// stringBuilder3.append("®ion=AS");
// stringBuilder3.append("&sys_region=AS");
// stringBuilder3.append("&carrier_region=&carrier_region_v2=");
// int dSTSavings = (TimeZone.getDefault().getDSTSavings() / 1000) + (TimeZone.getDefault().getRawOffset() / 1000);
// stringBuilder3.append("&timezone_offset=");
// stringBuilder3.append(dSTSavings);
// stringBuilder3.append("&timezone_name=");
// stringBuilder3.append(Uri.encode(TimeZone.getDefault().getID()));
// stringBuilder3.append("&mcc_mnc=&retry_type=no_retry&is_my_cn=1&fp=&pass-region=1&pass-route=1&ac=wifi&channel=googleplay&aid=1180&iid=6800628374143469314&app_name=trill&version_code=494&device_platform=android&ab_version=4.9.3&aid=1180&ssmix=a&manifest_version_code=494&update_version_code=4940");
// int i2 = Resources.getSystem().getDisplayMetrics().heightPixels;
// dSTSavings = Resources.getSystem().getDisplayMetrics().widthPixels;
// stringBuilder3.append("&resolution=");
// stringBuilder3.append(dSTSavings);
// stringBuilder3.append("*");
// stringBuilder3.append(i2);
// DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
// stringBuilder3.append("&dpi=");
// stringBuilder3.append(displayMetrics.densityDpi);
// stringBuilder3.append("&openudid=");
// stringBuilder3.append(Secure.getString(context.getContentResolver(), "android_id"));
// stringBuilder3.append("&device_type=");
// stringBuilder3.append(Uri.encode(Build.MODEL));
// stringBuilder3.append("&os_version=");
// stringBuilder3.append(VERSION.RELEASE);
// stringBuilder3.append("&os_api=");
// stringBuilder3.append(VERSION.SDK_INT);
// stringBuilder3.append("&device_brand=");
// stringBuilder3.append(Build.BRAND);
// try {
// stringBuilder = new StringBuilder();
// stringBuilder.append("com.ss.android.ugc.trill/494 ");
// stringBuilder.append(WebSettings.getDefaultUserAgent(context));
// stringBuilder2 = stringBuilder.toString();
// } catch (Throwable th) {
// th.printStackTrace();
// stringBuilder2 = "com.ss.android.ugc.trill/494 Mozilla/5.0 (Linux; Android 10; HRY-AL00a Build/HONORHRY-AL00a; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36";
// }
// HashMap hashMap3 = new HashMap();
// try {
// hashMap3.put(str5, URLEncoder.encode(stringBuilder2, str6));
// hashMap3.put(str3, URLEncoder.encode(stringBuilder3.toString(), str6));
// hashMap3.put(str4, URLEncoder.encode(str, str6));
// } catch (UnsupportedEncodingException e2) {
// e2.printStackTrace();
// }
// stringBuilder = new StringBuilder();
// stringBuilder.append(System.currentTimeMillis());
// str6 = "";
// stringBuilder.append(str6);
// hashMap3.put("userId", stringBuilder.toString());
// stringBuilder = new StringBuilder();
// stringBuilder.append(System.currentTimeMillis());
// stringBuilder.append(str6);
// hashMap3.put("timestamp", stringBuilder.toString());
// stringBuilder = new StringBuilder();
// TreeMap treeMap2 = new TreeMap(hashMap3);
// Excluder excluder2 = Excluder.f;
// ww0 com_video_downloader_no_watermark_tiktok_ui_view_ww02 = ww0.a;
// bw0 com_video_downloader_no_watermark_tiktok_ui_view_bw02 = bw0.a;
// HashMap hashMap4 = r7;
// HashMap hashMap5 = new HashMap();
// Collection collection3 = r7;
// Collection arrayList4 = new ArrayList();
// Collection collection4 = r11;
// Collection arrayList5 = new ArrayList();
// boolean z5 = false;
// boolean z6 = false;
// boolean z7 = false;
// int i3 = 2;
// List list2 = r12;
// List arrayList6 = new ArrayList((arrayList5.size() + arrayList4.size()) + 3);
// arrayList6.addAll(arrayList4);
// Collections.reverse(arrayList6);
// arrayList4 = new ArrayList(arrayList5);
// Collections.reverse(arrayList4);
// arrayList6.addAll(arrayList4);
// String str7 = str6;
// iw0 com_video_downloader_no_watermark_tiktok_ui_view_iw02 = r7;
// iw0 com_video_downloader_no_watermark_tiktok_ui_view_iw03 = new iw0(excluder2, com_video_downloader_no_watermark_tiktok_ui_view_bw02, hashMap4, false, false, false, false, z7, z5, z6, com_video_downloader_no_watermark_tiktok_ui_view_ww02, null, 2, i3, collection3, collection4, list2);
// stringBuilder.append(com_video_downloader_no_watermark_tiktok_ui_view_iw02.f(treeMap2));
// stringBuilder.append(getSafeKey(context));
// try {
// a = qu0.a(MessageDigest.getInstance("SHA-256").digest(stringBuilder.toString().getBytes("UTF-8")));
// } catch (NoSuchAlgorithmException e3) {
// e = e3;
// e.printStackTrace();
// a = str7;
// hashMap3.put("sign", a);
// parse = MediaType.parse("application/json");
// getURL(context);
// for (Entry entry : hashMap3.entrySet()) {
// if (str4.equals(entry.getKey())) {
// str2 = (String) entry.getKey();
// str2 = (String) entry.getValue();
// b.header((String) entry.getKey(), String.valueOf(entry.getValue()));
// }
// }
// treeMap = new TreeMap();
// treeMap.put(str5, hashMap3.get(str5));
// treeMap.put(str3, hashMap3.get(str3));
// treeMap.put(str4, hashMap3.get(str4));
// excluder = Excluder.f;
// com_video_downloader_no_watermark_tiktok_ui_view_ww0 = ww0.a;
// com_video_downloader_no_watermark_tiktok_ui_view_bw0 = bw0.a;
// hashMap = hashMap2;
// hashMap2 = new HashMap();
// collection = arrayList;
// arrayList = new ArrayList();
// collection2 = arrayList2;
// arrayList2 = new ArrayList();
// z = false;
// z2 = false;
// z7 = false;
// z3 = false;
// z4 = false;
// i = 2;
// list = arrayList3;
// arrayList3 = new ArrayList((arrayList2.size() + arrayList.size()) + 3);
// arrayList3.addAll(arrayList);
// Collections.reverse(arrayList3);
// arrayList = new ArrayList(arrayList2);
// Collections.reverse(arrayList);
// arrayList3.addAll(arrayList);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0 = new iw0(excluder, com_video_downloader_no_watermark_tiktok_ui_view_bw0, hashMap, z, z4, false, false, z3, z2, z7, com_video_downloader_no_watermark_tiktok_ui_view_ww0, null, 2, i, collection, collection2, list);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap);
// a.newCall(b.post(RequestBody.create(parse, com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap))).url(getURL(context)).build()).enqueue(callback);
// } catch (UnsupportedEncodingException e4) {
// e = e4;
// e.printStackTrace();
// a = str7;
// hashMap3.put("sign", a);
// parse = MediaType.parse("application/json");
// getURL(context);
// for (Entry entry2 : hashMap3.entrySet()) {
// if (str4.equals(entry2.getKey())) {
// str2 = (String) entry2.getKey();
// str2 = (String) entry2.getValue();
// b.header((String) entry2.getKey(), String.valueOf(entry2.getValue()));
// }
// }
// treeMap = new TreeMap();
// treeMap.put(str5, hashMap3.get(str5));
// treeMap.put(str3, hashMap3.get(str3));
// treeMap.put(str4, hashMap3.get(str4));
// excluder = Excluder.f;
// com_video_downloader_no_watermark_tiktok_ui_view_ww0 = ww0.a;
// com_video_downloader_no_watermark_tiktok_ui_view_bw0 = bw0.a;
// hashMap = hashMap2;
// hashMap2 = new HashMap();
// collection = arrayList;
// arrayList = new ArrayList();
// collection2 = arrayList2;
// arrayList2 = new ArrayList();
// z = false;
// z2 = false;
// z7 = false;
// z3 = false;
// z4 = false;
// i = 2;
// list = arrayList3;
// arrayList3 = new ArrayList((arrayList2.size() + arrayList.size()) + 3);
// arrayList3.addAll(arrayList);
// Collections.reverse(arrayList3);
// arrayList = new ArrayList(arrayList2);
// Collections.reverse(arrayList);
// arrayList3.addAll(arrayList);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0 = new iw0(excluder, com_video_downloader_no_watermark_tiktok_ui_view_bw0, hashMap, z, z4, false, false, z3, z2, z7, com_video_downloader_no_watermark_tiktok_ui_view_ww0, null, 2, i, collection, collection2, list);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap);
// a.newCall(b.post(RequestBody.create(parse, com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap))).url(getURL(context)).build()).enqueue(callback);
// }
// hashMap3.put("sign", a);
// parse = MediaType.parse("application/json");
// getURL(context);
// for (Entry entry22 : hashMap3.entrySet()) {
// if (!(str5.equals(entry22.getKey()) || str3.equals(entry22.getKey()))) {
// if (str4.equals(entry22.getKey())) {
// str2 = (String) entry22.getKey();
// str2 = (String) entry22.getValue();
// b.header((String) entry22.getKey(), String.valueOf(entry22.getValue()));
// }
// }
// }
// treeMap = new TreeMap();
// treeMap.put(str5, hashMap3.get(str5));
// treeMap.put(str3, hashMap3.get(str3));
// treeMap.put(str4, hashMap3.get(str4));
// excluder = Excluder.f;
// com_video_downloader_no_watermark_tiktok_ui_view_ww0 = ww0.a;
// com_video_downloader_no_watermark_tiktok_ui_view_bw0 = bw0.a;
// hashMap = hashMap2;
// hashMap2 = new HashMap();
// collection = arrayList;
// arrayList = new ArrayList();
// collection2 = arrayList2;
// arrayList2 = new ArrayList();
// z = false;
// z2 = false;
// z7 = false;
// z3 = false;
// z4 = false;
// i = 2;
// list = arrayList3;
// arrayList3 = new ArrayList((arrayList2.size() + arrayList.size()) + 3);
// arrayList3.addAll(arrayList);
// Collections.reverse(arrayList3);
// arrayList = new ArrayList(arrayList2);
// Collections.reverse(arrayList);
// arrayList3.addAll(arrayList);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0 = new iw0(excluder, com_video_downloader_no_watermark_tiktok_ui_view_bw0, hashMap, z, z4, false, false, z3, z2, z7, com_video_downloader_no_watermark_tiktok_ui_view_ww0, null, 2, i, collection, collection2, list);
// com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap);
// a.newCall(b.post(RequestBody.create(parse, com_video_downloader_no_watermark_tiktok_ui_view_iw0.f(treeMap))).url(getURL(context)).build()).enqueue(callback);
// }
//
// public static native String getSafeKey(Object obj);
//
// public static native String getURL(Object obj);
// }
//
}
InstagramBulkDownloader.java
package com.infusiblecoder.allinonevideodownloader;
import android.app.ProgressDialog;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.google.gson.Gson;
import com.infusiblecoder.allinonevideodownloader.adapters.Profile_bulk_layout_adapter;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityInstagramBulkDownloaderBinding;
import com.infusiblecoder.allinonevideodownloader.models.bulkdownloader.UserUser;
import com.infusiblecoder.allinonevideodownloader.utils.SharedPrefsForInstagram;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Keep
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public class InstagramBulkDownloader extends AppCompatActivity {
private Profile_bulk_layout_adapter adapter;
private ActivityInstagramBulkDownloaderBinding binding;
private ProgressDialog progressDralogGenaratinglink;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityInstagramBulkDownloaderBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
progressDralogGenaratinglink = new ProgressDialog(InstagramBulkDownloader.this);
binding.searchinstaprofile.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// https://www.instagram.com/web/search/topsearch/?query=
System.out.println("hvjksdhfhdkd bb " + query);
SharedPrefsForInstagram sharedPrefsFor = new SharedPrefsForInstagram(InstagramBulkDownloader.this);
Map map = sharedPrefsFor.getPreference(SharedPrefsForInstagram.PREFERENCE);
if (map != null) {
String cookie = "ds_user_id=" + map.get(SharedPrefsForInstagram.PREFERENCE_USERID) + "; sessionid=" + map.get(SharedPrefsForInstagram.PREFERENCE_SESSIONID);
progressDralogGenaratinglink.setMessage(getResources().getString(R.string.loading));
progressDralogGenaratinglink.show();
AndroidNetworking.get("https://www.instagram.com/web/search/topsearch/?query={query1}")
.addPathParameter("query1", query)
.setPriority(Priority.LOW)
.addHeaders("Cookie", cookie)
.addHeaders(
"User-Agent",
"\"Instagram 9.5.2 (iPhone7,2; iPhone OS 9_3_3; en_US; en-US; scale=2.00; 750x1334) AppleWebKit/420+\""
)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
if (progressDralogGenaratinglink != null)
progressDralogGenaratinglink.dismiss();
List list = new ArrayList<>();
// System.out.println("hvjksdhfhdkd " + response.toString().substring(0,150));
//4162923872
//3401888503
try {
JSONArray responseJSONArray = response.getJSONArray("users");
for (int i = 0; i < responseJSONArray.length(); i++) {
Gson gson = new Gson();
UserUser gsonObj = gson.fromJson(responseJSONArray.getJSONObject(i).getJSONObject("user").toString(), UserUser.class);
list.add(gsonObj);
System.out.println("hvjksdhfhdkd " + gsonObj.is_verified);
}
// System.out.println("hvjksdhfhdkd length " + response.getJSONArray("places").getJSONObject(0).getJSONObject("place").getJSONObject("location").getString("short_name"));
binding.recyclerView.setLayoutManager(new LinearLayoutManager(InstagramBulkDownloader.this));
adapter = new Profile_bulk_layout_adapter(list, InstagramBulkDownloader.this);
binding.recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(ANError anError) {
if (progressDralogGenaratinglink != null)
progressDralogGenaratinglink.dismiss();
Toast.makeText(InstagramBulkDownloader.this, getResources().getString(R.string.error_occ), Toast.LENGTH_LONG).show();
System.out.println("hvjksdhfhdkd eeee" + anError.getResponse());
}
});
//https://www.instagram.com/graphql/query/
//https://i.instagram.com/api/v1/user/629205195/reel_media
// https://i.instagram.com/api/v1/users/$UserId/full_detail_info?max_id=
//https://www.instagram.com/{{username}}/?__a=1
//https://i.instagram.com/api/v1/users/{userid}/info/
} else {
Toast.makeText(InstagramBulkDownloader.this, R.string.loginfirst, Toast.LENGTH_LONG).show();
}
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
loadDummyData();
}
void loadDummyData() {
List list = new ArrayList<>();
// System.out.println("hvjksdhfhdkd " + response.toString().substring(0,150));
//4162923872
//3401888503
try {
JSONObject obj = new JSONObject(loadJSONFromAsset());
JSONArray responseJSONArray = obj.getJSONArray("users");
for (int i = 0; i < responseJSONArray.length(); i++) {
Gson gson = new Gson();
UserUser gsonObj = gson.fromJson(responseJSONArray.getJSONObject(i).getJSONObject("user").toString(), UserUser.class);
list.add(gsonObj);
System.out.println("hvjksdhfhdkd " + gsonObj.is_verified);
}
// System.out.println("hvjksdhfhdkd length " + response.getJSONArray("places").getJSONObject(0).getJSONObject("place").getJSONObject("location").getString("short_name"));
binding.recyclerView.setLayoutManager(new LinearLayoutManager(InstagramBulkDownloader.this));
adapter = new Profile_bulk_layout_adapter(list, InstagramBulkDownloader.this);
binding.recyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public String loadJSONFromAsset() {
String json = null;
try {
InputStream is = getAssets().open("dummy.json");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
json = new String(buffer, StandardCharsets.UTF_8);
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return json;
}
}
InstagramLoginActivity.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityLoginInstagramBinding;
import com.infusiblecoder.allinonevideodownloader.utils.SharedPrefsForInstagram;
import java.util.HashMap;
import java.util.Map;
public class InstagramLoginActivity extends AppCompatActivity {
private String cookies;
private ActivityLoginInstagramBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLoginInstagramBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
LoadPage();
binding.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
LoadPage();
}
});
}
public void LoadPage() {
binding.webView.getSettings().setJavaScriptEnabled(true);
binding.webView.clearCache(true);
if (android.os.Build.VERSION.SDK_INT >= 21) {
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.webView, true);
} else {
CookieManager.getInstance().setAcceptCookie(true);
}
binding.webView.setWebViewClient(new MyWebviewClient());
CookieSyncManager.createInstance(InstagramLoginActivity.this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();
binding.webView.loadUrl("https://www.instagram.com/accounts/login/");
binding.webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
binding.swipeRefreshLayout.setRefreshing(progress != 100);
}
});
}
public String getCookie(String siteName, String CookieName) {
String CookieValue = null;
CookieManager cookieManager = CookieManager.getInstance();
String cookies = cookieManager.getCookie(siteName);
if (cookies != null && !cookies.isEmpty()) {
String[] temp = cookies.split(";");
for (String ar1 : temp) {
if (ar1.contains(CookieName)) {
String[] temp1 = ar1.split("=");
CookieValue = temp1[1];
break;
}
}
}
return CookieValue;
}
private class MyWebviewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView webView1, String url) {
webView1.loadUrl(url);
return true;
}
@Override
public void onLoadResource(WebView webView, String str) {
super.onLoadResource(webView, str);
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
cookies = CookieManager.getInstance().getCookie(str);
try {
String session_id = getCookie(str, "sessionid");
String csrftoken = getCookie(str, "csrftoken");
String userid = getCookie(str, "ds_user_id");
if (session_id != null && csrftoken != null && userid != null) {
Map map = new HashMap<>();
map.put(SharedPrefsForInstagram.PREFERENCE_COOKIES, cookies);
map.put(SharedPrefsForInstagram.PREFERENCE_CSRF, csrftoken);
map.put(SharedPrefsForInstagram.PREFERENCE_ISINSTAGRAMLOGEDIN, "true");
map.put(SharedPrefsForInstagram.PREFERENCE_SESSIONID, session_id);
map.put(SharedPrefsForInstagram.PREFERENCE_USERID, userid);
SharedPrefsForInstagram sharedPrefsForInstagram = new SharedPrefsForInstagram(InstagramLoginActivity.this);
sharedPrefsForInstagram.setPreference(map);
webView.destroy();
Intent intent = new Intent();
intent.putExtra("result", "result");
setResult(RESULT_OK, intent);
finish();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
return super.shouldInterceptRequest(webView, webResourceRequest);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
return super.shouldOverrideUrlLoading(webView, webResourceRequest);
}
}
}
PlayActivity.java
package com.infusiblecoder.allinonevideodownloader;
import android.app.PictureInPictureParams;
import android.content.Intent;
import android.content.res.Configuration;
import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Rational;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player.EventListener;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.LoopingMediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.measurement.api.AppMeasurementSdk.ConditionalUserProperty;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityPlayBinding;
public class PlayActivity extends AppCompatActivity {
private static final int REQUEST_WRITE_PERMISSION = 999;
private static final String SHARE_ID = "com.android.all";
PictureInPictureParams.Builder pictureInPictureParamsBuilder;
public Boolean playing;
private final Boolean downloading;
private String extension;
private boolean firstcall = true;
private String name;
private SimpleExoPlayer player;
private String title;
private DefaultTrackSelector trackSelector;
private String urlToDownload;
private String videourl;
private final boolean visibleuser;
private ActivityPlayBinding binding;
private ImageView exo_pause;
public ImageView exo_play;
public PlayActivity() {
Boolean valueOf = Boolean.valueOf(false);
this.downloading = valueOf;
this.visibleuser = false;
this.playing = valueOf;
}
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
binding = ActivityPlayBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(view);
this.name = getIntent().getStringExtra(ConditionalUserProperty.NAME);
this.videourl = getIntent().getStringExtra("videourl");
this.exo_pause = findViewById(R.id.exo_pause);
this.exo_play = findViewById(R.id.exo_play);
initplayer();
binding.back.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
PlayActivity.this.onBackPressed();
}
});
binding.imgPictureinpicture.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startPictureInPictureFeature();
}
});
}
private void initplayer() {
String str = this.videourl;
this.urlToDownload = str;
this.title = this.name;
this.extension = "mp4";
binding.videoName.setText(this.name);
ThumbnailUtils.createVideoThumbnail(this.videourl, 1);
this.firstcall = false;
Uri parse = Uri.parse(this.videourl);
this.player = ExoPlayerFactory.newSimpleInstance(this, new DefaultTrackSelector(new AdaptiveTrackSelection.Factory()));
binding.videoView.setPlayer(this.player);
ExtractorMediaSource extractorMediaSource = new ExtractorMediaSource(parse, new DefaultDataSourceFactory(this, Util.getUserAgent(this, "CloudinaryExoplayer")), new DefaultExtractorsFactory(), null, null);
this.player.prepare(new LoopingMediaSource(extractorMediaSource));
this.player.setPlayWhenReady(true);
this.exo_play.setVisibility(View.GONE);
binding.videoView.setControllerShowTimeoutMs(ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED);
this.player.addListener(new EventListener() {
public void onLoadingChanged(boolean z) {
}
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
}
public void onPlayerError(ExoPlaybackException exoPlaybackException) {
}
public void onPositionDiscontinuity(int i) {
}
public void onRepeatModeChanged(int i) {
}
public void onShuffleModeEnabledChanged(boolean z) {
}
public void onTimelineChanged(Timeline timeline, Object obj, int i) {
}
public void onTracksChanged(TrackGroupArray trackGroupArray, TrackSelectionArray trackSelectionArray) {
}
public void onPlayerStateChanged(boolean z, int i) {
if (i == 3) {
try {
binding.loader.setVisibility(View.GONE);
binding.videoView.setVisibility(View.VISIBLE);
PlayActivity.this.exo_play.setVisibility(View.GONE);
PlayActivity.this.playing = Boolean.valueOf(true);
} catch (Exception e) {
e.printStackTrace();
return;
}
}
if (i == 2) {
binding.loader.setVisibility(View.VISIBLE);
binding.videoView.setVisibility(View.GONE);
}
}
});
}
public void onResume() {
super.onResume();
if (this.player == null && this.playing.booleanValue()) {
initplayer();
}
}
public void onDestroy() {
super.onDestroy();
releaseplayer();
}
public void onPause() {
super.onPause();
// releaseplayer();
// If called while in PIP mode, do not pause playback
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (isInPictureInPictureMode()) {
// Continue playback
} else {
// Use existing playback logic for paused Activity behavior.
releaseplayer();
}
}
}
private void releaseplayer() {
SimpleExoPlayer simpleExoPlayer = this.player;
if (simpleExoPlayer != null) {
simpleExoPlayer.release();
this.player = null;
this.trackSelector = null;
}
}
public void onStop() {
super.onStop();
releaseplayer();
}
public void onBackPressed() {
super.onBackPressed();
}
@Override
protected void onNewIntent(Intent intent) {
this.name = intent.getStringExtra(ConditionalUserProperty.NAME);
this.videourl = intent.getStringExtra("videourl");
releaseplayer();
initplayer();
super.onNewIntent(intent);
}
private void startPictureInPictureFeature() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Rational aspectRatio = new Rational(2, 1);
pictureInPictureParamsBuilder= new PictureInPictureParams.Builder();
Rational aspectRatio = new Rational(16, 9);
pictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
enterPictureInPictureMode(pictureInPictureParamsBuilder.build());
}
}
@Override
public void onUserLeaveHint() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (!isInPictureInPictureMode()) {
Rational aspectRatio = new Rational(binding.videoView.getWidth(), binding.videoView.getHeight());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
try {
pictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
enterPictureInPictureMode(pictureInPictureParamsBuilder.build());
releaseplayer();
} catch (Exception e) {
Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
}
}
}
}
}
@Override
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode,
Configuration newConfig) {
if (isInPictureInPictureMode) {
} else {
}
}
}
RateUsWebView.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityRateUsWebViewBinding;
import com.infusiblecoder.allinonevideodownloader.utils.LocaleHelper;
public class RateUsWebView extends AppCompatActivity {
private ActivityRateUsWebViewBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rate_us_web_view);
binding = ActivityRateUsWebViewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
Intent i = getIntent();
String url = i.getStringExtra("link");
binding.webviewView.loadUrl(url);
}
@Override
protected void attachBaseContext(Context newBase) {
newBase = LocaleHelper.onAttach(newBase);
super.attachBaseContext(newBase);
}
}
SplashScreen.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivitySplashScreenBinding;
import com.infusiblecoder.allinonevideodownloader.facebookstorysaver.FacebookPrivateWebview;
import com.infusiblecoder.allinonevideodownloader.utils.LocaleHelper;
public class SplashScreen extends AppCompatActivity {
private ActivitySplashScreenBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
binding = ActivitySplashScreenBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
new CountDownTimer(1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
startActivity(new Intent(SplashScreen.this, MainActivity.class));
finish();
}
}.start();
}
@Override
protected void attachBaseContext(Context newBase) {
newBase = LocaleHelper.onAttach(newBase);
super.attachBaseContext(newBase);
}
}
TikTokDownloadWebview.java
package com.infusiblecoder.allinonevideodownloader;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.ConsoleMessage;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.PermissionRequest;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityTikTokDownloadWebviewBinding;
import com.infusiblecoder.allinonevideodownloader.tasks.downloadFile;
import com.infusiblecoder.allinonevideodownloader.utils.iUtils;
import org.json.JSONObject;
public class TikTokDownloadWebview extends AppCompatActivity {
public static Handler handler;
private static ValueCallback mUploadMessageArr;
String TAG = "whatsapptag";
boolean doubleBackToExitPressedOnce = false;
private ActivityTikTokDownloadWebviewBinding binding;
boolean isdownloadstarted = false;
ProgressDialog progressDialog;
static String myvidintenturlis = "";
@SuppressLint("HandlerLeak")
private class btnInitHandlerListner extends Handler {
@SuppressLint({"SetTextI18n"})
public void handleMessage(Message msg) {
}
}
private class webChromeClients extends WebChromeClient {
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
Log.e("CustomClient", consoleMessage.message());
return super.onConsoleMessage(consoleMessage);
}
}
private class MyBrowser extends WebViewClient {
public void onPageStarted(WebView view, String url, Bitmap favicon) {
binding.progressBar.setVisibility(View.VISIBLE);
Log.e(TAG, "binding.progressBar");
super.onPageStarted(view, url, favicon);
}
public boolean shouldOverrideUrlLoading(WebView view, String request) {
view.loadUrl(request);
return true;
}
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.e(TAG, "binding.progressBar GONE");
binding.progressBar.setVisibility(View.GONE);
String jsscript = "javascript:(function() { "
+ "document.getElementById(\"main_page_text\").value ='" + myvidintenturlis + "';"
+ "document.getElementById(\"submit\").click();"
// + "await new Promise(resolve => setTimeout(resolve, 3000)); "
// + "javascript:document.getElementsByClassName(\"pure-button pure-button-primary is-center u-bl dl-button download_link without_watermark_direct\").click(); "
+ "})();";
view.evaluateJavascript(jsscript, new ValueCallback() {
public void onReceiveValue(Object obj) {
Log.e(TAG, "binding.progressBar reciveing data " + obj.toString());
}
});
try {
Handler handler1 = new Handler();
handler1.postDelayed(new Runnable() {
@Override
public void run() {
Log.e(TAG, "binding.progressBar reciveing data executed 1");
// binding.webViewscan.loadUrl("javascript:window.HTMLOUT.showHTML('" + url + "',''+document.getElementsByTagName('audio')[0].getAttribute(\"src\"));");
view.evaluateJavascript("javascript:document.getElementsByTagName('a')[5].getAttribute('href')", new ValueCallback() {
public void onReceiveValue(Object obj) {
Log.e(TAG, "binding.progressBar reciveing data download " + obj.toString());
if (obj.toString() != null && obj.toString().contains("http")) {
Log.e(TAG, "binding.progressBar reciveing data http " + obj.toString());
handler1.removeCallbacksAndMessages(null);
if (!isdownloadstarted) {
new downloadFile().Downloading(TikTokDownloadWebview.this, obj.toString(), "Tiktok_" + System.currentTimeMillis(), ".mp4");
isdownloadstarted = true;
}
// startActivity(new Intent(TikTokDownloadWebview.this,MainActivity.class));
finish();
}
}
});
handler1.postDelayed(this, 2000);
}
}, 2000);
} catch (Exception e) {
finish();
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
binding = ActivityTikTokDownloadWebviewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
setSupportActionBar(binding.tool12);
InitHandler();
progressDialog = new ProgressDialog(TikTokDownloadWebview.this);
progressDialog.setMessage(getString(R.string.nodeifittakeslonger));
progressDialog.show();
if (getIntent().getStringExtra("myvidurl") != null && !getIntent().getStringExtra("myvidurl").equals("")) {
myvidintenturlis = getIntent().getStringExtra("myvidurl");
}
binding.opentiktok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.tiktok.com/"));
intent.setPackage("com.zhiliaoapp.musically");
startActivity(intent);
} catch (ActivityNotFoundException e) {
iUtils.ShowToast(TikTokDownloadWebview.this, "Tiktok not Installed");
}
}
});
if (Build.VERSION.SDK_INT >= 24) {
onstart();
binding.webViewscan.clearFormData();
binding.webViewscan.getSettings().setSaveFormData(true);
// binding.webViewscan.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0");
binding.webViewscan.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
// binding.webViewscan.setWebChromeClient(new webChromeClients());
binding.webViewscan.setWebViewClient(new MyBrowser());
binding.webViewscan.getSettings().setAppCacheMaxSize(5242880);
binding.webViewscan.getSettings().setAllowFileAccess(true);
binding.webViewscan.getSettings().setAppCacheEnabled(true);
binding.webViewscan.getSettings().setJavaScriptEnabled(true);
binding.webViewscan.getSettings().setDefaultTextEncodingName("UTF-8");
binding.webViewscan.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
binding.webViewscan.getSettings().setDatabaseEnabled(true);
binding.webViewscan.getSettings().setBuiltInZoomControls(false);
binding.webViewscan.getSettings().setSupportZoom(true);
binding.webViewscan.getSettings().setUseWideViewPort(true);
binding.webViewscan.getSettings().setDomStorageEnabled(true);
binding.webViewscan.getSettings().setLoadsImagesAutomatically(true);
binding.webViewscan.getSettings().setBlockNetworkImage(false);
binding.webViewscan.getSettings().setBlockNetworkLoads(false);
binding.webViewscan.getSettings().setLoadWithOverviewMode(true);
binding.webViewscan.setWebChromeClient(new WebChromeClient() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onPermissionRequest(final PermissionRequest request) {
request.grant(request.getResources());
}
});
binding.webViewscan.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
String nametitle = "tiktokvideo_" +
System.currentTimeMillis();
new downloadFile().Downloading(TikTokDownloadWebview.this, url, nametitle, ".mp4");
}
});
binding.webViewscan.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if (progress < 100 && binding.progressBar.getVisibility() == View.GONE) {
binding.progressBar.setVisibility(View.VISIBLE);
}
binding.progressBar.setProgress(progress);
if (progress == 100) {
binding.progressBar.setVisibility(View.GONE);
}
}
});
binding.webViewscan.loadUrl("https://ssstiktok.io/");
} else {
onstart();
binding.webViewscan.clearFormData();
binding.webViewscan.getSettings().setSaveFormData(true);
// binding.webViewscan.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0");
binding.webViewscan.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
// binding.webViewscan.setWebChromeClient(new webChromeClients());
binding.webViewscan.setWebViewClient(new MyBrowser());
binding.webViewscan.getSettings().setAppCacheMaxSize(5242880);
binding.webViewscan.getSettings().setAllowFileAccess(true);
binding.webViewscan.getSettings().setAppCacheEnabled(true);
binding.webViewscan.getSettings().setJavaScriptEnabled(true);
binding.webViewscan.getSettings().setDefaultTextEncodingName("UTF-8");
binding.webViewscan.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
binding.webViewscan.getSettings().setDatabaseEnabled(true);
binding.webViewscan.getSettings().setBuiltInZoomControls(false);
binding.webViewscan.getSettings().setSupportZoom(false);
binding.webViewscan.getSettings().setUseWideViewPort(true);
binding.webViewscan.getSettings().setDomStorageEnabled(true);
binding.webViewscan.getSettings().setAllowFileAccess(true);
binding.webViewscan.getSettings().setLoadWithOverviewMode(true);
binding.webViewscan.getSettings().setLoadsImagesAutomatically(true);
binding.webViewscan.getSettings().setBlockNetworkImage(false);
binding.webViewscan.getSettings().setBlockNetworkLoads(false);
binding.webViewscan.getSettings().setLoadWithOverviewMode(true);
binding.webViewscan.setWebChromeClient(new WebChromeClient() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onPermissionRequest(final PermissionRequest request) {
request.grant(request.getResources());
}
});
binding.webViewscan.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
String nametitle = "tiktokvideo_" +
System.currentTimeMillis();
new downloadFile().Downloading(TikTokDownloadWebview.this, url, nametitle, ".mp4");
}
});
binding.webViewscan.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if (progress < 100 && binding.progressBar.getVisibility() == View.GONE) {
binding.progressBar.setVisibility(View.VISIBLE);
}
binding.progressBar.setProgress(progress);
if (progress == 100) {
binding.progressBar.setVisibility(View.GONE);
}
}
});
binding.webViewscan.loadUrl("https://ssstiktok.io/");
}
}
public void onstart() {
if (Build.VERSION.SDK_INT >= 23) {
requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_PHONE_STATE", "android.permission.ACCESS_COARSE_LOCATION", "android.permission.EXPAND_STATUS_BAR"}, 123);
}
}
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 1001 && Build.VERSION.SDK_INT >= 21) {
mUploadMessageArr.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(i2, intent));
mUploadMessageArr = null;
}
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
boolean z = true;
if (keyCode == 4) {
try {
if (binding.webViewscan.canGoBack()) {
binding.webViewscan.goBack();
return z;
}
} catch (Exception e) {
e.printStackTrace();
}
}
finish();
z = super.onKeyDown(keyCode, event);
return z;
}
@SuppressLint({"WrongConstant"})
@RequiresApi(api = 21)
public void onBackPressed() {
if (this.doubleBackToExitPressedOnce) {
super.onBackPressed();
finish();
return;
}
this.doubleBackToExitPressedOnce = true;
Toast.makeText(this, getString(R.string.pressagain), Toast.LENGTH_LONG).show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce = false;
}
}, 2000);
}
protected void onResume() {
super.onResume();
}
public void onPause() {
super.onPause();
binding.webViewscan.clearCache(true);
}
public void onDestroy() {
super.onDestroy();
binding.webViewscan.clearCache(true);
}
public void onStart() {
super.onStart();
}
public void onStop() {
binding.webViewscan.clearCache(true);
super.onStop();
}
public boolean onSupportNavigateUp() {
finish();
return true;
}
@SuppressLint({"HandlerLeak"})
private void InitHandler() {
handler = new btnInitHandlerListner();
}
// public void a(String str, int i) {
// String str2 = "";
// if (i == 1) {
// str2 = "https://snaptik.app/";
// i = "function get_snaptik(url){var input=document.querySelector('input');if(input){input.value=url;var button=document.querySelector('button[type=\"submit\"]');if(button){button.click();execute()}}}var phxVideoIsFound=false;var phxVideoSpiderTicks=0;var phxTimerId=-1;function execute(){if(phxVideoIsFound||phxVideoSpiderTicks>=15){clearTimeout(phxTimerId);phxTimerId=-1;phxVideoIsFound=false;phxVideoSpiderTicks=0;return}phxVideoSpiderTicks++;phxTimerId=setTimeout(\"getData()\",1000)}function getData(){var data={};var abuttons=document.querySelector('.abuttons');if(abuttons){var array=abuttons.querySelectorAll('a');for(var i=0;i0){data.video_no_mark_url_2=array[i].href;phxVideoIsFound=true}else if(cls.lastIndexOf('without_watermark')>0){data.video_no_mark_url=array[i].href;phxVideoIsFound=true}else if(cls.indexOf('music')>0){data.mp3_url=array[i].href}}if(phxVideoIsFound){phoenix.OnVideoFound(JSON.stringify(data))}}if(!phxVideoIsFound){execute()}}";
// } else if (i == 3) {
// str2 = "https://ttdownloader.com/";
// i = "function get_snaptik(url){var input=document.querySelector('input');if(input){input.value=url;var button=document.querySelector('button[id=\"submit\"]');if(button){button.click();execute()}}}var phxVideoIsFound=false;var phxVideoSpiderTicks=0;var phxTimerId=-1;function execute(){if(phxVideoIsFound||phxVideoSpiderTicks>=15){clearTimeout(phxTimerId);phxTimerId=-1;phxVideoIsFound=false;phxVideoSpiderTicks=0;return}phxVideoSpiderTicks++;phxTimerId=setTimeout(\"getData()\",1000)}function getData(){var data={};var list=document.querySelector('.results-list');if(list){var a=list.querySelector('a');if(a){phxVideoIsFound=true;data.video_no_mark_url=a.href}}if(phxVideoIsFound){phoenix.OnVideoFound(JSON.stringify(data))}if(!phxVideoIsFound){execute()}}";
// } else if (i == 4) {
// str2 = "https://musicallydown.com/";
// i = "function get_snaptik(url){var input=document.querySelector('input');if(input){input.value=url;var button=document.querySelector('button[type=\"submit\"]');if(button){button.click();execute()}}else{execute()}}var phxVideoIsFound=false;var phxVideoSpiderTicks=0;var phxTimerId=-1;function execute(){if(phxVideoIsFound||phxVideoSpiderTicks>=15){clearTimeout(phxTimerId);phxTimerId=-1;phxVideoIsFound=false;phxVideoSpiderTicks=0;return}phxVideoSpiderTicks++;phxTimerId=setTimeout(\"getData()\",1000)}function getData(){var data={};var array=document.querySelectorAll('a');for(var i=0;i0){data.video_no_mark_url=url;phxVideoIsFound=true}}}var a=document.querySelector('a[rel=\"noreferrer\"]');if(a&&data.video_no_mark_url==undefined){phxVideoIsFound=true;data.video_no_mark_url=a.href}if(phxVideoIsFound){phoenix.OnVideoFound(JSON.stringify(data))}if(!phxVideoIsFound){execute()}}";
// } else {
// i = str2;
// }
// this.g = new d(str2, i);
// a(str);
// }
}
VideoPlayActivity2.java
package com.infusiblecoder.allinonevideodownloader;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import com.google.android.material.snackbar.Snackbar;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityPlayBinding;
import com.infusiblecoder.allinonevideodownloader.databinding.ActivityVideoPlay2Binding;
import com.universalvideoview.UniversalMediaController;
import com.universalvideoview.UniversalVideoView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class VideoPlayActivity2 extends AppCompatActivity {
String urls;
private ActivityVideoPlay2Binding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityVideoPlay2Binding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
try {
urls = getIntent().getStringExtra("videourl");
binding.videoView.setMediaController(binding.mediaController);
binding.videoView.setVideoURI(Uri.parse(urls));
binding.videoView.setVideoViewCallback(new UniversalVideoView.VideoViewCallback() {
@Override
public void onScaleChange(boolean isFullscreen) {
}
@Override
public void onPause(MediaPlayer mediaPlayer) { // Video pause
}
@Override
public void onStart(MediaPlayer mediaPlayer) { // Video start/resume to play
}
@Override
public void onBufferingStart(MediaPlayer mediaPlayer) {// steam start loading
}
@Override
public void onBufferingEnd(MediaPlayer mediaPlayer) {// steam end loading
}
});
binding.storyVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.storyVideo.setVisibility(View.GONE);
binding.videoView.start();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
Please do not enter any spam link in the comment box.