daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class WorkingWindowFragment extends BaseFragment<WhetherView, WhetherPresenter>
  2.         implements WhetherView {
  3.     private Toolbar toolbar;
  4.     private TextView tvCity;
  5.     private TextView temper;
  6.     private TextView tvDate;
  7.     private ImageView imageView;
  8.     private String uri;
  9.     private EditText editText;
  10.     private String nameCity;
  11.  
  12.     public static WorkingWindowFragment newInstance() {
  13.         WorkingWindowFragment fragment = new WorkingWindowFragment();
  14.         return fragment;
  15.     }
  16.  
  17.     @Nullable
  18.     @Override
  19.     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  20.         View view = inflater.inflate(R.layout.fragment_work_window, container, false);
  21.         initView(view);
  22.         return view;
  23.     }
  24.  
  25.     private void initView(View view) {
  26.         toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  27.         tvCity = (TextView) view.findViewById(R.id.tv_city_name);
  28.         temper = (TextView) view.findViewById(R.id.tv_temp);
  29.         tvDate = (TextView) view.findViewById(R.id.tv_date);
  30.         imageView = (ImageView) view.findViewById(R.id.iv_image);
  31.         editText = (EditText) view.findViewById(R.id.et_city);
  32.     }
  33.  
  34.     @Override
  35.     public WhetherPresenter createPresenter() {
  36.         return new WhetherPresenterIml();
  37.     }
  38.  
  39.     @Override
  40.     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  41.         super.onViewCreated(view, savedInstanceState);
  42.         toolbar.setTitle("Прогноз");
  43.         toolbar.setTitleTextColor(getResources().getColor(R.color.colorTextToolbar));
  44.         toolbar.setNavigationIcon(R.drawable.ic_brightness_5_black_24dp);
  45.         toolbar.setNavigationOnClickListener(v ->
  46.         {
  47.             if (editText.getText().toString().equals("")) {
  48.                 Toast.makeText(getContext(), "Введіть назву міста", Toast.LENGTH_LONG).show();
  49.             } else {
  50.                 nameCity = editText.getText().toString();
  51.             }
  52.             getPresenter().getNameCity(nameCity);
  53.  
  54.         });
  55.     }
  56.  
  57.  
  58.     @Override
  59.     public void getDani(String city, String temp, String speed, String uri, String date) {
  60.         tvCity.setText(city + temp);
  61.         tvDate.setText(date);
  62.         temper.setText(speed);
  63.  
  64.         Glide.with(getContext())
  65.                 .load(Uri.parse(uri))
  66.                 .into(imageView);
  67.     }
  68. }
RAW Paste Data
Top