diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-04-23 15:32:23 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-04-23 15:32:23 -0400 |
commit | abe80cc31d5a40ebed743085011fbcda0c1a9a10 (patch) | |
tree | fb3762f06b84745b182af281abb107b95a9fcf01 /mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java | |
parent | 63295d0087eb58a6eb34cad324c4c53d1b220491 (diff) | |
download | UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.gz UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.lz UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.xz UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.zip |
Issue #1053 - Drop support Android and remove Fennec - Part 1a: Remove mobile/android
Diffstat (limited to 'mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java')
-rw-r--r-- | mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java deleted file mode 100644 index 367da640f..000000000 --- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayoutAdapter.java +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.tabs; - -import org.mozilla.gecko.R; -import org.mozilla.gecko.Tab; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; - -import java.util.ArrayList; - -// Adapter to bind tabs into a list -public class TabsLayoutAdapter extends BaseAdapter { - public static final String LOGTAG = "Gecko" + TabsLayoutAdapter.class.getSimpleName(); - - private final Context mContext; - private final int mTabLayoutId; - private ArrayList<Tab> mTabs; - private final LayoutInflater mInflater; - - public TabsLayoutAdapter (Context context, int tabLayoutId) { - mContext = context; - mInflater = LayoutInflater.from(mContext); - mTabLayoutId = tabLayoutId; - } - - final void setTabs (ArrayList<Tab> tabs) { - mTabs = tabs; - notifyDataSetChanged(); // Be sure to call this whenever mTabs changes. - } - - final boolean removeTab (Tab tab) { - boolean tabRemoved = mTabs.remove(tab); - if (tabRemoved) { - notifyDataSetChanged(); // Be sure to call this whenever mTabs changes. - } - return tabRemoved; - } - - final void clear() { - mTabs = null; - - notifyDataSetChanged(); // Be sure to call this whenever mTabs changes. - } - - @Override - public int getCount() { - return (mTabs == null ? 0 : mTabs.size()); - } - - @Override - public Tab getItem(int position) { - return mTabs.get(position); - } - - @Override - public long getItemId(int position) { - return position; - } - - final int getPositionForTab(Tab tab) { - if (mTabs == null || tab == null) - return -1; - - return mTabs.indexOf(tab); - } - - @Override - public boolean isEnabled(int position) { - return true; - } - - @Override - final public TabsLayoutItemView getView(int position, View convertView, ViewGroup parent) { - final TabsLayoutItemView view; - if (convertView == null) { - view = newView(position, parent); - } else { - view = (TabsLayoutItemView) convertView; - } - final Tab tab = mTabs.get(position); - bindView(view, tab); - return view; - } - - TabsLayoutItemView newView(int position, ViewGroup parent) { - return (TabsLayoutItemView) mInflater.inflate(mTabLayoutId, parent, false); - } - - void bindView(TabsLayoutItemView view, Tab tab) { - view.assignValues(tab); - } -}
\ No newline at end of file |