oscarb pad

Guides, resources, notes, docs and knowledge for everything Oscar.

Tags

Android Studio

Download Android Studio and SDK Tools

Themes

Color scheme

Editor > Tear line: #586672

Plugins

Virtual devices

Use x86 images instead of x86_64, for faster boot-up of emulator

Install

File > Import settings…

ADB

Add adb to path variable

%localappdata%\Android\sdk\platform-tools

List devices

adb devices -l

Install app

adb install app-release.apk

Install app on specific device

adb -s "<deviceId>" install app-release.apk

Uninstall app

adb uninstall com.package.name

Start app

adb shell monkey -p your.app.package.name 1

Input text on device

adb shell input text 'my string here. With some characters escaped like \$ that'

Enable logging on Huawei devices

*#*#2846579#*#*

Background setting > Log Setting

Code style

Settings

Setup horizontal scroll wheel to Alt + /

Keyboard shortcuts

Shortcut Action
Ctrl + NumPad + Increase Font Size
Ctrl + NumPad - Decrease Font Size
Ctrl + NumPad-0 Reset Font Size
Ctrl + R Refactor This…
Ctrl + NumPad , Run
Alt + NumPad , Run…
Alt + NumPad + Apply Changes
Alt + ' VCS popup
Ctrl + NumPad 1 Toggle Presentation mode
Ctrl + NumPad 2 Toggle Distraction Free mode
Ctrl + NumPad 3 Toggle Full Screen mode
Ctrl + Enter Complete Current Statement
Ctrl + Space Code Completion SmartType
Ctrl + Shift + Enter Code Completion Basic
Alt + Page Up/Page Down Move to opposite group
Ctrl + W Close tab

Live Templates

Create a new intent

Abbreviation
Intnt
Description
Create an intent that starts an Activity

Template text:

android.content.Intent intent = new Intent(this, $className$.class);
intent.putExtra($CURSOR$);
startActivity(intent);

Reformat according to style

Template variables

Name Expression Default value Skip if defined
className classNameComplete()    
CURSOR      

Create a card

Snackbar

Abbreviation
Snackbar
Description
Create a new Snackbar

Template text:

Snackbar.make(findViewById(R.id.$resId$), "$text$", Snackbar.LENGTH_SHORT).show();

Reformat according to style

Template variables

Name Expression Default value Skip if defined
resId completeSmart()    
text      

Applicable in Java: statement.

Tips

When switching between a debug apk and a signed release apk on the same device, remember to first uninstall the debug apk for all users.

Edit Custom VM options…

-Xms256m
-Xmx1024m

C:\Users\Oscar.gradle\gradle.properties

org.gradle.daemon=true

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX: +HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.parallel=true

org.gradle.configureondemand=true

Set up device for Espresso tests

Turn off animations on your test device, otherwise Espresso may not work as expected and the tests may fail. Turn off animations from Settings by opening Developer Options and turning all the following options under “Drawing” off:

Resources

Resources