/*
HvcLocationAlertDialogActivity.java
Copyright (c) 2017 NTT DOCOMO,INC.
Released under the MIT license
http://opensource.org/licenses/mit-license.php
*/
package org.deviceconnect.android.deviceplugin.hvc.profile;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import org.deviceconnect.android.deviceplugin.hvc.R;
/**
* HVC Location Alert Dialog Activity.
*
* @author NTT DOCOMO, INC.
*/
public class HvcLocationAlertDialog extends Activity {
private Activity mActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.hvc_location_alert_dialog);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage(R.string.setting_dialog_disable_location)
.setCancelable(false)
// 位置情報設定画面起動用ボタンとイベント定義
.setPositiveButton(R.string.location_settings_title,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent callLocationSettingIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(callLocationSettingIntent);
mActivity.finish();
}
});
// キャンセルボタン処理
alertDialogBuilder.setNegativeButton(R.string.setting_location_dialog_cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
mActivity.finish();
}
});
AlertDialog alert = alertDialogBuilder.create();
// 設定画面移動問い合わせダイアログ表示
alert.show();
}
}