-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6186e1
commit fddee3e
Showing
88 changed files
with
18,525 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion rootProject.ext.compileSdkVersion | ||
buildToolsVersion rootProject.ext.buildToolsVersion | ||
|
||
defaultConfig { | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
targetCompatibility 1.7 | ||
sourceCompatibility 1.7 | ||
} | ||
} | ||
dependencies { | ||
testImplementation 'junit:junit:4.12' | ||
testImplementation 'org.assertj:assertj-core:3.10.0' | ||
api fileTree(dir: 'libs', include: ['*.jar']) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<manifest package="com.duy.ide.java.plugin.decompiler" /> |
20 changes: 20 additions & 0 deletions
20
lib-decompiler/src/main/java/com/duy/java8/util/DCollection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.duy.java8.util; | ||
|
||
import com.duy.java8.util.function.Predicate; | ||
|
||
import java.util.Iterator; | ||
|
||
public class DCollection { | ||
public static <E> boolean removeIf(java.util.Collection<E> collection, | ||
Predicate<? super E> filter) { | ||
boolean removed = false; | ||
final Iterator<E> each = collection.iterator(); | ||
while (each.hasNext()) { | ||
if (filter.test(each.next())) { | ||
each.remove(); | ||
removed = true; | ||
} | ||
} | ||
return removed; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
lib-decompiler/src/main/java/com/duy/java8/util/DComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.duy.java8.util; | ||
|
||
import java.util.Comparator; | ||
|
||
public class DComparator { | ||
public static <T> Comparator<T> thenComparing(final Comparator<? super T> first, | ||
final Comparator<? super T> second) { | ||
return new Comparator<T>() { | ||
@Override | ||
public int compare(T c1, T c2) { | ||
int res = first.compare(c1, c2); | ||
return (res != 0) ? res : second.compare(c1, c2); | ||
} | ||
}; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lib-decompiler/src/main/java/com/duy/java8/util/DList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.duy.java8.util; | ||
|
||
import com.duy.java8.util.function.Consumer; | ||
import com.duy.java8.util.function.Predicate; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class DList { | ||
public static <E> void forEach(List<E> list, Consumer<? super E> action) { | ||
for (E e : list) { | ||
action.accept(e); | ||
} | ||
} | ||
|
||
public static <E> List<E> filter(List<E> input, Predicate<E> predicate) { | ||
List<E> list = new ArrayList<>(); | ||
for (E e : input) { | ||
if (predicate.test(e)) { | ||
list.add(e); | ||
} | ||
} | ||
return list; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.duy.java8.util; | ||
|
||
import com.duy.java8.util.function.BiFunction; | ||
import com.duy.java8.util.function.Function; | ||
|
||
import java.util.Map; | ||
|
||
public class DMap { | ||
public static <K, V> V putIfAbsent(Map<K, V> map, K key, V value) { | ||
V v = map.get(key); | ||
if (v == null) { | ||
v = map.put(key, value); | ||
} | ||
|
||
return v; | ||
} | ||
|
||
public static <K, V> V computeIfAbsent(Map<K, V> map, K key, | ||
Function<? super K, ? extends V> mappingFunction) { | ||
V v; | ||
if ((v = map.get(key)) == null) { | ||
V newValue; | ||
if ((newValue = mappingFunction.apply(key)) != null) { | ||
map.put(key, newValue); | ||
return newValue; | ||
} | ||
} | ||
|
||
return v; | ||
} | ||
|
||
public static <K, V> V merge(Map<K, V> map, K key, V value, | ||
BiFunction<? super V, ? super V, ? extends V> remappingFunction) { | ||
V oldValue = map.get(key); | ||
V newValue = (oldValue == null) ? value : | ||
remappingFunction.apply(oldValue, value); | ||
if (newValue == null) { | ||
map.remove(key); | ||
} else { | ||
map.put(key, newValue); | ||
} | ||
return newValue; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
lib-decompiler/src/main/java/com/duy/java8/util/function/BiFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.duy.java8.util.function; | ||
|
||
/** | ||
* Represents a function that accepts two arguments and produces a result. | ||
* This is the two-arity specialization of {@link com.duy.java8.util.function.Function}. | ||
* <p> | ||
* <p>This is a <a href="package-summary.html">functional interface</a> | ||
* whose functional method is {@link #apply(Object, Object)}. | ||
* | ||
* @param <T> the type of the first argument to the function | ||
* @param <U> the type of the second argument to the function | ||
* @param <R> the type of the result of the function | ||
* @see com.duy.java8.util.function.Function | ||
*/ | ||
public interface BiFunction<T, U, R> { | ||
|
||
/** | ||
* Applies this function to the given arguments. | ||
* | ||
* @param t the first function argument | ||
* @param u the second function argument | ||
* @return the function result | ||
*/ | ||
R apply(T t, U u); | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
lib-decompiler/src/main/java/com/duy/java8/util/function/BinaryOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.duy.java8.util.function; | ||
|
||
|
||
/** | ||
* Represents an operation upon two operands of the same type, producing a result | ||
* of the same type as the operands. This is a specialization of | ||
* {@link com.duy.java8.util.function.BiFunction} for the case where the operands and the result are all of | ||
* the same type. | ||
* <p> | ||
* <p>This is a <a href="package-summary.html">functional interface</a> | ||
* whose functional method is {@link #apply(Object, Object)}. | ||
* | ||
* @param <T> the type of the operands and result of the operator | ||
* @see com.duy.java8.util.function.BiFunction | ||
* @see UnaryOperator | ||
*/ | ||
@FunctionalInterface | ||
public interface BinaryOperator<T> extends BiFunction<T, T, T> { | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
lib-decompiler/src/main/java/com/duy/java8/util/function/Consumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.duy.java8.util.function; | ||
|
||
/** | ||
* Represents an operation that accepts a single input argument and returns no | ||
* result. Unlike most other functional interfaces, {@code Consumer} is expected | ||
* to operate via side-effects. | ||
* <p> | ||
* <p>This is a <a href="package-summary.html">functional interface</a> | ||
* whose functional method is {@link #accept(Object)}. | ||
* | ||
* @param <T> the type of the input to the operation | ||
*/ | ||
public interface Consumer<T> { | ||
|
||
/** | ||
* Performs this operation on the given argument. | ||
* | ||
* @param t the input argument | ||
*/ | ||
void accept(T t); | ||
|
||
|
||
} |
47 changes: 47 additions & 0 deletions
47
lib-decompiler/src/main/java/com/duy/java8/util/function/Function.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.duy.java8.util.function; | ||
|
||
/** | ||
* Represents a function that accepts one argument and produces a result. | ||
* <p> | ||
* <p>This is a <a href="package-summary.html">functional interface</a> | ||
* whose functional method is {@link #apply(Object)}. | ||
* | ||
* @param <T> the type of the input to the function | ||
* @param <R> the type of the result of the function | ||
*/ | ||
public interface Function<T, R> { | ||
|
||
/** | ||
* Applies this function to the given argument. | ||
* | ||
* @param t the function argument | ||
* @return the function result | ||
*/ | ||
R apply(T t); | ||
|
||
|
||
} |
47 changes: 47 additions & 0 deletions
47
lib-decompiler/src/main/java/com/duy/java8/util/function/Predicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.duy.java8.util.function; | ||
|
||
/** | ||
* Represents a predicate (boolean-valued function) of one argument. | ||
* <p> | ||
* <p>This is a <a href="package-summary.html">functional interface</a> | ||
* whose functional method is {@link #test(Object)}. | ||
* | ||
* @param <T> the type of the input to the predicate | ||
*/ | ||
@FunctionalInterface | ||
public interface Predicate<T> { | ||
|
||
/** | ||
* Evaluates this predicate on the given argument. | ||
* | ||
* @param t the input argument | ||
* @return {@code true} if the input argument matches the predicate, | ||
* otherwise {@code false} | ||
*/ | ||
boolean test(T t); | ||
|
||
} |
Oops, something went wrong.
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there prediction of when the app will support gradle 💯?
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gradle wrote by using java and groovy, so you can not run it on Android. I am try to port Android builder from AOSP.
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tranleduy2000 I did not quite understand, but I look forward to the next updates good luck and good work :)
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this app Now support gradle or not?
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fddee3e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheReyzer it's been 4 years instead of a "few months" any update on this?