Archives Code Snippets

Constants Retrofit

public class Constants { public static final String BASE_URL = "https://tushar.club/"; private static ApiService apiService; public static final ApiService getApiService(){ if(apiService == null){ HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); // set your desired log level logging.setLevel(HttpLoggingInterceptor.Level.NONE); OkHttpClient.Builder httpClient = new OkHttpClient.Builder();…

JavaCustomerObject

public class Resturant{ public static void main(String [] args){ Customer cus = new Customer(); cus.setName("Demo name"); cus.setAdderss("Demo Address"); cus.setPhoneNumber("123456"); System.out.println(cus.getName()); System.out.println(cus.getAddress()); System.out.println(cus.getPhoneNumber()); } }

JavaClassCustomerMethod

public class Customer{ private String name; private String address; private String phoneNumber; private String previousPurchsedFood; public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getAddress(){ return address; } public void setAddress(String address){ this.address…

Statusbar_Color

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); }

rounded_corner_button

<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ddd"/> <corners android:bottomRightRadius="5dip" android:bottomLeftRadius="5dip" android:topLeftRadius="5dip" android:topRightRadius="5dip"/> </shape>

Rounded_Corner

<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ddBD96FF"/> <corners android:bottomRightRadius="5dip" android:bottomLeftRadius="5dip" android:topLeftRadius="5dip" android:topRightRadius="5dip"/> </shape>

LoginUI

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_weight="4" android:src="@drawable/ic_login" android:scaleType="centerCrop" android:layout_width="match_parent" android:layout_height="0dp" /> <View android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp"/> </LinearLayout> <LinearLayout android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_margin="?actionBarSize" android:textStyle="bold" android:textSize="40sp" android:textColor="#fff" android:text="Sign in" android:layout_width="wrap_content" android:layout_height="wrap_content"…