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
private var superSafeWebView: WebView? = null | |
private var safeBrowsingIsInitialized: Boolean = false | |
// ... | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
superSafeWebView = WebView(this).apply { | |
webViewClient = MyWebViewClient() |
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
private WebView superSafeWebView; | |
private boolean safeBrowsingIsInitialized; | |
// ... | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
superSafeWebView = new WebView(this); |
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
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 |
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 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. |
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
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']; |
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
val retrofit: Retrofit = Retrofit.Builder() | |
.baseUrl("https://api.github.com/") | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() | |
val service = retrofit.create(ApiService::class.java) |
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
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 | |
} | |
} |
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
<?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 |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
setLineChartData() | |
} |
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
@override | |
void initState() { | |
super.initState(); | |
_animationController = AnimationController( | |
duration: Duration(seconds: 2), | |
vsync: this, | |
); | |
final animationCurve = CurvedAnimation( | |
curve: Curves.easeInExpo, |
OlderNewer