Skip to content

Commit

Permalink
Merge pull request #4 from zeoflow/files-deployment
Browse files Browse the repository at this point in the history
Files deployment
  • Loading branch information
teogor authored Jun 25, 2021
2 parents 4326abe + 31405c1 commit ebd9e77
Show file tree
Hide file tree
Showing 502 changed files with 56,750 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
# depot
# Depot
The Depot persistence library provides an abstraction layer over SQLite to allow for more robust database access while using the full power of SQLite.

### 1. Depend on our library

Eyejet Library is available through Maven Repository.
To use it:

1. Open the `build.gradle` file for your application.
2. Make sure that the `repositories` section includes Maven Repository
`mavenCentral()`. For example:
```groovy
allprojects {
repositories {
mavenCentral()
}
}
```

## License
Copyright (C) 2021 ZeoFlow S.R.L.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

## 🏆 Contributors 🏆

<!-- ZEOBOT-LIST:START - Do not remove or modify this section -->
Expand Down
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
44 changes: 44 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.zeoflow.depot"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0.0"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

// Depot Components
implementation(project(":runtime"))
annotationProcessor(project(":compiler"))

// Depot-Dispatcher Components
implementation project(':dispatcher-runtime')
annotationProcessor project(':dispatcher-compiler')

implementation('com.zeoflow:flow-kit:1.6.0')

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
21 changes: 21 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zeoflow.depot">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Depot">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
65 changes: 65 additions & 0 deletions app/src/main/java/com/zeoflow/depot/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2021 ZeoFlow SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.zeoflow.depot;

import android.os.Bundle;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.zeoflow.depot.adapter.WordListAdapter;
import com.zeoflow.depot.db.WordDao_Model;
import com.zeoflow.depot.db.Word;
import com.zeoflow.app.Activity;

import java.util.Random;

public class MainActivity extends Activity
{

private WordDao_Model mWordViewModel;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

RecyclerView recyclerView = findViewById(R.id.recyclerview);
final WordListAdapter adapter = new WordListAdapter(new WordListAdapter.WordDiff());
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

// Get a new or existing ViewModel from the ViewModelProvider.
mWordViewModel = new WordDao_Model();

// Add an observer on the LiveData returned by getAlphabetizedWords.
// The onChanged() method fires when the observed data changes and the activity is
// in the foreground.
// Update the cached copy of the words in the adapter.
// mWordViewModel.getAllWords();
mWordViewModel.observerGetWords(this, adapter::submitList);

FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(view ->
{
mWordViewModel.insert(new Word("Hello, World!" + new Random().nextInt()));
});
}

}
68 changes: 68 additions & 0 deletions app/src/main/java/com/zeoflow/depot/adapter/WordListAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.zeoflow.depot.adapter;

/*
* Copyright (C) 2021 ZeoFlow SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListAdapter;

import com.zeoflow.depot.db.Word;

import org.jetbrains.annotations.NotNull;

public class WordListAdapter extends ListAdapter<Word, WordViewHolder>
{

public WordListAdapter(@NonNull DiffUtil.ItemCallback<Word> diffCallback)
{
super(diffCallback);
}

@NotNull
@Override
public WordViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType)
{
return WordViewHolder.create(parent);
}

@Override
public void onBindViewHolder(WordViewHolder holder, int position)
{
Word current = getItem(position);
holder.bind(current.getWord());
}

public static class WordDiff extends DiffUtil.ItemCallback<Word>
{

@Override
public boolean areItemsTheSame(@NonNull Word oldItem, @NonNull Word newItem)
{
return oldItem == newItem;
}

@Override
public boolean areContentsTheSame(@NonNull Word oldItem, @NonNull Word newItem)
{
return oldItem.getWord().equals(newItem.getWord());
}

}

}
49 changes: 49 additions & 0 deletions app/src/main/java/com/zeoflow/depot/adapter/WordViewHolder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2020 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.zeoflow.depot.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.zeoflow.depot.R;

class WordViewHolder extends RecyclerView.ViewHolder
{

private final TextView wordItemView;

private WordViewHolder(View itemView)
{
super(itemView);
wordItemView = itemView.findViewById(R.id.textView);
}
static WordViewHolder create(ViewGroup parent)
{
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recyclerview_item, parent, false);
return new WordViewHolder(view);
}
public void bind(String text)
{
wordItemView.setText(text);
}

}
56 changes: 56 additions & 0 deletions app/src/main/java/com/zeoflow/depot/db/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.zeoflow.depot.db;

/*
* Copyright (C) 2021 ZeoFlow SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import androidx.annotation.NonNull;

import com.zeoflow.depot.ColumnInfo;
import com.zeoflow.depot.Entity;
import com.zeoflow.depot.PrimaryKey;

/**
* A basic class representing an entity that is a row in a one-column database table.
*
* @ Entity - You must annotate the class as an entity and supply a table name if not class name.
* @ PrimaryKey - You must identify the primary key.
* @ ColumnInfo - You must supply the column name if it is different from the variable name.
* <p>
* See the documentation for the full rich set of annotations.
* https://developer.android.com/topic/libraries/architecture/depot.html
*/

@Entity(tableName = "user_table")
public class User
{

@PrimaryKey
@NonNull
@ColumnInfo(name = "word")
private final String mWord;

public User(@NonNull String word)
{
this.mWord = word;
}

@NonNull
public String getWord()
{
return this.mWord;
}

}
Loading

0 comments on commit ebd9e77

Please sign in to comment.