forked from upstream-mirrors/OpenTracks
Use one scrollbar for confirm sharing dialog.
This commit is contained in:
@@ -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
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" >
|
||||
<CheckBox
|
||||
android:id="@+id/confirm_sharing"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/ScrollView" >
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_width="fill_parent"
|
||||
android:text="@string/generic_do_not_show_again"
|
||||
style="@style/TextMedium" />
|
||||
</LinearLayout>
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="12dp"
|
||||
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>
|
||||
+9
-4
@@ -28,6 +28,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* An interstitial to confirm sharing with friends.
|
||||
@@ -59,7 +60,12 @@ public class ConfirmSharingActivity extends Activity {
|
||||
return 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() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int button) {
|
||||
@@ -74,10 +80,9 @@ public class ConfirmSharingActivity extends Activity {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
String message = getString(
|
||||
R.string.share_track_confirm_message, getString(R.string.maps_public_unlisted_url));
|
||||
|
||||
Dialog dialog = DialogUtils.createConfirmationDialog(
|
||||
this, message, view, okListener, cancelListener);
|
||||
this, -1, view, okListener, cancelListener);
|
||||
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialogInterface) {
|
||||
|
||||
@@ -43,31 +43,34 @@ public class DialogUtils {
|
||||
*/
|
||||
public static Dialog createConfirmationDialog(
|
||||
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.
|
||||
*
|
||||
* @param context the context
|
||||
* @param message the message
|
||||
* @param messageId the messageId
|
||||
* @param view the view
|
||||
* @param okListener the listener when OK is clicked
|
||||
* @param cancelListener the listener when cancel is clicked
|
||||
*/
|
||||
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) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||
.setCancelable(true)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setMessage(message)
|
||||
.setNegativeButton(android.R.string.cancel, cancelListener)
|
||||
.setPositiveButton(android.R.string.ok, okListener)
|
||||
.setTitle(R.string.generic_confirm_title);
|
||||
if (messageId != -1) {
|
||||
builder.setMessage(messageId);
|
||||
}
|
||||
if (view != null) {
|
||||
builder.setView(view);
|
||||
}
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user