-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 #5 from zeoflow/modules-deployed
Populated repository with `eyejet` modules
- Loading branch information
Showing
63 changed files
with
3,283 additions
and
2 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
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,30 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.3" | ||
defaultConfig { | ||
minSdkVersion 21 | ||
targetSdkVersion 30 | ||
applicationId "com.zeoflow.eyejet.demo" | ||
versionCode 1 | ||
versionName "1.0.0" | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation("com.zeoflow:zson:1.3.0") | ||
implementation("com.zeoflow:flow-kit:1.5.1") | ||
implementation("com.zeoflow:material-elements:2.4.1") | ||
|
||
implementation("com.zeoflow:parcelled-runtime:1.1.0") | ||
annotationProcessor("com.zeoflow:parcelled-compiler:1.1.0") | ||
|
||
implementation project(":eyejet") | ||
} |
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,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.zeoflow.eyejet.demo"> | ||
|
||
<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/AppTheme" | ||
tools:ignore="AllowBackup,GoogleAppIndexingWarning"> | ||
<activity android:name=".ThirdActivity" /> | ||
<activity android:name=".SecondActivity" /> | ||
<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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/zeoflow/eyejet/demo/MainActivity.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,42 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.zeoflow.app.Activity; | ||
|
||
import java.util.Random; | ||
|
||
public class MainActivity extends Activity | ||
{ | ||
|
||
private final MainActivityRepository repository = new MainActivityRepository(this); | ||
|
||
@SuppressLint("SetTextI18n") | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
TextView txtV = findViewById(R.id.txtV); | ||
findViewById(R.id.button).setOnClickListener(v -> configureNewActivity(SecondActivity.class).start()); | ||
repository.user.observe(this, obj -> txtV.setText("txt: " + obj.id + " > " + obj.firstName)); | ||
repository.user.setValue( | ||
User.create( | ||
new Random().nextInt(99999999), | ||
"Teodor", | ||
"Grigor" | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
protected void onResume() | ||
{ | ||
super.onResume(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/zeoflow/eyejet/demo/MainActivityRepository.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,23 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import androidx.lifecycle.LifecycleOwner; | ||
|
||
import com.zeoflow.eyejet.Eyejet; | ||
import com.zeoflow.eyejet.EyejetField; | ||
import com.zeoflow.eyejet.annotation.ShareProperty; | ||
|
||
@UserScope // custom scope | ||
public class MainActivityRepository | ||
{ | ||
|
||
@ShareProperty("user") | ||
public EyejetField<User> user = new EyejetField<>(); | ||
|
||
public MainActivityRepository(LifecycleOwner lifecycleOwner) | ||
{ | ||
Eyejet.shareLifecycle( | ||
this, | ||
lifecycleOwner | ||
); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
app/src/main/java/com/zeoflow/eyejet/demo/SecondActivity.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 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.zeoflow.app.Activity; | ||
import com.zeoflow.eyejet.Eyejet; | ||
import com.zeoflow.eyejet.EyejetField; | ||
import com.zeoflow.eyejet.annotation.ShareProperty; | ||
import com.zeoflow.eyejet.annotation.ShareType; | ||
|
||
import java.util.Random; | ||
|
||
@UserScope | ||
public class SecondActivity extends Activity | ||
{ | ||
|
||
@ShareProperty(value = "user", shareType = ShareType.KEEP_ACTIVE) | ||
public EyejetField<User> user = new EyejetField<>(); | ||
|
||
@SuppressLint("SetTextI18n") | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
Eyejet.shareLifecycle(this, this); | ||
TextView txtV = findViewById(R.id.txtV); | ||
user.observe(this, obj -> txtV.setText("txt: " + obj.id + " > " + obj.firstName)); | ||
user.setValue( | ||
User.create( | ||
new Random().nextInt(99999999), | ||
"Teodor", | ||
"Grigor" | ||
) | ||
); | ||
findViewById(R.id.button).setOnClickListener(v -> configureNewActivity(ThirdActivity.class).start()); | ||
} | ||
|
||
@Override | ||
protected void onResume() | ||
{ | ||
super.onResume(); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/zeoflow/eyejet/demo/ThirdActivity.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 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.zeoflow.app.Activity; | ||
import com.zeoflow.eyejet.Eyejet; | ||
import com.zeoflow.eyejet.EyejetField; | ||
import com.zeoflow.eyejet.annotation.ShareProperty; | ||
import com.zeoflow.eyejet.annotation.ShareType; | ||
|
||
@UserScope | ||
public class ThirdActivity extends Activity | ||
{ | ||
|
||
@ShareProperty(value = "user", shareType = ShareType.ON_FIRST_USE) | ||
public EyejetField<User> user = new EyejetField<>(); | ||
|
||
@SuppressLint("SetTextI18n") | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
Eyejet.shareLifecycle(this, this); | ||
TextView txtV = findViewById(R.id.txtV); | ||
user.observe(this, obj -> txtV.setText("txt: " + obj.id + " > " + obj.firstName)); | ||
// user.setValue( | ||
// User.create( | ||
// new Random().nextInt(99999999), | ||
// "Teodor", | ||
// "Grigor" | ||
// ) | ||
// ); | ||
findViewById(R.id.button).setOnClickListener(v -> configureNewActivity(ThirdActivity.class).start()); | ||
} | ||
|
||
@Override | ||
protected void onResume() | ||
{ | ||
super.onResume(); | ||
} | ||
|
||
} |
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,64 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import android.os.Parcelable; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import com.zeoflow.eyejet.demo.Parcelled_User; | ||
import com.zeoflow.parcelled.Default; | ||
import com.zeoflow.parcelled.Parcelled; | ||
import com.zeoflow.parcelled.ParcelledVersion; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
@Parcelled(version = 1) | ||
public abstract class User implements Parcelable | ||
{ | ||
|
||
@Default(code = "0") | ||
public int id; | ||
|
||
@Nullable | ||
@Default(code = "null") | ||
public String firstName; | ||
|
||
@ParcelledVersion(after = 1, before = 2) | ||
@Nullable | ||
public String lastName; | ||
|
||
public static User create( | ||
int id, | ||
@NonNull String firstName, | ||
@NonNull String lastName | ||
) | ||
{ | ||
return new Parcelled_User(id, firstName, lastName); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) | ||
{ | ||
if (this == other) | ||
{ | ||
return true; | ||
} | ||
|
||
if (!(other instanceof User)) | ||
{ | ||
return false; | ||
} | ||
|
||
User o = (User) other; | ||
|
||
return id == o.id; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String toString() | ||
{ | ||
return "User{$ID}" + id; | ||
} | ||
|
||
} |
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,13 @@ | ||
package com.zeoflow.eyejet.demo; | ||
|
||
import com.zeoflow.eyejet.annotation.EyejetScope; | ||
|
||
import java.lang.annotation.Retention; | ||
|
||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@EyejetScope | ||
@Retention(RUNTIME) | ||
public @interface UserScope | ||
{ | ||
} |
Oops, something went wrong.