This file contains hidden or 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
struct Webview: UIViewControllerRepresentable { | |
let url: URL | |
func makeUIViewController(context: Context) -> WebviewController { | |
let webviewController = WebviewController() | |
let request = URLRequest(url: self.url, cachePolicy: .returnCacheDataElseLoad) | |
webviewController.webview.load(request) | |
return webviewController |
This file contains hidden or 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
// This layout will display its children with rounded corners | |
// It works with Glide image library placeholders and animations | |
// It assumes your background is a solid color. If you need the corners to be truly transparent, | |
// this solution will not work for you. | |
package com.myapp.ui; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; |
This file contains hidden or 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.example.remotecontrolclient; | |
import android.app.Service; | |
import android.content.ComponentName; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.graphics.BitmapFactory; | |
import android.media.AudioManager; | |
import android.os.IBinder; | |
import android.support.v4.media.MediaMetadataCompat; |
This file contains hidden or 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
Scheduling Repeating Alarms | |
https://developer.android.com/training/scheduling/alarms.html#tradeoffs | |
########################### | |
public class AlarmBroadcaster extends BroadcastReceiver { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
//Remember in the SetAlarm file we made an intent to this, this is way this work, otherwise you would have to put an action | |
//and here listen to the action, like in a normal receiver | |
createNotification(context); |
This file contains hidden or 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 ImageSaveTask extends AsyncTask<String, Void, Void> { | |
private Context context; | |
public ImageSaveTask(Context context) { | |
this.context = context; | |
} | |
@Override | |
protected Void doInBackground(String... params) { | |
if (params == null || params.length < 2) { |
This file contains hidden or 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
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.widget.ImageView; | |
import com.bumptech.glide.Glide; | |
import com.bumptech.glide.Priority; | |
import com.bumptech.glide.load.data.DataFetcher; | |
import com.bumptech.glide.load.model.stream.StreamModelLoader; |
This file contains hidden or 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
Sending and Managing Network Requests: | |
http://guides.codepath.com/android/Sending-and-Managing-Network-Requests | |
Core java: | |
. HttpUURLConnection: core java và android, low level, ta tự parse kết quả và tự làm request | |
Library: | |
. OkHttp(library của Android): http://square.github.io/okhttp/ | |
. http://loopj.com/android-async-http/ (library ) | |
. handle the entire process of sending and parsing network requests for us in a more robust and easy-to-use way. | |
. Retrofit |