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.chimeraprime.prizecam.tools.fragment; | |
import android.os.Bundle; | |
import android.support.v4.BuildConfig; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentActivity; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentTransaction; | |
import android.util.Log; |
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
/get json array from json string | |
JsonArray jarray = jobject.getAsJsonArray("reportRecords"); | |
//get a list of reportRecords using Gson | |
Gson mGson = new Gson(); | |
Type listType = new TypeToken<List<DataMetrics>>(){}.getType(); | |
List<DataMetrics> dataMetricsList = mGson.fromJson(reportRecordsJsonArray, listType); | |
//Filter only the ones with a specific name | |
List<DataMetrics> dataMetricsFilteredList = dataMetricsList.stream().filter(dataMetric -> dateMetric.getName.equals("Client::Sync")); |
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
switch($category) { | |
case 2: | |
$title = 'zakupy grupowe TRAVEL PODRÓŻE'; | |
break; | |
case 11: | |
$title = 'zakupy grupowe KRAKÓW'; | |
break; | |
case 10: | |
$title = 'zakupy grupowe WARSZAWA - okazje cenowe, kody kupony rabatowe, oferty promocyjne'; | |
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.bignerdranch.android.nerdfinder.web; | |
import android.content.Context; | |
import android.net.Uri; | |
import android.util.Log; | |
import com.bignerdranch.android.nerdfinder.exception.UnauthorizedException; | |
import com.bignerdranch.android.nerdfinder.listener.VenueCheckInListener; | |
import com.bignerdranch.android.nerdfinder.listener.VenueSearchListener; |
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
// status bar height | |
int statusBarHeight = 0; | |
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
if (resourceId > 0) { | |
statusBarHeight = getResources().getDimensionPixelSize(resourceId); | |
} | |
// action bar height | |
int actionBarHeight = 0; | |
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes( |
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
<?xml version="1.0" encoding="utf-8"?><!-- Clickable and selectableItemBackground are optional --> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="?selectableItemBackground" | |
android:clickable="true" | |
android:focusable="true" | |
android:minHeight="72dp" |
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
Observable.just("Will") | |
.observeOn(Schedulers.io()) | |
.flatMap({ name -> | |
updateUserName.execute(name) //returns another Observable<ApiResult> after calling the API | |
}, { | |
//this is executed after resolving the last observable emitted, so the result is ready. | |
name: String, apiResult: ApiResult -> Pair(name, apiResult) | |
}) | |
.subscribe({ result -> |
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
interface CryptographyManager { | |
/** | |
* This method first gets or generates an instance of SecretKey and then initializes the Cipher | |
* with the key. The secret key uses [ENCRYPT_MODE][Cipher.ENCRYPT_MODE] is used. | |
*/ | |
fun getInitializedCipherForEncryption(keyName: String): Cipher | |
/** | |
* This method first gets or generates an instance of SecretKey and then initializes the Cipher |