-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from zeoflow/files-deployment
Files deployment
- Loading branch information
Showing
502 changed files
with
56,750 additions
and
1 deletion.
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
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 @@ | ||
/build |
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 @@ | ||
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' | ||
} |
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,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 |
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,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> |
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,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
68
app/src/main/java/com/zeoflow/depot/adapter/WordListAdapter.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,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
49
app/src/main/java/com/zeoflow/depot/adapter/WordViewHolder.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,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); | ||
} | ||
|
||
} |
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,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; | ||
} | ||
|
||
} |
Oops, something went wrong.