This file contains hidden or 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
#!/bin/bash | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title V2G | |
# @raycast.mode compact | |
# Optional parameters: | |
# @raycast.icon 📸 |
This file contains hidden or 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.experiments.preferencehelper | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.util.Log | |
import com.experiments.preferencehelper.PreferenceHelper.get | |
import com.experiments.preferencehelper.PreferenceHelper.set | |
class MainActivity : AppCompatActivity() { |
This file contains hidden or 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
... | |
apply from: './flavors.gradle' | |
... | |
android { | |
buildTypes { | |
productFlavors { | |
project.flavors.each { flavor, config -> | |
"$flavor" { | |
dimension 'scope' | |
if (flavor != 'full') { |
This file contains hidden or 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
data class SimpleDemoState(val listing: Async<Listing> = Uninitialized) | |
class SimpleDemoViewModel(override val initialState: SimpleDemoState) : MvRxViewModel<SimpleDemoState>() { | |
init { | |
fetchListing() | |
} | |
private fun fetchListing() { | |
// This automatically fires off a request and maps its response to Async<Listing> | |
// which is a sealed class and can be: Unitialized, Loading, Success, and Fail. |
This file contains hidden or 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 LiveData<List<WeatherEntry>> getCurrentWeatherForecasts() { | |
initializeData(); | |
Date today = SunshineDateUtils.getNormalizedUtcDateForToday(); | |
return mWeatherDao.getCurrentWeatherForecasts(today); | |
} |
This file contains hidden or 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
@Database(entities = { WeatherEntry.class , UserEntry.class}, version = 2) | |
//any change to tables .. you must increase version, and define a migration methodology | |
@TypeConverters(DateConverter.class) | |
public abstract class SunshineDatabase extends RoomDatabase { | |
... | |
public static SunshineDatabase getInstance(Context context) { | |
if (sInstance == null) { | |
synchronized (LOCK) { |
This file contains hidden or 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
@Dao | |
public interface WeatherDao { | |
@Insert(onConflict = OnConflictStrategy.REPLACE) | |
void bulkInsert(WeatherEntry... entries); | |
@Query("SELECT * FROM weather where date = :date") | |
LiveData<WeatherEntry> getWeatherByDate(Date date); |
This file contains hidden or 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
@Entity(tableName = "weather", indices = @Index(value = "date", unique = true)) | |
public class WeatherEntry { | |
@PrimaryKey(autoGenerate = true) private int id; | |
private int weatherIconId; | |
.. | |
.. |
This file contains hidden or 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
mLiveDataTimerViewModel.getElapsedTime().observe(this, new Observer<Long>() { | |
@Overridepublic void onChanged(@Nullable Long aLong) { | |
//update UI | |
} | |
}); |
This file contains hidden or 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 MutableLiveData<Long> mElapsedTime = new MutableLiveData<>(); |
NewerOlder