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
class Whatever { | |
@Nullable | |
private MessagesListener listener; | |
@NonNull | |
private ArrayList<String> localMessages = new ArrayList<>(); | |
public void setListener(@Nullable MessageListener callback) { | |
listener = callback; |
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
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
scrollView.viewTreeObserver.addOnGlobalLayoutListener { | |
val scroll: Int = getScrollRange(scrollView) | |
seekBar.min = 0 | |
seekBar.max = scroll | |
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { |
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
private void configureViews() { | |
// Create a Constraint Set and clone our constraints | |
ConstraintSet constraintSet = new ConstraintSet(); | |
// Create our progress bar… | |
ProgressBar progressBar = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleLarge); | |
progressBar.setIndeterminate(true); | |
progressBar.setId(generateViewId()); | |
// Add it to our hierarchy |
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
public ProgressConstraintLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
configureViews(); | |
} | |
private void configureViews() { | |
// Create a Constraint Set and clone our constraints | |
ConstraintSet constraintSet = new ConstraintSet(); | |
constraintSet.clone(this); | |
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
import Swift | |
/* | |
Now, a nice string is one with all of the following properties: | |
It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps). | |
It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa. | |
*/ | |
var d5input: [String] = ["qjhvvvzxzqqjkmpb", "sknufchjdvccccta", "ugqblsonqaxycvkg", "yevmbiyrqdqrmlbw", "bvpvwrhoyneorcmm", "gbyjqzcsheaxnyib", "knhsmdjssycvuoqf","nizjxiwdakpfttyh", "nwrkbhorhfqqoliz", "ynsqwvwuwzqpzzwp", "yitscrgexjfclwwh", "dhajwxqdbtrfltzz", "bmrfylxhthiaozpv", "frvatcvgknjhcndw", "xlvtdmpvkpcnmhya", "pxpemuzuqzjlmtoc", "dijdacfteteypkoq", "knrcdkrvywagglnf", "viuajtspnvnptia", "xvlqzukmwbcjgwho"] | |
var pairs = [String:Int]() |
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
// getter/setter ommited | |
class A extends RealmObject { | |
@PrimaryKey | |
private String name; | |
} | |
class B extends RealmObject { | |
@PrimaryKey | |
private String name; | |
private A a; | |
} |