Fork me on GitHub

Wednesday, January 23, 2013

Scaloid powered Soundcorset metronome & tuner


I recently released all-in-one metronome and tuner application, called Soundcorset metronome & tuner. It covers all of the basic features required to metronomes and tuners, and I will grow it constantly.

Using Scaloid, the UI layout is written incredibly concise without any XML. For example, the image shown below is the screenshot of the main activity:


In "bpm" section, the code is written as:

this += new SLinearLayout {
  SButton("-", bpm -= 1).textSize(25 dip).<<(55 dip, FILL_PARENT).>>
  SButton("+", bpm += 1).textSize(25 dip).<<(55 dip, FILL_PARENT).>>
  this += new SVerticalLayout {
    STextView(R.string.bpm)
    bpmText = STextView().textSize(25 dip)
    latinBpmText = STextView("Allegro")
  }.<<.wrap.marginLeft(10 dip).>>
}.<<.>>

A simple 9 lines of code actually build the UI and wire the logic. Look at the statement "bpm -= 1" at the line 3. This simple and intuitive code actually play the beat a little slowly, move slidebar, and change the number indicates the bps. All these chores are hidden behind the assignment overload function:

def bpm_=(b: Int) {
  // move the progress bar and do more
}

Then Scala language permits fancy expressions such as "bpm += 10".

4 comments:

  1. Kami akan memberikan 100 rekomendasi game offline apk mod untuk kamu yang memiliki koneksi internet atau paket internet yang. DOWNLOAD DI PLAYSTORE. Game Pertualang Offline Terbaik 2019, Game Pertualang Offline Terbaik. Petualangan Terbaik 2019, Dijamin Seru Wajib Kalian Download. Game Android offline free download menjadi pilihan yang diminati para penggemar game yang ingin hemat kuota tetapi tetap memainkan game kesayangan. daftar game Android Offline Gratis Tanpa Koneksi. Kalian dapat mengunduh atau men download game offline android apk mod di: https://downloadgameofflineapkmod.blogspot.com - download game offline.

    ReplyDelete