Use one scrollbar for confirm sharing dialog.

This commit is contained in:
Jimmy Shih
2012-06-12 14:51:42 -07:00
parent 831a12303a
commit cba40a6688
3 changed files with 37 additions and 19 deletions
+21 -11
View File
@@ -14,16 +14,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" style="@style/ScrollView" >
android:layout_width="fill_parent" > <LinearLayout
<CheckBox
android:id="@+id/confirm_sharing"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:text="@string/generic_do_not_show_again" android:orientation="vertical"
style="@style/TextMedium" /> android:paddingBottom="12dp"
</LinearLayout> android:paddingLeft="14dp"
android:paddingRight="10dp"
android:paddingTop="2dp" >
<TextView
android:id="@+id/confirm_sharing_text_view"
android:autoLink="web"
style="@style/TextMedium" />
<CheckBox
android:id="@+id/confirm_sharing_check_box"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_width="fill_parent"
android:text="@string/generic_do_not_show_again"
style="@style/TextMedium" />
</LinearLayout>
</ScrollView>
@@ -28,6 +28,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.TextView;
/** /**
* An interstitial to confirm sharing with friends. * An interstitial to confirm sharing with friends.
@@ -59,7 +60,12 @@ public class ConfirmSharingActivity extends Activity {
return null; return null;
} }
View view = getLayoutInflater().inflate(R.layout.confirm_sharing, null); View view = getLayoutInflater().inflate(R.layout.confirm_sharing, null);
checkBox = (CheckBox) view.findViewById(R.id.confirm_sharing);
TextView textView = (TextView) view.findViewById(R.id.confirm_sharing_text_view);
textView.setText(getString(
R.string.share_track_confirm_message, getString(R.string.maps_public_unlisted_url)));
checkBox = (CheckBox) view.findViewById(R.id.confirm_sharing_check_box);
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int button) { public void onClick(DialogInterface dialog, int button) {
@@ -74,10 +80,9 @@ public class ConfirmSharingActivity extends Activity {
finish(); finish();
} }
}; };
String message = getString(
R.string.share_track_confirm_message, getString(R.string.maps_public_unlisted_url));
Dialog dialog = DialogUtils.createConfirmationDialog( Dialog dialog = DialogUtils.createConfirmationDialog(
this, message, view, okListener, cancelListener); this, -1, view, okListener, cancelListener);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialogInterface) { public void onCancel(DialogInterface dialogInterface) {
@@ -43,31 +43,34 @@ public class DialogUtils {
*/ */
public static Dialog createConfirmationDialog( public static Dialog createConfirmationDialog(
Context context, int messageId, DialogInterface.OnClickListener okListener) { Context context, int messageId, DialogInterface.OnClickListener okListener) {
return createConfirmationDialog(context, context.getString(messageId), null, okListener, null); return createConfirmationDialog(context, messageId, null, okListener, null);
} }
/** /**
* Creates a confirmation dialog. * Creates a confirmation dialog.
* *
* @param context the context * @param context the context
* @param message the message * @param messageId the messageId
* @param view the view * @param view the view
* @param okListener the listener when OK is clicked * @param okListener the listener when OK is clicked
* @param cancelListener the listener when cancel is clicked * @param cancelListener the listener when cancel is clicked
*/ */
public static Dialog createConfirmationDialog( public static Dialog createConfirmationDialog(
Context context, String message, View view, DialogInterface.OnClickListener okListener, Context context, int messageId, View view, DialogInterface.OnClickListener okListener,
DialogInterface.OnClickListener cancelListener) { DialogInterface.OnClickListener cancelListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context) AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setCancelable(true) .setCancelable(true)
.setIcon(android.R.drawable.ic_dialog_alert) .setIcon(android.R.drawable.ic_dialog_alert)
.setMessage(message)
.setNegativeButton(android.R.string.cancel, cancelListener) .setNegativeButton(android.R.string.cancel, cancelListener)
.setPositiveButton(android.R.string.ok, okListener) .setPositiveButton(android.R.string.ok, okListener)
.setTitle(R.string.generic_confirm_title); .setTitle(R.string.generic_confirm_title);
if (messageId != -1) {
builder.setMessage(messageId);
}
if (view != null) { if (view != null) {
builder.setView(view); builder.setView(view);
} }
return builder.create(); return builder.create();
} }