Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
52f4e25e
Commit
52f4e25e
authored
Apr 04, 2017
by
Bruno Coelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Update example to include a swift and objc listener"
This reverts commit
fde11639
.
parent
f4580a43
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
59 additions
and
333 deletions
+59
-333
example/android/app/src/main/res/layout/activity_main.xml
example/android/app/src/main/res/layout/activity_main.xml
+0
-5
example/example.djinni
example/example.djinni
+1
-6
example/generated-src/cpp/sort_items.hpp
example/generated-src/cpp/sort_items.hpp
+1
-4
example/generated-src/cpp/textbox_reset_listener.hpp
example/generated-src/cpp/textbox_reset_listener.hpp
+0
-17
example/generated-src/java/com/dropbox/textsort/SortItems.java
...le/generated-src/java/com/dropbox/textsort/SortItems.java
+1
-11
example/generated-src/java/com/dropbox/textsort/TextboxResetListener.java
...d-src/java/com/dropbox/textsort/TextboxResetListener.java
+0
-11
example/generated-src/jni/NativeSortItems.cpp
example/generated-src/jni/NativeSortItems.cpp
+2
-13
example/generated-src/jni/NativeTextboxResetListener.cpp
example/generated-src/jni/NativeTextboxResetListener.cpp
+0
-26
example/generated-src/jni/NativeTextboxResetListener.hpp
example/generated-src/jni/NativeTextboxResetListener.hpp
+0
-46
example/generated-src/objc/TXSSortItems+Private.mm
example/generated-src/objc/TXSSortItems+Private.mm
+2
-11
example/generated-src/objc/TXSSortItems.h
example/generated-src/objc/TXSSortItems.h
+1
-5
example/generated-src/objc/TXSTextboxResetListener+Private.h
example/generated-src/objc/TXSTextboxResetListener+Private.h
+0
-31
example/generated-src/objc/TXSTextboxResetListener+Private.mm
...ple/generated-src/objc/TXSTextboxResetListener+Private.mm
+0
-49
example/generated-src/objc/TXSTextboxResetListener.h
example/generated-src/objc/TXSTextboxResetListener.h
+0
-11
example/generated-src/objc/TextSort-Bridging-Header.h
example/generated-src/objc/TextSort-Bridging-Header.h
+0
-1
example/handwritten-src/cpp/sort_items_impl.cpp
example/handwritten-src/cpp/sort_items_impl.cpp
+3
-13
example/handwritten-src/cpp/sort_items_impl.hpp
example/handwritten-src/cpp/sort_items_impl.hpp
+1
-4
example/handwritten-src/java/com/dropbox/textsort/MainActivity.java
...ndwritten-src/java/com/dropbox/textsort/MainActivity.java
+1
-7
example/handwritten-src/java/com/dropbox/textsort/TextboxResetListenerImpl.java
...c/java/com/dropbox/textsort/TextboxResetListenerImpl.java
+0
-18
example/handwritten-src/objc/TXSViewController.m
example/handwritten-src/objc/TXSViewController.m
+3
-10
example/handwritten-src/swift/TXSTextboxListenerImpl.swift
example/handwritten-src/swift/TXSTextboxListenerImpl.swift
+22
-0
example/objc/TextSort.xcodeproj/project.pbxproj
example/objc/TextSort.xcodeproj/project.pbxproj
+4
-4
example/objc/TextSort/Base.lproj/Main_iPhone.storyboard
example/objc/TextSort/Base.lproj/Main_iPhone.storyboard
+17
-30
No files found.
example/android/app/src/main/res/layout/activity_main.xml
View file @
52f4e25e
...
...
@@ -14,11 +14,6 @@
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:id=
"@+id/actions"
>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Reset"
android:onClick=
"reset"
/>
<Button
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
example/example.djinni
View file @
52f4e25e
...
...
@@ -11,8 +11,7 @@ sort_order = enum {
sort_items = interface +c {
# For the iOS / Android demo
sort(order: sort_order, items: item_list);
reset();
static create_with_listener(listener: textbox_listener, reset_listener: textbox_reset_listener): sort_items;
static create_with_listener(listener: textbox_listener): sort_items;
# For the localhost / command-line demo
static run_sort(items: item_list): item_list;
...
...
@@ -21,7 +20,3 @@ sort_items = interface +c {
textbox_listener = interface +j +o {
update(items: item_list);
}
textbox_reset_listener = interface +j +o {
reset(text: string);
}
example/generated-src/cpp/sort_items.hpp
View file @
52f4e25e
...
...
@@ -8,7 +8,6 @@
namespace
textsort
{
class
TextboxListener
;
class
TextboxResetListener
;
enum
class
sort_order
;
struct
ItemList
;
...
...
@@ -19,9 +18,7 @@ public:
/** For the iOS / Android demo */
virtual
void
sort
(
sort_order
order
,
const
ItemList
&
items
)
=
0
;
virtual
void
reset
()
=
0
;
static
std
::
shared_ptr
<
SortItems
>
create_with_listener
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
,
const
std
::
shared_ptr
<
TextboxResetListener
>
&
reset_listener
);
static
std
::
shared_ptr
<
SortItems
>
create_with_listener
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
);
/** For the localhost / command-line demo */
static
ItemList
run_sort
(
const
ItemList
&
items
);
...
...
example/generated-src/cpp/textbox_reset_listener.hpp
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#pragma once
#include <string>
namespace
textsort
{
class
TextboxResetListener
{
public:
virtual
~
TextboxResetListener
()
{}
virtual
void
reset
(
const
std
::
string
&
text
)
=
0
;
};
}
// namespace textsort
example/generated-src/java/com/dropbox/textsort/SortItems.java
View file @
52f4e25e
...
...
@@ -11,10 +11,8 @@ import javax.annotation.Nonnull;
/** For the iOS / Android demo */
public
abstract
void
sort
(
@Nonnull
SortOrder
order
,
@Nonnull
ItemList
items
);
public
abstract
void
reset
();
@CheckForNull
public
static
native
SortItems
createWithListener
(
@CheckForNull
TextboxListener
listener
,
@CheckForNull
TextboxResetListener
resetListener
);
public
static
native
SortItems
createWithListener
(
@CheckForNull
TextboxListener
listener
);
/** For the localhost / command-line demo */
@Nonnull
...
...
@@ -50,13 +48,5 @@ import javax.annotation.Nonnull;
native_sort
(
this
.
nativeRef
,
order
,
items
);
}
private
native
void
native_sort
(
long
_nativeRef
,
SortOrder
order
,
ItemList
items
);
@Override
public
void
reset
()
{
assert
!
this
.
destroyed
.
get
()
:
"trying to use a destroyed object"
;
native_reset
(
this
.
nativeRef
);
}
private
native
void
native_reset
(
long
_nativeRef
);
}
}
example/generated-src/java/com/dropbox/textsort/TextboxResetListener.java
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
package
com.dropbox.textsort
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnull
;
/*package*/
abstract
class
TextboxResetListener
{
public
abstract
void
reset
(
@Nonnull
String
text
);
}
example/generated-src/jni/NativeSortItems.cpp
View file @
52f4e25e
...
...
@@ -5,7 +5,6 @@
#include "NativeItemList.hpp"
#include "NativeSortOrder.hpp"
#include "NativeTextboxListener.hpp"
#include "NativeTextboxResetListener.hpp"
namespace
djinni_generated
{
...
...
@@ -32,21 +31,11 @@ CJNIEXPORT void JNICALL Java_com_dropbox_textsort_SortItems_00024CppProxy_native
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
void
JNICALL
Java_com_dropbox_textsort_SortItems_00024CppProxy_native_1reset
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jlong
nativeRef
)
{
try
{
DJINNI_FUNCTION_PROLOGUE1
(
jniEnv
,
nativeRef
);
const
auto
&
ref
=
::
djinni
::
objectFromHandleAddress
<::
textsort
::
SortItems
>
(
nativeRef
);
ref
->
reset
();
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
)
}
CJNIEXPORT
jobject
JNICALL
Java_com_dropbox_textsort_SortItems_createWithListener
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jobject
j_listener
,
jobject
j_resetListener
)
CJNIEXPORT
jobject
JNICALL
Java_com_dropbox_textsort_SortItems_createWithListener
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jobject
j_listener
)
{
try
{
DJINNI_FUNCTION_PROLOGUE0
(
jniEnv
);
auto
r
=
::
textsort
::
SortItems
::
create_with_listener
(
::
djinni_generated
::
NativeTextboxListener
::
toCpp
(
jniEnv
,
j_listener
),
::
djinni_generated
::
NativeTextboxResetListener
::
toCpp
(
jniEnv
,
j_resetListener
));
auto
r
=
::
textsort
::
SortItems
::
create_with_listener
(
::
djinni_generated
::
NativeTextboxListener
::
toCpp
(
jniEnv
,
j_listener
));
return
::
djinni
::
release
(
::
djinni_generated
::
NativeSortItems
::
fromCpp
(
jniEnv
,
r
));
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
0
/* value doesn't matter */
)
}
...
...
example/generated-src/jni/NativeTextboxResetListener.cpp
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#include "NativeTextboxResetListener.hpp" // my header
#include "Marshal.hpp"
namespace
djinni_generated
{
NativeTextboxResetListener
::
NativeTextboxResetListener
()
:
::
djinni
::
JniInterface
<::
textsort
::
TextboxResetListener
,
NativeTextboxResetListener
>
()
{}
NativeTextboxResetListener
::~
NativeTextboxResetListener
()
=
default
;
NativeTextboxResetListener
::
JavaProxy
::
JavaProxy
(
JniType
j
)
:
Handle
(
::
djinni
::
jniGetThreadEnv
(),
j
)
{
}
NativeTextboxResetListener
::
JavaProxy
::~
JavaProxy
()
=
default
;
void
NativeTextboxResetListener
::
JavaProxy
::
reset
(
const
std
::
string
&
c_text
)
{
auto
jniEnv
=
::
djinni
::
jniGetThreadEnv
();
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
10
);
const
auto
&
data
=
::
djinni
::
JniClass
<::
djinni_generated
::
NativeTextboxResetListener
>::
get
();
jniEnv
->
CallVoidMethod
(
Handle
::
get
().
get
(),
data
.
method_reset
,
::
djinni
::
get
(
::
djinni
::
String
::
fromCpp
(
jniEnv
,
c_text
)));
::
djinni
::
jniExceptionCheck
(
jniEnv
);
}
}
// namespace djinni_generated
example/generated-src/jni/NativeTextboxResetListener.hpp
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#pragma once
#include "djinni_support.hpp"
#include "textbox_reset_listener.hpp"
namespace
djinni_generated
{
class
NativeTextboxResetListener
final
:
::
djinni
::
JniInterface
<::
textsort
::
TextboxResetListener
,
NativeTextboxResetListener
>
{
public:
using
CppType
=
std
::
shared_ptr
<::
textsort
::
TextboxResetListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
textsort
::
TextboxResetListener
>
;
using
JniType
=
jobject
;
using
Boxed
=
NativeTextboxResetListener
;
~
NativeTextboxResetListener
();
static
CppType
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
{
return
::
djinni
::
JniClass
<
NativeTextboxResetListener
>::
get
().
_fromJava
(
jniEnv
,
j
);
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCppOpt
(
JNIEnv
*
jniEnv
,
const
CppOptType
&
c
)
{
return
{
jniEnv
,
::
djinni
::
JniClass
<
NativeTextboxResetListener
>::
get
().
_toJava
(
jniEnv
,
c
)};
}
static
::
djinni
::
LocalRef
<
JniType
>
fromCpp
(
JNIEnv
*
jniEnv
,
const
CppType
&
c
)
{
return
fromCppOpt
(
jniEnv
,
c
);
}
private:
NativeTextboxResetListener
();
friend
::
djinni
::
JniClass
<
NativeTextboxResetListener
>
;
friend
::
djinni
::
JniInterface
<::
textsort
::
TextboxResetListener
,
NativeTextboxResetListener
>
;
class
JavaProxy
final
:
::
djinni
::
JavaProxyHandle
<
JavaProxy
>
,
public
::
textsort
::
TextboxResetListener
{
public:
JavaProxy
(
JniType
j
);
~
JavaProxy
();
void
reset
(
const
std
::
string
&
text
)
override
;
private:
friend
::
djinni
::
JniInterface
<::
textsort
::
TextboxResetListener
,
::
djinni_generated
::
NativeTextboxResetListener
>
;
};
const
::
djinni
::
GlobalRef
<
jclass
>
clazz
{
::
djinni
::
jniFindClass
(
"com/dropbox/textsort/TextboxResetListener"
)
};
const
jmethodID
method_reset
{
::
djinni
::
jniGetMethodID
(
clazz
.
get
(),
"reset"
,
"(Ljava/lang/String;)V"
)
};
};
}
// namespace djinni_generated
example/generated-src/objc/TXSSortItems+Private.mm
View file @
52f4e25e
...
...
@@ -8,7 +8,6 @@
#import "TXSItemList+Private.h"
#import "TXSSortOrder+Private.h"
#import "TXSTextboxListener+Private.h"
#import "TXSTextboxResetListener+Private.h"
#include <exception>
#include <stdexcept>
#include <utility>
...
...
@@ -41,17 +40,9 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
-
(
void
)
reset
{
+
(
nullable
TXSSortItems
*
)
createWithListener
:(
nullable
id
<
TXSTextboxListener
>
)
listener
{
try
{
_cppRefHandle
.
get
()
->
reset
();
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
nullable
TXSSortItems
*
)
createWithListener
:(
nullable
id
<
TXSTextboxListener
>
)
listener
resetListener
:(
nullable
id
<
TXSTextboxResetListener
>
)
resetListener
{
try
{
auto
objcpp_result_
=
::
textsort
::
SortItems
::
create_with_listener
(
::
djinni_generated
::
TextboxListener
::
toCpp
(
listener
),
::
djinni_generated
::
TextboxResetListener
::
toCpp
(
resetListener
));
auto
objcpp_result_
=
::
textsort
::
SortItems
::
create_with_listener
(
::
djinni_generated
::
TextboxListener
::
toCpp
(
listener
));
return
::
djinni_generated
::
SortItems
::
fromCpp
(
objcpp_result_
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
...
...
example/generated-src/objc/TXSSortItems.h
View file @
52f4e25e
...
...
@@ -6,7 +6,6 @@
#import <Foundation/Foundation.h>
@class
TXSSortItems
;
@protocol
TXSTextboxListener
;
@protocol
TXSTextboxResetListener
;
@interface
TXSSortItems
:
NSObject
...
...
@@ -15,10 +14,7 @@
-
(
void
)
sort
:(
TXSSortOrder
)
order
items
:(
nonnull
TXSItemList
*
)
items
;
-
(
void
)
reset
;
+
(
nullable
TXSSortItems
*
)
createWithListener
:(
nullable
id
<
TXSTextboxListener
>
)
listener
resetListener
:(
nullable
id
<
TXSTextboxResetListener
>
)
resetListener
;
+
(
nullable
TXSSortItems
*
)
createWithListener
:(
nullable
id
<
TXSTextboxListener
>
)
listener
;
/** For the localhost / command-line demo */
+
(
nonnull
TXSItemList
*
)
runSort
:(
nonnull
TXSItemList
*
)
items
;
...
...
example/generated-src/objc/TXSTextboxResetListener+Private.h
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#include "textbox_reset_listener.hpp"
#include <memory>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
@protocol
TXSTextboxResetListener
;
namespace
djinni_generated
{
class
TextboxResetListener
{
public:
using
CppType
=
std
::
shared_ptr
<::
textsort
::
TextboxResetListener
>
;
using
CppOptType
=
std
::
shared_ptr
<::
textsort
::
TextboxResetListener
>
;
using
ObjcType
=
id
<
TXSTextboxResetListener
>
;
using
Boxed
=
TextboxResetListener
;
static
CppType
toCpp
(
ObjcType
objc
);
static
ObjcType
fromCppOpt
(
const
CppOptType
&
cpp
);
static
ObjcType
fromCpp
(
const
CppType
&
cpp
)
{
return
fromCppOpt
(
cpp
);
}
private:
class
ObjcProxy
;
};
}
// namespace djinni_generated
example/generated-src/objc/TXSTextboxResetListener+Private.mm
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSTextboxResetListener+Private.h"
#import "TXSTextboxResetListener.h"
#import "DJIMarshal+Private.h"
#import "DJIObjcWrapperCache+Private.h"
#include <stdexcept>
static_assert
(
__has_feature
(
objc_arc
),
"Djinni requires ARC to be enabled for this file"
);
namespace
djinni_generated
{
class
TextboxResetListener
::
ObjcProxy
final
:
public
::
textsort
::
TextboxResetListener
,
private
::
djinni
::
ObjcProxyBase
<
ObjcType
>
{
friend
class
::
djinni_generated
::
TextboxResetListener
;
public:
using
ObjcProxyBase
::
ObjcProxyBase
;
void
reset
(
const
std
::
string
&
c_text
)
override
{
@autoreleasepool
{
[
djinni_private_get_proxied_objc_object
()
reset
:(
::
djinni
:
:
String
::
fromCpp
(
c_text
))];
}
}
};
}
// namespace djinni_generated
namespace
djinni_generated
{
auto
TextboxResetListener
::
toCpp
(
ObjcType
objc
)
->
CppType
{
if
(
!
objc
)
{
return
nullptr
;
}
return
::
djinni
::
get_objc_proxy
<
ObjcProxy
>
(
objc
);
}
auto
TextboxResetListener
::
fromCppOpt
(
const
CppOptType
&
cpp
)
->
ObjcType
{
if
(
!
cpp
)
{
return
nil
;
}
return
dynamic_cast
<
ObjcProxy
&>
(
*
cpp
).
djinni_private_get_proxied_objc_object
();
}
}
// namespace djinni_generated
example/generated-src/objc/TXSTextboxResetListener.h
deleted
100644 → 0
View file @
f4580a43
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import <Foundation/Foundation.h>
@protocol
TXSTextboxResetListener
-
(
void
)
reset
:(
nonnull
NSString
*
)
text
;
@end
example/generated-src/objc/TextSort-Bridging-Header.h
View file @
52f4e25e
...
...
@@ -5,4 +5,3 @@
#import "TXSSortOrder.h"
#import "TXSSortItems.h"
#import "TXSTextboxListener.h"
#import "TXSTextboxResetListener.h"
example/handwritten-src/cpp/sort_items_impl.cpp
View file @
52f4e25e
...
...
@@ -8,24 +8,14 @@
namespace
textsort
{
std
::
shared_ptr
<
SortItems
>
SortItems
::
create_with_listener
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
,
const
std
::
shared_ptr
<
TextboxResetListener
>
&
reset_
listener
)
{
return
std
::
make_shared
<
SortItemsImpl
>
(
listener
,
reset_listener
);
std
::
shared_ptr
<
SortItems
>
SortItems
::
create_with_listener
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
)
{
return
std
::
make_shared
<
SortItemsImpl
>
(
listener
);
}
SortItemsImpl
::
SortItemsImpl
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
,
const
std
::
shared_ptr
<
TextboxResetListener
>
&
reset_listener
)
{
SortItemsImpl
::
SortItemsImpl
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
)
{
this
->
m_listener
=
listener
;
this
->
m_reset_listener
=
reset_listener
;
}
void
SortItemsImpl
::
reset
()
{
std
::
string
resetText
=
"Type the lines to sort"
;
// Pass result to client interface
this
->
m_reset_listener
->
reset
(
resetText
);
}
void
SortItemsImpl
::
sort
(
sort_order
order
,
const
ItemList
&
items
)
{
auto
lines
=
items
.
items
;
switch
(
order
)
{
...
...
example/handwritten-src/cpp/sort_items_impl.hpp
View file @
52f4e25e
...
...
@@ -2,20 +2,17 @@
#include "sort_items.hpp"
#include "textbox_listener.hpp"
#include "textbox_reset_listener.hpp"
namespace
textsort
{
class
SortItemsImpl
:
public
SortItems
{
public:
SortItemsImpl
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
,
const
std
::
shared_ptr
<
TextboxResetListener
>
&
reset_listener
);
virtual
void
reset
()
override
;
SortItemsImpl
(
const
std
::
shared_ptr
<
TextboxListener
>
&
listener
);
virtual
void
sort
(
sort_order
order
,
const
ItemList
&
items
)
override
;
private:
std
::
shared_ptr
<
TextboxListener
>
m_listener
;
std
::
shared_ptr
<
TextboxResetListener
>
m_reset_listener
;
};
...
...
example/handwritten-src/java/com/dropbox/textsort/MainActivity.java
View file @
52f4e25e
...
...
@@ -13,7 +13,6 @@ public class MainActivity extends Activity {
private
EditText
text
;
private
SortItems
sortItemsInterface
;
private
TextboxListener
textboxListener
;
private
TextboxResetListener
textboxResetListener
;
static
{
System
.
loadLibrary
(
"textsort_jni"
);
...
...
@@ -26,13 +25,8 @@ public class MainActivity extends Activity {
text
=
(
EditText
)
findViewById
(
R
.
id
.
editText
);
textboxListener
=
new
TextboxListenerImpl
(
text
);
textboxResetListener
=
new
TextboxResetListenerImpl
(
text
);
// Call JNI to initiate the SortItems object from the given textboxListener and translate to Java
sortItemsInterface
=
SortItems
.
createWithListener
(
textboxListener
,
textboxResetListener
);
}
public
void
reset
(
View
view
)
{
sortItemsInterface
.
reset
();
sortItemsInterface
=
SortItems
.
createWithListener
(
textboxListener
);
}
public
void
sort
(
SortOrder
order
)
{
...
...
example/handwritten-src/java/com/dropbox/textsort/TextboxResetListenerImpl.java
deleted
100644 → 0
View file @
f4580a43
package
com.dropbox.textsort
;
import
android.widget.EditText
;
public
class
TextboxResetListenerImpl
extends
TextboxResetListener
{
private
EditText
mTextArea
;
public
TextboxResetListenerImpl
(
EditText
textArea
)
{
this
.
mTextArea
=
textArea
;
}
@Override
public
void
reset
(
String
text
)
{
mTextArea
.
setText
(
text
);
}
}
example/handwritten-src/objc/TXSViewController.m
View file @
52f4e25e
#import "TXSItemList.h"
#import "TXSSortItems.h"
#import "TXSTextboxListenerImpl.h"
#import "TXSViewController.h"
#import "TextSort-Swift.h"
#import "TXSViewController.h"
#import "TXSTextboxListener.h"
#import <QuartzCore/QuartzCore.h>
...
...
@@ -17,7 +17,6 @@
@implementation
TXSViewController
{
TXSSortItems
*
_sortItemInterface
;
id
<
TXSTextboxListener
>
_textboxListener
;
id
<
TXSTextboxResetListener
>
_textboxResetListener
;
}
-
(
void
)
viewDidLoad
...
...
@@ -36,13 +35,7 @@
// Create the Objective-C TXSTextboxListener
_textboxListener
=
[[
TXSTextboxListenerImpl
alloc
]
initWithUITextView
:
self
.
textView
];
_textboxResetListener
=
[[
TXSTextboxResetListenerImpl
alloc
]
initWithUITextView
:
self
.
textView
];
_sortItemInterface
=
[
TXSSortItems
createWithListener
:
_textboxListener
resetListener
:
_textboxResetListener
];
}
-
(
IBAction
)
reset
:(
id
)
sender
{
[
_sortItemInterface
reset
];
_sortItemInterface
=
[
TXSSortItems
createWithListener
:
_textboxListener
];
}
-
(
IBAction
)
sort
:(
id
)
sender
...
...
example/handwritten-src/swift/TXSTextbox
Reset
ListenerImpl.swift
→
example/handwritten-src/swift/TXSTextboxListenerImpl.swift
View file @
52f4e25e
//
// TXSTextboxListenerImpl.swift
// TextSort
//
// Created by Bruno Coelho on 10/03/2017.
// Copyright © 2017 Dropbox, Inc. All rights reserved.
//
import
UIKit
@objc
class
TXSTextbox
ResetListenerImpl
:
NSObject
,
TXSTextboxReset
Listener
{
@objc
class
TXSTextbox
ListenerImpl
:
NSObject
,
TXSTextbox
Listener
{
private
var
textView_
:
UITextView
@objc
(
initWithUITextView
:)
...
...
@@ -8,7 +16,7 @@ import UIKit
textView_
=
textView
}
func
reset
(
_
text
:
String
)
{
textView_
.
text
=
text
@objc
func
update
(
_
items
:
TXSItemList
)
{
textView_
.
text
=
items
.
items
.
joined
(
separator
:
"
\n
"
)
}
}
example/objc/TextSort.xcodeproj/project.pbxproj
View file @
52f4e25e
...
...
@@ -17,7 +17,7 @@
65D7FDFB19AD0CDF0038F82F
/* TXSAppDelegate.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65D7FDF519AD0CDF0038F82F
/* TXSAppDelegate.m */
;
};
65D7FDFC19AD0CDF0038F82F
/* TXSTextboxListenerImpl.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65D7FDF719AD0CDF0038F82F
/* TXSTextboxListenerImpl.m */
;
};
65D7FDFD19AD0CDF0038F82F
/* TXSViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65D7FDF919AD0CDF0038F82F
/* TXSViewController.m */
;
};
A546A26E1E72FBAF004A8BBD
/* TXSTextbox
ResetListenerImpl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A546A26D1E72FBAF004A8BBD
/* TXSTextboxReset
ListenerImpl.swift */
;
};
A546A26E1E72FBAF004A8BBD
/* TXSTextbox
ListenerImpl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A546A26D1E72FBAF004A8BBD
/* TXSTextbox
ListenerImpl.swift */
;
};
B003051919B70561008E1F67
/* libdjinni_objc.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
B003051819B70561008E1F67
/* libdjinni_objc.a */
;
};
B097B6BC19B1C07E0047653A
/* libtextsort_objc.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
B097B6BB19B1C07E0047653A
/* libtextsort_objc.a */
;
};
/* End PBXBuildFile section */
...
...
@@ -39,7 +39,7 @@
65D7FDF719AD0CDF0038F82F
/* TXSTextboxListenerImpl.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TXSTextboxListenerImpl.m
;
sourceTree
=
"<group>"
;
};
65D7FDF819AD0CDF0038F82F
/* TXSViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
TXSViewController.h
;
sourceTree
=
"<group>"
;
};
65D7FDF919AD0CDF0038F82F
/* TXSViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TXSViewController.m
;
sourceTree
=
"<group>"
;
};
A546A26D1E72FBAF004A8BBD
/* TXSTextbox
ResetListenerImpl.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
name
=
TXSTextboxResetListenerImpl.swift
;
path
=
"../handwritten-src/swift/TXSTextboxReset
ListenerImpl.swift"
;
sourceTree
=
"<group>"
;
};
A546A26D1E72FBAF004A8BBD
/* TXSTextbox
ListenerImpl.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
name
=
TXSTextboxListenerImpl.swift
;
path
=
"../handwritten-src/swift/TXSTextbox
ListenerImpl.swift"
;
sourceTree
=
"<group>"
;
};
B003051819B70561008E1F67
/* libdjinni_objc.a */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
archive.ar
;
name
=
libdjinni_objc.a
;
path
=
"../../support-lib/build/Debug-iphoneos/libdjinni_objc.a"
;
sourceTree
=
"<group>"
;
};
B097B6BB19B1C07E0047653A
/* libtextsort_objc.a */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
archive.ar
;
name
=
libtextsort_objc.a
;
path
=
"../../build/Debug-iphoneos/libtextsort_objc.a"
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
...
...
@@ -129,7 +129,7 @@
A546A26A1E72F967004A8BBD
/* handwritten-swift */
=
{
isa
=
PBXGroup
;
children
=
(
A546A26D1E72FBAF004A8BBD
/* TXSTextbox
Reset
ListenerImpl.swift */
,
A546A26D1E72FBAF004A8BBD
/* TXSTextboxListenerImpl.swift */
,
);
name
=
"handwritten-swift"
;
sourceTree
=
"<group>"
;
...
...
@@ -208,7 +208,7 @@
65D7FDFC19AD0CDF0038F82F
/* TXSTextboxListenerImpl.m in Sources */
,
65D7FDFB19AD0CDF0038F82F
/* TXSAppDelegate.m in Sources */
,
65D7FDFD19AD0CDF0038F82F
/* TXSViewController.m in Sources */
,
A546A26E1E72FBAF004A8BBD
/* TXSTextbox
Reset
ListenerImpl.swift in Sources */
,
A546A26E1E72FBAF004A8BBD
/* TXSTextboxListenerImpl.swift in Sources */
,
65D7FDFA19AD0CDF0038F82F
/* main.mm in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
example/objc/TextSort/Base.lproj/Main_iPhone.storyboard
View file @
52f4e25e
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"12118"
systemVersion=
"16E195"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
colorMatched=
"YES"
initialViewController=
"vXZ-lx-hvc"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"7531"
systemVersion=
"14D136"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
initialViewController=
"vXZ-lx-hvc"
>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"
12086
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"
7520
"
/>
<capability
name=
"Constraints to layout margins"
minToolsVersion=
"6.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<scenes>
<!--View Controller-->
...
...
@@ -19,57 +15,48 @@
<viewControllerLayoutGuide
type=
"bottom"
id=
"2fi-mo-0CV"
/>
</layoutGuides>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"kh9-bI-dsS"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"3
75"
height=
"667
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"3
20"
height=
"568
"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<subviews>
<textView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
text=
"Type the lines to sort"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"GOB-Ok-Z2R"
>
<rect
key=
"frame"
x=
"16"
y=
"28"
width=
"
343"
height=
"581
"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"c
ustom"
customColorSpace=
"s
RGB"
/>
<rect
key=
"frame"
x=
"16"
y=
"28"
width=
"
288"
height=
"482
"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"c
alibrated
RGB"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<textInputTraits
key=
"textInputTraits"
autocapitalizationType=
"sentences"
/>
</textView>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"A93-rB-AZ4"
>
<rect
key=
"frame"
x=
"
106"
y=
"617"
width=
"3
0"
height=
"30"
/>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
misplaced=
"YES"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"A93-rB-AZ4"
>
<rect
key=
"frame"
x=
"
54"
y=
"518"
width=
"6
0"
height=
"30"
/>
<state
key=
"normal"
title=
"Sort"
>
<color
key=
"titleShadowColor"
red=
"0.5"
green=
"0.5"
blue=
"0.5"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB
"
/>
<color
key=
"titleShadowColor"
white=
"0.5"
alpha=
"1"
colorSpace=
"calibratedWhite
"
/>
</state>
<connections>
<action
selector=
"sort:"
destination=
"vXZ-lx-hvc"
eventType=
"touchUpInside"
id=
"JmD-7I-e8t"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"81n-2H-7fH"
>
<rect
key=
"frame"
x=
"1
44"
y=
"617"
width=
"88
"
height=
"30"
/>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
misplaced=
"YES"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"81n-2H-7fH"
>
<rect
key=
"frame"
x=
"1
04"
y=
"518"
width=
"113
"
height=
"30"
/>
<state
key=
"normal"
title=
"Reverse Sort"
>
<color
key=
"titleShadowColor"
red=
"0.5"
green=
"0.5"
blue=
"0.5"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB
"
/>
<color
key=
"titleShadowColor"
white=
"0.5"
alpha=
"1"
colorSpace=
"calibratedWhite
"
/>
</state>
<connections>
<action
selector=
"reverseSort:"
destination=
"vXZ-lx-hvc"
eventType=
"touchUpInside"
id=
"3ph-FD-T7F"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"cv7-dA-P8a"
>
<rect
key=
"frame"
x=
"2
40"
y=
"617"
width=
"57
"
height=
"30"
/>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
misplaced=
"YES"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"cv7-dA-P8a"
>
<rect
key=
"frame"
x=
"2
25"
y=
"518"
width=
"60
"
height=
"30"
/>
<state
key=
"normal"
title=
"Random"
>
<color
key=
"titleShadowColor"
red=
"0.5"
green=
"0.5"
blue=
"0.5"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB
"
/>
<color
key=
"titleShadowColor"
white=
"0.5"
alpha=
"1"
colorSpace=
"calibratedWhite
"
/>
</state>
<connections>
<action
selector=
"randomSort:"
destination=
"vXZ-lx-hvc"
eventType=
"touchUpInside"
id=
"Qm2-PQ-ghk"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ujE-Fh-KYB"
>
<rect
key=
"frame"
x=
"58"
y=
"617"
width=
"39"
height=
"30"
/>
<state
key=
"normal"
title=
"Reset"
/>
<connections>
<action
selector=
"reset:"
destination=
"vXZ-lx-hvc"
eventType=
"touchUpInside"
id=
"aYB-V7-80Y"
/>
</connections>
</button>
</subviews>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB
"
/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"calibratedWhite
"
/>
<constraints>
<constraint
firstItem=
"ujE-Fh-KYB"
firstAttribute=
"top"
secondItem=
"A93-rB-AZ4"
secondAttribute=
"top"
id=
"4FY-bm-lFV"
/>
<constraint
firstItem=
"cv7-dA-P8a"
firstAttribute=
"leading"
secondItem=
"81n-2H-7fH"
secondAttribute=
"trailing"
constant=
"8"
id=
"6k6-kS-Uv4"
/>
<constraint
firstItem=
"81n-2H-7fH"
firstAttribute=
"baseline"
secondItem=
"cv7-dA-P8a"
secondAttribute=
"baseline"
id=
"EDF-c5-6UY"
/>
<constraint
firstItem=
"GOB-Ok-Z2R"
firstAttribute=
"trailing"
secondItem=
"kh9-bI-dsS"
secondAttribute=
"trailingMargin"
id=
"FcW-gp-TKr"
/>
<constraint
firstItem=
"A93-rB-AZ4"
firstAttribute=
"leading"
secondItem=
"ujE-Fh-KYB"
secondAttribute=
"trailing"
constant=
"9"
id=
"Fhe-NE-isa"
/>
<constraint
firstItem=
"cv7-dA-P8a"
firstAttribute=
"top"
secondItem=
"GOB-Ok-Z2R"
secondAttribute=
"bottom"
constant=
"8"
id=
"LWK-fr-cJv"
/>
<constraint
firstItem=
"81n-2H-7fH"
firstAttribute=
"leading"
secondItem=
"A93-rB-AZ4"
secondAttribute=
"trailing"
constant=
"8"
id=
"M4F-4D-BXj"
/>
<constraint
firstItem=
"2fi-mo-0CV"
firstAttribute=
"top"
secondItem=
"81n-2H-7fH"
secondAttribute=
"bottom"
constant=
"20"
id=
"Skf-gJ-Pvn"
/>
...
...
@@ -92,6 +79,6 @@
<simulatedMetricsContainer
key=
"defaultSimulatedMetrics"
>
<simulatedStatusBarMetrics
key=
"statusBar"
/>
<simulatedOrientationMetrics
key=
"orientation"
/>
<simulatedScreenMetrics
key=
"destination"
type=
"retina4
_7.fullscreen
"
/>
<simulatedScreenMetrics
key=
"destination"
type=
"retina4"
/>
</simulatedMetricsContainer>
</document>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment