Skip to content

Commit

Permalink
Merge pull request #22 from daktak/development
Browse files Browse the repository at this point in the history
0.4.6
  • Loading branch information
daktak authored Apr 28, 2018
2 parents 4b8d3ac + bbcf728 commit 61268f8
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea
.DS_Store
/build
/captures
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

7 changes: 1 addition & 6 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android:
- tools
- platform-tools
- tools
- build-tools-23.0.2
- android-24
- build-tools-25.0.3
- android-25
script:
- ./gradlew build check
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion '23.0.2'
compileSdkVersion 25
buildToolsVersion '25.0.3'

defaultConfig {
applicationId "org.afhdownloader"
minSdkVersion 16
targetSdkVersion 24
versionCode 10
versionName "0.4.5"
targetSdkVersion 25
versionCode 11
versionName "0.4.6"
}
buildTypes {
release {
Expand All @@ -22,14 +22,14 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'org.jsoup:jsoup:1.9.1'
}

android {
lintOptions {
disable 'TrustAllX509TrustManager','UnusedResources','GoogleAppIndexingWarning','IconDipSize','IconLocation','IconMissingDensityFolder'
disable 'TrustAllX509TrustManager','UnusedResources','GoogleAppIndexingWarning','IconDipSize','IconLocation','IconMissingDensityFolder','ObsoleteSdkInt','MissingTranslation'
checkReleaseBuilds false
}
}
13 changes: 7 additions & 6 deletions app/src/main/java/org/afhdownloader/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.net.URLDecoder;


/**
Expand Down Expand Up @@ -137,11 +138,7 @@ public String getMD5(String url) {
Log.d(LOGTAG, "md5 url: "+url);
String userAgent = getString(R.string.user_agent);
Document doc = Jsoup.connect(url).timeout(10 * 1000).followRedirects(true).userAgent(userAgent).get();
/*
SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String select_md5 = mySharedPreferences.getString("prefSelector",getString(R.string.md5_sel_val)).trim();
*/
String select_md5 = "span:has(span:containsOwn(md5))";
String select_md5 = getString(R.string.md5_sel_val);
Log.d(LOGTAG, "md5 selector: "+select_md5);
Elements md5s = doc.select(select_md5);
for (Element md5 : md5s) {
Expand Down Expand Up @@ -212,9 +209,13 @@ private class dlMd5 extends AsyncTask<String, Void, String> {
protected String doInBackground(String... strings) {
try {
String aUrl = strings[0];
String md5_ext = getString(R.string.md5_ext);
int slash = aUrl.lastIndexOf("/");
String filename = aUrl.substring(slash+1)+".md5";
String filename = aUrl.substring(slash+1);
filename = URLDecoder.decode(filename) + md5_ext;
Log.d(LOGTAG,"Saving File: "+filename);
String body = getMD5(getBaseUrl()+"/?"+strings[1]);
Log.d(LOGTAG,"Found MD5: "+body);
FileOutputStream fileout=openFileOutput(filename, MODE_PRIVATE);
OutputStreamWriter outputWriter=new OutputStreamWriter(fileout);
outputWriter.write(body);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/afhdownloader/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
setAlarm(this);
return true;
}
if (id == R.id.action_refresh) {
run(this);
}
if (id == R.id.action_reboot) {
ExecuteAsRootBase e = new ExecuteAsRootBase() {
@Override
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/org/afhdownloader/PrefsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class PrefsFragment extends PreferenceFragment {

@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class SetPreferenceActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
return false;
}

// TODO: ensure this is a finger, and set a flag

// Find the child view that was touched (perform a hit test)
Rect rect = new Rect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public boolean onTouch(View view, MotionEvent motionEvent) {

switch (motionEvent.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
// TODO: ensure this is a finger, and set a flag
mDownX = motionEvent.getRawX();
mDownY = motionEvent.getRawY();
if (mCallbacks.canDismiss(mToken)) {
Expand Down Expand Up @@ -244,7 +243,6 @@ public void onAnimationEnd(Animator animation) {
if (mSwiping) {
mTranslationX = deltaX;
mView.setTranslationX(deltaX - mSwipingSlop);
// TODO: use an ease-out interpolator or such
mView.setAlpha(Math.max(0f, Math.min(1f,
1f - 2f * Math.abs(deltaX) / mViewWidth)));
view.performClick();
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
<item
android:id="@+id/action_refresh"
android:orderInCategory="99"
android:title="@string/action_refresh"
app:showAsAction="never" />
<item
android:id="@+id/action_reboot"
android:orderInCategory="99"
android:orderInCategory="98"
android:title="@string/action_reboot"
app:showAsAction="never" />
</menu>
2 changes: 1 addition & 1 deletion app/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="mirrordata_val">submit=submit&amp;action=getdownloadmirrors&amp;</string>
<string name="selector_val" translatable="false">div[class=file-name] > h3 > a[href^=/?fid=]</string>
<string name="md5_sel_val" tranlatable="false">span:has(span:containsOwn(md5))</string>
<string name="base_val" translatable="false">https://www.androidfilehost.com</string>
<string name="base_val" translatable="false">https://androidfilehost.com</string>
<string name="flid_val" translatable="false">39788</string>
<string name="hour_val" translatable="false">3</string>
<string name="minute_val" translatable="false">0</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="delete">Delete</string>
<string name="action_refresh">Refresh</string>
</resources>

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Sat Oct 21 22:43:10 AEDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

0 comments on commit 61268f8

Please sign in to comment.