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
RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap); | |
bitmapDrawable.setCornerRadius(Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f); | |
bitmapDrawable.setAntiAlias(true); | |
/* Apply drawable to ImageView */ | |
view.setImageDrawable(bitmapDrawable); |
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
Glide.with(getActivity()) | |
.load("Insert URL") | |
.asBitmap() | |
.into(new BitmapImageViewTarget(view) { | |
@Override | |
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { | |
super.onResourceReady(resource, glideAnimation); | |
RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap); | |
bitmapDrawable.setCornerRadius(Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f); | |
bitmapDrawable.setAntiAlias(true); |
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
<!-- Added First Line --> | |
<!doctype html> |
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
/* | |
Merge array | |
@param f_s : first_start | |
@param f_e : first_end | |
@param s_s : second_start | |
@param s_e : second_end | |
@param source : source array | |
*/ | |
void merge(int f_s, int f_e, int s_s, int s_e, int* source) { |
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
#include <iostream> | |
#include <stdlib.h> | |
using namespace std; | |
#define RAND_MAX_CAPACITY 100 | |
#define LIST_SIZE 8 | |
inline int getRandNumber() { return (rand() % RAND_MAX_CAPACITY) + 1; } | |
class List { |
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
// Remove toolbar top shadow | |
// Base code is android studio new application template | |
// AndroidManifest.xml | |
<activity | |
android:name=".MainActivity" | |
android:label="@string/app_name" | |
- android:theme="@style/AppTheme.NoActionBar"> // Remove this line | |
+ android:theme="@style/AppTheme"> // Replace this line | |
// styles.xml |
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
// See also: http://stackoverflow.com/questions/22490057/android-okhttp-with-basic-authentication | |
// Uses authenticator | |
fun login(val id: String, val password: String) { | |
var client = OkHttpClient() | |
client.authenticator = object:Authenticator() { | |
@Throws(IOException::class) | |
fun authenticate(route: Route, response: Response): Request { | |
var credential = Credentials.basic(id, password) | |
var request = response.request | |
.newBuilder() |
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
'use strict'; | |
function ArrayUtil() { } | |
ArrayUtil.prototype.show = function(arr, rowLength = 5) { | |
var lengthCount = rowLength; | |
arr.forEach(function(element) { | |
process.stdout.write(element + "\t"); | |
lengthCount--; | |
if (lengthCount == 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.namhyun.playground | |
import android.content.Intent | |
import android.os.Bundle | |
import android.preference.Preference | |
import android.preference.PreferenceFragment | |
import android.preference.PreferenceScreen | |
import com.namhyun.playground.camera.BasicActivity | |
import com.namhyun.playground.firebase.DatabaseActivity | |
import com.namhyun.playground.location.LocationActivity |
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
// Reference document | |
// https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html#setHasFixedSize(boolean) | |
// stackoverflow: https://stackoverflow.com/questions/28827597/when-do-we-use-the-recyclerview-sethasfixedsize | |
RecyclerView recyclerView = findViewById(R.id.recyclerview_id); | |
recyclerView.setHasFixedSize(true); // Not depend on the adapter content. | |
recyclerView.setHasFixedSize(false); // Depend on the adapter content. |
OlderNewer