Commit fb21a680 by onuma

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

parent 5b195b4a
......@@ -47,6 +47,7 @@ import jp.agentec.abook.abv.bl.data.tables.TEnquete;
import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TOperation;
import jp.agentec.abook.abv.bl.data.tables.TPushMessage;
import jp.agentec.abook.abv.bl.data.tables.TSppDevice;
import jp.agentec.abook.abv.bl.data.tables.TTask;
import jp.agentec.abook.abv.bl.data.tables.TTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportApproval;
......@@ -111,6 +112,9 @@ public class ABVDataOpenHelper {
iTableScripts.add(new ROperationGroupMasterOperation());
iTableScripts.add(new TTaskReportApproval());
// SPP通信端末管理テーブルをスクリプトに追加
iTableScripts.add(new TSppDevice());
return iTableScripts;
}
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.SppDeviceDto;
/**
* SPP通信の端末情報を管理する
*/
public class SppDeviceDao extends AbstractDao {
private static final String TAG = "SppDeviceDao";
@Override
protected SppDeviceDto convert(Cursor cursor) {
SppDeviceDto dto = new SppDeviceDto();
int column = cursor.getColumnIndex("spp_device_id");
if (column != -1) {
dto.sppDeviceId = cursor.getInt(column);
}
column = cursor.getColumnIndex("spp_device_name");
if (column != -1) {
dto.sppDeviceName = cursor.getString(column);
}
column = cursor.getColumnIndex("data_start_index");
if (column != -1) {
dto.dataStartIndex = cursor.getInt(column);
}
column = cursor.getColumnIndex("data_end_index");
if (column != -1) {
dto.dataEndIndex = cursor.getInt(column);
}
column = cursor.getColumnIndex("pairing_device_name");
if (column != -1) {
dto.pairingDeviceName = cursor.getString(column);
}
column = cursor.getColumnIndex("pairing_device_address");
if (column != -1) {
dto.pairingDeviceAddress = cursor.getString(column);
}
return dto;
}
/**
* 登録処理
* @param dto
*/
public void insert(SppDeviceDto dto) {
insert("insert into t_spp_device "
+ "(spp_device_id, "
+ "spp_device_name, "
+ "data_start_index, "
+ "data_end_index, "
+ "pairing_device_name, "
+ "pairing_device_address) "
+ "values "
+ "(?,?,?,?,?,?)",
dto.getInsertValues());
}
/**
* SPP通信端末を全て取得
* @return
*/
public List<SppDeviceDto> getAllSppDevice() {
return rawQueryGetDtoList("SELECT * FROM t_spp_device ORDER BY spp_device_id DESC", null, SppDeviceDto.class);
}
/**
* SPP通信端末をIDで検索
* @param sppDeviceId
* @return
*/
public SppDeviceDto getSppDeviceById(Integer sppDeviceId) {
return rawQueryGetDto("SELECT * FROM t_spp_device WHERE spp_device_id = ?", new String[] { "" + sppDeviceId }, SppDeviceDto.class);
}
/**
* SPP通信端末IDを全て取得
* @return
*/
public List<Integer> getSppDeviceIdList() {
return rawQueryGetIntegerList("SELECT spp_device_id FROM t_spp_device ORDER BY spp_device_id DESC", null);
}
/**
* SPP通信端末でペアリング済みデータ取得
* @return
*/
public List<SppDeviceDto> getPairingDeviceList() {
return rawQueryGetDtoList("SELECT * FROM t_spp_device WHERE pairing_device_name is NOT NULL AND pairing_device_address is NOT NULL order by spp_device_id DESC", null, SppDeviceDto.class);
}
/**
* SPP通信端末の更新処理
* @param dto
* @return
*/
public boolean updateSppDevice(SppDeviceDto dto) {
long count = update("UPDATE t_spp_device SET spp_device_name=?, data_start_index=?, data_end_index=?, pairing_device_name=?, pairing_device_address=? WHERE spp_device_id=?", dto.getUpdateValues());
return count > 0;
}
/**
* ペアリングの端末アドレスがユニーク前提
* ペアリング情報をアドレスで取得
* @param deviceAddress
* @return
*/
public SppDeviceDto getPairingDeviceByAddress(String deviceAddress) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT DISTINCT * ");
sql.append(" FROM t_spp_device");
sql.append(" WHERE pairing_device_address = ?");
return rawQueryGetDto(sql.toString(), new String[] { deviceAddress }, SppDeviceDto.class);
}
/**
* ペアリング情報をクリアする
* @param deviceAddress
*/
public void clearPairingDevice(String deviceAddress) {
SppDeviceDto sppDeviceDto = getPairingDeviceByAddress(deviceAddress);
// ペアリング情報を空にして更新
sppDeviceDto.pairingDeviceName = null;
sppDeviceDto.pairingDeviceAddress = null;
updateSppDevice(sppDeviceDto);
}
/**
* SPP端末IDでDB情報を削除
* @param sppDeviceId
*/
public void deleteById(Integer sppDeviceId) {
delete("t_spp_device", "spp_device_id=?", new String[] { "" + sppDeviceId });
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* CMS側から取得したSPP通信端末を管理するテーブル
*/
public class TSppDevice extends SQLiteTableScript {
public TSppDevice() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_spp_device ( ");
sql.append(" spp_device_id INTEGER NOT NULL");
sql.append(" , spp_device_name VARCHAR(256) NOT NULL");
sql.append(" , data_start_index INTEGER NOT NULL ");
sql.append(" , data_end_index INTEGER NOT NULL ");
sql.append(" , pairing_device_name VARCHAR(256) ");
sql.append(" , pairing_device_address VARCHAR(256) ");
sql.append(" , PRIMARY KEY (spp_device_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
/**
* マイグレーション処理
* @param oldVersion
* @param newVersion
* @return
*/
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_4_0) {
ddl.addAll(getCreateScript(newVersion));
}
return ddl;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
package jp.agentec.abook.abv.bl.dto;
/**
* SPP通信の端末情報DTO
*/
public class SppDeviceDto extends AbstractDto {
// SPP通信端末ID
public Integer sppDeviceId;
// SPP通信端末名
public String sppDeviceName;
// 取得したいデータの開始時点
public Integer dataStartIndex;
// 取得したいデータの終了時点
public Integer dataEndIndex;
// ペアリング端末名
public String pairingDeviceName;
// ペアリング端末アドレス
public String pairingDeviceAddress;
@Override
public Object[] getInsertValues() {
return new Object[] { sppDeviceId, sppDeviceName, dataStartIndex, dataEndIndex, pairingDeviceName, pairingDeviceAddress };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { sppDeviceName, dataStartIndex, dataEndIndex, pairingDeviceName, pairingDeviceAddress, sppDeviceId };
}
@Override
public String[] getKeyValues() {
return new String[] { "" + sppDeviceId };
}
}
......@@ -34,6 +34,8 @@
<!-- QRCode -->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<!-- BLE -->
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
......@@ -256,7 +258,14 @@
android:taskAffinity=".ChatWebViewActivity"
android:resizeableActivity="true"
android:excludeFromRecents="true"
android:supportsPictureInPicture="true"/>
android:supportsPictureInPicture="true" >
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BlePairingSettingActivity"
android:theme="@style/AppTheme"
android:configChanges="keyboardHidden|orientation|screenSize" >
</activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.SppBluetoothPairingSettingActivity"
android:theme="@style/AppTheme">
</activity>
</application>
</manifest>
\ No newline at end of file
......@@ -1515,6 +1515,15 @@
<string name="clickable_detail_button">(詳細)</string>
<string name="err_gert_term_of_use_text">利用規約の取得に失敗しました。ネットワークの接続状態を確認してください。</string>
<!-- アルコールチェッカー -->
<string name="alc_setting">アルコールチェッカーHW設定</string>
<string name="set_title_pairing">ペアリング</string>
<string name="pairing_search_scan">スキャン</string>
<string name="pairing_search_scaning">スキャン中..</string>
<string name="pairing_search_stop">中止</string>
<string name="chino_machine">CHINO機器</string>
<string name="spp_machine">シリアル通信機器</string>
<string name="alc_setting">alc checker setting</string>
<string name="bluetooth_is_not_supported">Bluetooth機能が利用できない端末です。</string>
<string name="msg_scan_bluetooth_no_allow">BlueToothの利用を「許可」しないと、%1$sのスキャンができません。</string>
<string name="msg_location_device_no_allow">端末の設定から位置情報をONにしてください。</string>
<string name="center_thermometer">中心温度計</string>
</resources>
......@@ -1520,6 +1520,4 @@
<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
......@@ -1516,6 +1516,20 @@
<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="set_title_pairing">Pairing</string>
<string name="center_thermometer">中心温度計</string>
<string name="pairing_search_scan">Scan</string>
<string name="pairing_search_scaning">Scaning...</string>
<string name="pairing_search_stop">Stop</string>
<string name="chino_machine">CHINO機器</string>
<string name="spp_machine">シリアル通信機器</string>
<string name="radiation_thermometer">放射温度計</string>
<string name="alc_setting">alc checker setting</string>
<string name="bluetooth_is_not_supported">Bluetooth is not supported.</string>
<string name="msg_scan_bluetooth_no_allow">If Bluetooth is not allow, %1$s scan is disabled.</string>
<string name="msg_location_device_no_allow">Please set the location information to ON in the device setting.</string>
<string name="pairing_save_machine">Saved %s</string>
<string name="pairing_other_machine">Other %s</string>
<string name="pairing_other_machine_searching">Other %s(Searching...)</string>
<string name="select_spp_device_title">シリアル通信機器選択</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@android:color/darker_gray"
android:gravity="center_vertical"
android:minHeight="30dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="@+id/titleTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:text="Main Title" />
<TextView
android:id="@+id/subTitleTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/titleTxt"
android:gravity="right"
android:text="SubTitle" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:orientation="horizontal"
android:descendantFocusability="blocksDescendants">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="50dp"
android:orientation="vertical"
android:gravity="left|center_vertical"
android:layout_weight="1">
<TextView
android:id="@+id/bl_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:maxWidth="250dp"
android:padding="3dp"
android:text="Main Titledfsafsafsdfsdfsdfsd"
android:gravity="left|center_vertical"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:id="@+id/sub_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:text="SubTitle"
android:visibility="visible" />
<Button
android:id="@+id/bl_deleteBtn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|center_vertical"
android:layout_marginTop="2dp"
android:text="@string/delete"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/operation_bg"
android:minWidth="500dp"
android:minHeight="300dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/select_spp_device_title"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<Button
android:id="@+id/closeBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:contentDescription="@string/cont_desc" />
</RelativeLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_spp_device_select"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/spp_device_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="20dp"
android:padding="10dp"
android:text="@string/dummy_str"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_select" />
<ImageView
android:id="@+id/nextLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:src="@drawable/ic_navigation_next_item"
android:visibility="visible" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="jp.agentec.abook.abv.ui.home.activity.BlePairingSettingActivity">
<!--android:background="@drawable/setting_bg"-->
<!--android:layout_height="0dp"-->
<!--android:background="@drawable/setting_bg"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="@+id/device_toolbar_title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="@color/edt_text"
android:textSize="20sp" />
<ImageButton
android:id="@+id/close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:onClick="onClickCloseView" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true">
<Button
android:id="@+id/btn_reload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="@android:color/transparent"
android:text="Scan"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:orientation="vertical">
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" />
<ListView
android:id="@+id/devicelist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -73,10 +73,15 @@
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">
<PreferenceCategory android:title="@string/set_title_pairing" android:key="set_pairing" android:layout="@layout/custom_preference_category">
<PreferenceScreen
android:key="pairingBluetooth"
android:title="@string/alc_setting"
android:key="setChinoPairing"
android:title="@string/chino_machine"
android:layout="@layout/custom_preference_screen">
</PreferenceScreen>
<PreferenceScreen
android:key="setSppPairing"
android:title="@string/spp_machine"
android:layout="@layout/custom_preference_screen">
</PreferenceScreen>
</PreferenceCategory>
......
......@@ -87,8 +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";
// 機器連携(ペアリング)
private static final String SET_CHINO_PAIRING = "setChinoPairing"; // CHINO機器
private static final String SET_SPP_PAIRING = "setSppPairing"; // SPP通信機器
protected Handler handler = new Handler();
protected AlertDialog alertDialog = null;
......@@ -108,6 +109,8 @@ public class ABookSettingFragment extends PreferenceFragment {
setLogInfoSetting();
// アプリ情報
setAppInfoSetting();
// ペアリング設定
setPairingSetting();
}
@Override
......@@ -450,8 +453,6 @@ public class ABookSettingFragment extends PreferenceFragment {
TextView copyrightText = (TextView) mainView.findViewById(R.id.textCopyRight);
copyrightText.setText(copyright);
// ABookAlertDialog alertDialog = AlertDialogUtil.scrollableAlertDialog(this, R.string.app_name, message);
//String title = String.format(r.getString(R.string.about_app), r.getString(R.string.app_name));
String title = r.getString(R.string.about_app);
ABookAlertDialog aBookAlertDialog = AlertDialogUtil.createAlertDialog(getActivity(), title);
aBookAlertDialog.setIcon(R.drawable.icon);// 固定の専用アイコンにする
......@@ -477,4 +478,44 @@ public class ABookSettingFragment extends PreferenceFragment {
Logger.d(TAG, "saveLeaveAppTime()");
PreferenceUtil.putUserPref(getActivity(), UserPrefKey.LEAVE_APP, System.currentTimeMillis());
}
// 機器連携のペアリング設定
private void setPairingSetting() {
// CHINO機器
PreferenceGroup chinoDevicePairing = (PreferenceGroup) findPreference(SET_CHINO_PAIRING);
chinoDevicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
Logger.i(TAG,"" + getActivity().getLocalClassName());
// ペアリング設定画面(BLE通信)
Intent intent = new Intent();
intent.setClass(getActivity(), BlePairingSettingActivity.class);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
// SPP通信機器
PreferenceGroup sppDevicePairing = (PreferenceGroup) findPreference(SET_SPP_PAIRING);
sppDevicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
// ペアリング設定画面(SPP通信)
Intent intent = new Intent();
intent.setClass(getActivity(), SppBluetoothPairingSettingActivity.class);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
}
}
......@@ -32,10 +32,10 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
public View viewForHeaderInSection(View convertView, int section) {
ListHeaderViewHolder holder = null;
if (convertView == null) {
//convertView = inflater.inflate(R.layout.ble_section_list_header, 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);
holder.titleTxt = (TextView) convertView.findViewById(R.id.titleTxt);
holder.subtitleTxt = (TextView) convertView.findViewById(R.id.subTitleTxt);
convertView.setTag(holder);
} else {
holder = (ListHeaderViewHolder) convertView.getTag();
......@@ -50,14 +50,14 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
public View cellForRowAtIndexPath(View convertView, IndexPath indexPath) {
ListRowViewHolder holder = null;
if (convertView == null) {
//convertView = inflater.inflate(R.layout.ble_section_list_row, 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.bl_title = (TextView) convertView.findViewById(R.id.bl_title);
// 該当通信機器の名(中心温度計・放射温度計)
//holder.sub_title = (TextView) convertView.findViewById(R.id.sub_title);
holder.sub_title = (TextView) convertView.findViewById(R.id.sub_title);
// 削除ボタン
//holder.bl_deleteBtn = (Button) convertView.findViewById(R.id.bl_deleteBtn);
holder.bl_deleteBtn = (Button) convertView.findViewById(R.id.bl_deleteBtn);
convertView.setTag(holder);
} else {
holder = (ListRowViewHolder) convertView.getTag();
......
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.FixPushMessageDto;
import jp.agentec.abook.abv.bl.dto.SppDeviceDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* SPP端末選択アダプタ用
*/
public class SelectSppDeviceAdapter extends ArrayAdapter<SppDeviceDto> {
private LayoutInflater mInflater;
private List<SppDeviceDto> mSppDeviceDtoList;
public SelectSppDeviceAdapter(Context context, List<SppDeviceDto> sppDeviceDtoList) {
super(context, 0, sppDeviceDtoList);
mSppDeviceDtoList = sppDeviceDtoList;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_spp_device_select, parent, false);
holder = new ViewHolder();
holder.tvSppDeviceName = (TextView) convertView.findViewById(R.id.spp_device_name);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
final SppDeviceDto sppDeviceDto = getItem(position);
if (sppDeviceDto != null) {
holder.tvSppDeviceName.setText(sppDeviceDto.sppDeviceName);
}
return convertView;
}
private static class ViewHolder {
TextView tvSppDeviceName;
}
}
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