Skip to content

Instantly share code, notes, and snippets.

Avatar

JosephRoskopfOPI

View GitHub Profile
View TestViewModel.java
public class TestViewModel extends ViewModel {
}
View gist:3423eac96fa95876d4e1bff2ce2dc77d
int toReturn = 0;
if(calcResult.getEffectiveShortOnDutySecondsLeft() > calcResult.getAvailableWeeklyOnDutySecondsLeft()) {
toReturn = calcResult.getAvailableWeeklyOnDutySecondsLeft();
}else{
toReturn = calcResult.getEffectiveShortOnDutySecondsLeft();
}
if(toReturn < 0) {
toReturn = 0;
View auto_size_java.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textViewLong = (TextView) findViewById(R.id.textViewLong);
EditText editText = (EditText) findViewById(R.id.editText);
editText.addTextChangedListener(new TextWatcher() {
@Override
View auto_size.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewShort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
View gist.java
FirebaseUser firebaseUser = mAuth.getCurrentUser();
if (firebaseUser != null) {
// Try refreshing the user to make sure they didn't get deleted or deactivated:
firebaseUser.reload().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
// User is signed in and still valid
}
else {
View nested_linear.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2"
tools:context="com.example.opi.blog.MainActivity">
<LinearLayout
View percent_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.opi.blog.MainActivity">
<Button
android:background="@android:color/holo_red_dark"
You can’t perform that action at this time.