-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4f9e0c0
Showing
15 changed files
with
353 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: place your license here and we'll include it in the module distribution |
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,5 @@ | ||
Based on: https://github.com/CameraKit/blurkit-android | ||
|
||
``` | ||
<BlurView module="ti.blurview" width="400" height="100" blurRadius="2" downscaleFactor="0.1"/> | ||
``` |
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,26 @@ | ||
--- | ||
Language: Java | ||
AccessModifierOffset: -4 | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
# class, constructor, method should be next line | ||
BreakBeforeBraces: Linux | ||
# Keep '=' at end of line when wrapping, but move things like '&&', '||' to beginning of newline | ||
BreakBeforeBinaryOperators: NonAssignment | ||
# FIXME: break for brace after synchronized block, anonymous class declarations | ||
BreakAfterJavaFieldAnnotations: true | ||
ColumnLimit: 120 | ||
IndentCaseLabels: true | ||
IndentWidth: 4 | ||
MaxEmptyLinesToKeep: 1 | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpacesInParentheses: false | ||
TabWidth: 4 | ||
UseTab: ForContinuationAndIndentation | ||
SpaceAfterCStyleCast: true | ||
# Spaces inside {} for array literals, i.e. "new Object[] { args }" | ||
Cpp11BracedListStyle: false | ||
ReflowComments: false |
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,5 @@ | ||
|
||
Files in this directory are copied to the APK's `assets/Resources` when doing an app build. | ||
This is the same directory a Titanium app's `Resources` files are copied to. The app's | ||
`Resources` files take priority and will be copied over module `Resources` files having | ||
the same name. |
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,4 @@ | ||
|
||
dependencies { | ||
implementation 'io.alterac.blurkit:blurkit:1.1.0' | ||
} |
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,6 @@ | ||
|
||
You can place your `*.jar` library dependencies in this directory. | ||
|
||
Note that its best to reference dependencies in the module's "build.gradle" file | ||
instead if you can. This avoids class name collision in case another module uses | ||
the same library. |
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,18 @@ | ||
# | ||
# this is your module manifest and used by Titanium | ||
# during compilation, packaging, distribution, etc. | ||
# | ||
version: 1.0.0 | ||
apiversion: 4 | ||
architectures: arm64-v8a armeabi-v7a x86 x86_64 | ||
description: ti.blurview | ||
author: Michael Gangolf | ||
license: Apache 2.0 | ||
copyright: Copyright (c) 2020 Michael Gangolf | ||
|
||
# these should not be edited | ||
name: ti.blurview | ||
moduleid: ti.blurview | ||
guid: 2e3a4f09-6eb6-4b4c-a652-88f340d4d7a0 | ||
platform: android | ||
minsdk: 9.0.0.GA |
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,27 @@ | ||
|
||
The `./build/android` directory is treated like a gradle project's `./src/main` directory. | ||
These files will be bundled into the module's built AAR library and copied into the built app's APK. | ||
|
||
Adding files to the below folder will add them to APK's root "assets" folder. | ||
(Note that a Titanium app's files under the `Resources` directory are copied to the APK's `assets/Resources`.) | ||
|
||
<project-dir>/build/android/assets | ||
|
||
The below folders are an example on how to add resource files to the APK's "res" folder. | ||
|
||
<project-dir>/build/android/res/drawable | ||
<project-dir>/build/android/res/raw | ||
<project-dir>/build/android/res/xml | ||
|
||
Prebuilt C/C++ `*.so` libraries must go under the following folder to be bundled with the AAR and APK. | ||
|
||
<project-dir>/build/android/jniLibs | ||
|
||
Android AIDL code generation files go under the following folder. The build system will automatically | ||
generate Java code for them when the app that is built. | ||
|
||
<project-dir>/build/android/aidl | ||
|
||
Android "RenderScript" files (aka: `*.rs` files) go under the below folder. | ||
|
||
<project-dir>/build/android/rs |
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,15 @@ | ||
<FrameLayout android:background="#00ffffff" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:blurkit="http://schemas.android.com/apk/res-auto"> | ||
|
||
<io.alterac.blurkit.BlurLayout | ||
android:id="@+id/blurLayout" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
/> | ||
|
||
</FrameLayout> |
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,113 @@ | ||
/** | ||
* This file was auto-generated by the Titanium Module SDK helper for Android | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2009-2017 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
* | ||
*/ | ||
package ti.blurview; | ||
|
||
import org.appcelerator.kroll.KrollDict; | ||
import org.appcelerator.kroll.KrollProxy; | ||
import org.appcelerator.kroll.annotations.Kroll; | ||
import org.appcelerator.titanium.TiC; | ||
import org.appcelerator.kroll.common.Log; | ||
import org.appcelerator.kroll.common.TiConfig; | ||
import org.appcelerator.titanium.util.TiConvert; | ||
import org.appcelerator.titanium.proxy.TiViewProxy; | ||
import org.appcelerator.titanium.view.TiCompositeLayout; | ||
import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement; | ||
import org.appcelerator.titanium.view.TiUIView; | ||
import android.content.res.Resources; | ||
import android.view.LayoutInflater; | ||
import android.app.Activity; | ||
import io.alterac.blurkit.BlurLayout; | ||
import android.view.View; | ||
|
||
@Kroll.proxy(creatableInModule=TiBlurViewModule.class) | ||
public class BlurViewProxy extends TiViewProxy | ||
{ | ||
// Standard Debugging variables | ||
private static final String LCAT = "BlurViewProxy"; | ||
private static final boolean DBG = TiConfig.LOGD; | ||
BlurLayout blurLayout; | ||
private int blurRadius = 2; | ||
private float downscaleFactor = 0.15f; | ||
|
||
private class BlurView extends TiUIView | ||
{ | ||
public BlurView(TiViewProxy proxy) { | ||
super(proxy); | ||
String packageName = proxy.getActivity().getPackageName(); | ||
Resources resources = proxy.getActivity().getResources(); | ||
View viewWrapper; | ||
|
||
int resId_viewHolder; | ||
int resIdPublish; | ||
|
||
resId_viewHolder = resources.getIdentifier("layout_main", "layout", packageName); | ||
resIdPublish = resources.getIdentifier("blurLayout", "id", packageName); | ||
|
||
LayoutInflater inflater = LayoutInflater.from(proxy.getActivity()); | ||
viewWrapper = inflater.inflate(resId_viewHolder, null); | ||
blurLayout = (BlurLayout) viewWrapper.findViewById(resIdPublish); | ||
blurLayout.setBlurRadius(blurRadius); | ||
blurLayout.setDownscaleFactor(downscaleFactor); | ||
setNativeView(viewWrapper); | ||
} | ||
|
||
@Override | ||
public void processProperties(KrollDict d) | ||
{ | ||
super.processProperties(d); | ||
} | ||
} | ||
|
||
|
||
// Constructor | ||
public BlurViewProxy() | ||
{ | ||
super(); | ||
} | ||
|
||
@Override | ||
public TiUIView createView(Activity activity) | ||
{ | ||
TiUIView view = new BlurView(this); | ||
view.getLayoutParams().autoFillsHeight = true; | ||
view.getLayoutParams().autoFillsWidth = true; | ||
return view; | ||
} | ||
|
||
// Handle creation options | ||
@Override | ||
public void handleCreationDict(KrollDict options) | ||
{ | ||
super.handleCreationDict(options); | ||
|
||
if (options.containsKey("blurFactor")) { | ||
blurRadius = TiConvert.toInt(options.get("blurRadius"),2); | ||
} | ||
if (options.containsKey("downscaleFactor")) { | ||
downscaleFactor = TiConvert.toFloat(options.get("downscaleFactor"),0.15f); | ||
} | ||
} | ||
|
||
// Methods | ||
@Kroll.method | ||
public void startBlur() | ||
{ | ||
blurLayout.startBlur(); | ||
} | ||
|
||
@Kroll.setProperty | ||
public void downscaleFactor(float factor){ | ||
blurLayout.setDownscaleFactor(factor); | ||
} | ||
|
||
@Kroll.setProperty | ||
public void blurRadius(int factor){ | ||
blurLayout.setBlurRadius(factor); | ||
} | ||
} |
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,39 @@ | ||
/** | ||
* This file was auto-generated by the Titanium Module SDK helper for Android | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2009-2018 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
* | ||
*/ | ||
package ti.blurview; | ||
|
||
import org.appcelerator.kroll.KrollModule; | ||
import org.appcelerator.kroll.annotations.Kroll; | ||
|
||
import org.appcelerator.titanium.TiApplication; | ||
import org.appcelerator.kroll.common.Log; | ||
import org.appcelerator.kroll.common.TiConfig; | ||
|
||
|
||
@Kroll.module(name="TiView", id="ti.blurview") | ||
public class TiBlurViewModule extends KrollModule | ||
{ | ||
|
||
// Standard Debugging variables | ||
private static final String LCAT = "TiBlurViewModule"; | ||
private static final boolean DBG = TiConfig.LOGD; | ||
|
||
// You can define constants with @Kroll.constant, for example: | ||
// @Kroll.constant public static final String EXTERNAL_NAME = value; | ||
|
||
public TiBlurViewModule() | ||
{ | ||
super(); | ||
} | ||
|
||
@Kroll.onAppCreate | ||
public static void onAppCreate(TiApplication app){} | ||
|
||
|
||
} |
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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ti:module xmlns:ti="http://ti.appcelerator.org" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<!-- | ||
Similar to tiapp.xml, but contains module/platform specific | ||
configuration in <iphone> and <android> sections | ||
--> | ||
<android xmlns:android="http://schemas.android.com/apk/res/android"> | ||
</android> | ||
</ti:module> |
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,7 @@ | ||
Place your assets like PNG files in this directory and they will be packaged | ||
with your module. | ||
|
||
All JavaScript files in the assets directory are IGNORED except if you create a | ||
file named "ti.blurkit.js" in this directory in which case it will be | ||
wrapped by native code, compiled, and used as your module. This allows you to | ||
run pure JavaScript modules that are pre-compiled. |
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,39 @@ | ||
# ti.blurkit Module | ||
|
||
## Description | ||
|
||
TODO: Enter your module description here | ||
|
||
## Accessing the ti.blurkit Module | ||
|
||
To access this module from JavaScript, you would do the following: | ||
|
||
var ti_blurkit = require("ti.blurkit"); | ||
|
||
The ti_blurkit variable is a reference to the Module object. | ||
|
||
## Reference | ||
|
||
TODO: If your module has an API, you should document | ||
the reference here. | ||
|
||
### ti_blurkit.function | ||
|
||
TODO: This is an example of a module function. | ||
|
||
### ti_blurkit.property | ||
|
||
TODO: This is an example of a module property. | ||
|
||
## Usage | ||
|
||
TODO: Enter your usage example here | ||
|
||
## Author | ||
|
||
TODO: Enter your author name, email and other contact | ||
details you want to share here. | ||
|
||
## License | ||
|
||
TODO: Enter your license/legal information here. |
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,39 @@ | ||
// This is a test harness for your module | ||
// You should do something interesting in this harness | ||
// to test out the module and to provide instructions | ||
// to users on how to use it by example. | ||
|
||
|
||
// open a single window | ||
var win = Ti.UI.createWindow({ | ||
backgroundColor:'white' | ||
}); | ||
var label = Ti.UI.createLabel(); | ||
win.add(label); | ||
win.open(); | ||
|
||
// TODO: write your module tests here | ||
var ti_blurkit = require('ti.blurkit'); | ||
Ti.API.info("module is => " + ti_blurkit); | ||
|
||
label.text = ti_blurkit.example(); | ||
|
||
Ti.API.info("module exampleProp is => " + ti_blurkit.exampleProp); | ||
ti_blurkit.exampleProp = "This is a test value"; | ||
|
||
if (Ti.Platform.name == "android") { | ||
var proxy = ti_blurkit.createExample({ | ||
message: "Creating an example Proxy", | ||
backgroundColor: "red", | ||
width: 100, | ||
height: 100, | ||
top: 100, | ||
left: 150 | ||
}); | ||
|
||
proxy.printMessage("Hello world!"); | ||
proxy.message = "Hi world!. It's me again."; | ||
proxy.printMessage("Hello world!"); | ||
win.add(proxy); | ||
} | ||
|