Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Akın Demir akndmr

🎯
Focusing
  • Mobillium
Block or report user

Report or block akndmr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@akndmr
akndmr / Scale down drawable of EditText.java
Created Jun 26, 2019
Scale left/start, right/end, top, bottom drawables of EditText
View Scale down drawable of EditText.java
private Drawable getScaledDrawable(int drawableId){
Drawable drawable = getResources().getDrawable(drawableId);
drawable.setBounds(0, 0, (int) (drawable.getIntrinsicWidth() * 0.4),
(int) (drawable.getIntrinsicHeight() * 0.4));
return drawable;
}
/**
* Scale down left drawable
* android:drawableLeft="@drawable/myIcon"
@akndmr
akndmr / strings.xml
Last active Dec 25, 2018
Popvie App v2 Translation
View strings.xml
<resources>
<!-- App related -->
<string name="app_name" translatable="false">Popvie</string>
<string name="app_version">v2.0</string>
<string name="app_slogan">\"all about movie\"</string>
<string name="app_copyright" translatable="false">©2018</string>
<!-- Generel -->
<string name="no_internet_connection">There is no internet connection!</string>
<string name="permission_grant_rationale">You need to grant this permission to change the picture. After change you can cancel this permission from phone settings anytime.</string>
@akndmr
akndmr / mock_hotels_ayt
Created Sep 22, 2018
Mock hotels in Antalya
View mock_hotels_ayt
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "BWAYT020",
"chainCode": "BW",
"dupeId": "700003141",
"name": "BEST WESTERN PLUS KHAN HOTEL",
@akndmr
akndmr / mock_hotels_ist
Created Sep 22, 2018
Mock hotels in Istanbul - JSON
View mock_hotels_ist
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "WWISTTAK",
"chainCode": "WW",
"dupeId": "700013174",
"name": "POINT HOTEL TAKSIM",
@akndmr
akndmr / mock_hotels_ank
Created Sep 22, 2018
Mock hotels in Ankara - JSON
View mock_hotels_ank
{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "HLANK243",
"chainCode": "HL",
"dupeId": "700035344",
"name": "ANKARA HILTONSA",
@akndmr
akndmr / XActivity.java
Created Mar 3, 2018
Popvie - Movie Activity
View XActivity.java
// 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 / response.json
Created Mar 3, 2018
Popvie - Example response for Fight Club
View response.json
{
"adult": false,
"backdrop_path": "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg",
"belongs_to_collection": null,
"budget": 63000000,
"genres": [
{
"id": 18,
"name": "Drama"
}
@akndmr
akndmr / MovieService.java
Created Mar 3, 2018
Popvie - MovieService interface
View MovieService.java
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 Mar 3, 2018
Popvie - Retrofit HttpClient
View HttpClient.java
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();
You can’t perform that action at this time.