Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View akndmr's full-sized avatar
👨‍💻
Coding

Akın akndmr

👨‍💻
Coding
  • Mobillium
View GitHub Profile
@akndmr
akndmr / build.gradle
Last active March 3, 2018 23:03
Dependencies for Popvie
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:transition:27.1.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
@akndmr
akndmr / build.gradle
Last active March 3, 2018 23:11
Popvie - buildConfigField
android {
/*...*/
buildTypes.each {
it.buildConfigField 'String', 'TMDB_API_KEY', TmdbBApiKey
}
}
@akndmr
akndmr / MovieService.java
Created March 3, 2018 23:29
Popvie - MovieService interface
public interface MovieService {
//Get a movie
@GET("movie/{id}")
Call<Movie> getMovieWithId(@Path("id") int movieId, @Query("api_key") String api_key);
}
@akndmr
akndmr / HttpClient.java
Last active March 3, 2018 23:33
Popvie - Retrofit HttpClient
public class HttpClient {
private final static String BASE_URL = "https://api.themoviedb.org/3/";
public final MovieService mMovieService;
public HttpClient() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
@akndmr
akndmr / response.json
Created March 3, 2018 23:41
Popvie - Example response for Fight Club
{
"adult": false,
"backdrop_path": "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg",
"belongs_to_collection": null,
"budget": 63000000,
"genres": [
{
"id": 18,
"name": "Drama"
}
@akndmr
akndmr / XActivity.java
Created March 3, 2018 23:51
Popvie - Movie Activity
// Fetch a single movie by id
private void fetchMovieByID(int movieId) {
final Call<Movie> call = mService.getMovieWithId(movieId, BuildConfig.TMDB_API_KEY);
call.enqueue(new Callback<Movie>() {
@Override
public void onResponse(Call<Movie> call, Response<Movie> response) {
movie = response.body();
// Do sth with movie instance
// Like : movieTitleTextView.setText(movie.getTitle());
@akndmr
akndmr / mock_hotels_ank
Created September 22, 2018 17:41
Mock hotels in Ankara - JSON
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "HLANK243",
"chainCode": "HL",
"dupeId": "700035344",
"name": "ANKARA HILTONSA",
@akndmr
akndmr / mock_hotels_ist
Created September 22, 2018 17:43
Mock hotels in Istanbul - JSON
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "WWISTTAK",
"chainCode": "WW",
"dupeId": "700013174",
"name": "POINT HOTEL TAKSIM",
@akndmr
akndmr / mock_hotels_ayt
Created September 22, 2018 17:47
Mock hotels in Antalya
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "BWAYT020",
"chainCode": "BW",
"dupeId": "700003141",
"name": "BEST WESTERN PLUS KHAN HOTEL",