diff --git a/.github/shellpanel-legacy-compat-mock.py b/.github/shellpanel-legacy-compat-mock.py new file mode 100644 index 0000000..76e50de --- /dev/null +++ b/.github/shellpanel-legacy-compat-mock.py @@ -0,0 +1,27 @@ +from http.server import BaseHTTPRequestHandler, HTTPServer +from pathlib import Path + +class Handler(BaseHTTPRequestHandler): + def log_message(self, *args): + pass + + def do_GET(self): + if self.path.startswith('/api/dl/'): + body = Path('.github/shellpanel-legacy-compat-tool.sh').read_bytes() + self.send_response(200) + self.send_header('Content-Length', str(len(body))) + self.end_headers() + self.wfile.write(body) + return + self.send_error(404) + + def do_POST(self): + length = int(self.headers.get('Content-Length', '0')) + body = self.rfile.read(length) + with open('/tmp/shellpanel_legacy_compat_requests.log', 'ab') as output: + output.write(self.path.encode() + b' ' + body + b'\n') + self.send_response(200) + self.end_headers() + self.wfile.write(b'ok') + +HTTPServer(('127.0.0.1', 18080), Handler).serve_forever() diff --git a/.github/shellpanel-legacy-compat-tool.sh b/.github/shellpanel-legacy-compat-tool.sh new file mode 100644 index 0000000..2bce04e --- /dev/null +++ b/.github/shellpanel-legacy-compat-tool.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +printf '%s\n' 'shellpanel-legacy-compat-smoke-v2-tool-started' +printf '%s\n' 'shellpanel-legacy-compat-smoke-v2-result' > /tmp/shellpanel_legacy_compat_result.txt diff --git a/README.md b/README.md index fcf7a22..f1efa4c 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,31 @@ public class SlidingLayerExampleActivity extends Activity { } } ``` + +Kotlin +------ +```kotlin +class SlidingLayerExampleActivity:Activity() { + + fun onCreate(savedInstanceState:Bundle) { + super.onCreate(savedInstanceState) + setContentView(R.layout.main_view) + + val slidingLayer = findViewById(R.id.slidingLayer1) as SlidingLayer + + slidingLayer.setShadowDrawable(R.drawable.sidebar_shadow) + slidingLayer.setShadowSizeRes(R.dimen.shadow_size) + slidingLayer.setOffsetDistanceRes(R.dimen.offset_distance) + slidingLayer.setPreviewOffsetDistanceRes(R.dimen.preview_offset_distance) + slidingLayer.setStickTo(SlidingLayer.STICK_TO_LEFT) + slidingLayer.setChangeStateOnTap(false) + + slidingLayer.addView(Button(this)) + ... + } +} +``` + Code of Conduct -------------------