Formatting + fix lint issues

This commit is contained in:
Gaurav Ujjwal 2022-04-07 21:56:21 +05:30
parent 0cce0c2ef8
commit 00bd2da0f6
12 changed files with 27 additions and 19 deletions

View file

@ -29,9 +29,9 @@ class VncClientTest {
}
lateinit var server: TestServer
lateinit var client: VncClient
lateinit var observer: TestObserver
private lateinit var server: TestServer
private lateinit var client: VncClient
private lateinit var observer: TestObserver
private val sampleText = "Smelly Cat"
private val sampleTextWithAccent = "Pokémon Fõbár"

View file

@ -9,6 +9,7 @@
package com.gaurav.avnc.vnc
import android.net.Uri
import com.gaurav.avnc.model.ServerProfile
import org.junit.Assert.assertEquals
import org.junit.Test
@ -44,6 +45,7 @@ class VncUriTest {
assertEquals("foo", uri.password)
assertEquals(2, uri.securityType)
assertEquals(true, uri.viewOnly)
assertEquals(ServerProfile.CHANNEL_TCP, uri.channelType)
}
@Test
@ -55,6 +57,7 @@ class VncUriTest {
assertEquals("foo", uri.password)
assertEquals(2, uri.securityType)
assertEquals(true, uri.viewOnly)
assertEquals(ServerProfile.CHANNEL_TCP, uri.channelType)
}
@Test

View file

@ -24,6 +24,7 @@
<activity-alias
android:name=".StartupActivity"
android:exported="true"
android:targetActivity=".ui.home.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -33,6 +34,7 @@
<activity-alias
android:name=".UriReceiverActivity"
android:exported="true"
android:targetActivity=".ui.vnc.UriReceiverActivity">
<intent-filter>

View file

@ -95,7 +95,9 @@ void freeCursor(Cursor *cursor) {
free(cursor);
}
void updateCursor(Cursor *cursor, uint8_t *buffer, uint8_t *mask, uint16_t width, int height, int xHot, int yHot) {
void updateCursor(Cursor *cursor, uint8_t *buffer, uint8_t *mask, uint16_t width, uint16_t height,
uint16_t xHot, uint16_t yHot) {
freeCursorBuffers(cursor);
cursor->buffer = buffer;
cursor->mask = mask;

View file

@ -11,7 +11,6 @@
#include <rfb/rfbclient.h>
#include "ClientEx.h"
#include "Cursor.h"
#include "Utility.h"
@ -24,7 +23,7 @@ struct JniContext {
jclass managedCls; //Managed `VncClient` class
jmethodID cbFramebufferUpdated; //Cached reference to managed callback
JNIEnv *getEnv() {
JNIEnv *getEnv() const {
JNIEnv *env = nullptr;
if (vm != nullptr && vm->GetEnv((void **) &env, JNI_VERSION_1_6) == JNI_OK)
@ -204,13 +203,14 @@ static rfbBool onMallocFrameBuffer(rfbClient *client) {
return TRUE;
}
static void onGotCursorShape(rfbClient *client, int xhot, int yhot, int width, int height, int bytesPerPixel) {
static void onGotCursorShape(rfbClient *client, int xHot, int yHot, int width, int height, int bytesPerPixel) {
auto ex = getClientExtension(client);
LOCK(ex->mutex);
//Steel buffers from rfbClient
updateCursor(ex->cursor, client->rcSource, client->rcMask, width, height, xhot, yhot);
updateCursor(ex->cursor, client->rcSource, client->rcMask, (uint16_t) width, (uint16_t) height,
(uint16_t) xHot, (uint16_t) yHot);
client->rcSource = NULL;
client->rcMask = NULL;
@ -350,7 +350,7 @@ extern "C"
JNIEXPORT jboolean JNICALL
Java_com_gaurav_avnc_vnc_VncClient_nativeSendKeyEvent(JNIEnv *env, jobject thiz, jlong client_ptr,
jlong key, jboolean is_down) {
return (jboolean) SendKeyEvent((rfbClient *) client_ptr, (uint32_t) key, is_down);
return (jboolean) SendKeyEvent((rfbClient *) client_ptr, (uint32_t) key, is_down ? TRUE : FALSE);
}
extern "C"
@ -460,7 +460,7 @@ Java_com_gaurav_avnc_vnc_VncClient_nativeUploadCursor(JNIEnv *env, jobject thiz,
auto fb = (uint32_t *) client->frameBuffer;
auto buffer = (uint32_t *) cursor->buffer;
auto scratch = (uint32_t *) cursor->scratchBuffer;
auto mask = (uint8_t *) cursor->mask;
auto mask = cursor->mask;
//Scratch buffer index
int32_t z = 0;

View file

@ -66,7 +66,7 @@ open class BaseViewModel(val app: Application) : AndroidViewModel(app) {
/**
* Executes given [block] asynchronously on IO thread.
*/
protected fun asyncIO(block: () -> Unit) = asyncIO(block, {})
protected fun asyncIO(block: () -> Unit) = asyncIO(block) {}
/**
* Executes given [block] asynchronously on IO thread.

View file

@ -97,7 +97,7 @@ class VncClient(private val observer: Observer) {
* This flags works around the issue by temporarily ignoring serer-side updates.
*/
@Volatile
var ignorePointerMovesByServer = false;
var ignorePointerMovesByServer = false
/**
* Setup different properties for this client.

View file

@ -7,6 +7,7 @@
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
@ -32,10 +33,10 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_large"
android:layout_marginBottom="@dimen/margin_normal"
android:drawableEnd="@drawable/ic_gpl"
android:drawablePadding="@dimen/padding_small"
android:text='@{@string/app_name + " is released under the GNU General Public License, version 3 or later."}'
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
app:drawableEndCompat="@drawable/ic_gpl" />
<TextView

View file

@ -45,7 +45,7 @@
android:contentDescription="Hide Virtual Keys"
android:minWidth="30dp"
android:src="@drawable/ic_clear"
android:tint="?colorError" />
app:tint="?colorError" />
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~ Meta keys ~~~~~~~~~~~~~~~~~~~~~-->

View file

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources />

View file

@ -6,8 +6,8 @@
~ See COPYING.txt for more details.
-->
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:title="@string/pref_input">
<PreferenceCategory

View file

@ -162,7 +162,7 @@ class FrameStateTest {
val state = FrameState()
state.setViewportSize(50f, 50f)
state.setFramebufferSize(100f, 100f)
state.showFbPoint(49f, 49f)
assertEquals(0f, state.frameX)
assertEquals(0f, state.frameY)