From 0b5881639df8017895373c5e154266bd448024c0 Mon Sep 17 00:00:00 2001 From: Benoit Vermont Date: Sat, 2 Sep 2017 13:42:01 +0200 Subject: [PATCH] Update all versions one last time, and update readme --- README.md | 18 +- build.gradle | 11 +- gradle/wrapper/gradle-wrapper.properties | 4 +- lazy-database/build.gradle | 12 +- test-application/build.gradle | 19 +- .../testapplication/DetailActivity.java | 4 +- .../library/testapplication/MainActivity.java | 6 +- .../testapplication/RandomUserAdapter.java | 168 +++++++++--------- 8 files changed, 125 insertions(+), 117 deletions(-) diff --git a/README.md b/README.md index 38e909c..26dcf07 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ A fast way to store POJO in sqlite on an Android device without troubling yourse [![Build Status](https://travis-ci.org/redwarp/Android-LazyDatabase.svg?branch=develop)](https://travis-ci.org/redwarp/Android-LazyDatabase) [![Download](https://api.bintray.com/packages/redwarp/android/lazy-database/images/download.svg) ](https://bintray.com/redwarp/android/lazy-database/_latestVersion) +# Deprecated +Google introduced [Room](https://developer.android.com/topic/libraries/architecture/room.html) which does the same thing, but better. I thereby deprecate Android-LazyDatabase, it's not useful anymore. It's still a good tutorial about how to upload artifacts to JCenter though. + ## What is it? If you are working on a proof of concept app for Android (you should probably not use it for production in it's current state), and you need to store some good old POJO, this library is there for you. As the title says, it's a database for lazy people. @@ -18,7 +21,7 @@ Seriously, **don't use it for production**, only for proof of concept or stuff l net.redwarp.android.library lazy-database - 0.2.2 + 0.2.3 aar ``` @@ -27,7 +30,7 @@ Seriously, **don't use it for production**, only for proof of concept or stuff l ### For Gradle ``` -compile 'net.redwarp.android.library:lazy-database:0.2.2' +compile 'net.redwarp.android.library:lazy-database:0.2.3' ``` ## How to? @@ -136,9 +139,10 @@ public class GoodOldPojo { ## What's left to do? - * [ ] A shit load + * [ ] ~~A shit load~~ * [x] Clear should also deleted chain elements - * [ ] Relations of type one to many - * [ ] Benchmarking (I mean, how fast is it compared to an hand written database) - * [ ] Search - * [ ] Unique keyword, etc... + * [ ] ~~Relations of type one to many~~ + * [ ] ~~Benchmarking (I mean, how fast is it compared to an hand written database)~~ + * [ ] ~~Search~~ + * [ ] ~~Unique keyword, etc...~~ + * [x] Nothing, it's deprecated diff --git a/build.gradle b/build.gradle index b433433..37e0554 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,11 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' + classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' - classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0' + classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -19,6 +19,9 @@ buildscript { allprojects { repositories { + maven { + url 'https://maven.google.com' + } jcenter() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0dff70f..2cc006f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Apr 07 23:40:12 CEST 2016 +#Sat Sep 02 13:16:48 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/lazy-database/build.gradle b/lazy-database/build.gradle index adc89f3..ae2ed1a 100644 --- a/lazy-database/build.gradle +++ b/lazy-database/build.gradle @@ -19,14 +19,14 @@ apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.jfrog.bintray' android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" + compileSdkVersion 26 + buildToolsVersion "26.0.0" defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 6 - versionName '0.2.2' + versionName '0.2.3' } buildTypes { release { @@ -43,8 +43,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-annotations:23.3.0' - compile 'org.apache.commons:commons-lang3:3.4' + compile 'com.android.support:support-annotations:26.0.2' + compile 'org.apache.commons:commons-lang3:3.6' } def siteUrl = 'https://github.com/redwarp/Android-LazyDatabase' // Homepage URL of the library diff --git a/test-application/build.gradle b/test-application/build.gradle index 01c0a6e..3170a89 100644 --- a/test-application/build.gradle +++ b/test-application/build.gradle @@ -17,13 +17,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" + compileSdkVersion 26 + buildToolsVersion "26.0.0" defaultConfig { applicationId "net.redwarp.library.testapplication" minSdkVersion 19 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 1 versionName "1.0" } @@ -47,12 +47,13 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':lazy-database') - compile 'com.android.support:appcompat-v7:23.3.0' - compile 'com.android.support:recyclerview-v7:23.3.0' - compile 'com.jakewharton:butterknife:7.0.1' - compile 'com.android.support:design:23.3.0' - compile 'com.facebook.stetho:stetho:1.3.1' - compile 'com.facebook.stetho:stetho-okhttp:1.3.1' + compile 'com.android.support:appcompat-v7:26.0.2' + compile 'com.android.support:recyclerview-v7:26.0.2' + compile 'com.jakewharton:butterknife:8.8.1' + annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' + compile 'com.android.support:design:26.0.2' + compile 'com.facebook.stetho:stetho:1.5.0' + compile 'com.facebook.stetho:stetho-okhttp:1.5.0' } task pullDatabase(type:Exec){ diff --git a/test-application/src/main/java/net/redwarp/library/testapplication/DetailActivity.java b/test-application/src/main/java/net/redwarp/library/testapplication/DetailActivity.java index 9e8ebab..a11a274 100644 --- a/test-application/src/main/java/net/redwarp/library/testapplication/DetailActivity.java +++ b/test-application/src/main/java/net/redwarp/library/testapplication/DetailActivity.java @@ -6,13 +6,13 @@ import android.view.MenuItem; import android.widget.TextView; -import butterknife.Bind; +import butterknife.BindView; import butterknife.ButterKnife; public class DetailActivity extends AppCompatActivity { - @Bind(R.id.text) TextView mTextView; + @BindView(R.id.text) TextView mTextView; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/test-application/src/main/java/net/redwarp/library/testapplication/MainActivity.java b/test-application/src/main/java/net/redwarp/library/testapplication/MainActivity.java index 9d53643..992e00e 100644 --- a/test-application/src/main/java/net/redwarp/library/testapplication/MainActivity.java +++ b/test-application/src/main/java/net/redwarp/library/testapplication/MainActivity.java @@ -34,7 +34,7 @@ import java.util.List; -import butterknife.Bind; +import butterknife.BindView; import butterknife.ButterKnife; @@ -42,8 +42,8 @@ public class MainActivity extends AppCompatActivity implements RandomUserAdapter.ItemCountChangedListener { public static final String EXTRA_USER_ID = "net.redwarp.library.testapplication.extra.EXTRA_USER_ID"; - @Bind(R.id.recycler_view) RecyclerView mRecyclerView; - @Bind(R.id.add_button) FloatingActionButton mAddButton; + @BindView(R.id.recycler_view) RecyclerView mRecyclerView; + @BindView(R.id.add_button) FloatingActionButton mAddButton; private NameGenerator mGenerator; private RandomUserAdapter mAdapter; diff --git a/test-application/src/main/java/net/redwarp/library/testapplication/RandomUserAdapter.java b/test-application/src/main/java/net/redwarp/library/testapplication/RandomUserAdapter.java index 5d0f043..1b36bab 100644 --- a/test-application/src/main/java/net/redwarp/library/testapplication/RandomUserAdapter.java +++ b/test-application/src/main/java/net/redwarp/library/testapplication/RandomUserAdapter.java @@ -27,117 +27,117 @@ import java.util.ArrayList; import java.util.List; -import butterknife.Bind; +import butterknife.BindView; import butterknife.ButterKnife; -/** - * Created by Redwarp on 27/05/2015. - */ public class RandomUserAdapter extends RecyclerView.Adapter { - private final Context mContext; - private List mStuffList; - private ItemCountChangedListener mCountListener = null; + private final Context mContext; + private List mStuffList; + private ItemCountChangedListener mCountListener = null; - private OnRandomUserClickedListener mUserClickedListener = null; + private OnRandomUserClickedListener mUserClickedListener = null; - public RandomUserAdapter(Context context, List stuffList) { - mContext = context; + public RandomUserAdapter(Context context, List stuffList) { + mContext = context; - if (stuffList != null) { - mStuffList = stuffList; - } else { - mStuffList = new ArrayList<>(); + if (stuffList != null) { + mStuffList = stuffList; + } else { + mStuffList = new ArrayList<>(); + } } - } - public void addStuff(RandomUser stuff) { - if (stuff != null) { - mStuffList.add(stuff); - notifyItemInserted(mStuffList.size() - 1); - postCount(); + public void addStuff(RandomUser stuff) { + if (stuff != null) { + mStuffList.add(stuff); + notifyItemInserted(mStuffList.size() - 1); + postCount(); + } } - } - - public void addAllStuff(List stuffList) { - if (stuffList != null) { - int startingPoint = mStuffList.size(); - mStuffList.addAll(stuffList); - notifyItemRangeInserted(startingPoint, stuffList.size()); - postCount(); + + public void addAllStuff(List stuffList) { + if (stuffList != null) { + int startingPoint = mStuffList.size(); + mStuffList.addAll(stuffList); + notifyItemRangeInserted(startingPoint, stuffList.size()); + postCount(); + } } - } - - public void clearStuff() { - int numberOfItems = mStuffList.size(); - mStuffList.clear(); - notifyItemRangeRemoved(0, numberOfItems); - postCount(); - } - - private void postCount() { - if (mCountListener != null) { - mCountListener.onItemCountChange(mStuffList.size()); + + public void clearStuff() { + int numberOfItems = mStuffList.size(); + mStuffList.clear(); + notifyItemRangeRemoved(0, numberOfItems); + postCount(); } - } - public void setOnItemCountChangeListener(ItemCountChangedListener listener) { - mCountListener = listener; - } + private void postCount() { + if (mCountListener != null) { + mCountListener.onItemCountChange(mStuffList.size()); + } + } - @Override - public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view = LayoutInflater.from(mContext).inflate(R.layout.item_random_stuff, parent, false); - return new ViewHolder(view); - } + public void setOnItemCountChangeListener(ItemCountChangedListener listener) { + mCountListener = listener; + } + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View + view = + LayoutInflater.from(mContext).inflate(R.layout.item_random_stuff, parent, false); + return new ViewHolder(view); + } - @Override - public void onBindViewHolder(ViewHolder holder, int position) { - RandomUser stuff = mStuffList.get(position); - holder.textView.setText(stuff.name); - } + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + RandomUser stuff = mStuffList.get(position); + holder.textView.setText(stuff.name); + } - @Override - public int getItemCount() { - return mStuffList.size(); - } + @Override + public int getItemCount() { + return mStuffList.size(); + } - public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { + public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - @Bind(R.id.text) - TextView textView; + @BindView(R.id.text) + TextView textView; - public ViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - itemView.setOnClickListener(this); - } + public ViewHolder(View itemView) { + super(itemView); + ButterKnife.bind(this, itemView); + itemView.setOnClickListener(this); + } - @Override - public void onClick(@NonNull final View view) { - if (mUserClickedListener != null) { - assert mStuffList != null; - int position = getLayoutPosition(); - if (position < mStuffList.size()) { - mUserClickedListener.onRandomUserClicked(mStuffList.get(position), view, position); + @Override + public void onClick(@NonNull final View view) { + if (mUserClickedListener != null) { + assert mStuffList != null; + int position = getLayoutPosition(); + if (position < mStuffList.size()) { + mUserClickedListener + .onRandomUserClicked(mStuffList.get(position), view, position); + } + } } - } } - } - public void setOnUserClickedListener(OnRandomUserClickedListener userClickedListener) { - mUserClickedListener = userClickedListener; - } + public void setOnUserClickedListener(OnRandomUserClickedListener userClickedListener) { + mUserClickedListener = userClickedListener; + } - public interface ItemCountChangedListener { + public interface ItemCountChangedListener { - void onItemCountChange(int newCount); - } + void onItemCountChange(int newCount); + } - public interface OnRandomUserClickedListener { + public interface OnRandomUserClickedListener { - void onRandomUserClicked(final RandomUser user, final View view, final int position); - } + void onRandomUserClicked(final RandomUser user, final View view, final int position); + } }