Skip to content

Commit

Permalink
problem in settingsFragment; removed bug in log code; inc versionCode
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelessjolt committed Dec 7, 2018
1 parent b9194b9 commit b4e4b3d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "me.harshithgoka.youtubedl"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionCode 13
versionName "0.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -36,14 +36,14 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.github.codekidX:storage-chooser:2.0.4.2'

implementation 'com.github.tony19:named-regexp:0.2.5'
implementation 'com.google.code.gson:gson:2.8.5'

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

implementation 'com.github.codekidX:storage-chooser:2.0.4.2'
implementation 'com.googlecode.mp4parser:isoparser:1.1.21'

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ public boolean onOptionsItemSelected(MenuItem item) {

switch (id) {
case R.id.action_settings:
openSettingPage();
Toast.makeText(getApplicationContext(), "Coming soon", Toast.LENGTH_LONG).show();
// openSettingPage();
return true;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import android.view.ViewGroup
import android.widget.TextView
import android.widget.Toast

import com.codekidlabs.storagechooser.StorageChooser
import com.codekidlabs.storagechooser.utils.DiskUtil
//import com.codekidlabs.storagechooser.StorageChooser
//import com.codekidlabs.storagechooser.utils.DiskUtil

import androidx.core.content.res.ResourcesCompat
import androidx.preference.EditTextPreference
Expand Down Expand Up @@ -78,32 +78,32 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP

override fun onPreferenceClick(preference: Preference): Boolean {
if (preference.key == downloadFolderPref!!.key) {
val theme = StorageChooser.Theme(context)

val myScheme = theme.defaultScheme
myScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = ResourcesCompat.getColor(resources, R.color.colorAccent, context!!.theme)
myScheme[StorageChooser.Theme.SEC_FOLDER_TINT_INDEX] = ResourcesCompat.getColor(resources, R.color.colorPrimary, context!!.theme)
myScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = ResourcesCompat.getColor(resources, R.color.colorAccent, context!!.theme)
theme.scheme = myScheme

val chooser = StorageChooser.Builder()
.allowCustomPath(true)
.setType(StorageChooser.DIRECTORY_CHOOSER)
.withActivity(activity)
.withFragmentManager(activity!!.fragmentManager)
.withMemoryBar(true)
.setTheme(theme)
.build()

chooser.show()

// get path that the user has chosen
chooser.setOnSelectListener { path ->
Log.d("SELECTED_PATH", path)
downloadFolderPref!!.text = path
downloadFolderPref!!.summary = path
}
return true
// val theme = StorageChooser.Theme(context)
//
// val myScheme = theme.defaultScheme
// myScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = ResourcesCompat.getColor(resources, R.color.colorAccent, context!!.theme)
// myScheme[StorageChooser.Theme.SEC_FOLDER_TINT_INDEX] = ResourcesCompat.getColor(resources, R.color.colorPrimary, context!!.theme)
// myScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = ResourcesCompat.getColor(resources, R.color.colorAccent, context!!.theme)
// theme.scheme = myScheme
//
// val chooser = StorageChooser.Builder()
// .allowCustomPath(true)
// .setType(StorageChooser.DIRECTORY_CHOOSER)
// .withActivity(activity)
// .withFragmentManager(activity!!.fragmentManager)
// .withMemoryBar(true)
// .setTheme(theme)
// .build()
//
// chooser.show()
//
// // get path that the user has chosen
// chooser.setOnSelectListener { path ->
// Log.d("SELECTED_PATH", path)
// downloadFolderPref!!.text = path
// downloadFolderPref!!.summary = path
// }
// return true
}
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,20 @@ else if (params.contains("s")) {
m.find();
String player_url = m.group(1);
player_url = new JSONObject("{ \"str\" :" + player_url + "}").getString("str");
// < Only for verbose logging >
// String player_version = "unknown";
// String player_desc = "unknown";
// Pattern playerType = Pattern.compile("(html5player-([^/]+?)(?:/html5player(?:-new)?)?\\.js)|((?:www|player)-([^/]+)(?:/[a-z]{2}_[A-Z]{2})?/base\\.js)");
// m = playerType.matcher(player_url);
// if (!m.find()) {
// Log.d("ERR", "Couldn't find Player URL");
// Log.d("ERR", response);
// }
// else {
// player_version = m.group();
// player_desc = "html5 player " + player_version;
// }

Pattern playerType = Pattern.compile("(html5player-([^/]+?)(?:/html5player(?:-new)?)?\\.js)|((?:www|player)-([^/]+)(?:/[a-z]{2}_[A-Z]{2})?/base\\.js)");
m = playerType.matcher(player_url);
if (!m.find()) {
Log.d("ERR", "Couldn't find Player URL");
Log.d("ERR", response);
}

String player_version = m.group();
String player_desc = "html5 player " + player_version;
String encrypted_signature = query_pairs.get("s");
String videoID = getID(you_url);

Expand Down

0 comments on commit b4e4b3d

Please sign in to comment.