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
| //here code before... | |
| public boolean onCreateOptionsMenu(Menu menu) { | |
| getSupportMenuInflater().inflate(R.menu.article_menu, menu); | |
| return super.onCreateOptionsMenu(menu); | |
| } | |
| public boolean onOptionsItemSelected( |
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.ideaplay.sharee.utility; | |
| import java.util.ArrayList; | |
| public class ListItem { | |
| private String contributorImageUrl; | |
| private String itemTitle; | |
| private String itemContent; | |
| private String itemContributor; | |
| private String itemPubDate; |
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 pandas as pd | |
| import time | |
| from sklearn.feature_extraction.text import TfidfVectorizer | |
| from sklearn.metrics.pairwise import linear_kernel | |
| import json | |
| start = time.time() | |
| ds = pd.read_csv('query_result.csv') |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.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:padding="16dp" | |
| android:layout_height="match_parent"> | |
| <android.support.v7.widget.RecyclerView | |
| android:id="@+id/rvListOfEvent" |
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
| dependencies { | |
| .... | |
| // viewmodel & livedata | |
| implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion" | |
| annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion" | |
| .... | |
| } |
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
| class EventListViewModel : ViewModel(){ | |
| val eventList = arrayListOf(Event("Google IO 2018"), | |
| Event("Droidcon London 2018"), | |
| Event("GOTO Berlin 2018")) | |
| } |
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
| class EventListActivity : BaseActivity(){ | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_event_list) | |
| val viewModel = ViewModelProviders.of(this).get(EventListViewModel::class.java) | |
| rvListOfEvent.layoutManager = LinearLayoutManager(this) | |
| val adapter = EventListAdapter() |
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
| class EventListViewModel : ViewModel(){ | |
| val eventList = MutableLiveData<List<Event>>() | |
| init { | |
| eventList.postValue(arrayListOf(Event("Google IO 2018"), | |
| Event("Droidcon London 2018"), | |
| Event("GOTO Berlin 2018"))) | |
| } |
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
| class EventListActivity : BaseActivity(){ | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_event_list) | |
| val viewModel = ViewModelProviders.of(this).get(EventListViewModel::class.java) | |
| // setup recyclerview | |
| rvListOfKajian.layoutManager = LinearLayoutManager(this) |
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
| if (isIpAddressDifferentWithLastRecorded(latestIpAddress)) { | |
| Log.d( | |
| WorkManagerHelper.TAG, | |
| "Different IP Address ($latestIpAddress}." | |
| ) | |
| insertNewRecordToDb(latestIpAddress) | |
| } else { | |
| if (connManager.getNetworkClass() == ConnectionManager.NETWORK_WIFI) { | |
| // check if its on wifi more than one hour |
OlderNewer