@@ -20,20 +20,20 @@ const ButtonData = struct {
2020};
2121
2222pub fn timerInvoke (data : ? * anyopaque , jni : * android.JNI , method : android.jobject , args : android.jobjectArray ) ! android.jobject {
23- var btn_data = @ptrCast (* ButtonData , @alignCast (@alignOf ( * ButtonData ), data ));
23+ var btn_data : * ButtonData = @ptrCast (@alignCast (data ));
2424 btn_data .count += 1 ;
2525 std .log .info ("Running invoke!" , .{});
2626 const method_name = try android .JNI .String .init (jni , try jni .callObjectMethod (method , "getName" , "()Ljava/lang/String;" , .{}));
2727 defer method_name .deinit (jni );
28- std .log .info ("Method {}" , .{std .unicode .fmtUtf16le (method_name .slice )});
28+ std .log .info ("Method {}" , .{std .unicode .fmtUtf16Le (method_name .slice )});
2929
3030 const length = try jni .invokeJni (.GetArrayLength , .{args });
3131 var i : i32 = 0 ;
3232 while (i < length ) : (i += 1 ) {
3333 const object = try jni .invokeJni (.GetObjectArrayElement , .{ args , i });
3434 const string = try android .JNI .String .init (jni , try jni .callObjectMethod (object , "toString" , "()Ljava/lang/String;" , .{}));
3535 defer string .deinit (jni );
36- std .log .info ("Arg {}: {}" , .{ i , std .unicode .fmtUtf16le (string .slice ) });
36+ std .log .info ("Arg {}: {}" , .{ i , std .unicode .fmtUtf16Le (string .slice ) });
3737
3838 if (i == 0 ) {
3939 const Button = try jni .findClass ("android/widget/Button" );
@@ -61,10 +61,10 @@ pub const AndroidApp = struct {
6161
6262 // This is needed because to run a callback on the UI thread Looper you must
6363 // react to a fd change, so we use a pipe to force it
64- pipe : [2 ]std.os .fd_t = undefined ,
64+ pipe : [2 ]std.posix .fd_t = undefined ,
6565 // This is used with futexes so that runOnUiThread waits until the callback is completed
6666 // before returning.
67- uiThreadCondition : std .atomic .Atomic (u32 ) = std .atomic .Atomic (u32 ).init (0 ),
67+ uiThreadCondition : std .atomic .Value (u32 ) = std .atomic .Value (u32 ).init (0 ),
6868 uiThreadLooper : * android.ALooper = undefined ,
6969 uiThreadId : std.Thread.Id = undefined ,
7070
@@ -83,10 +83,10 @@ pub const AndroidApp = struct {
8383 // Initialize the variables we need to execute functions on the UI thread
8484 self .uiThreadLooper = android .ALooper_forThread ().? ;
8585 self .uiThreadId = std .Thread .getCurrentId ();
86- self .pipe = try std .os .pipe ();
86+ self .pipe = try std .posix .pipe ();
8787 android .ALooper_acquire (self .uiThreadLooper );
8888
89- var native_activity = android .NativeActivity .init (self .activity );
89+ const native_activity = android .NativeActivity .init (self .activity );
9090 var jni = native_activity .jni ;
9191 self .uiJni = native_activity ;
9292
@@ -125,7 +125,7 @@ pub const AndroidApp = struct {
125125
126126 const Instance = struct {
127127 fn callback (_ : c_int , _ : c_int , data : ? * anyopaque ) callconv (.C ) c_int {
128- const data_struct = @ptrCast (* Data , @alignCast (@alignOf ( Data ), data .? ));
128+ const data_struct : * Data = @ptrCast (@alignCast (data .? ));
129129 const self_ptr = data_struct .self ;
130130 defer self_ptr .allocator .destroy (data_struct );
131131
@@ -143,7 +143,7 @@ pub const AndroidApp = struct {
143143 Instance .callback ,
144144 data_ptr ,
145145 );
146- std .debug .assert (try std .os .write (self .pipe [1 ], "hello" ) == 5 );
146+ std .debug .assert (try std .posix .write (self .pipe [1 ], "hello" ) == 5 );
147147 if (result == -1 ) {
148148 return error .LooperError ;
149149 }
@@ -156,7 +156,7 @@ pub const AndroidApp = struct {
156156 }
157157
158158 pub fn deinit (self : * AndroidApp ) void {
159- @atomicStore (bool , & self .running , false , .SeqCst );
159+ @atomicStore (bool , & self .running , false , .seq_cst );
160160 if (self .thread ) | thread | {
161161 thread .join ();
162162 self .thread = null ;
0 commit comments