summaryrefslogtreecommitdiff
path: root/src/com/android/contacts/widget
diff options
context:
space:
mode:
authorWenyi Wang <wenyiw@google.com>2016-02-10 16:20:40 -0800
committerWenyi Wang <wenyiw@google.com>2016-02-11 21:24:26 +0000
commit5fe9557ae4fdd7a1b70f27f7b1b6b4c096984d6a (patch)
tree26fa3a900c9f54afe7d3fbca97fa254c51bda74e /src/com/android/contacts/widget
parent9ff6a7caf65540c00e456e4d4a7354f8939ffd0c (diff)
downloadContacts-5fe9557ae4fdd7a1b70f27f7b1b6b4c096984d6a.tar.gz
Remove "Blocked Numbers Activity" from Contacts
This is almost a revert of ag/847363. We also hide menu for now in PeopleActivity. Bug 27118866 Change-Id: Ie242e2d1fcf00e7226a1f8e16c92c5d7620630e4 (cherry picked from commit 4bc3bd2aea6f053f5e9159a1ca5cd79e1d8887d8)
Diffstat (limited to 'src/com/android/contacts/widget')
-rw-r--r--src/com/android/contacts/widget/EmptyContentView.java117
-rw-r--r--src/com/android/contacts/widget/SearchEditTextLayout.java247
2 files changed, 0 insertions, 364 deletions
diff --git a/src/com/android/contacts/widget/EmptyContentView.java b/src/com/android/contacts/widget/EmptyContentView.java
deleted file mode 100644
index 12795e3e3..000000000
--- a/src/com/android/contacts/widget/EmptyContentView.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.contacts.widget;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.android.contacts.R;
-
-public class EmptyContentView extends LinearLayout implements View.OnClickListener {
-
- public static final int NO_LABEL = 0;
- public static final int NO_IMAGE = 0;
-
- private ImageView mImageView;
- private TextView mDescriptionView;
- private TextView mActionView;
- private OnEmptyViewActionButtonClickedListener mOnActionButtonClickedListener;
-
- public interface OnEmptyViewActionButtonClickedListener {
- public void onEmptyViewActionButtonClicked();
- }
-
- public EmptyContentView(Context context) {
- this(context, null);
- }
-
- public EmptyContentView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public EmptyContentView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public EmptyContentView(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setOrientation(LinearLayout.VERTICAL);
-
- final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- inflater.inflate(R.layout.empty_content_view, this);
- // Don't let touches fall through the empty view.
- setClickable(true);
- mImageView = (ImageView) findViewById(R.id.emptyListViewImage);
- mDescriptionView = (TextView) findViewById(R.id.emptyListViewMessage);
- mActionView = (TextView) findViewById(R.id.emptyListViewAction);
- mActionView.setOnClickListener(this);
- }
-
- public void setDescription(int resourceId) {
- if (resourceId == NO_LABEL) {
- mDescriptionView.setText(null);
- mDescriptionView.setVisibility(View.GONE);
- } else {
- mDescriptionView.setText(resourceId);
- mDescriptionView.setVisibility(View.VISIBLE);
- }
- }
-
- public void setImage(int resourceId) {
- if (resourceId == NO_LABEL) {
- mImageView.setImageDrawable(null);
- mImageView.setVisibility(View.GONE);
- } else {
- mImageView.setImageResource(resourceId);
- mImageView.setVisibility(View.VISIBLE);
- }
- }
-
- public void setActionLabel(int resourceId) {
- if (resourceId == NO_LABEL) {
- mActionView.setText(null);
- mActionView.setVisibility(View.GONE);
- } else {
- mActionView.setText(resourceId);
- mActionView.setVisibility(View.VISIBLE);
- }
- }
-
- public boolean isShowingContent() {
- return mImageView.getVisibility() == View.VISIBLE
- || mDescriptionView.getVisibility() == View.VISIBLE
- || mActionView.getVisibility() == View.VISIBLE;
- }
-
- public void setActionClickedListener(OnEmptyViewActionButtonClickedListener listener) {
- mOnActionButtonClickedListener = listener;
- }
-
- @Override
- public void onClick(View v) {
- if (mOnActionButtonClickedListener != null) {
- mOnActionButtonClickedListener.onEmptyViewActionButtonClicked();
- }
- }
-}
diff --git a/src/com/android/contacts/widget/SearchEditTextLayout.java b/src/com/android/contacts/widget/SearchEditTextLayout.java
deleted file mode 100644
index 6d24fbbb3..000000000
--- a/src/com/android/contacts/widget/SearchEditTextLayout.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.widget;
-
-import android.content.Context;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.AttributeSet;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
-import android.widget.FrameLayout;
-
-import com.android.contacts.R;
-import com.android.phone.common.animation.AnimUtils;
-
-public class SearchEditTextLayout extends FrameLayout {
- private static final int ANIMATION_DURATION = 200;
-
- private OnKeyListener mPreImeKeyListener;
- private int mTopMargin;
- private int mBottomMargin;
- private int mLeftMargin;
- private int mRightMargin;
-
- /* Subclass-visible for testing */
- protected boolean mIsExpanded = false;
- protected boolean mIsFadedOut = false;
-
- private View mExpanded;
- private EditText mSearchView;
- private View mBackButtonView;
- private View mClearButtonView;
-
- private Callback mCallback;
-
- /**
- * Listener for the back button next to the search view being pressed
- */
- public interface Callback {
- public void onBackButtonClicked();
- public void onSearchViewClicked();
- }
-
- public SearchEditTextLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public void setPreImeKeyListener(OnKeyListener listener) {
- mPreImeKeyListener = listener;
- }
-
- public void setCallback(Callback listener) {
- mCallback = listener;
- }
-
- @Override
- protected void onFinishInflate() {
- MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
- mTopMargin = params.topMargin;
- mBottomMargin = params.bottomMargin;
- mLeftMargin = params.leftMargin;
- mRightMargin = params.rightMargin;
-
- mExpanded = findViewById(R.id.search_box_expanded);
- mSearchView = (EditText) mExpanded.findViewById(R.id.search_view);
-
- mBackButtonView = findViewById(R.id.search_back_button);
- mClearButtonView = findViewById(R.id.search_close_button);
-
- mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (hasFocus) {
- showInputMethod(v);
- } else {
- hideInputMethod(v);
- }
- }
- });
-
- mSearchView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onSearchViewClicked();
- }
- }
- });
-
- mSearchView.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- mClearButtonView.setVisibility(TextUtils.isEmpty(s) ? View.GONE : View.VISIBLE);
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- }
- });
-
- findViewById(R.id.search_close_button).setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mSearchView.setText(null);
- }
- });
-
- findViewById(R.id.search_back_button).setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mCallback != null) {
- mCallback.onBackButtonClicked();
- }
- }
- });
-
- super.onFinishInflate();
- }
-
- @Override
- public boolean dispatchKeyEventPreIme(KeyEvent event) {
- if (mPreImeKeyListener != null) {
- if (mPreImeKeyListener.onKey(this, event.getKeyCode(), event)) {
- return true;
- }
- }
- return super.dispatchKeyEventPreIme(event);
- }
-
- public void fadeOut() {
- fadeOut(null);
- }
-
- public void fadeOut(AnimUtils.AnimationCallback callback) {
- AnimUtils.fadeOut(this, ANIMATION_DURATION, callback);
- mIsFadedOut = true;
- }
-
- public void fadeIn() {
- AnimUtils.fadeIn(this, ANIMATION_DURATION);
- mIsFadedOut = false;
- }
-
- public void setVisible(boolean visible) {
- if (visible) {
- setAlpha(1);
- setVisibility(View.VISIBLE);
- mIsFadedOut = false;
- } else {
- setAlpha(0);
- setVisibility(View.GONE);
- mIsFadedOut = true;
- }
- }
-
- public void expand(boolean requestFocus) {
- updateVisibility(true /* isExpand */);
- mExpanded.setVisibility(View.VISIBLE);
- mExpanded.setAlpha(1);
- setMargins(0f);
- // Set 9-patch background. This owns the padding, so we need to restore the original values.
- int paddingTop = this.getPaddingTop();
- int paddingStart = this.getPaddingStart();
- int paddingBottom = this.getPaddingBottom();
- int paddingEnd = this.getPaddingEnd();
- setBackgroundResource(R.drawable.search_shadow);
- setElevation(0);
- setPaddingRelative(paddingStart, paddingTop, paddingEnd, paddingBottom);
-
- if (requestFocus) {
- mSearchView.requestFocus();
- }
- mIsExpanded = true;
- }
-
- /**
- * Updates the visibility of views depending on whether we will show the expanded or collapsed
- * search view. This helps prevent some jank with the crossfading if we are animating.
- *
- * @param isExpand Whether we are about to show the expanded search box.
- */
- private void updateVisibility(boolean isExpand) {
- int expandedViewVisibility = isExpand ? View.VISIBLE : View.GONE;
-
- mBackButtonView.setVisibility(expandedViewVisibility);
- if (TextUtils.isEmpty(mSearchView.getText())) {
- mClearButtonView.setVisibility(View.GONE);
- } else {
- mClearButtonView.setVisibility(expandedViewVisibility);
- }
- }
-
- public boolean isExpanded() {
- return mIsExpanded;
- }
-
- /**
- * Assigns margins to the search box as a fraction of its maximum margin size
- *
- * @param fraction How large the margins should be as a fraction of their full size
- */
- private void setMargins(float fraction) {
- MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
- params.topMargin = (int) (mTopMargin * fraction);
- params.bottomMargin = (int) (mBottomMargin * fraction);
- params.leftMargin = (int) (mLeftMargin * fraction);
- params.rightMargin = (int) (mRightMargin * fraction);
- requestLayout();
- }
-
- private void showInputMethod(View view) {
- final InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(
- Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.showSoftInput(view, 0);
- }
- }
-
- private void hideInputMethod(View view) {
- final InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(
- Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
- }
- }
-}