Last active
February 23, 2016 21:47
-
-
Save pfn/72172c1841c6e9274232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IO(numSlider) >>= stdH >>= k.max(state.length) >>= k.progress(state.minNum) >>= k.enabled(state.num) >>= | |
hookM.seekBarChange.onProgressChanged((sb: SeekBar, p: Int, user: Boolean) => for { | |
st <- transformState(_.copy(minNum = p)) | |
_ <- IO(minNumLabel) >>= k.text(getString(R.string.minimum_numbers, p.asInstanceOf[Integer])) | |
_ <- IO(uppSlider) >>= k.progress(math.min(st.minUpper, math.max(st.length - st.minNum - st.minSym, 0))) | |
_ <- IO(symSlider) >>= k.progress(math.min(st.minSym, math.max(st.length - st.minUpper - st.minNum, 0))) | |
} yield ()), | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IO(symSlider) >>= stdH >>= k.max(state.length) >>= k.progress(state.minSym) >>= k.enabled(state.sym) >>= | |
hookM.seekBarChange.onProgressChanged((sb: SeekBar, p: Int, user: Boolean) => seekBarTransform( | |
_.copy(minSym = p), minSymLabel, R.string.minimum_symbols, p, | |
uppSlider, _.minUpper, m => m.minNum + m.minSym, | |
numSlider, _.minNum, m => m.minUpper + m.minSym)) | |
def seekBarTransform(f: PasswordGeneratorModel => PasswordGeneratorModel, label: TextView, labelres: Int, p: Int | |
seek1: SeekBar, min1: PasswordGeneratorModel => Int, delta1: PasswordGeneratorModel => Int, | |
seek2: SeekBar, min2: PasswordGeneratorModel => Int, delta2: PasswordGeneratorModel => Int): IO[Unit] = for { | |
st <- transformState(f) | |
_ <- IO(label) >>= k.text(getString(labelres, p.asInstanceOf[Integer])) | |
_ <- IO(seek1) >>= k.progress(math.min(min1(st), math.max(st.length - delta1(st), 0))) | |
_ <- IO(seek2) >>= k.progress(math.min(min2(st), math.max(st.length - delta2(st), 0))) | |
} yield () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment