summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/widget
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-07-16 11:36:07 -0700
committerYorke Lee <yorkelee@google.com>2015-07-17 10:23:33 -0700
commit575ae388961252a771488c357e425fca191594b2 (patch)
tree81126e76d811d650cd1b44a59380a14ceb703891 /src/com/android/dialer/widget
parent3cf92c747c54fa44240be5ba78cbc8eb6e3b8cd5 (diff)
downloadpackages_apps_Dialer-575ae388961252a771488c357e425fca191594b2.tar.gz
packages_apps_Dialer-575ae388961252a771488c357e425fca191594b2.tar.bz2
packages_apps_Dialer-575ae388961252a771488c357e425fca191594b2.zip
Add permission prompts for contacts and dialpad search
Update the following fragments to handle denied permissions -Contacts Search (Contacts and Location) -Dialpad Search (Phone) Tweak and remove some of the onTouch listener logic as they are no longer valid with the new UI. Instead of intercepting the touches when the query is empty and returning to the main dialer activity, allow the fragments to remain on screen if the permission request UI is showing. Modify signature of onEmptyViewActionButtonClicked to remove unused permissions parameter. Bug: 22174668 Change-Id: I96d00f2ab45df936dca602ac025f723638ac02c4
Diffstat (limited to 'src/com/android/dialer/widget')
-rw-r--r--src/com/android/dialer/widget/EmptyContentView.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/com/android/dialer/widget/EmptyContentView.java b/src/com/android/dialer/widget/EmptyContentView.java
index 67c9ce15f..2f5e0d9d7 100644
--- a/src/com/android/dialer/widget/EmptyContentView.java
+++ b/src/com/android/dialer/widget/EmptyContentView.java
@@ -18,6 +18,7 @@ package com.android.dialer.widget;
import android.content.Context;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@@ -29,15 +30,15 @@ import com.android.dialer.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 String[] mPermissions = new String[] {};
private OnEmptyViewActionButtonClickedListener mOnActionButtonClickedListener;
public interface OnEmptyViewActionButtonClickedListener {
- public void onEmptyViewActionButtonClicked(String[] permissions);
+ public void onEmptyViewActionButtonClicked();
}
public EmptyContentView(Context context) {
@@ -60,11 +61,6 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.empty_content_view, this);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
mImageView = (ImageView) findViewById(R.id.emptyListViewImage);
mDescriptionView = (TextView) findViewById(R.id.emptyListViewMessage);
mActionView = (TextView) findViewById(R.id.emptyListViewAction);
@@ -72,11 +68,22 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen
}
public void setDescription(int resourceId) {
- mDescriptionView.setText(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) {
mImageView.setImageResource(resourceId);
+ if (resourceId == NO_LABEL) {
+ mImageView.setVisibility(View.GONE);
+ } else {
+ mImageView.setVisibility(View.VISIBLE);
+ }
}
public void setActionLabel(int resourceId) {
@@ -89,6 +96,12 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen
}
}
+ public boolean isShowingContent() {
+ return mImageView.getVisibility() == View.VISIBLE
+ || mDescriptionView.getVisibility() == View.VISIBLE
+ || mActionView.getVisibility() == View.VISIBLE;
+ }
+
public void setActionClickedListener(OnEmptyViewActionButtonClickedListener listener) {
mOnActionButtonClickedListener = listener;
}
@@ -96,7 +109,7 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen
@Override
public void onClick(View v) {
if (mOnActionButtonClickedListener != null) {
- mOnActionButtonClickedListener.onEmptyViewActionButtonClicked(mPermissions);
+ mOnActionButtonClickedListener.onEmptyViewActionButtonClicked();
}
}
}