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
var s2t = function(str) { | |
var _str = ''; | |
var po; | |
for(var i=0; i < str.length; i++) { | |
if((po = sMap.indexOf(str.charAt(i))) != -1) | |
_str += tMap.charAt(po); | |
else | |
_str += str.charAt(i); | |
} | |
return _str; |
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
/* | |
* Copyright (C) 2012 Google Inc. | |
* Licensed to The Android Open Source Project. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
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.ricebook.app.api; | |
import com.ricebook.app.api.utils.OkClientFactory; | |
import com.ricebook.app.api.utils.RestAdapterFactory; | |
import android.app.Application; | |
import retrofit.RestAdapter; | |
/** |
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
android.applicationVariants.all { variant -> | |
println "*********" + variant.description + "**********"; | |
def variants = variant.baseName.split("-"); | |
def apkName = "ricebook-"; | |
apkName += variants[0]; | |
apkName += "-v" + android.defaultConfig.versionName; | |
if (!variant.zipAlign) { | |
apkName += "-unaligned"; | |
} | |
if (variant.buildType.name == "release") { |
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
///////////// | |
// NDK Support | |
////////////// | |
// If using this, Android studio will fail run the following to set the environment variable for android studio: | |
// export ANDROID_NDK_HOME=/Android/android-ndk-r8e (Linux) | |
// launchctl setenv ANDROID_NDK_HOME /Android/android-ndk-r8e (Mac) | |
// or, better, add the export to the .profile of your user home and re-login | |
task copyNativeLibs(type: Copy, dependsOn: 'buildNative') { | |
from(new File('src/main/libs')) { include '**/*.so' } | |
into new File(buildDir, 'native-libs') |
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
public class RoundedDrawable extends Drawable { | |
private static final boolean USE_VIGNETTE = true; | |
private RectF mRect = new RectF(); | |
private final Paint paint; | |
private final int mRadius; | |
private final BitmapShader bitmapShader; | |
public RoundedDrawable(Bitmap bitmap, int radius) { | |
bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); | |
paint = new Paint(); |
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
/* | |
* Copyright (C) 2012 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
public static String getLocalizedName(Resources res, int bucketId, | |
String name) { | |
if (bucketId == MediaSetUtils.CAMERA_BUCKET_ID) { | |
return res.getString(R.string.folder_camera); | |
} else if (bucketId == MediaSetUtils.DOWNLOAD_BUCKET_ID) { | |
return res.getString(R.string.folder_download); | |
} else if (bucketId == MediaSetUtils.IMPORTED_BUCKET_ID) { | |
return res.getString(R.string.folder_imported); | |
} else if (bucketId == MediaSetUtils.SNAPSHOT_BUCKET_ID) { | |
return res.getString(R.string.folder_screenshot); |
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
/** | |
* A {@link HttpRequest.ConnectionFactory connection factory} which uses OkHttp. | |
* <p/> | |
* Call {@link HttpRequest#setConnectionFactory(HttpRequest.ConnectionFactory)} with an instance of | |
* this class to enable. | |
*/ | |
public class OkConnectionFactory implements HttpRequest.ConnectionFactory { | |
private final OkHttpClient client; | |
public OkConnectionFactory() { |
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
public class LoadMoreListView extends ListView implements OnScrollListener { | |
private static final String TAG = "LoadMoreListView"; | |
/** | |
* Listener that will receive notifications every time the list scrolls. | |
*/ | |
private OnScrollListener mOnScrollListener; | |
private LayoutInflater mInflater; |