Quick response clean-up
Highlighting now appears when selecting a quick response. On "insert quick response" dialog has exactly two lines of quick response shown. Done also works properly now on the phone. Known bug: text is not ellipsized. However, this is dependent on bug 3389545 being fixed by frameworks team. Change-Id: I7490e139267963d1508fa0573144a10c9190e11c
This commit is contained in:
parent
b8b560f315
commit
bc42ab7706
|
@ -29,7 +29,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:listSelector="@android:drawable/list_selector_background"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 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.
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/quick_response_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:padding="9dip"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="2"
|
||||
android:ellipsize="end"
|
||||
/>
|
|
@ -19,28 +19,31 @@
|
|||
android:id="@+id/line_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7dip"
|
||||
android:background="?android:attr/listChoiceBackgroundIndicator"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:padding="7dip"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/delete_button"
|
||||
android:layout_height="wrap_content"
|
||||
<ImageView
|
||||
android:id="@+id/delete_icon"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/delete_quick_response_action"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?android:attr/listChoiceBackgroundIndicator"
|
||||
android:focusable="true"
|
||||
android:padding="7dip"
|
||||
android:src="@drawable/ic_menu_trash_holo_light"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/quick_response_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@id/delete_button"
|
||||
android:layout_toLeftOf="@id/delete_icon"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/accountSetupInfoText"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="2"
|
||||
android:ellipsize="end"
|
||||
android:focusable="false"
|
||||
android:maxLines="2"
|
||||
/>
|
||||
</RelativeLayout>
|
|
@ -64,8 +64,7 @@ import java.util.List;
|
|||
* sense to use a loader for the accounts list, because it would provide better support for
|
||||
* dealing with accounts being added/deleted and triggering the header reload.
|
||||
*/
|
||||
public class AccountSettings extends PreferenceActivity
|
||||
implements AccountSettingsEditQuickResponsesFragment.Callback {
|
||||
public class AccountSettings extends PreferenceActivity {
|
||||
/*
|
||||
* Intent to open account settings for account=1
|
||||
adb shell am start -a android.intent.action.EDIT \
|
||||
|
@ -655,14 +654,6 @@ public class AccountSettings extends PreferenceActivity
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements AccountSettingsEditQuickResponsesFragment.Callback
|
||||
*/
|
||||
@Override
|
||||
public void onEditQuickResponsesDone() {
|
||||
getFragmentManager().popBackStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch to edit incoming settings.
|
||||
*
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.content.Context;
|
|||
import android.database.ContentObserver;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -39,14 +40,14 @@ import android.view.View.OnClickListener;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
/**
|
||||
* Lists quick responses associated with the specified email account. Allows users to create,
|
||||
* edit, and delete quick responses. Owning activity must:
|
||||
* <ul>
|
||||
* <li>Implement Callback to properly dismiss this fragment.</li>
|
||||
* <li>Launch this fragment using startPreferencePanel().</li>
|
||||
* <li>Provide an Account as an argument named "account". This account's quick responses
|
||||
* will be read and potentially modified.</li>
|
||||
* </ul>
|
||||
|
@ -58,20 +59,9 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
|
|||
private ListView mQuickResponsesView;
|
||||
private Account mAccount;
|
||||
private Context mContext;
|
||||
private Callback mListen;
|
||||
private EmailAsyncTask.Tracker mTaskTracker;
|
||||
|
||||
/**
|
||||
* Allows this fragment to properly dismiss itself via the Callback's implementation.
|
||||
*/
|
||||
public interface Callback {
|
||||
/**
|
||||
* Dismisses the fragment.
|
||||
*/
|
||||
public void onEditQuickResponsesDone();
|
||||
}
|
||||
|
||||
// Helper class to place a TextView alongside "Delete" button in the ListView
|
||||
// Helper class to place a TextView alongside "Delete" icon in the ListView
|
||||
// displaying the QuickResponses
|
||||
private static class ArrayAdapterWithButtons extends ArrayAdapter<QuickResponse> {
|
||||
private QuickResponse[] mQuickResponses;
|
||||
|
@ -133,9 +123,9 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
|
|||
convertView.setTag(mQuickResponses[position]);
|
||||
convertView.setOnClickListener(mOnEditListener);
|
||||
|
||||
Button deleteButton = (Button) convertView.findViewById(R.id.delete_button);
|
||||
deleteButton.setTag(mQuickResponses[position]);
|
||||
deleteButton.setOnClickListener(mOnDeleteListener);
|
||||
ImageView deleteIcon = (ImageView) convertView.findViewById(R.id.delete_icon);
|
||||
deleteIcon.setTag(mQuickResponses[position]);
|
||||
deleteIcon.setOnClickListener(mOnDeleteListener);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -201,7 +191,7 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
|
|||
} else {
|
||||
adapter = new ArrayAdapter<QuickResponse>(
|
||||
mContext,
|
||||
android.R.layout.simple_selectable_list_item,
|
||||
R.layout.insert_quick_response,
|
||||
quickResponseItems
|
||||
);
|
||||
mQuickResponsesView.setOnItemClickListener(mListener);
|
||||
|
@ -213,11 +203,6 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
|
|||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
mListen = (Callback) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException(activity.toString() + " must implement Callback");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -277,7 +262,9 @@ public class AccountSettingsEditQuickResponsesFragment extends Fragment
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.done) {
|
||||
mListen.onEditQuickResponsesDone();
|
||||
// since launched using startPreferencePanel, this is the proper way to end it
|
||||
// for both tablets and phones
|
||||
((PreferenceActivity) getActivity()).finishPreferencePanel(this, 0, null);
|
||||
} else if (v.getId() == R.id.create_new) {
|
||||
EditQuickResponseDialog
|
||||
.newInstance(null, mAccount.mId)
|
||||
|
|
Loading…
Reference in New Issue