38 | * To use the component, simply add it to your view hierarchy. Then in your 39 | * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call 40 | * {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for. 41 | *
42 | * The colors can be customized in two ways. The first and simplest is to provide an array of colors 43 | * via {@link #setSelectedIndicatorColors(int...)}. The 44 | * alternative is via the {@link TabColorizer} interface which provides you complete control over 45 | * which color is used for any individual position. 46 | *
47 | * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
48 | * providing the layout ID of your custom layout.
49 | */
50 | public class SlidingTabLayout extends HorizontalScrollView {
51 | /**
52 | * Allows complete control over the colors drawn in the tab layout. Set with
53 | * {@link #setCustomTabColorizer(TabColorizer)}.
54 | */
55 | public interface TabColorizer {
56 |
57 | /**
58 | * @return return the color of the indicator used when {@code position} is selected.
59 | */
60 | int getIndicatorColor(int position);
61 |
62 | }
63 |
64 | private static final int TITLE_OFFSET_DIPS = 24;
65 | private static final int TAB_VIEW_PADDING_DIPS = 16;
66 | private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
67 |
68 | private int mTitleOffset;
69 |
70 | private int mTabViewLayoutId;
71 | private int mTabViewTextViewId;
72 | private boolean mDistributeEvenly;
73 |
74 | private ViewPager mViewPager;
75 | private SparseArray
54 | *
61 | */
62 | public class SynchronizeActivity extends AppCompatActivity {
63 |
64 | public static final String DEFAULT_CONFIG_PATH = "configs.json";
65 |
66 | private PagerAdapter pagerAdapter;
67 |
68 | /**
69 | * Messenger for communicating with service.
70 | */
71 | private Messenger serviceObject = null;
72 | /**
73 | * Flag indicating whether we have called bind on the service.
74 | */
75 | private boolean isBound;
76 |
77 | /**
78 | * The dialog which is being displayed while a sync is in progress
79 | */
80 | private ProgressDialog syncProgress = null;
81 |
82 | /**
83 | * Target we publish for clients to send messages to IncomingHandler.
84 | */
85 | private final Messenger mMessenger = new Messenger(
86 | new IncomingHandler(new WeakReference<>(this))
87 | );
88 |
89 | @Override
90 | protected void onCreate(Bundle savedInstanceState) {
91 | super.onCreate(savedInstanceState);
92 | setContentView(R.layout.activity_synchronize);
93 |
94 | Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
95 | setSupportActionBar(toolbar);
96 |
97 | List