Example usage for android.widget ImageView ImageView

List of usage examples for android.widget ImageView ImageView

Introduction

In this page you can find the example usage for android.widget ImageView ImageView.

Prototype

public ImageView(Context context) 

Source Link

Usage

From source file:org.dalol.orthodoxmezmurmedia.utilities.widgets.AmharicKeyboardView.java

private void populateKeyboardRow(KeyboardRow keyboardRow, int keyHeight) {
    Context context = getContext();
    LinearLayout keyContainer = new LinearLayout(context);
    keyContainer.setOrientation(HORIZONTAL);
    keyContainer.setGravity(Gravity.CENTER);

    List<KeyboardKey> keyList = keyboardRow.getKeyList();
    if (keyList != null) {
        for (int i = 0; i < keyList.size(); i++) {
            KeyboardKey keyboardKey = keyList.get(i);
            if (keyboardKey.getKeyCommand() == KeyboardKey.KEY_EVENT_NORMAL) {
                TextView key = new TextView(context);
                key.setGravity(Gravity.CENTER);
                key.setTypeface(mCharTypeface, Typeface.BOLD);
                key.setText(keyboardKey.getCharCode());
                key.setTextSize(16f);//from ww  w . j  a va  2s  .  c  om
                key.setTextColor(
                        ContextCompat.getColorStateList(context, R.color.amharic_key_text_color_selector));
                key.setTag(keyboardKey);
                key.setIncludeFontPadding(false);
                keyContainer.setBaselineAligned(false);
                handleChild(key, keyboardKey.getColumnCount(), keyContainer, keyHeight);
            } else if (keyboardKey.getKeyCommand() == KeyboardKey.KEY_EVENT_BACKSPACE
                    || keyboardKey.getKeyCommand() == KeyboardKey.KEY_EVENT_SPACE
                    || keyboardKey.getKeyCommand() == KeyboardKey.KEY_NEW_LINE
                    || keyboardKey.getKeyCommand() == KeyboardKey.KEY_EVENT_ENTER
                    || keyboardKey.getKeyCommand() == KeyboardKey.KEY_HIDE_KEYBOARD) {
                ImageView child = new ImageView(context);
                child.setImageResource(keyboardKey.getCommandImage());
                int padding = getCustomSize(6);
                child.setPadding(padding, padding, padding, padding);
                child.setTag(keyboardKey);
                handleChild(child, keyboardKey.getColumnCount(), keyContainer, keyHeight);
            }
        }
    }
    addView(keyContainer, new LayoutParams(LayoutParams.MATCH_PARENT, keyHeight));
}

From source file:at.wada811.android.dialogfragments.sample.alertdialogfragment.AlertDialogFragmentExamplesFragment.java

@Override
public DialogFragmentCallback getDialogFragmentCallback() {
    return new SimpleDialogFragmentCallback() {
        @Override//from w  w  w  . j ava 2  s. co  m
        public void onShow(DialogFragmentInterface dialog) {
            String text = "onShow";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onCancel(DialogFragmentInterface dialog) {
            String text = "onCancel";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onDismiss(DialogFragmentInterface dialog) {
            String text = "onDismiss";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onClickPositive(DialogFragmentInterface dialog) {
            String text = "onClickPositive";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onClickNeutral(DialogFragmentInterface dialog) {
            String text = "onClickNeutral";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onClickNegative(DialogFragmentInterface dialog) {
            String text = "onClickNegative";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public boolean onKey(DialogFragmentInterface dialog, int keyCode, KeyEvent event) {
            String text = "onKey[keyCode: " + keyCode + ", KeyEvent: " + event + "]";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
            return false;
        }

        @Override
        public void onItemClick(DialogFragmentInterface dialog, int position) {
            Bundle extra = dialog.getExtra();
            String[] items = extra.getStringArray("items");
            String text = "onItemClick[position: " + position + ", item: " + items[position] + "]";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public ListAdapter getAdapter(DialogFragmentInterface dialog) {
            String[] items = new String[] { AlertDialog.class.getSimpleName(),
                    CharacterPickerDialog.class.getSimpleName(), ProgressDialog.class.getSimpleName(),
                    DatePickerDialog.class.getSimpleName(), TimePickerDialog.class.getSimpleName(), };
            Bundle extra = new Bundle();
            extra.putStringArray("items", items);
            dialog.setExtra(extra);
            return new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, items);
        }

        @Override
        public void onSingleChoiceClick(DialogFragmentInterface dialog, int position) {
            Bundle extra = dialog.getExtra();
            String[] items = extra.getStringArray("items");
            String text = "onItemClick[position: " + position + ", item: " + items[position] + "]";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onMultiChoiceClick(DialogFragmentInterface dialog, int position, boolean isChecked) {
            Bundle extra = dialog.getExtra();
            String[] items = extra.getStringArray("items");
            String text = "onItemClick[position: " + position + ", item: " + items[position] + ", isChecked: "
                    + isChecked + "]";
            Log.v(dialog.getTag(), text);
            Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
        }

        @Override
        public View getCustomTitle(DialogFragmentInterface dialog) {
            TextView titleView = new TextView(getActivity());
            titleView.setText(dialog.getTag());
            titleView.setPadding(0, 24, 0, 24);
            titleView.setGravity(Gravity.CENTER);
            titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
            return titleView;
        }

        @Override
        public View getView(DialogFragmentInterface dialog) {
            ImageView imageView = new ImageView(getActivity());
            imageView.setImageResource(R.drawable.ic_launcher);
            imageView.setPadding(0, 24, 0, 24);
            return imageView;
        }
    };
}

From source file:com.example.android.navigationdrawerexample.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    StrictMode.enableDefaults(); //STRICT MODE ENABLED

    db = new DBHelper(this);
    session = new Session(getApplicationContext());

    inflatedView = getLayoutInflater().inflate(R.layout.full_layout, null);
    mTitle = mDrawerTitle = getTitle();/*  w w  w .ja va  2s .  c o m*/
    login_layout = (RelativeLayout) findViewById(R.id.login_layout);
    //   order_list_layout= (RelativeLayout) findViewById(R.id.order_list_layout);
    signup_layout = (RelativeLayout) findViewById(R.id.signup_layout);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    actionBar = getActionBar();

    text = (TextView) inflatedView.findViewById(R.id.user_name);
    login_option = (TextView) inflatedView.findViewById(R.id.textView1);

    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    order_list = (ListView) findViewById(R.id.order_list);

    final LayoutInflater factory = getLayoutInflater();

    final View vendor_menu = factory.inflate(R.layout.vendor_menu, null);
    final View order_menu = factory.inflate(R.layout.my_order, null);
    menu_list = (ListView) vendor_menu.findViewById(R.id.menu_list);
    // loginPopup= (TextView) vendor_menu.findViewById(R.id.menu_title);
    // Log.d
    //menu_list.addView(order_menu,0);

    Signup = (Button) findViewById(R.id.Signup);
    Gosignup = (Button) findViewById(R.id.Gosignup);
    Login = (ImageButton) findViewById(R.id.Login);

    Sign_username = (EditText) findViewById(R.id.SignUsername);
    Sign_name = (EditText) findViewById(R.id.vendor);
    Sign_pass = (EditText) findViewById(R.id.SignPass);
    Sign_cpass = (EditText) findViewById(R.id.SignCpass);
    Sign_phone = (EditText) findViewById(R.id.Phone);

    Login_pass = (EditText) findViewById(R.id.Logpass);
    Login_email = (EditText) findViewById(R.id.Logusername);

    // Log_username= (EditText) findViewById(R.id.Logusername);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener

    adapter = new MyAdapter(this);
    //adapter2=new MyAdapter2(this);
    // menu_adapter=new MyAdapter2(this);
    mDrawerList.setAdapter(adapter);
    mDrawerList.setDividerHeight(0);
    //mDrawerList.setAdapter(adapter);
    // order_list.setAdapter(adapter2);
    // menu_list.setAdapter(menu_adapter);

    menu_list.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, adapter.mPlanetTitles));

    ImageView floatoption = new ImageView(this);
    floatoption.setImageResource(R.drawable.foption);

    ImageView floatadd = new ImageView(this);
    floatadd.setImageResource(R.drawable.fplus);

    floatin = new ImageView(this);
    floatin.setImageResource(R.drawable.flogin);

    floatout = new ImageView(this);
    floatout.setImageResource(R.drawable.flogout);

    ImageView floatrefresh = new ImageView(this);
    floatrefresh.setImageResource(R.drawable.refresh);

    itemBuilder = new SubActionButton.Builder(this);

    loginout = itemBuilder.setContentView(floatin).build();
    refresh = itemBuilder.setContentView(floatrefresh).build();
    additem = itemBuilder.setContentView(floatadd).build();

    actionButton = new FloatingActionButton.Builder(this).setContentView(floatoption).build();

    actionMenu = new FloatingActionMenu.Builder(this).addSubActionView(loginout).addSubActionView(additem)
            .addSubActionView(refresh)

            // ...
            .attachTo(actionButton).build();

    Signup.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {

            View v = mDrawerList.getChildAt(0);
            View v2 = mDrawerList.getChildAt(5);

            text = (TextView) v.findViewById(R.id.user_name);
            login_option = (TextView) v2.findViewById(R.id.textView1);
            profile = (ImageView) v.findViewById(R.id.user_image);
            profile.setImageResource(R.drawable.welcome);
            text.setTextSize(20);
            text.setTextColor(Color.MAGENTA);
            text.setText("" + Sign_name.getText().toString());

            login_option.setText("Logout");

            floatout.setImageResource(R.drawable.flogout);
            // loginout.setContentView(floatout);
            long id = db.Insert(Sign_username.getText().toString(), Sign_name.getText().toString(),
                    Sign_pass.getText().toString(), Sign_phone.getText().toString());

            Log.d("This is-----------==", (String) text.getText() + id);

            //mDrawerList.invalidateViews();

            //mDrawerList.removeViewAt(0);
            adapter.notifyDataSetChanged();

            loginout.removeView(floatin);
            loginout.setContentView(floatout);

            order_list.setVisibility(View.VISIBLE);
            signup_layout.setVisibility(View.INVISIBLE);
            login_layout.setVisibility(View.INVISIBLE);

        }
    });

    Login.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            user_name = Login_email.getText().toString();
            user_pass = Login_pass.getText().toString();

            new GetAllCustomerTask().execute(new ApiConnector());
            new Order_details().execute(new ApiConnector());

        }
    });

    if (!session.getusename().equals("")) {
        user_id = session.getusename();
        user_name = session.getusename();
        user_pass = session.getpassword();
        login_layout.setVisibility(View.INVISIBLE);
        new GetAllCustomerTask().execute(new ApiConnector());
        // new Order_details().execute(new ApiConnector());
        // View vt = mDrawerList.getChildAt(0);
        //login_check(jsonArray);

        //new Order_details().execute(new ApiConnector());
    }

    additem.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (logged_in) {
                Intent i = new Intent(getApplicationContext(), Add_Item.class);
                startActivity(i);
            } else
                Toast.makeText(getApplicationContext(), "You Need To Login...", Toast.LENGTH_LONG).show();

        }
    });
    loginout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (logged_in) {
                session.setusename("", "");
                finish();
                startActivity(getIntent());
                Toast.makeText(getApplicationContext(), "You are Loged Out", Toast.LENGTH_SHORT).show();
            } else
                Toast.makeText(getApplicationContext(), "You Need To Login...", Toast.LENGTH_LONG).show();

        }
    });

    Login.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            user_name = Login_email.getText().toString();
            user_pass = Login_pass.getText().toString();
            new GetAllCustomerTask().execute(new ApiConnector());
            //   new Order_details().execute(new ApiConnector());

        }
    });

    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    order_list.setOnItemClickListener(new OrderItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
    ActionBar actionBar = getActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(0xFF3BBD8F));

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            getActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            text = (TextView) inflatedView.findViewById(R.id.user_name);
            Log.d("Thit is----------------", (String) text.getText());
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
        selectItem(0);
    }

}

From source file:com.pdftron.pdf.controls.AddPageDialogFragment.java

private void initViewPagerDotLayout() {
    if ((int) Math.ceil(PageType.values().length / 3.0) < 2)
        return;//from  w  ww . j  a v  a2s.  com
    for (int i = 0; i < (int) Math.ceil(PageType.values().length / 3.0); i++) {
        ImageView dot = new ImageView(getContext());
        LinearLayout.LayoutParams dotParams = new LinearLayout.LayoutParams((int) (8 * mDeviceScale + 0.5f),
                (int) (8 * mDeviceScale + 0.5f));
        int margin = (int) (5 * mDeviceScale + 0.5f);
        dotParams.setMargins(margin, margin, margin, margin);
        dot.setLayoutParams(dotParams);
        dot.setImageDrawable(getResources().getDrawable(R.drawable.viewpager_point));
        dot.setEnabled(i == 0 ? true : false);
        mViewPagerDotLayout.addView(dot);
    }
}

From source file:com.google.code.twisty.Twisty.java

/** Called when activity is first created. */
@Override/*from  w w w . jav  a2s . c  o m*/
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);

    // Map our built-in game resources to real filenames
    builtinGames.clear();
    builtinGames.put(R.raw.violet, "violet.z8");
    builtinGames.put(R.raw.rover, "rover.gblorb");
    builtinGames.put(R.raw.glulxercise, "glulxercise.ulx");
    builtinGames.put(R.raw.windowtest, "windowtest.ulx");

    UISync.setInstance(this);

    // An imageview to show the twisty icon
    iv = new ImageView(this);
    iv.setBackgroundColor(0xffffff);
    iv.setImageResource(R.drawable.app_icon);
    iv.setAdjustViewBounds(true);
    iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    // The main 'welcome screen' window from which games are launched.
    tv = new TextBufferView(this);
    mainWin = new TextBufferIO(tv, new StyleManager());
    //final GlkEventQueue eventQueue = null;
    tv.setFocusableInTouchMode(true);

    // The Glk window layout manager
    glkLayout = new GlkLayout(this);

    // put it all together
    ll = new LinearLayout(this);
    ll.setBackgroundColor(Color.argb(0xFF, 0xFE, 0xFF, 0xCC));
    ll.setOrientation(android.widget.LinearLayout.VERTICAL);
    ll.addView(iv);
    ll.addView(tv);
    glkLayout.setVisibility(View.GONE);
    ll.addView(glkLayout);
    setContentView(ll);

    dialog_handler = new DialogHandler(this);
    terp_handler = new TerpHandler(this);

    // Ensure we can write story files and save games to external storage
    checkWritePermission();

    Uri dataSource = this.getIntent().getData();
    if (dataSource != null) {
        /* Suck down the URI we received to sdcard, launch terp on it. */
        try {
            startTerp(dataSource);
        } catch (Exception e) {
            Log.e(TAG, e.getMessage(), e);
        }
    } else {
        printWelcomeMessage();
    }
}

From source file:com.mumu.pokemongogo.HeadService.java

private void initGameControlButtons() {
    mDirectionIconList = new ArrayList<>();

    // Up button// w  ww.ja v  a  2s .  c o  m
    HeadIconView upButton = new HeadIconView(new ImageView(this), mWindowManager, 130, 160);
    upButton.getImageView().setImageResource(R.drawable.ic_arrow_up);
    upButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    upButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.NORTH, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(upButton);

    // Down button
    HeadIconView downButton = new HeadIconView(new ImageView(this), mWindowManager, 130, 0);
    downButton.getImageView().setImageResource(R.drawable.ic_arrow_down);
    downButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    downButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.SOUTH, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(downButton);

    // Left button
    HeadIconView leftButton = new HeadIconView(new ImageView(this), mWindowManager, 50, 80);
    leftButton.getImageView().setImageResource(R.drawable.ic_arrow_left);
    leftButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    leftButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.WEST, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(leftButton);

    // Right button
    HeadIconView rightButton = new HeadIconView(new ImageView(this), mWindowManager, 210, 80);
    rightButton.getImageView().setImageResource(R.drawable.ic_arrow_right);
    rightButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    rightButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.EAST, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(rightButton);

    // North West button
    HeadIconView upLeftButton = new HeadIconView(new ImageView(this), mWindowManager, 50, 160);
    upLeftButton.getImageView().setImageResource(R.drawable.ic_arrow_squart);
    upLeftButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    upLeftButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.NORTHWEST, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(upLeftButton);

    // West South button
    HeadIconView leftDownButton = new HeadIconView(new ImageView(this), mWindowManager, 50, 0);
    leftDownButton.getImageView().setImageResource(R.drawable.ic_arrow_squart);
    leftDownButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    leftDownButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.WESTSOUTH, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(leftDownButton);

    // South East button
    HeadIconView downRightButton = new HeadIconView(new ImageView(this), mWindowManager, 210, 0);
    downRightButton.getImageView().setImageResource(R.drawable.ic_arrow_squart);
    downRightButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    downRightButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.SOUTHEAST, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(downRightButton);

    // East North button
    HeadIconView rightUpButton = new HeadIconView(new ImageView(this), mWindowManager, 210, 160);
    rightUpButton.getImageView().setImageResource(R.drawable.ic_arrow_squart);
    rightUpButton.getImageView()
            .setBackgroundColor(ContextCompat.getColor(mContext, R.color.button_half_transparent));
    rightUpButton.setOnTapListener(new HeadIconView.OnTapListener() {
        @Override
        public void onTap(View view) {
            mFakeLocationManager.setSpeed(mWalkSpeed);
            mFakeLocationManager.walkPace(FakeLocation.EASTNORTH, 1.0);
        }

        @Override
        public void onLongPress(View view) {

        }
    });
    mDirectionIconList.add(rightUpButton);

    // add view and set invisible
    for (HeadIconView icon : mDirectionIconList) {
        icon.setVisibility(View.INVISIBLE);
        icon.setGravity(Gravity.BOTTOM | Gravity.START, false);
        icon.addView();
    }
}

From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java

/**
 * DOUBLE IMAGE ROW/*from   ww w .j  a va  2s .  c  o m*/
 * @param att
 * @param linear
 * @return
 */
public LinearLayout getDoubleImageRow(Map<String, String> att, LinearLayout linear) {

    LinearLayout container_layout = new LinearLayout(context);
    container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo));
    container_layout.setMinimumHeight(46);
    container_layout.setVerticalGravity(Gravity.CENTER);

    LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.3f);
    TextView tx = new TextView(context);
    tx.setText(att.get("title"));
    tx.setTextSize(11);
    tx.setTypeface(null, Typeface.BOLD);
    tx.setGravity(Gravity.LEFT);
    tx.setPadding(3, 0, 0, 2);
    tx.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(tx, value_params);

    LinearLayout.LayoutParams value_one_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46,
            0.35f);
    ImageView img1 = new ImageView(context);
    String path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value1"));
    img1.setImageResource(context.getResources().getIdentifier(path, null, null));
    img1.setPadding(0, 3, 0, 3);
    container_layout.addView(img1, value_one_params);

    LinearLayout.LayoutParams value_two_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46,
            0.35f);
    ImageView img2 = new ImageView(context);
    path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value2"));
    img2.setImageResource(context.getResources().getIdentifier(path, null, null));
    img2.setPadding(0, 3, 0, 3);
    container_layout.addView(img2, value_two_params);

    linear.addView(container_layout);

    return linear;
}

From source file:com.example.sam.savemeapp.StatisticsFragment.java

/**
 * Sets up the initial legend with the contained categories shown
 * in the pie chart and bullet points with the corresponding colors.
 *///from   w w w  . j a  va2  s  .  co  m
public void setUpPiechart() {
    pieChart.getDescription().setEnabled(false);
    Legend pieL = pieChart.getLegend();
    Log.d("stats", Float.toString(pieL.getEntries().length));
    startLegend = pieL;
    LegendEntry[] legends = pieL.getEntries();
    pieL.setEnabled(false);
    mLegend.removeAllViews();
    //The default legend consist of TextViews and ImageViews which contains a bullet point.
    //The legends are contained inside of a horizontal LinearLayout which is contained in a vertical LinearLayout.
    for (int t = 0; t < legends.length - 1; t++) {
        LegendEntry x = legends[t];
        LinearLayout hLayout = new LinearLayout(getContext());
        hLayout.setLayoutParams(params);
        TextView tv = new TextView(getContext());
        tv.setText(x.label);
        tv.setTextColor(x.formColor);
        tv.setTypeface(fontLight);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                getResources().getDimension(R.dimen.statistics_main_text_size));
        tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
        LinearLayoutCompat.LayoutParams textViewParams = new LinearLayoutCompat.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        textViewParams.setMarginStart((int) getResources().getDimension(R.dimen.statistics_text_margin));
        tv.setLayoutParams(textViewParams);
        ImageView iv = new ImageView(getContext());
        Drawable dot = ContextCompat.getDrawable(getContext(), R.drawable.circle_legend);
        dot.setColorFilter(x.formColor, PorterDuff.Mode.SRC);
        iv.setImageDrawable(dot);
        iv.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        hLayout.addView(iv);
        hLayout.addView(tv);
        mLegend.addView(hLayout);
    }

    designPiechart();

    pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        private int color;

        @Override
        public void onValueSelected(Entry e, Highlight h) {
            //it creates new legends with the information of the subcategories when a
            // category in the pi chart is clicked
            ArrayList<LegendEntry> list = new ArrayList<>();
            mLegend.removeAllViews();
            if (e.getData().equals(Color.parseColor("#00a0ae"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Food & Beverage")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Food & Beverage: "
                        + u.categories.get("Food & Beverage").get("Food & Beverage") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Restaurant & Caf: "
                        + u.categories.get("Food & Beverage").get("Restaurant & Caf") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Supermarket: " + u.categories.get("Food & Beverage").get("Supermarket") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                //This category legends consist of the main category in this case "Food & Beverage" in the top of the legend
                //and the sub categories bellow. The name is also shown together with the amount spend in that category.
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#be3127"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Transportation")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Transportation: "
                        + u.categories.get("Transportation").get("Transportation") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Public transport: "
                        + u.categories.get("Transportation").get("Public transport") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Taxi & Uber: " + u.categories.get("Transportation").get("Taxi & Uber") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Petrol: " + u.categories.get("Transportation").get("Petrol") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Maintenance: " + u.categories.get("Transportation").get("Maintenance") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#7dc725"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Shopping")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry(
                        "Shopping: " + u.categories.get("Shopping").get("Shopping") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Clothing: " + u.categories.get("Shopping").get("Clothing") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Electronics: " + u.categories.get("Shopping").get("Electronics") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Books: " + u.categories.get("Shopping").get("Books") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Gifts: " + u.categories.get("Shopping").get("Gifts") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Other: " + u.categories.get("Shopping").get("Other") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#e88300"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Entertainment")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry(
                        "Entertainment: " + u.categories.get("Entertainment").get("Entertainment") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Going out: " + u.categories.get("Entertainment").get("Going out") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Sports: " + u.categories.get("Entertainment").get("Sports") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#dc006d"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Health")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Health: " + u.categories.get("Health").get("Health") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Doctor: " + u.categories.get("Health").get("Doctor") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Pharmacy: " + u.categories.get("Health").get("Pharmacy") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            } else if (e.getData().equals(Color.parseColor("#1562a4"))) {
                for (LegendEntry x : startLegend.getEntries()) {
                    if (x.label.equals("Bills")) {
                        color = x.formColor;
                    }
                }
                list.add(new LegendEntry("Bills: " + u.categories.get("Bills").get("Bills") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Water: " + u.categories.get("Bills").get("Water") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry(
                        "Electricity: " + u.categories.get("Bills").get("Electricity") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Gas: " + u.categories.get("Bills").get("Gas") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Rent: " + u.categories.get("Bills").get("Rent") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Phone: " + u.categories.get("Bills").get("Phone") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(
                        new LegendEntry("Insurance: " + u.categories.get("Bills").get("Insurance") + u.currency,
                                Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("TV: " + u.categories.get("Bills").get("TV") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                list.add(new LegendEntry("Internet: " + u.categories.get("Bills").get("Internet") + u.currency,
                        Legend.LegendForm.SQUARE, 7f, 7f, null, color));
                mLegend.removeAllViews();
                for (LegendEntry x : list) {
                    TextView tv = new TextView(getContext());
                    if (x.equals(list.get(0))) {
                        tv.setTypeface(fontBlack);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_main_text_size));
                    } else {
                        tv.setTypeface(fontLight);
                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                                getResources().getDimension(R.dimen.statistics_text_size));
                    }
                    tv.setText(x.label);
                    tv.setTextColor(color);
                    tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                    mLegend.addView(tv);
                }
            }
        }

        @Override
        public void onNothingSelected() {
            //Sets up the default legend when nothing is selected
            pieChart = (PieChart) v.findViewById(R.id.piechart);
            pieChart.setUsePercentValues(true);
            LegendEntry[] legends = startLegend.getEntries();
            startLegend.setEnabled(false);
            mLegend.removeAllViews();
            for (LegendEntry x : legends) {
                LinearLayout hLayout = new LinearLayout(getContext());
                hLayout.setLayoutParams(params);
                TextView tv = new TextView(getContext());
                tv.setText(x.label);
                tv.setTextColor(x.formColor);
                tv.setTypeface(fontLight);
                tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,
                        getResources().getDimension(R.dimen.statistics_main_text_size));
                tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
                LinearLayoutCompat.LayoutParams textViewParams = new LinearLayoutCompat.LayoutParams(
                        ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                textViewParams
                        .setMarginStart((int) getResources().getDimension(R.dimen.statistics_text_margin));
                tv.setLayoutParams(textViewParams);
                ImageView iv = new ImageView(getContext());
                Drawable dot = ContextCompat.getDrawable(getContext(), R.drawable.circle_legend);
                dot.setColorFilter(x.formColor, PorterDuff.Mode.SRC);
                iv.setImageDrawable(dot);
                iv.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.MATCH_PARENT));
                hLayout.addView(iv);
                hLayout.addView(tv);
                mLegend.addView(hLayout);
            }
        }
    });
}

From source file:com.TakeTaxi.jy.OnrouteScreen.java

public void pingpicked(JSONObject json) {

    try {// w w w  .ja va  2s.co m

        int driverpicked = json.getInt("picked");
        int drivercancelled = json.getInt("dcancel");
        int starttime = json.getInt("datetime");

        // /////////////////////////////// DRIVER CANCEL ////////
        if (drivercancelled == 1) {

            // //// DRIVER CANCEL LATE /////

            if (starttime + 300 <= Query.getServerTime()) {
                handlerboolean = false;
                handler.removeCallbacks(r);

                AlertDialog dcancelbuilder = new AlertDialog.Builder(OnrouteScreen.this).create();
                dcancelbuilder
                        .setMessage("Job has been cancelled.\nWould you like to report a late cancellation?.");

                // //// DRIVER CANCEL LATE - NO REPORT LATE/////
                button_cancelJob_noquery(dcancelbuilder);
                // //// DRIVER CANCEL LATE - REPORT LATE /////
                button_drivercancel_reportlate(dcancelbuilder);

                dcancelbuilder.show();

            } else {
                // /////////////////////////////// DRIVER CANCEL NO ALERTS -
                // WITHIN TIME LIMIT///////////////
                handlerboolean = false;
                handler.removeCallbacks(r);

                alertdialog_drivercancelintime();

            }
        }
        if (driverpicked == 1) {
            // /////////////////////////////// CONFIRM PICK UP
            // ///////////////////////////////////////////

            handlerboolean = false;
            handler.removeCallbacks(r);
            AlertDialog.Builder alert = new AlertDialog.Builder(OnrouteScreen.this);
            final Drawable thumbsup = getResources().getDrawable(R.drawable.thumbsup);
            final Drawable thumbsupwhite = getResources().getDrawable(R.drawable.thumbsupwhite);
            final Drawable thumbsdown = getResources().getDrawable(R.drawable.thumbsdown);
            final Drawable thumbsdownwhite = getResources().getDrawable(R.drawable.thumbsdownwhite);
            LinearLayout layout = new LinearLayout(OnrouteScreen.this);
            layout.setOrientation(1);
            layout.setGravity(17);

            TextView tx1 = new TextView(OnrouteScreen.this);
            tx1.setText("Driver says you have been picked up");
            tx1.setGravity(17);
            tx1.setTextSize(20);
            tx1.setTextColor(Color.WHITE);
            tx1.setPadding(10, 10, 10, 10);

            TextView tx2 = new TextView(OnrouteScreen.this);
            tx2.setText("Please rate your driver");
            tx2.setGravity(17);
            tx2.setTextSize(16);

            LinearLayout imglayout = new LinearLayout(OnrouteScreen.this);
            imglayout.setOrientation(0);
            imglayout.setGravity(17);

            final ImageView ivup = new ImageView(OnrouteScreen.this);
            ivup.setImageDrawable(thumbsupwhite);
            ivup.setClickable(true);
            ivup.setPadding(0, 5, 30, 5);
            final ImageView ivdown = new ImageView(OnrouteScreen.this);
            ivdown.setImageDrawable(thumbsdownwhite);
            ivdown.setClickable(true);
            ivup.setPadding(30, 5, 0, 5);
            imglayout.addView(ivup);
            imglayout.addView(ivdown);

            layout.addView(tx1);
            layout.addView(tx2);

            layout.addView(imglayout);
            // /////////////////////////////// CONFIRM PICK UP - RATINGS
            // ///////////////////////////////////////////

            ivup.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsupboolean == false) {
                        thumbsupboolean = true;
                        thumbsdownboolean = false;
                        ivup.setImageDrawable(thumbsup);
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 1;
                    } else {
                        thumbsupboolean = false;
                        ivup.setImageDrawable(thumbsupwhite);
                        rating = 0;
                    }

                }
            });

            ivdown.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsdownboolean == false) {
                        thumbsdownboolean = true;
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdown);
                        ivup.setImageDrawable(thumbsupwhite);

                        AlertDialog alert = new AlertDialog.Builder(OnrouteScreen.this).create();

                        alert.setMessage("Please pick one");
                        alert.setButton("No show", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -1;
                            }
                        });
                        alert.setButton2("Driver late", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -2;
                            }
                        });
                        alert.setButton3("Poor service", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -3;
                            }
                        });
                        alert.show();

                    } else {
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 0;
                    }

                }
            });

            button_completed_finish(alert);

            alert.setView(layout);
            alert.create();
            alert.show();
        } else {
        }

    } catch (JSONException e) {
    }
}

From source file:com.yaozu.object.widget.PagerSlidingTabStrip.java

public void notifyDataSetChanged() {

    tabsContainer.removeAllViews();//from  w w  w  .  j a  v  a2 s  .  co m

    tabCount = pager.getAdapter().getCount();

    for (int i = 0; i < tabCount; i++) {
        addTextTab(i, pager.getAdapter().getPageTitle(i).toString());
    }

    // add by hangl
    if (!shouldExpand && expandViewWidth != 0) {
        ImageView spaceView = new ImageView(getContext());
        LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(expandViewWidth,
                LinearLayout.LayoutParams.MATCH_PARENT);
        tabsContainer.addView(spaceView, tabCount, llp);
    }

    updateTabStyles();

    getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @SuppressWarnings("deprecation")
        @SuppressLint("NewApi")
        @Override
        public void onGlobalLayout() {

            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
            } else {
                getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }

            currentPosition = pager.getCurrentItem();
            scrollToChild(currentPosition, 0);
        }
    });
    selectTab(pager.getCurrentItem()); // focus current selected tab
}