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
protected void onCreate(Bundle savedInstanceState){ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// Get the top text view | |
TextView top = (TextView) findViewById(R.id.top_text_view); | |
// Get the bottom text view | |
TextView bottom = (TextView) findViewById(R.id.bottom_text_view); | |
} |
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
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:fab="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<include layout="@layout/toolbar"/> | |
<FrameLayout |
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
// The app level | |
apply plugin: 'com.android.application' | |
android { | |
def globalConfiguration = rootProject.extensions.getByName("ext") | |
compileSdkVersion globalConfiguration["androidCompileSdkVersion"] | |
buildToolsVersion globalConfiguration["androidBuildToolsVersion"] |
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 static String getKeyForClass(Class<?> classToCheck) { | |
int index = -1; | |
int internalClassesLength = ManagerRegistry.INTERNAL_CLASSES.size(); | |
// Check if this class has a superclass defined in this project. | |
for (int i = 0; i < internalClassesLength; i++) { | |
if (ManagerRegistry.INTERNAL_CLASSES.get(i).isAssignableFrom(classToCheck)) { | |
index = i; | |
break; | |
} |
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
package com.adammcneilly.todolist.test; | |
import java.util.Date; | |
public class Task { | |
private String description; | |
private Date date; | |
private boolean isCompleted; | |
public Task() { |
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
// Examples of it being used inside a RecyclerView.adapter class | |
// Now, each instance of onCreateViewHolder is just one line instead of the same 3 every time. | |
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): AccountViewHolder { | |
return createViewHolder(::AccountViewHolder, R.layout.list_item_account, parent) | |
} | |
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): CategoryViewHolder { | |
return createViewHolder(::CategoryViewHolder, R.layout.list_item_textview, parent) | |
} |
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 class WrapContentViewPager extends ViewPager{ | |
public WrapContentViewPager(Context context) { | |
this(context, null); | |
} | |
public WrapContentViewPager(Context context, AttributeSet attributeSet) { | |
super(context, attributeSet); | |
} |
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 React, { Component } from 'react'; | |
import { SectionList, StyleSheet, Text, View} from 'react-native'; | |
export default class SectionListBasics extends Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<SectionList | |
sections={[ | |
{title: 'D', data: ['Devin']}, |
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
/** | |
* We declare a package-level function main which returns Unit and takes | |
* an Array of strings as a parameter. Note that semicolons are optional. | |
*/ | |
import java.util.Random | |
fun CharRange.startIndex() = indexOf(start) | |
fun CharRange.endIndex() = indexOf(endInclusive) | |
fun CharRange.random() = elementAt(Random().nextInt(endIndex() - startIndex()) + startIndex()) |
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
/** | |
* We declare a package-level function main which returns Unit and takes | |
* an Array of strings as a parameter. Note that semicolons are optional. | |
*/ | |
import Status.OFF | |
enum class Status { | |
ON, | |
OFF | |
} |