Commit 79136c8b by onuma

#47941 HW連携 @FormからBluetoothのソースを移植

parent bb6c99f5
......@@ -1514,4 +1514,7 @@
<string name="msg_agree_to_terms_of_use">利用規約に同意する</string>
<string name="clickable_detail_button">(詳細)</string>
<string name="err_gert_term_of_use_text">利用規約の取得に失敗しました。ネットワークの接続状態を確認してください。</string>
<!-- アルコールチェッカー -->
<string name="alc_setting">アルコールチェッカーHW設定</string>
<string name="bluetooth_is_not_supported">Bluetooth機能が利用できない端末です。</string>
</resources>
......@@ -1519,4 +1519,7 @@
<string name="msg_agree_to_terms_of_use">이용약관에 동의함</string>
<string name="clickable_detail_button">(상세)</string>
<string name="err_gert_term_of_use_text">이용약관을 얻지 못했습니다. 네트워크 연결 상태를 확인해주세요.</string>
<!-- アルコールチェッカー -->
<string name="alc_setting">알코올 검사기 HW 설정</string>
<string name="bluetooth_is_not_supported">블루투스는 지원되지 않습니다.</string>
</resources>
\ No newline at end of file
......@@ -1515,4 +1515,7 @@
<string name="msg_agree_to_terms_of_use">I agree to the terms of use</string>
<string name="clickable_detail_button">(detail)</string>
<string name="err_gert_term_of_use_text">Failed to get the terms of use. Check the network connection status.</string>
<!-- アルコールチェッカー -->
<string name="alc_setting">alc checker setting</string>
<string name="bluetooth_is_not_supported">Bluetooth is not supported.</string>
</resources>
......@@ -73,4 +73,11 @@
android:layout="@layout/custom_preference_screen">
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/alc_setting" android:key="@string/alc_setting" android:layout="@layout/custom_preference_category">
<PreferenceScreen
android:key="pairingBluetooth"
android:title="@string/alc_setting"
android:layout="@layout/custom_preference_screen">
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
......@@ -87,6 +87,9 @@ public class ABookSettingFragment extends PreferenceFragment {
private static final String ABOOK_CHECK_MANUAL = "abookCheckManual";
private static final String PRIVACY_POLICY = "privacyPolicy";
// ペアリング情報
private static final String PAIRING_BLUETOOTH = "pairingBluetooth";
protected Handler handler = new Handler();
protected AlertDialog alertDialog = null;
private SharedPreferences pref;
......@@ -240,6 +243,15 @@ public class ABookSettingFragment extends PreferenceFragment {
return true;
}
});
// // ペアリング情報
// Preference pairingBluetooth = findPreference(PAIRING_BLUETOOTH);
// pairingBluetooth.setOnPreferenceClickListener(new OnPreferenceClickListener() {
// @Override
// public boolean onPreferenceClick(Preference preference) {
// return false;
// }
// });
// ライセンス情報
Preference licenseInfo = findPreference(LICENSE_INFO);
......@@ -285,28 +297,10 @@ public class ABookSettingFragment extends PreferenceFragment {
appInfo.removePreference(checkAppUpdate);
}
// 不要?
Preference abookCheckManual = findPreference(ABOOK_CHECK_MANUAL);
appInfo.removePreference(abookCheckManual);
// // リソースパターンの適用
// abookCheckManual.setTitle(PatternStringUtil.patternToString(getActivity().getApplicationContext(),
// R.string.operation_manual,
// getUserPref(getActivity().getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
// abookCheckManual.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// @Override
// public boolean onPreferenceClick(Preference preference) {
// try {
// Intent intent = new Intent();
// intent.putExtra(ABookKeys.CONTENT_ID, 0L);
// intent.putExtra("FILEPATH", ABVEnvironment.getInstance().getContentCacheDirectoryPath(0L));
// intent.putExtra("page", 0);
// intent.setClass(getActivity(), GuideViewActivity.class);
// startActivity(intent);
// } catch (Exception e) {
// Logger.e(TAG, e);
// }
// return true;
// }
// });
}
private void showLicenseDialog() {
......
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.launcher.android.R;
public class BleListAdapter {
public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleListRowData> {
private static final String TAG = "BleListAdapter";
protected jp.agentec.abook.abv.ui.home.adapter.BleListAdapter.BleListAdapterListener listener;
public interface BleListAdapterListener {
// 登録されたデバイス情報削除(bluetooth情報を引数としてセット)
void onDeleteConnectInfo(BleListRowData rowData);
}
public BleListAdapter(Context context, List<SectionHeaderData> sectionList,
List<List<BleListRowData>> rowList, BleListAdapterListener listener) {
super(context, sectionList, rowList);
this.listener = listener;
}
@Override
public View viewForHeaderInSection(View convertView, int section) {
ListHeaderViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.ble_section_list_header, null);
holder = new ListHeaderViewHolder();
holder.titleTxt = (TextView) convertView.findViewById(R.id.titleTxt);
holder.subtitleTxt = (TextView) convertView.findViewById(R.id.subTitleTxt);
convertView.setTag(holder);
} else {
holder = (ListHeaderViewHolder) convertView.getTag();
}
SectionHeaderData headerData = sectionList.get(section);
holder.titleTxt.setText(headerData.title);
holder.subtitleTxt.setText(headerData.subTitle);
return convertView;
}
@Override
public View cellForRowAtIndexPath(View convertView, IndexPath indexPath) {
ListRowViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.ble_section_list_row, null);
holder = new ListRowViewHolder();
// bluetoothのデバイス名
holder.bl_title = (TextView) convertView.findViewById(R.id.bl_title);
// 該当通信機器の名(中心温度計・放射温度計)
holder.sub_title = (TextView) convertView.findViewById(R.id.sub_title);
// 削除ボタン
holder.bl_deleteBtn = (Button) convertView.findViewById(R.id.bl_deleteBtn);
convertView.setTag(holder);
} else {
holder = (ListRowViewHolder) convertView.getTag();
}
final BleListRowData rowData = rowList.get(indexPath.section).get(indexPath.row);
holder.bl_title.setText(rowData.title);
if (rowData.isSaved) {
// 既に保存されてる場合、削除ボタン表示・機器名は非表示
holder.sub_title.setVisibility(View.GONE);
holder.bl_deleteBtn.setVisibility(View.VISIBLE);
holder.bl_deleteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onDeleteConnectInfo(rowData);
}
});
} else {
// スキャンされたbluetooth機器表示時に削除ボタンと接続ステータス非表示
holder.bl_deleteBtn.setVisibility(View.GONE);
holder.sub_title.setVisibility(View.VISIBLE);
holder.sub_title.setText(rowData.subTitle);
}
return convertView;
}
static class ListHeaderViewHolder {
TextView titleTxt;
TextView subtitleTxt;
}
static class ListRowViewHolder {
TextView bl_title;
TextView sub_title;
Button bl_deleteBtn;
}
public void setItem(List<SectionHeaderData> sectionList, List<List<BleListRowData>> rowList) {
settingSectionRowData(sectionList, rowList);
notifyDataSetChanged();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment