Apostolos Fanakis
6 years ago
29 changed files with 877 additions and 52 deletions
@ -0,0 +1,137 @@ |
|||
package gr.auth.databases.flavours.activities.drink; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.appcompat.app.ActionBar; |
|||
import androidx.appcompat.widget.Toolbar; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.fragment.app.FragmentManager; |
|||
import androidx.fragment.app.FragmentPagerAdapter; |
|||
import androidx.viewpager.widget.ViewPager; |
|||
import gr.auth.databases.flavours.R; |
|||
import gr.auth.databases.flavours.activities.drink.fragments.DrinkInfoFragment; |
|||
import gr.auth.databases.flavours.activities.drink.fragments.DrinkIngredientsFragment; |
|||
import gr.auth.databases.flavours.base.BaseActivity; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.MenuItem; |
|||
import android.view.View; |
|||
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
|||
import com.google.android.material.tabs.TabLayout; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class DrinkActivity extends BaseActivity { |
|||
|
|||
private ViewPager viewPager; |
|||
private FloatingActionButton FAB; |
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_drink); |
|||
|
|||
Toolbar toolbar = findViewById(R.id.drink_toolbar); |
|||
toolbar.setTitle("White Russian"); |
|||
setSupportActionBar(toolbar); |
|||
ActionBar actionbar = getSupportActionBar(); |
|||
if (actionbar != null) { |
|||
actionbar.setDisplayHomeAsUpEnabled(true); |
|||
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp); |
|||
} |
|||
|
|||
createDrawer(); |
|||
drawer.setSelection(-1); |
|||
|
|||
FAB = findViewById(R.id.drink_fab); |
|||
FAB.hide(); |
|||
FAB.setOnClickListener(new View.OnClickListener() { |
|||
@Override |
|||
public void onClick(View view) { |
|||
/*Intent intent = new Intent(view.getContext(), AddRestaurantActivity.class); |
|||
startActivity(intent);*/ |
|||
} |
|||
}); |
|||
|
|||
viewPager = findViewById(R.id.drink_pager); |
|||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { |
|||
public void onPageScrollStateChanged(int state) { |
|||
} |
|||
|
|||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
|||
} |
|||
|
|||
public void onPageSelected(int position) { |
|||
if (position == 0) { |
|||
FAB.hide(); |
|||
} else { |
|||
FAB.show(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
setupViewPager(viewPager); |
|||
TabLayout tabLayout = findViewById(R.id.drink_tabs); |
|||
tabLayout.setupWithViewPager(viewPager); |
|||
} |
|||
|
|||
@Override |
|||
public boolean onOptionsItemSelected(MenuItem item) { |
|||
int id = item.getItemId(); |
|||
|
|||
if (id == android.R.id.home) { |
|||
drawer.openDrawer(); |
|||
return true; |
|||
} |
|||
|
|||
return super.onOptionsItemSelected(item); |
|||
} |
|||
|
|||
@Override |
|||
public void onBackPressed() { |
|||
if (drawer.isDrawerOpen()) { |
|||
drawer.closeDrawer(); |
|||
} else { |
|||
super.onBackPressed(); |
|||
} |
|||
} |
|||
|
|||
private void setupViewPager(ViewPager viewPager) { |
|||
RestaurantPagerAdapter adapter = new RestaurantPagerAdapter(getSupportFragmentManager()); |
|||
adapter.addFrag(DrinkInfoFragment.newInstance(64), "INFO"); |
|||
adapter.addFrag(DrinkIngredientsFragment.newInstance(64), "INGREDIENTS"); |
|||
/*adapter.addFrag(DrinkRatingsFragment.newInstance(64), "RATINGS");*/ |
|||
viewPager.setAdapter(adapter); |
|||
} |
|||
|
|||
private class RestaurantPagerAdapter extends FragmentPagerAdapter { |
|||
private final List<Fragment> mFragmentList = new ArrayList<>(); |
|||
private final List<String> mFragmentTitleList = new ArrayList<>(); |
|||
|
|||
RestaurantPagerAdapter(FragmentManager manager) { |
|||
super(manager); |
|||
} |
|||
|
|||
@NonNull |
|||
@Override |
|||
public Fragment getItem(int position) { |
|||
return mFragmentList.get(position); |
|||
} |
|||
|
|||
@Override |
|||
public int getCount() { |
|||
return mFragmentList.size(); |
|||
} |
|||
|
|||
void addFrag(Fragment fragment, String title) { |
|||
mFragmentList.add(fragment); |
|||
mFragmentTitleList.add(title); |
|||
} |
|||
|
|||
@Override |
|||
public CharSequence getPageTitle(int position) { |
|||
return mFragmentTitleList.get(position); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
package gr.auth.databases.flavours.activities.drink.fragments; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.fragment.app.Fragment; |
|||
import gr.auth.databases.flavours.R; |
|||
|
|||
public class DrinkInfoFragment extends Fragment { |
|||
|
|||
public DrinkInfoFragment() { |
|||
// Required empty public constructor
|
|||
} |
|||
|
|||
private static final String DRINK_ID = "DRINK_ID"; |
|||
|
|||
private int drinkId; |
|||
|
|||
public static DrinkInfoFragment newInstance(int drinkId) { |
|||
DrinkInfoFragment fragment = new DrinkInfoFragment(); |
|||
Bundle args = new Bundle(); |
|||
args.putInt(DRINK_ID, drinkId); |
|||
fragment.setArguments(args); |
|||
return fragment; |
|||
} |
|||
|
|||
@Override |
|||
public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
assert getArguments() != null; |
|||
drinkId = getArguments().getInt(DRINK_ID); |
|||
} |
|||
|
|||
@Override |
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
|||
final View rootView = inflater.inflate(R.layout.fragment_drink_info, container, false); |
|||
|
|||
TextView restaurantServing = rootView.findViewById(R.id.drink_serving_restaurant); |
|||
restaurantServing.setText(getString(R.string.drink_serving_restaurant, "Restaurant's name")); |
|||
TextView hasAlcohol = rootView.findViewById(R.id.drink_contains_alcohol); |
|||
hasAlcohol.setText(getString(R.string.drink_has_alcohol, "YES")); |
|||
TextView description = rootView.findViewById(R.id.drink_description); |
|||
description.setText("a description"); |
|||
return rootView; |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
package gr.auth.databases.flavours.activities.drink.fragments; |
|||
|
|||
import android.content.Context; |
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.recyclerview.widget.DividerItemDecoration; |
|||
import androidx.recyclerview.widget.LinearLayoutManager; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
import gr.auth.databases.flavours.R; |
|||
import gr.auth.databases.flavours.model.IngredientSummary; |
|||
import gr.auth.databases.flavours.utils.IngredientItemAdapter; |
|||
|
|||
public class DrinkIngredientsFragment extends Fragment { |
|||
|
|||
public DrinkIngredientsFragment() { |
|||
// Required empty public constructor
|
|||
} |
|||
|
|||
private static final String DRINK_ID = "DRINK_ID"; |
|||
|
|||
private int drinkId; |
|||
|
|||
public static DrinkIngredientsFragment newInstance(int drinkId) { |
|||
DrinkIngredientsFragment fragment = new DrinkIngredientsFragment(); |
|||
Bundle args = new Bundle(); |
|||
args.putInt(DRINK_ID, drinkId); |
|||
fragment.setArguments(args); |
|||
return fragment; |
|||
} |
|||
|
|||
@Override |
|||
public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
assert getArguments() != null; |
|||
drinkId = getArguments().getInt(DRINK_ID); |
|||
} |
|||
|
|||
@Override |
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
|||
final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false); |
|||
|
|||
ArrayList<IngredientSummary> ingredients = new ArrayList<>(); |
|||
ingredients.add(new IngredientSummary("Βότκα", true)); |
|||
ingredients.add(new IngredientSummary("Γάλα", false)); |
|||
|
|||
Context context = getContext(); |
|||
assert context != null; |
|||
IngredientItemAdapter itemAdapter = new IngredientItemAdapter(context, ingredients); |
|||
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list); |
|||
mainContent.setAdapter(itemAdapter); |
|||
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); |
|||
mainContent.setLayoutManager(layoutManager); |
|||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mainContent.getContext(), |
|||
layoutManager.getOrientation()); |
|||
mainContent.addItemDecoration(dividerItemDecoration); |
|||
|
|||
return rootView; |
|||
} |
|||
} |
@ -0,0 +1,137 @@ |
|||
package gr.auth.databases.flavours.activities.food; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.appcompat.app.ActionBar; |
|||
import androidx.appcompat.widget.Toolbar; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.fragment.app.FragmentManager; |
|||
import androidx.fragment.app.FragmentPagerAdapter; |
|||
import androidx.viewpager.widget.ViewPager; |
|||
import gr.auth.databases.flavours.R; |
|||
import gr.auth.databases.flavours.activities.food.fragments.FoodInfoFragment; |
|||
import gr.auth.databases.flavours.activities.food.fragments.FoodIngredientsFragment; |
|||
import gr.auth.databases.flavours.base.BaseActivity; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.MenuItem; |
|||
import android.view.View; |
|||
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
|||
import com.google.android.material.tabs.TabLayout; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class FoodActivity extends BaseActivity { |
|||
|
|||
private ViewPager viewPager; |
|||
private FloatingActionButton FAB; |
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_food); |
|||
|
|||
Toolbar toolbar = findViewById(R.id.food_toolbar); |
|||
toolbar.setTitle("Γεμιστά"); |
|||
setSupportActionBar(toolbar); |
|||
ActionBar actionbar = getSupportActionBar(); |
|||
if (actionbar != null) { |
|||
actionbar.setDisplayHomeAsUpEnabled(true); |
|||
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp); |
|||
} |
|||
|
|||
createDrawer(); |
|||
drawer.setSelection(-1); |
|||
|
|||
FAB = findViewById(R.id.food_fab); |
|||
FAB.hide(); |
|||
FAB.setOnClickListener(new View.OnClickListener() { |
|||
@Override |
|||
public void onClick(View view) { |
|||
/*Intent intent = new Intent(view.getContext(), AddRestaurantActivity.class); |
|||
startActivity(intent);*/ |
|||
} |
|||
}); |
|||
|
|||
viewPager = findViewById(R.id.food_pager); |
|||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { |
|||
public void onPageScrollStateChanged(int state) { |
|||
} |
|||
|
|||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
|||
} |
|||
|
|||
public void onPageSelected(int position) { |
|||
if (position == 0) { |
|||
FAB.hide(); |
|||
} else { |
|||
FAB.show(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
setupViewPager(viewPager); |
|||
TabLayout tabLayout = findViewById(R.id.food_tabs); |
|||
tabLayout.setupWithViewPager(viewPager); |
|||
} |
|||
|
|||
@Override |
|||
public boolean onOptionsItemSelected(MenuItem item) { |
|||
int id = item.getItemId(); |
|||
|
|||
if (id == android.R.id.home) { |
|||
drawer.openDrawer(); |
|||
return true; |
|||
} |
|||
|
|||
return super.onOptionsItemSelected(item); |
|||
} |
|||
|
|||
@Override |
|||
public void onBackPressed() { |
|||
if (drawer.isDrawerOpen()) { |
|||
drawer.closeDrawer(); |
|||
} else { |
|||
super.onBackPressed(); |
|||
} |
|||
} |
|||
|
|||
private void setupViewPager(ViewPager viewPager) { |
|||
RestaurantPagerAdapter adapter = new RestaurantPagerAdapter(getSupportFragmentManager()); |
|||
adapter.addFrag(FoodInfoFragment.newInstance(64), "INFO"); |
|||
adapter.addFrag(FoodIngredientsFragment.newInstance(64), "INGREDIENTS"); |
|||
/*adapter.addFrag(FoodRatingsFragment.newInstance(64), "RATINGS");*/ |
|||
viewPager.setAdapter(adapter); |
|||
} |
|||
|
|||
private class RestaurantPagerAdapter extends FragmentPagerAdapter { |
|||
private final List<Fragment> mFragmentList = new ArrayList<>(); |
|||
private final List<String> mFragmentTitleList = new ArrayList<>(); |
|||
|
|||
RestaurantPagerAdapter(FragmentManager manager) { |
|||
super(manager); |
|||
} |
|||
|
|||
@NonNull |
|||
@Override |
|||
public Fragment getItem(int position) { |
|||
return mFragmentList.get(position); |
|||
} |
|||
|
|||
@Override |
|||
public int getCount() { |
|||
return mFragmentList.size(); |
|||
} |
|||
|
|||
void addFrag(Fragment fragment, String title) { |
|||
mFragmentList.add(fragment); |
|||
mFragmentTitleList.add(title); |
|||
} |
|||
|
|||
@Override |
|||
public CharSequence getPageTitle(int position) { |
|||
return mFragmentTitleList.get(position); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
package gr.auth.databases.flavours.activities.food.fragments; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.fragment.app.Fragment; |
|||
import gr.auth.databases.flavours.R; |
|||
|
|||
public class FoodInfoFragment extends Fragment { |
|||
|
|||
public FoodInfoFragment() { |
|||
// Required empty public constructor
|
|||
} |
|||
|
|||
private static final String FOOD_ID = "FOOD_ID"; |
|||
|
|||
private int foodId; |
|||
|
|||
public static FoodInfoFragment newInstance(int foodId) { |
|||
FoodInfoFragment fragment = new FoodInfoFragment(); |
|||
Bundle args = new Bundle(); |
|||
args.putInt(FOOD_ID, foodId); |
|||
fragment.setArguments(args); |
|||
return fragment; |
|||
} |
|||
|
|||
@Override |
|||
public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
assert getArguments() != null; |
|||
foodId = getArguments().getInt(FOOD_ID); |
|||
} |
|||
|
|||
@Override |
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
|||
final View rootView = inflater.inflate(R.layout.fragment_food_info, container, false); |
|||
|
|||
TextView restaurantServing = rootView.findViewById(R.id.food_serving_restaurant); |
|||
restaurantServing.setText(getString(R.string.food_serving_restaurant, "Restaurant's name")); |
|||
TextView calories = rootView.findViewById(R.id.food_calories); |
|||
calories.setText(getString(R.string.food_calories, 500)); |
|||
TextView description = rootView.findViewById(R.id.food_description); |
|||
description.setText("some awesome description"); |
|||
return rootView; |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
package gr.auth.databases.flavours.activities.food.fragments; |
|||
|
|||
import android.content.Context; |
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.recyclerview.widget.DividerItemDecoration; |
|||
import androidx.recyclerview.widget.LinearLayoutManager; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
import gr.auth.databases.flavours.R; |
|||
import gr.auth.databases.flavours.model.IngredientSummary; |
|||
import gr.auth.databases.flavours.utils.IngredientItemAdapter; |
|||
|
|||
public class FoodIngredientsFragment extends Fragment { |
|||
|
|||
public FoodIngredientsFragment() { |
|||
// Required empty public constructor
|
|||
} |
|||
|
|||
private static final String FOOD_ID = "FOOD_ID"; |
|||
|
|||
private int foodId; |
|||
|
|||
public static FoodIngredientsFragment newInstance(int foodId) { |
|||
FoodIngredientsFragment fragment = new FoodIngredientsFragment(); |
|||
Bundle args = new Bundle(); |
|||
args.putInt(FOOD_ID, foodId); |
|||
fragment.setArguments(args); |
|||
return fragment; |
|||
} |
|||
|
|||
@Override |
|||
public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
assert getArguments() != null; |
|||
foodId = getArguments().getInt(FOOD_ID); |
|||
} |
|||
|
|||
@Override |
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
|||
final View rootView = inflater.inflate(R.layout.reusable_recycler_list, container, false); |
|||
|
|||
ArrayList<IngredientSummary> ingredients = new ArrayList<>(); |
|||
ingredients.add(new IngredientSummary("Κιμάς", false)); |
|||
ingredients.add(new IngredientSummary("Ρύζι", false)); |
|||
|
|||
Context context = getContext(); |
|||
assert context != null; |
|||
IngredientItemAdapter itemAdapter = new IngredientItemAdapter(context, ingredients); |
|||
RecyclerView mainContent = rootView.findViewById(R.id.recycler_list); |
|||
mainContent.setAdapter(itemAdapter); |
|||
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); |
|||
mainContent.setLayoutManager(layoutManager); |
|||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mainContent.getContext(), |
|||
layoutManager.getOrientation()); |
|||
mainContent.addItemDecoration(dividerItemDecoration); |
|||
|
|||
return rootView; |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package gr.auth.databases.flavours.model; |
|||
|
|||
public class IngredientSummary { |
|||
private String name; |
|||
private boolean hasAlcohol; |
|||
|
|||
public IngredientSummary(String name, boolean hasAlcohol) { |
|||
this.name = name; |
|||
this.hasAlcohol = hasAlcohol; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public boolean hasAlcohol() { |
|||
return hasAlcohol; |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
package gr.auth.databases.flavours.utils; |
|||
|
|||
import android.content.Context; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.TextView; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
import gr.auth.databases.flavours.R; |
|||
import gr.auth.databases.flavours.model.IngredientSummary; |
|||
|
|||
public class IngredientItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|||
private final ArrayList<IngredientSummary> ingredients; |
|||
private Context context; |
|||
|
|||
public IngredientItemAdapter(@NonNull Context context, ArrayList<IngredientSummary> ingredients) { |
|||
this.ingredients = ingredients; |
|||
this.context = context; |
|||
} |
|||
|
|||
@NonNull |
|||
@Override |
|||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
|||
View view = LayoutInflater.from(parent.getContext()). |
|||
inflate(R.layout.ingredient_row, parent, false); |
|||
return new ItemViewHolder(view); |
|||
} |
|||
|
|||
@Override |
|||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) { |
|||
IngredientSummary ingredient = ingredients.get(position); |
|||
ItemViewHolder itemViewHolder = (ItemViewHolder) holder; |
|||
|
|||
itemViewHolder.name.setText(ingredient.getName()); |
|||
itemViewHolder.hasAlcohol.setText(context.getString(R.string.ingredient_has_alcohol, |
|||
ingredient.hasAlcohol() ? "YES" : "NO")); |
|||
} |
|||
|
|||
@Override |
|||
public int getItemCount() { |
|||
return ingredients == null ? 0 : ingredients.size(); |
|||
} |
|||
|
|||
private static class ItemViewHolder extends RecyclerView.ViewHolder { |
|||
TextView name, hasAlcohol; |
|||
|
|||
ItemViewHolder(View itemView) { |
|||
super(itemView); |
|||
name = itemView.findViewById(R.id.ingredient_name); |
|||
hasAlcohol = itemView.findViewById(R.id.ingredient_has_alcohol); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:background="@android:color/background_light" |
|||
android:fitsSystemWindows="true"> |
|||
|
|||
<com.google.android.material.appbar.AppBarLayout |
|||
android:id="@+id/drink_appbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:paddingTop="@dimen/appbar_padding_top" |
|||
android:theme="@style/ToolbarTheme"> |
|||
|
|||
<androidx.appcompat.widget.Toolbar |
|||
android:id="@+id/drink_toolbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="?attr/actionBarSize" |
|||
android:background="?attr/colorPrimary" |
|||
android:gravity="center" |
|||
app:popupTheme="@style/ToolbarTheme" |
|||
app:title="@string/drink_toolbar_title" /> |
|||
|
|||
<com.google.android.material.tabs.TabLayout |
|||
android:id="@+id/drink_tabs" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:gravity="center" |
|||
app:tabGravity="fill" |
|||
app:tabMode="fixed" |
|||
app:tabSelectedTextColor="@color/accent" |
|||
app:tabTextColor="@color/iron" /> |
|||
</com.google.android.material.appbar.AppBarLayout> |
|||
|
|||
<androidx.viewpager.widget.ViewPager |
|||
android:id="@+id/drink_pager" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
app:layout_anchor="@id/drink_appbar" |
|||
app:layout_anchorGravity="bottom|start" |
|||
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> |
|||
|
|||
<com.google.android.material.floatingactionbutton.FloatingActionButton |
|||
android:id="@+id/drink_fab" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_gravity="bottom|end" |
|||
android:layout_margin="16dp" |
|||
android:src="@drawable/ic_add_white_24dp" |
|||
app:fabSize="normal" |
|||
app:layout_behavior="gr.auth.databases.flavours.utils.ScrollAwareFABBehavior" /> |
|||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
@ -0,0 +1,53 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:background="@android:color/background_light" |
|||
android:fitsSystemWindows="true"> |
|||
|
|||
<com.google.android.material.appbar.AppBarLayout |
|||
android:id="@+id/food_appbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:paddingTop="@dimen/appbar_padding_top" |
|||
android:theme="@style/ToolbarTheme"> |
|||
|
|||
<androidx.appcompat.widget.Toolbar |
|||
android:id="@+id/food_toolbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="?attr/actionBarSize" |
|||
android:background="?attr/colorPrimary" |
|||
android:gravity="center" |
|||
app:popupTheme="@style/ToolbarTheme" |
|||
app:title="@string/food_toolbar_title" /> |
|||
|
|||
<com.google.android.material.tabs.TabLayout |
|||
android:id="@+id/food_tabs" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:gravity="center" |
|||
app:tabGravity="fill" |
|||
app:tabMode="fixed" |
|||
app:tabSelectedTextColor="@color/accent" |
|||
app:tabTextColor="@color/iron" /> |
|||
</com.google.android.material.appbar.AppBarLayout> |
|||
|
|||
<androidx.viewpager.widget.ViewPager |
|||
android:id="@+id/food_pager" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
app:layout_anchor="@id/food_appbar" |
|||
app:layout_anchorGravity="bottom|start" |
|||
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> |
|||
|
|||
<com.google.android.material.floatingactionbutton.FloatingActionButton |
|||
android:id="@+id/food_fab" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_gravity="bottom|end" |
|||
android:layout_margin="16dp" |
|||
android:src="@drawable/ic_add_white_24dp" |
|||
app:fabSize="normal" |
|||
app:layout_behavior="gr.auth.databases.flavours.utils.ScrollAwareFABBehavior" /> |
|||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:orientation="vertical" |
|||
android:paddingStart="12dp" |
|||
android:paddingEnd="12dp"> |
|||
|
|||
<TextView |
|||
android:id="@+id/drink_serving_restaurant" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/drink_serving_restaurant_placeholder" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/drink_contains_alcohol" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/drink_has_alcohol_placeholder" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/drink_description" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/drink_description_placeholder" /> |
|||
</LinearLayout> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:orientation="vertical" |
|||
android:paddingStart="12dp" |
|||
android:paddingEnd="12dp"> |
|||
|
|||
<TextView |
|||
android:id="@+id/food_serving_restaurant" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/food_serving_restaurant_placeholder" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/food_calories" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/food_calories_placeholder" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/food_description" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/food_description_placeholder" /> |
|||
</LinearLayout> |
@ -1,10 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:id="@+id/main_recycler" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginStart="12dp" |
|||
android:layout_marginEnd="12dp" |
|||
android:orientation="vertical" |
|||
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginStart="12dp" |
|||
android:layout_marginEnd="12dp" |
|||
android:orientation="vertical"> |
|||
|
|||
<TextView |
|||
android:id="@+id/ingredient_name" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/ingredient_name_placeholder" |
|||
android:textStyle="bold" /> |
|||
|
|||
<TextView |
|||
android:id="@+id/ingredient_has_alcohol" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:text="@string/ingredient_has_alcohol_placeholder" /> |
|||
</LinearLayout> |
@ -1,6 +1,6 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:id="@+id/restaurant_list" |
|||
android:id="@+id/recycler_list" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:layout_marginStart="12dp" |
Loading…
Reference in new issue