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
DBHelper dbHelper = new DBHelper(getContext()); | |
SQLiteDatabase db = dbHelper.getWritableDatabase(); | |
List<String> distinct_id_products = new ArrayList<>(); | |
ArrayList<ArrayList<Double>> priceValues_Array_arrayList = new ArrayList<>(); | |
String query1 = "SELECT DISTINCT " + ProductsContract.PricesEntry.COLUMN_ID_PRODUCTS + | |
" FROM " + ProductsContract.PricesEntry.TABLE_NAME + | |
" ORDER BY " + ProductsContract.PricesEntry.COLUMN_ID_PRODUCTS; | |
Cursor cursor1 = db.rawQuery(query1, null); | |
int cursor1Count = cursor1.getCount(); |
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
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 27 | |
buildToolsVersion "27.0.3" | |
defaultConfig { | |
applicationId "com.example.android.mygarden" | |
minSdkVersion 15 | |
targetSdkVersion 27 |
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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
google() | |
} | |
dependencies { | |
// Android Plugin for Gradle |
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
# Project-wide Gradle settings. | |
# IDE (e.g. Android Studio) users: | |
# Gradle settings configured through the IDE *will override* | |
# any settings specified in this file. | |
# For more details on how to configure your build environment visit | |
# http://www.gradle.org/docs/current/userguide/build_environment.html | |
# Specifies the JVM arguments used for the daemon process. |
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
#Tue Mar 27 18:24:31 BST 2018 | |
distributionBase=GRADLE_USER_HOME | |
distributionPath=wrapper/dists | |
zipStoreBase=GRADLE_USER_HOME | |
zipStorePath=wrapper/dists | |
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | |
# Android Plugin for Gradle version (3.1) vs Required Gradle version (4.4) | |
# https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle |
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 timber.log.Timber; | |
public class TimberImplementation { | |
public static void init() { | |
Timber.plant(new Timber.DebugTree() { | |
@Override | |
protected String createStackElementTag(StackTraceElement element) { | |
return String.format("Sergio> %s; Method %s; Line %s", | |
super.createStackElementTag(element), | |
element.getMethodName(), |
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
fun View.flickerAnimation() { | |
AnimatorInflater.loadAnimator(this.context, R.animator.cycle_alpha_animator).apply { | |
setTarget(this) | |
start() | |
} | |
} |
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 com.the.package.name.extensions.get | |
import com.the.package.name.extensions.myPreferences | |
import com.the.package.name.extensions.set | |
val Context.myPreferences: SharedPreferences | |
get() = this.getSharedPreferences("${this.packageName} ${this.javaClass.simpleName}", MODE_PRIVATE) | |
@Suppress("UNCHECKED_CAST") |
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
func getCurrentWindow() -> UIWindow? { | |
if #available(iOS 13.0, *) { | |
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, | |
let sceneDelegate = windowScene.delegate as? SceneDelegate { | |
return sceneDelegate.window | |
} else { | |
return nil | |
} | |
} else { | |
// Fallback on earlier versions |
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 fun bytesToHex(bytes: ByteArray): String { | |
val result = bytes.joinToString(separator = "") { eachByte -> | |
"%02x".format(eachByte) | |
} | |
return result | |
} |
OlderNewer