How to add Keyboard language on AndroidTV emulator? - android-emulator

I'm developing AndroidTV application. And I need to input characters from another language into EditText (in my case - Russian). Is there any way I can do it?
Simply typing Russian doesn't make any effect. I also tried via adb input text, but as text contains Russian characters it gets killed.
generic_x86:/ # whoami
root
generic_x86:/ # input text 'пвыа'
Killed
137|generic_x86:/ # input text 'sdf'
generic_x86:/ #
I also didn't find a way to add a new keyboard layout, I googled for it, but no luck so far.

Use api 28 base emulator.
Settings -> Device preference -> Keyboard -> Gboard Settings -> Language -> Replace English with your language

Related

Force tab character indents for a language in vscode

Im trying to make a vscode extension for a video game level format, as it reads files and parses them into playable levels, but it uses indents for more than just visuals, and removing them all would make the level not playable.
The issue is that the game only uses tab characters (\t) for tabs, and wont parse the level if spaces are used.
I need to know if there is a way to ignore the users default settings and always use tab characters when pressing tab while typing in a language added by an extension (i need this built into the extension, having every user go and change some setting themself for a file type would be very annoying)

How to use Apple's swift-format with Xcode?

I started a new iOS project in Xcode with SwiftUI and I want to install swift-format to format the code as I work on the app. Unfortunately, it seems harder then I anticipated.
The library: https://github.com/apple/swift-format
I added swift-format package using Xcode, like this: File -> Swift Packages -> Add Package Dependency....
And I have no idea why the executable is disabled:
Anyways, after selecting the first two options (SwiftFormat and SwiftFormatConfiguration) I don't know how to use this library in order to format the code...
My question is, how I can run this library so that it formats the files for me?
You can use XCFormat. It is Xcode extension that you will find in the App Store. I think it is free. Then, you can access it through the editor menu in Xcode. Of course, you can also create a shortcut and simply use your keyboard for added convenience.
I made it work via Quick Actions and shortcut to format current document in Xcode with swift-format.
Follow instructions from https://github.com/apple/swift-format to build the library
Place swift-format binary to the global path... I did it with symlink ln -s /path/to/your/binary/swift-format /usr/local/bin/swift-format
Open Automator and create new Quick Action (name it with recognizable name like xcode-swift-format) and add the following Apple script to the action:
set current_document_path to ""
tell application "Xcode"
set last_word_in_main_window to (word -1 of (get name of window 1))
if (last_word_in_main_window is "Edited") then
tell application "System Events" to keystroke "s" using command down
delay 1
end if
set last_word_in_main_window to (word -1 of (get name of window 1))
set current_document to document 1 whose name ends with last_word_in_main_window
set current_document_path to path of current_document
end tell
if (current_document_path is not "") then
do shell script "/usr/local/bin/swift-format format -i " & current_document_path
end if
Set shortcut in System Preferences -> Keyboard -> Shortcuts -> Services for your quick action:
Add Xcode to System Preferences -> Security & Privacy -> Privaciy -> Accessibility (This step is needed so script can send Command+S keystroke to Xcode if you try to format unsaved document, it means it will save document before formatting)
Edit your.swift file in Xcode and hit the shortcut in my case Alt+Command+= ... it takes a second or two for the doc to be formatted.

Is there a way to set the find options in Xcode9 via keyboard?

If you want to search for something in Xcode9, ⌘F opens the find bar, ⇧⌘F opens Find in Project in the Navigator.
However, I often want to switch between contains, matches and regex, but the dropdowns (see image) to set this are not reachable via keyboard, only mouse.
For Xcode7, there seemed to be a way (see here), but this doesn't work any more.
Does anyone know how to set these options via keyboard in Xcode9?
In macOS System Preferences -> Keyboard -> Shortcuts, you have to set Full Keyboard Access to All Controls.
After that you can Tab to all the options.
This has worked for Find in Project (⇧⌘F) since Xcode 9.0. For the "normal" find (⌘F) it was buggy util apple fixed it in Xcode 9.3.
Resolved Issues
The source editor find and replace control now
supports Full Keyboard Access. (33666790)

How do I see the current encoding of a file in Sublime Text?

How do I see the current encoding of a file in Sublime Text?
This seems like a pretty simple thing to do but searching has not yielded much. Any pointers would be appreciated!
Since this thread is a popular result in google search, here is the way to do it for sublime text 3 build 3059+:
in user preferences, add the line:
"show_encoding": true
Another option in case you don't wanna use a plugin:
Ctrl+`
or
View -> Show Console
type on the console the following command:
view.encoding()
In case you want to something more intrusive, there's a option to create an shortcut that executes the following command:
sublime.message_dialog(view.encoding())
With the EncodingHelper plugin you can view the encoding of the file on the status bar. Also you can convert the encoding of the file and extended another functionalities.
For my part, and without any plug-in, simply saving the file either from the File menu or with keyboards shortcuts
CTRL + S (Windows, Linux) or CMD + S (Mac OS)
briefly displays the current encoding - between parentheses - in the status bar, at the bottom of the editor's window. This suggestion works in Sublime Text 2 and 3.
Note that the displayed encoding to the right in the status bar of Sublime Text 3, may display the wrong encoding of the file if you have attempted to save the file with an encoding that can't represent all the characters in your file.
In this case you would have seen an informational dialog and Sublime telling you it's falling back to UTF-8. This may not be the case, so be careful.
ShowEncoding is another simple plugin that shows you the encoding in the status bar. That's all it does, to convert between encodings use the built-in "Save with Encoding" and "Reopen with Encoding" commands.
plugin ConverToUTF8 also has the functionality.

all spaces replaced by tabs when ctrl+shift+f

working in eclipse,when I type 'tab',it insert 4 spaces,it works well.but after ctrl +shift +f to format,all the 4 space will been replaced by tabs.how to stop it?
Window->Preferences->Java->Code Style->Formatter: Edit Active profile->Indentation->Tab Policy: Select Spaces
You can't change the default profiles so you must provide a new profile name, then press the Apply button, then the Okay button. It may help to press the Apply button once you have returned to the Formatter screen. Go back and look at the Tab Policy again to verify that your changes were saved.
Including the above suggestions, I recommend searching for code style or style to get to the coding standard being applied with the user requests formatting of the code. It is possible that the code style uses tabs instead of spaces.
The only way that currently works is to use Ctrl-A Ctrl-X Ctrl-V on all code after using Ctrl-Shift-F. This will replace all tabs with spaces.
Don't know which version of Eclipse you are using but for
Eclipse 3.6 (for example) you may go to
Window->Preferences->General->Editors->Text Editors->Insert spaces for tabs
This will change Eclipse to use spaces instead of tabs
The place in the Preferences may be different depending on which version of Eclipse you use. If you load the preferences window you can use the search function there to find "Formatters" and set your preferences for different types of files, or generally.