Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ObservableLinearLayout.java « widget « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6f70dcefed1cd15a5e59d65665fc2a3be352a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.mapswithme.maps.widget;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;

public class ObservableLinearLayout extends LinearLayout
{
  @Nullable
  private SizeChangedListener mSizeChangedListener;

  public ObservableLinearLayout(@NonNull Context context)
  {
    super(context);
  }

  public ObservableLinearLayout(@NonNull Context context, @Nullable AttributeSet attrs)
  {
    super(context, attrs);
  }

  public ObservableLinearLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr)
  {
    super(context, attrs, defStyleAttr);
  }

  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public ObservableLinearLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes)
  {
    super(context, attrs, defStyleAttr, defStyleRes);
  }

  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh)
  {
    super.onSizeChanged(w, h, oldw, oldh);
    if (mSizeChangedListener != null)
      mSizeChangedListener.onSizeChanged(w, h, oldw, oldh);
  }

  public void setSizeChangedListener(@Nullable SizeChangedListener listener)
  {
    mSizeChangedListener = listener;
  }

  public interface SizeChangedListener
  {
    void onSizeChanged(int width, int height, int oldWidth, int oldHeight);
  }
}