Browse Source

Migrate to GitLab

master
Trevor Slocum 3 years ago
parent
commit
dafd8a263c
  1. 9
      README.md
  2. 28
      app/bind.sh
  3. 6
      app/build.gradle
  4. 2
      app/src/androidTest/java/space/rocketnine/gophast/ExampleInstrumentedTest.java
  5. 4
      app/src/main/java/space/rocketnine/gophast/AboutActivity.java
  6. 4
      app/src/main/java/space/rocketnine/gophast/DownloadRunnable.java
  7. 18
      app/src/main/java/space/rocketnine/gophast/GoPhast.java
  8. 6
      app/src/main/java/space/rocketnine/gophast/SettingsActivity.java
  9. 2
      build.gradle
  10. 4
      gradle/wrapper/gradle-wrapper.properties

9
README.md

@ -1,7 +1,8 @@
# GoPhast-Android
# gophast-android
[![GoDoc](https://godoc.org/gitlab.com/tslocum/gophast-android?status.svg)](https://godoc.org/gitlab.com/tslocum/gophast-android)
[![Donate](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
This application manages and accelerates downloads by using multiple connections.
Download manager and accelerator for Android
## Download
@ -12,5 +13,5 @@ This application manages and accelerates downloads by using multiple connections
## Support
- Ensure you are running the latest version of GoPhast-Android.
- Review the [open issues](https://todo.sr.ht/~tslocum/gophast-android).
- Open a [new issue](https://todo.sr.ht/~tslocum/gophast-android).
- Review the [open issues](https://gitlab.com/tslocum/gophast-android/issues).
- Open a [new issue](https://gitlab.com/tslocum/gophast-android/issues).

28
app/bind.sh

@ -1,8 +1,8 @@
#!/bin/bash
PROJECTPATH=$PWD
GOPATH="$PWD/go"
GO111MODULE=off
GOPATH="$PROJECTPATH/go"
GO111MODULE=on
if [ -z "$1" ]; then
echo "Usage: ./bind.sh <tag>"
@ -10,23 +10,27 @@ if [ -z "$1" ]; then
fi
echo "Installing/updating gomobile..."
GOPATH="$PROJECTPATH/go" go get -u golang.org/x/mobile/cmd/gomobile
echo $GOPATH
go get -u golang.org/x/mobile/cmd/...
go install golang.org/x/mobile/cmd/...
go get golang.org/x/mobile/cmd/gomobile
echo "Installing/updating gophast "`printf %q "$1"`"..."
mkdir -p $GOPATH/src/git.sr.ht/~tslocum
if [ ! -d "$GOPATH/src/git.sr.ht/~tslocum/gophast" ]; then
git clone https://git.sr.ht/~tslocum/gophast $GOPATH/src/git.sr.ht/~tslocum/gophast
mkdir -p $GOPATH/src/gitlab.com/tslocum
if [ ! -d "$GOPATH/src/gitlab.com/tslocum/gophast" ]; then
git clone https://gitlab.com/tslocum/gophast $GOPATH/src/gitlab.com/tslocum/gophast
fi
cd $GOPATH/src/git.sr.ht/~tslocum/gophast && git fetch origin && git reset --hard `printf %q "$1"` && cd $PROJECTPATH
cd $GOPATH/src/gitlab.com/tslocum/gophast && git fetch origin && git reset --hard `printf %q "$1"` && cd $PROJECTPATH
echo "Downloading dependencies..."
cd $GOPATH/src/git.sr.ht/~tslocum/gophast
go mod vendor
cd $PROJECTPATH
#echo "Downloading dependencies..."
#cd $GOPATH/src/gitlab.com/tslocum/gophast
#go mod vendor
#cd $PROJECTPATH
echo "Binding library..."
mkdir -p libs
GOPATH="$PROJECTPATH/go" $GOPATH/bin/gomobile bind -tags=android -ldflags "-X git.sr.ht/~tslocum/gophast/pkg/config.Version=`git -C $GOPATH/src/git.sr.ht/~tslocum/gophast describe --tags $(git -C $GOPATH/src/git.sr.ht/~tslocum/gophast rev-list --tags --max-count=1)`" -o libs/gophast.aar -target=android -androidapi=16 git.sr.ht/~tslocum/gophast/pkg/manager
PATH="$PROJECTPATH/go/bin:$PATH"
$GOPATH/bin/gomobile bind -javapkg space.rocketnine.gophast -tags=android -ldflags "-X gitlab.com/tslocum/gophast/pkg/config.Version=`git -C $GOPATH/src/gitlab.com/tslocum/gophast describe --tags $(git -C $GOPATH/src/gitlab.com/tslocum/gophast rev-list --tags --max-count=1)`" -o libs/gophast.aar -target=android -androidapi=16 gitlab.com/tslocum/gophast/pkg/manager
echo "Finished."

6
app/build.gradle

@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
project.ext {
libraryVersion = "0.1.6" // https://git.sr.ht/~tslocum/gophast/refs
libraryVersion = "0.1.7" // https://gitlab.com/tslocum/gophast/-/tags
}
android {
@ -13,8 +13,8 @@ android {
minSdkVersion 16
targetSdkVersion 28
versionCode 1014
versionName "0.1.4"
versionCode 1015
versionName "0.1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

2
app/src/androidTest/java/space/rocketnine/gophast/ExampleInstrumentedTest.java

@ -7,7 +7,7 @@ import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Instrumented test, which will execute on an Android device.

4
app/src/main/java/space/rocketnine/gophast/AboutActivity.java

@ -9,6 +9,8 @@ import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import space.rocketnine.gophast.manager.Manager;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -28,7 +30,7 @@ public class AboutActivity extends AppCompatActivity {
TextView txtAboutTitle = findViewById(R.id.txtAboutTitle);
txtAboutTitle.setText(String.format(getString(R.string.aboutGoPhastTitle), appVersion));
String goPhastVersion = manager.Manager.getGoPhastVersion();
String goPhastVersion = Manager.getGoPhastVersion();
if (goPhastVersion.trim().isEmpty()) {
goPhastVersion = "?";
}

4
app/src/main/java/space/rocketnine/gophast/DownloadRunnable.java

@ -8,8 +8,8 @@ import android.util.Log;
import java.util.Arrays;
import manager.Manager;
import manager.NewDownloadInfo;
import space.rocketnine.gophast.manager.Manager;
import space.rocketnine.gophast.manager.NewDownloadInfo;
class DownloadRunnable implements Runnable {
Download d;

18
app/src/main/java/space/rocketnine/gophast/GoPhast.java

@ -31,9 +31,9 @@ import java.util.Iterator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import manager.Manager;
import manager.Metadata;
import manager.NewDownloadInfo;
import space.rocketnine.gophast.manager.Manager;
import space.rocketnine.gophast.manager.Metadata;
import space.rocketnine.gophast.manager.NewDownloadInfo;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
@ -62,7 +62,7 @@ public class GoPhast extends Application {
wakeLocker = new WakeLocker();
try {
manager.Manager.initialize(2);
Manager.initialize(2);
} catch (Exception e) {
e.printStackTrace();
return;
@ -75,20 +75,20 @@ public class GoPhast extends Application {
} catch (PackageManager.NameNotFoundException e) {
appVersion = "?";
}
manager.Manager.setUserAgentExtra("gophast-android/" + appVersion + " (https://git.sr.ht/~tslocum/gophast-android)");
Manager.setUserAgentExtra("gophast-android/" + appVersion + " (https://gitlab.com/tslocum/gophast-android)");
manager.Manager.setForce(true);
Manager.setForce(true);
setDownloadDir("");
Long minSplitSize = Long.valueOf(getPrefs().getString("pref_minsplitsize", "10485760"));
if (minSplitSize >= 0) {
manager.Manager.setMinSplitSize(minSplitSize);
Manager.setMinSplitSize(minSplitSize);
}
Long maxConnections = Long.valueOf(getPrefs().getString("pref_maxconnections", "3"));
if (maxConnections >= 0) {
manager.Manager.setMaxConnections(maxConnections);
Manager.setMaxConnections(maxConnections);
}
downloads = new ArrayList<Download>();
@ -426,7 +426,7 @@ public class GoPhast extends Application {
}
Log.d("gophast", "Setting download directory to " + downloadDir);
manager.Manager.setDownloadDir(downloadDir);
Manager.setDownloadDir(downloadDir);
}
public void animateShowView(Context ctx, View v, int animation) {

6
app/src/main/java/space/rocketnine/gophast/SettingsActivity.java

@ -30,6 +30,8 @@ import com.nononsenseapps.filepicker.Utils;
import java.io.File;
import java.util.List;
import space.rocketnine.gophast.manager.Manager;
public class SettingsActivity extends PreferenceActivity {
private static final boolean FORCE_TABLET_VIEW = false;
public DownloadPreferenceFragment downloadPreferenceFragment = null;
@ -54,12 +56,12 @@ public class SettingsActivity extends PreferenceActivity {
} else if (preference.getKey().equals("pref_minsplitsize")) {
preference.setSummary(Formatter.formatShortFileSize(SettingsActivity.this, Long.valueOf(value.toString())));
if (Long.valueOf(value.toString()) >= 0) {
manager.Manager.setMinSplitSize(Long.valueOf(value.toString()));
Manager.setMinSplitSize(Long.valueOf(value.toString()));
}
} else if (preference.getKey().equals("pref_maxconnections")) {
preference.setSummary(String.format(getString(R.string.maxconnections_summary), value.toString()));
if (Long.valueOf(value.toString()) >= 0) {
manager.Manager.setMaxConnections(Long.valueOf(value.toString()));
Manager.setMaxConnections(Long.valueOf(value.toString()));
}
}

2
build.gradle

@ -5,7 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

4
gradle/wrapper/gradle-wrapper.properties vendored

@ -1,6 +1,6 @@
#Thu May 09 04:45:18 PDT 2019
#Thu Dec 26 20:12:55 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Loading…
Cancel
Save