mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-17 07:14:54 +00:00
resolve conflict
This commit is contained in:
commit
719140ab78
@ -56,7 +56,6 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:77a74b8'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:77a74b8'
|
||||||
|
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:1.10.19'
|
testImplementation 'org.mockito:mockito-core:1.10.19'
|
||||||
|
|
||||||
@ -66,7 +65,6 @@ dependencies {
|
|||||||
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
|
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
|
||||||
implementation "com.android.support:preference-v14:$supportLibVersion"
|
implementation "com.android.support:preference-v14:$supportLibVersion"
|
||||||
|
|
||||||
implementation 'com.google.code.gson:gson:2.8.2'
|
|
||||||
implementation 'ch.acra:acra:4.9.2'
|
implementation 'ch.acra:acra:4.9.2'
|
||||||
|
|
||||||
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||||
|
@ -32,7 +32,6 @@ public class AboutActivity extends AppCompatActivity {
|
|||||||
new SoftwareComponent("Giga Get", "2014", "Peter Cai", "https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL2),
|
new SoftwareComponent("Giga Get", "2014", "Peter Cai", "https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL2),
|
||||||
new SoftwareComponent("NewPipe Extractor", "2017", "Christian Schabesberger", "https://github.com/TeamNewPipe/NewPipeExtractor", StandardLicenses.GPL3),
|
new SoftwareComponent("NewPipe Extractor", "2017", "Christian Schabesberger", "https://github.com/TeamNewPipe/NewPipeExtractor", StandardLicenses.GPL3),
|
||||||
new SoftwareComponent("Jsoup", "2017", "Jonathan Hedley", "https://github.com/jhy/jsoup", StandardLicenses.MIT),
|
new SoftwareComponent("Jsoup", "2017", "Jonathan Hedley", "https://github.com/jhy/jsoup", StandardLicenses.MIT),
|
||||||
new SoftwareComponent("Google Gson", "2008", "Google Inc", "https://github.com/google/gson", StandardLicenses.APACHE2),
|
|
||||||
new SoftwareComponent("Rhino", "2015", "Mozilla", "https://www.mozilla.org/rhino/", StandardLicenses.MPL2),
|
new SoftwareComponent("Rhino", "2015", "Mozilla", "https://www.mozilla.org/rhino/", StandardLicenses.MPL2),
|
||||||
new SoftwareComponent("ACRA", "2013", "Kevin Gaudin", "http://www.acra.ch", StandardLicenses.APACHE2),
|
new SoftwareComponent("ACRA", "2013", "Kevin Gaudin", "http://www.acra.ch", StandardLicenses.APACHE2),
|
||||||
new SoftwareComponent("Universal Image Loader", "2011 - 2015", "Sergey Tarasevich", "https://github.com/nostra13/Android-Universal-Image-Loader", StandardLicenses.APACHE2),
|
new SoftwareComponent("Universal Image Loader", "2011 - 2015", "Sergey Tarasevich", "https://github.com/nostra13/Android-Universal-Image-Loader", StandardLicenses.APACHE2),
|
||||||
|
@ -2,17 +2,12 @@ package org.schabi.newpipe.player;
|
|||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
|
|
||||||
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class PlayerState implements Serializable {
|
public class PlayerState implements Serializable {
|
||||||
private final static String TAG = "PlayerState";
|
|
||||||
|
|
||||||
@NonNull private final PlayQueue playQueue;
|
@NonNull private final PlayQueue playQueue;
|
||||||
private final int repeatMode;
|
private final int repeatMode;
|
||||||
@ -41,21 +36,6 @@ public class PlayerState implements Serializable {
|
|||||||
// Serdes
|
// Serdes
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static PlayerState fromJson(@NonNull final String json) {
|
|
||||||
try {
|
|
||||||
return new Gson().fromJson(json, PlayerState.class);
|
|
||||||
} catch (JsonSyntaxException error) {
|
|
||||||
Log.e(TAG, "Failed to deserialize PlayerState from json=[" + json + "]", error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public String toJson() {
|
|
||||||
return new Gson().toJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Getters
|
// Getters
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -3,8 +3,6 @@ package us.shandian.giga.get;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
@ -156,16 +154,8 @@ public class DownloadManagerImpl implements DownloadManager {
|
|||||||
|
|
||||||
for (File sub : subs) {
|
for (File sub : subs) {
|
||||||
if (sub.isFile() && sub.getName().endsWith(".giga")) {
|
if (sub.isFile() && sub.getName().endsWith(".giga")) {
|
||||||
String str = Utility.readFromFile(sub.getAbsolutePath());
|
DownloadMission mis = Utility.readFromFile(sub.getAbsolutePath());
|
||||||
if (str != null && !str.trim().equals("")) {
|
if (mis != null) {
|
||||||
|
|
||||||
if (DEBUG) {
|
|
||||||
Log.d(TAG, "loading mission " + sub.getName());
|
|
||||||
Log.d(TAG, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
DownloadMission mis = new Gson().fromJson(str, DownloadMission.class);
|
|
||||||
|
|
||||||
if (mis.finished) {
|
if (mis.finished) {
|
||||||
if (!sub.delete()) {
|
if (!sub.delete()) {
|
||||||
Log.w(TAG, "Unable to delete .giga file: " + sub.getPath());
|
Log.w(TAG, "Unable to delete .giga file: " + sub.getPath());
|
||||||
|
@ -4,9 +4,8 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -18,7 +17,9 @@ import us.shandian.giga.util.Utility;
|
|||||||
|
|
||||||
import static org.schabi.newpipe.BuildConfig.DEBUG;
|
import static org.schabi.newpipe.BuildConfig.DEBUG;
|
||||||
|
|
||||||
public class DownloadMission {
|
public class DownloadMission implements Serializable {
|
||||||
|
private static final long serialVersionUID = 0L;
|
||||||
|
|
||||||
private static final String TAG = DownloadMission.class.getSimpleName();
|
private static final String TAG = DownloadMission.class.getSimpleName();
|
||||||
|
|
||||||
public interface MissionListener {
|
public interface MissionListener {
|
||||||
@ -79,7 +80,6 @@ public class DownloadMission {
|
|||||||
private transient boolean mWritingToFile;
|
private transient boolean mWritingToFile;
|
||||||
|
|
||||||
private static final int NO_IDENTIFIER = -1;
|
private static final int NO_IDENTIFIER = -1;
|
||||||
private long db_identifier = NO_IDENTIFIER;
|
|
||||||
|
|
||||||
public DownloadMission() {
|
public DownloadMission() {
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ public class DownloadMission {
|
|||||||
*/
|
*/
|
||||||
private void doWriteThisToFile() {
|
private void doWriteThisToFile() {
|
||||||
synchronized (blockState) {
|
synchronized (blockState) {
|
||||||
Utility.writeToFile(getMetaFilename(), new Gson().toJson(this));
|
Utility.writeToFile(getMetaFilename(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import android.content.ClipboardManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@ -16,6 +17,9 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
@ -51,57 +55,47 @@ public class Utility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeToFile(String fileName, String content) {
|
public static void writeToFile(@NonNull String fileName, @NonNull Serializable serializable) {
|
||||||
|
ObjectOutputStream objectOutputStream = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
writeToFile(fileName, content.getBytes("UTF-8"));
|
objectOutputStream = new ObjectOutputStream(new FileOutputStream(fileName));
|
||||||
|
objectOutputStream.writeObject(serializable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
//nothing to do
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeToFile(String fileName, byte[] content) {
|
if(objectOutputStream != null) {
|
||||||
File f = new File(fileName);
|
|
||||||
|
|
||||||
if (!f.exists()) {
|
|
||||||
try {
|
try {
|
||||||
f.createNewFile();
|
objectOutputStream.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
//nothing to do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
FileOutputStream opt = new FileOutputStream(f, false);
|
|
||||||
opt.write(content, 0, content.length);
|
|
||||||
opt.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String readFromFile(String file) {
|
@Nullable
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T readFromFile(String file) {
|
||||||
|
T object = null;
|
||||||
|
ObjectInputStream objectInputStream = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File f = new File(file);
|
objectInputStream = new ObjectInputStream(new FileInputStream(file));
|
||||||
|
object = (T) objectInputStream.readObject();
|
||||||
if (!f.exists() || !f.canRead()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedInputStream ipt = new BufferedInputStream(new FileInputStream(f));
|
|
||||||
|
|
||||||
byte[] buf = new byte[512];
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
while (ipt.available() > 0) {
|
|
||||||
int len = ipt.read(buf, 0, 512);
|
|
||||||
sb.append(new String(buf, 0, len, "UTF-8"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ipt.close();
|
|
||||||
return sb.toString();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
//nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(objectInputStream != null){
|
||||||
|
try {
|
||||||
|
objectInputStream .close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
//nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
Loading…
Reference in New Issue
Block a user