Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
Add constructors so can initialize AdapterSet with Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
deckyfx committed Mar 13, 2019
1 parent 0b11af8 commit abca03d
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 19 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
3 changes: 3 additions & 0 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.

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

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

1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'

defaultConfig {
applicationId "com.github.deckyfx.simpleadapterapp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {

ArrayList a = new ArrayList();
ArrayList<String> b = new ArrayList<String>();
AdapterDataSet<TestItem> c = new AdapterDataSet<TestItem>();
AdapterDataSet<TestItem> c = new AdapterDataSet<TestItem>(a);
AdapterDataSet d = new AdapterDataSet();
c.add(new TestItem());
d.add(new AdapterItem("A"));
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.60'
ext.kotlin_version = '1.3.0'
ext.android_support_version = '28.0.0'

repositories {
Expand All @@ -11,7 +11,7 @@ buildscript {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Additional libraries
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 @@
#Wed Oct 24 14:55:56 WIB 2018
#Wed Mar 13 17:26:23 WIB 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
21 changes: 10 additions & 11 deletions simpleadapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ def groupName = group
def artifactName = 'simpleadapter'

android {
compileSdkVersion 27
buildToolsVersion '28.0.2'
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
Expand Down Expand Up @@ -90,17 +89,17 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// NOTE: support libraries
provided "com.android.support:appcompat-v7:$android_support_version"
provided "com.android.support:design:$android_support_version"
provided "com.android.support:recyclerview-v7:$android_support_version"
provided "com.android.support:support-v4:$android_support_version"
compileOnly "com.android.support:appcompat-v7:$android_support_version"
compileOnly "com.android.support:design:$android_support_version"
compileOnly "com.android.support:recyclerview-v7:$android_support_version"
compileOnly "com.android.support:support-v4:$android_support_version"

// NOTE: 3rd parties
provided 'com.google.code.gson:gson:2.8.2'
provided 'com.squareup.moshi:moshi:1.5.0'
provided 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
provided 'com.fasterxml.jackson.core:jackson-core:2.9.4'
provided 'com.fasterxml.jackson.core:jackson-annotations:2.8.4'
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'com.squareup.moshi:moshi:1.5.0'
compileOnly 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
compileOnly 'com.fasterxml.jackson.core:jackson-core:2.9.4'
compileOnly 'com.fasterxml.jackson.core:jackson-annotations:2.8.4'
}


Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package com.github.deckyfx.simpleadapter;

import android.support.annotation.NonNull;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;

/**
Expand All @@ -11,6 +17,14 @@


public class AdapterDataSet<E extends BaseItem> extends ArrayList<E> implements List<E>, RandomAccess, Cloneable, Serializable {
public AdapterDataSet() {
super();
}

public AdapterDataSet(Collection<? extends E> c) {
super(c);
}

public AdapterDataSet<E> find(CharSequence constraint) {
AdapterDataSet<E> results = new AdapterDataSet<E>();
for (int i = 0; i < this.size(); i++) {
Expand Down

0 comments on commit abca03d

Please sign in to comment.