Skip to content

Instantly share code, notes, and snippets.

View fatihkurcenli's full-sized avatar
👨‍💻
Art of Coding

Fatih Kurçenli fatihkurcenli

👨‍💻
Art of Coding
View GitHub Profile
private var superSafeWebView: WebView? = null
private var safeBrowsingIsInitialized: Boolean = false
// ...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
superSafeWebView = WebView(this).apply {
webViewClient = MyWebViewClient()
private WebView superSafeWebView;
private boolean safeBrowsingIsInitialized;
// ...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
superSafeWebView = new WebView(this);
class MyWebViewClient : WebViewClient() {
// Automatically go "back to safety" when attempting to load a website that
// Safe Browsing has identified as a known threat. An instance of WebView
// calls this method only after Safe Browsing is initialized, so there's no
// conditional logic needed here.
override fun onSafeBrowsingHit(
view: WebView,
request: WebResourceRequest,
threatType: Int,
callback: SafeBrowsingResponse
public class MyWebViewClient extends WebViewClient {
// Automatically go "back to safety" when attempting to load a website that
// Safe Browsing has identified as a known threat. An instance of WebView
// calls this method only after Safe Browsing is initialized, so there's no
// conditional logic needed here.
@Override
public void onSafeBrowsingHit(WebView view, WebResourceRequest request,
int threatType, SafeBrowsingResponse callback) {
// The "true" argument indicates that your app reports incidents like
// this one to Safe Browsing.
@fatihkurcenli
fatihkurcenli / PostModel.dart
Last active November 5, 2020 13:19
PostModel.dart
class PostModel {
int userId;
int id;
String title;
String body;
PostModel({this.userId, this.id, this.title, this.body});
PostModel.fromJson(Map<String, dynamic> json) {
userId = json['userId'];
@fatihkurcenli
fatihkurcenli / RetrofitObject.kt
Created February 9, 2021 12:59
Retrofit Object
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl("https://api.github.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
val service = retrofit.create(ApiService::class.java)
@fatihkurcenli
fatihkurcenli / ServiceRequest.kt
Created February 9, 2021 13:05
ServiceRequest
service.getRepos().enqueue(object:Callback<List<Repo>>){
override fun onFailure(call:Cal<List<Repo>>, t:Throwable){
//TODO
}
override fun onResponse(call:Call<List<Repo>>, response:Response<List<Repo>>){
//TODO
}
}
@fatihkurcenli
fatihkurcenli / activity_main.xml
Created February 21, 2021 11:23
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.github.mikephil.charting.charts.LineChart
@fatihkurcenli
fatihkurcenli / ActivityMain.kt
Last active February 21, 2021 12:43
ActivityMain.kt
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
setLineChartData()
}
@fatihkurcenli
fatihkurcenli / initState.dart
Last active July 19, 2021 12:09
initState.dart
@override
void initState() {
super.initState();
_animationController = AnimationController(
duration: Duration(seconds: 2),
vsync: this,
);
final animationCurve = CurvedAnimation(
curve: Curves.easeInExpo,