Source: Francesco Cervone, Florina Muntenescu, Android Architecture Blueprint
-------- ------------- ---------
| View | <----> | Presenter | ----> | Model |
-------- ------------- ---------
Source: Francesco Cervone, Florina Muntenescu, Android Architecture Blueprint
-------- ------------- ---------
| View | <----> | Presenter | ----> | Model |
-------- ------------- ---------
import Foundation | |
import Photos | |
typealias AssetID = String | |
class ImageUtil { | |
static var defaultAlbumName = "App Name" | |
static var videosAlbumName = "App Name Videos" |
// Note: to add a JPEG COM marker go here: | |
// https://gist.github.com/nyg/bdeae8190a41b4b56bde8e13dd471ecc | |
import Foundation | |
import ImageIO | |
#if os(iOS) | |
import MobileCoreServices | |
#endif |
import UIKit | |
import Photos | |
extension PHPhotoLibrary { | |
// MARK: - PHPhotoLibrary+SaveImage | |
// MARK: - Public | |
func savePhoto(image:UIImage, albumName:String, completion:((PHAsset?)->())? = nil) { | |
func save() { |
func getURL(ofPhotoWith mPhasset: PHAsset, completionHandler : @escaping ((_ responseURL : URL?) -> Void)) { | |
if mPhasset.mediaType == .image { | |
let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions() | |
options.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData) -> Bool in | |
return true | |
} | |
mPhasset.requestContentEditingInput(with: options, completionHandler: { (contentEditingInput, info) in | |
completionHandler(contentEditingInput!.fullSizeImageURL) | |
}) |
package com.gunhansancar.changelanguageexample.helper; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import android.os.Build; | |
import android.preference.PreferenceManager; |
public static byte[] rotateYUV420Degree90(byte[] data, int imageWidth, int imageHeight) { | |
byte[] yuv = new byte[imageWidth * imageHeight * 3 / 2]; | |
// Rotate the Y luma | |
int i = 0; | |
for (int x = 0; x < imageWidth; x++) { | |
for (int y = imageHeight - 1; y >= 0; y--) { | |
yuv[i] = data[y * imageWidth + x]; | |
i++; | |
} | |
} |