Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.android.sab;
- import android.app.Activity;
- import android.content.Context;
- import android.content.Intent;
- import android.media.Image;
- import android.net.Uri;
- import android.os.Parcelable;
- import android.support.annotation.NonNull;
- import android.support.design.widget.BottomNavigationView;
- import android.support.v4.app.NotificationCompat;
- import android.support.v4.content.ContextCompat;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.support.v7.widget.LinearLayoutManager;
- import android.support.v7.widget.RecyclerView;
- import android.util.Log;
- import android.view.Menu;
- import android.view.MenuItem;
- import java.util.ArrayList;
- import static android.R.id.message;
- import static android.os.Build.VERSION_CODES.M;
- import static com.example.android.sab.R.string.n;
- //import static com.example.android.sab.CastleLager.modelArrayList;
- public class BlackLabel extends brands {
- private RecyclerView recyclerView;
- //private String modelArrayList;
- private Context ctx;
- public static ArrayList<Model> modelArrayList;
- private CustomAdapter customAdapter;
- //incomingData.setText(incomingName);;
- //private Button btnnext;
- // supossing to have an image called ic_play inside my drawables.
- public String[] brandlist = new String[]{
- "Black Label 340ml NRB (85023)",
- "Brutal Fruit Litchi 275ml NRB (85736)",
- "Castle Lager 500ml Cans (85023)",
- "Black Label 440ml NRB (86798)",
- "Black Label 330ml RB (85556)",
- "Black Label 750ml RB (85021)",
- "Black Label 340ml NRB 12 Pack (87009)",
- "Black Label 500ml Cans 12 Pack (85022)"};
- public int[] pallet_size = {
- 84,
- 127,
- 81,
- 80,
- 120,
- 70,
- 132,
- 90};
- public int[] myimage = {
- R.drawable.black_label,
- R.drawable.brutal_fruit,
- R.drawable.castle_lager,
- R.drawable.flying_fish,
- R.drawable.castle_lite,
- R.drawable.hansa,
- R.drawable.lion_lager,
- R.drawable.milk_stout};
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.order_by_brand);
- setTitle("Black Label");
- recyclerView = (RecyclerView) findViewById(R.id.recycler);
- modelArrayList = getModel();
- customAdapter = new CustomAdapter(this);
- recyclerView.setAdapter(customAdapter);
- recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false));
- }
- private ArrayList<Model> getModel() {
- final ArrayList<Model> list = new ArrayList<>();
- for (int i = 0; i < 8; i++) {
- final Model model = new Model();
- model.setNumber(0);
- model.setNumber2(0);
- model.setImage(myimage[i]);
- model.setBrand(brandlist[i]);
- model.setPallet_size(pallet_size[i]);
- list.add(model);
- BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavView_Bar);
- BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
- Menu menu = bottomNavigationView.getMenu();
- MenuItem menuItem = menu.getItem(0);
- menuItem.setChecked(true);
- class Model {
- public String brand;
- private int number2;
- public int getNumber2() {
- return number2;
- }
- public String getBrand() {
- return brand;
- }
- }
- bottomNavigationView.setOnNavigationItemSelectedListener(
- new BottomNavigationView.OnNavigationItemSelectedListener() {
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
- switch (item.getItemId()) {
- case R.id.ic_home:
- Intent intent1 = new Intent(BlackLabel.this, MainActivity.class);
- startActivity(intent1);
- break;
- case R.id.ic_clear:
- Intent intent2 = new Intent(BlackLabel.this, BlackLabel.class);
- startActivity(intent2);
- break;
- case R.id.ic_email:
- String extradata = model.getBrand() + model.getNumber2();
- Intent intent = new Intent(Intent.ACTION_SENDTO);
- intent.setData(Uri.parse("mailto:someone@somewhere.co.za"));
- intent.putExtra(Intent.EXTRA_SUBJECT, "Please place order for....");
- intent.putExtra(Intent.EXTRA_TEXT, extradata);
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
- }
- return false;
- }
- });
- }
- return list;
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement