One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| import android.content.Context; | |
| import android.content.res.Resources; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Color; | |
| import android.graphics.Paint; | |
| import android.util.AttributeSet; | |
| import android.view.View; |
| public class Utils { | |
| /** | |
| * Get formatted representation of distance in kilometers | |
| * | |
| * @param distanceInMeters Distance in meters | |
| * @return String representation of distance in kilometers | |
| */ | |
| public static String distanceFromYouFormatted(@NonNull Context context, float distanceInMeters) { |
| package com.cornershopapp.shopper.android.utils; | |
| import java.io.File; | |
| import java.io.IOException; | |
| import okhttp3.MediaType; | |
| import okhttp3.MultipartBody; | |
| import okhttp3.OkHttpClient; | |
| import okhttp3.Request; | |
| import okhttp3.RequestBody; |
| Supplier<File> diskSupplier = new Supplier<File>() { | |
| public File get() { | |
| return getApplicationContext().getCacheDir(); | |
| } | |
| }; | |
| DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this) | |
| .setBaseDirectoryName("images") | |
| .setBaseDirectoryPathSupplier(diskSupplier) |
| /** | |
| * Configure fresco using ONLY disk cache | |
| */ | |
| public void configFresco() { | |
| Supplier<File> diskSupplier = new Supplier<File>() { | |
| public File get() { | |
| return getApplicationContext().getCacheDir(); | |
| } | |
| }; |
| import java.io.BufferedReader; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| public class ParseMockJson { | |
| public static String readFromfile(String filename) { | |
| StringBuilder returnString = new StringBuilder(); |
| private boolean hasSmallDensity() { | |
| int densityDpi = getResources().getDisplayMetrics().densityDpi; | |
| if (densityDpi < DisplayMetrics.DENSITY_MEDIUM) { | |
| return true; | |
| } | |
| return false; | |
| } |
| apply plugin: 'com.android.application' | |
| apply plugin: 'kotlin-android' | |
| apply plugin: 'kotlin-kapt' | |
| android { | |
| compileSdkVersion 25 | |
| buildToolsVersion "26.0.0" | |
| defaultConfig { | |
| applicationId "pe.devpicon.android.myoxxorequestapp" | |
| minSdkVersion 21 |
| fun getDataSource(): MysqlDataSource { | |
| val fileInputStream = FileInputStream("myfile.properties") | |
| val properties = Properties() | |
| properties.load(fileInputStream) | |
| val mySqlDataSource = MysqlDataSource()?.apply { | |
| setURL(properties.getProperty("MYSQL_DB_URL")) | |
| user = properties.getProperty("MYSQL_DB_USERNAME") | |
| setPassword(properties.getProperty("MYSQL_DB_PASSWORD")) |