Skip to content

Instantly share code, notes, and snippets.

nosix

Block or report user

Report or block nosix

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nosix
nosix / Capture.kt
Created Sep 18, 2016
Taking a snapshot of the screen for Android (SDK 21) in Kotlin 1.0.3
View Capture.kt
package xxx
import android.content.Context
import android.graphics.Bitmap
import android.graphics.PixelFormat
import android.hardware.display.DisplayManager
import android.hardware.display.VirtualDisplay
import android.media.ImageReader
import android.media.projection.MediaProjection
import android.util.Log
@nosix
nosix / AndroidManifest.xml
Last active Jul 3, 2019
Floating App for Android (SDK 21) in Kotlin 1.0.3
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
...
<service android:name=".FloatingAppService"/>
@nosix
nosix / activity_main.xml
Last active Sep 15, 2016
FloatingActionButton for Android (SDK 24)
View activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.anyspirit.nsetting.MainActivity">
<android.support.design.widget.FloatingActionButton
@nosix
nosix / AndroidManifest.xml
Last active Sep 14, 2016
How to use Android Service API
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
@nosix
nosix / README.txt
Last active Dec 7, 2016
Thymeleaf 2.1.5 snippet (ja)
View README.txt
https://github.com/nosix/thymeleaf-snippet-ja に移動
@nosix
nosix / text-to-speech.html
Created Sep 7, 2016
Text to Speech using Watson
View text-to-speech.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Text to Speech</title>
</head>
<body>
<div id="text-to-speech">
<input type="text" name="speech-text" placeholder="Sentence">
@nosix
nosix / AndroidManifest.xml
Last active Mar 5, 2019
Writting to external storage (SD card) for Android (SDK 23) in Kotlin 1.0.3.
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...
</manifest>
@nosix
nosix / AndroidManifest.xml
Last active Nov 13, 2018
How to resolve the memory leak for Android (SDK 22) in Kotlin 1.0.2. (InputMethodManager refer to RecyclerView)
View AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<application
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
...
@nosix
nosix / AndroidManifest.xml
Created Jul 28, 2016
Using the LeakCanary that is a memory leak detection library for Android and Java.
View AndroidManifest.xml
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxx">
<application
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
@nosix
nosix / MainActivity.kt
Created Jul 26, 2016
ViewPager for Android (SDK 22) in Kotlin 1.0.2. It can be scrolled in one direction. (Left only, Right only or Both)
View MainActivity.kt
class MainActivity : AppCompatActivity() {
private fun updateViewPager() {
findViewById(R.id.main_container).let {
it as ViewPager
(it.adapter as MainPagerAdapter).last = it.currentItem
}
}
}
You can’t perform that action at this time.