completed compatibility changes for new server
This commit is contained in:
3
Android/.gitignore
vendored
3
Android/.gitignore
vendored
@@ -1,8 +1,7 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/workspace.xml
|
.idea/
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
|
|||||||
22
Android/.idea/compiler.xml
generated
22
Android/.idea/compiler.xml
generated
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<resourceExtensions />
|
|
||||||
<wildcardResourcePatterns>
|
|
||||||
<entry name="!?*.java" />
|
|
||||||
<entry name="!?*.form" />
|
|
||||||
<entry name="!?*.class" />
|
|
||||||
<entry name="!?*.groovy" />
|
|
||||||
<entry name="!?*.scala" />
|
|
||||||
<entry name="!?*.flex" />
|
|
||||||
<entry name="!?*.kt" />
|
|
||||||
<entry name="!?*.clj" />
|
|
||||||
<entry name="!?*.aj" />
|
|
||||||
</wildcardResourcePatterns>
|
|
||||||
<annotationProcessing>
|
|
||||||
<profile default="true" name="Default" enabled="false">
|
|
||||||
<processorPath useClasspath="true" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
3
Android/.idea/copyright/profiles_settings.xml
generated
3
Android/.idea/copyright/profiles_settings.xml
generated
@@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
||||||
19
Android/.idea/gradle.xml
generated
19
Android/.idea/gradle.xml
generated
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
<option value="$PROJECT_DIR$/app" />
|
|
||||||
<option value="$PROJECT_DIR$/decodesdk" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
9
Android/.idea/misc.xml
generated
9
Android/.idea/misc.xml
generated
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
Android/.idea/modules.xml
generated
10
Android/.idea/modules.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/Android.iml" filepath="$PROJECT_DIR$/Android.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/decodesdk/decodesdk.iml" filepath="$PROJECT_DIR$/decodesdk/decodesdk.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
12
Android/.idea/runConfigurations.xml
generated
12
Android/.idea/runConfigurations.xml
generated
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RunConfigurationProducerService">
|
|
||||||
<option name="ignoredProducers">
|
|
||||||
<set>
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -30,19 +30,16 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
dexOptions {
|
|
||||||
incremental true
|
|
||||||
}
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile files('libs/irext-web-api.jar')
|
compile files('libs/irext-web-api.jar')
|
||||||
compile project(path: ':decodesdk')
|
|
||||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
|
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
|
||||||
compile 'com.android.support:design:25.3.1'
|
compile 'com.android.support:design:25.3.1'
|
||||||
compile 'com.android.support:support-v4:25.3.1'
|
compile 'com.android.support:support-v4:25.3.1'
|
||||||
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
|
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
|
||||||
|
compile project(':decodesdk')
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -21,7 +21,7 @@ public class IRApplication extends com.activeandroid.app.Application {
|
|||||||
|
|
||||||
private static final String TAG = IRApplication.class.getSimpleName();
|
private static final String TAG = IRApplication.class.getSimpleName();
|
||||||
|
|
||||||
private static final String ADDRESS = "http://192.168.1.100:8080";
|
private static final String ADDRESS = "http://192.168.137.128:8080";
|
||||||
private static final String APP_NAME = "/irext";
|
private static final String APP_NAME = "/irext";
|
||||||
|
|
||||||
public WebAPIs mWeAPIs = WebAPIs.getInstance(ADDRESS, APP_NAME);
|
public WebAPIs mWeAPIs = WebAPIs.getInstance(ADDRESS, APP_NAME);
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ import java.util.List;
|
|||||||
public class RemoteControl extends Model {
|
public class RemoteControl extends Model {
|
||||||
|
|
||||||
@Column(name = "CategoryID")
|
@Column(name = "CategoryID")
|
||||||
private int categoryID;
|
private int categoryId;
|
||||||
|
|
||||||
@Column(name = "CategoryName")
|
@Column(name = "CategoryName")
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@Column(name = "BrandID")
|
@Column(name = "BrandID")
|
||||||
private int brandID;
|
private int brandId;
|
||||||
|
|
||||||
@Column(name = "BrandName")
|
@Column(name = "BrandName")
|
||||||
private String brandName;
|
private String brandName;
|
||||||
@@ -40,7 +40,7 @@ public class RemoteControl extends Model {
|
|||||||
private String cityName;
|
private String cityName;
|
||||||
|
|
||||||
@Column(name = "OperatorID")
|
@Column(name = "OperatorID")
|
||||||
private String operatorID;
|
private String operatorId;
|
||||||
|
|
||||||
@Column(name = "OperatorName")
|
@Column(name = "OperatorName")
|
||||||
private String operatorName;
|
private String operatorName;
|
||||||
@@ -57,12 +57,12 @@ public class RemoteControl extends Model {
|
|||||||
@Column(name = "SubCategory")
|
@Column(name = "SubCategory")
|
||||||
private int subCategory;
|
private int subCategory;
|
||||||
|
|
||||||
public int getCategoryID() {
|
public int getCategoryId() {
|
||||||
return categoryID;
|
return categoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategoryID(int categoryID) {
|
public void setCategoryId(int categoryId) {
|
||||||
this.categoryID = categoryID;
|
this.categoryId = categoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategoryName() {
|
public String getCategoryName() {
|
||||||
@@ -73,12 +73,12 @@ public class RemoteControl extends Model {
|
|||||||
this.categoryName = categoryName;
|
this.categoryName = categoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBrandID() {
|
public int getBrandId() {
|
||||||
return brandID;
|
return brandId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrandID(int brandID) {
|
public void setBrandId(int brandId) {
|
||||||
this.brandID = brandID;
|
this.brandId = brandId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBrandName() {
|
public String getBrandName() {
|
||||||
@@ -105,12 +105,12 @@ public class RemoteControl extends Model {
|
|||||||
this.cityName = cityName;
|
this.cityName = cityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOperatorID() {
|
public String getOperatorId() {
|
||||||
return operatorID;
|
return operatorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOperatorID(String operatorID) {
|
public void setOperatorId(String operatorId) {
|
||||||
this.operatorID = operatorID;
|
this.operatorId = operatorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOperatorName() {
|
public String getOperatorName() {
|
||||||
@@ -157,16 +157,16 @@ public class RemoteControl extends Model {
|
|||||||
return super.getId();
|
return super.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RemoteControl(int categoryID, String categoryName, int brandID, String brandName,
|
public RemoteControl(int categoryId, String categoryName, int brandId, String brandName,
|
||||||
String cityCode, String cityName, String operatorID, String operatorName,
|
String cityCode, String cityName, String operatorId, String operatorName,
|
||||||
String remote, String protocol, String remoteMap, int subCategory) {
|
String remote, String protocol, String remoteMap, int subCategory) {
|
||||||
this.categoryID = categoryID;
|
this.categoryId = categoryId;
|
||||||
this.categoryName = categoryName;
|
this.categoryName = categoryName;
|
||||||
this.brandID = brandID;
|
this.brandId = brandId;
|
||||||
this.brandName = brandName;
|
this.brandName = brandName;
|
||||||
this.cityCode = cityCode;
|
this.cityCode = cityCode;
|
||||||
this.cityName = cityName;
|
this.cityName = cityName;
|
||||||
this.operatorID = operatorID;
|
this.operatorId = operatorId;
|
||||||
this.operatorName = operatorName;
|
this.operatorName = operatorName;
|
||||||
this.remote = remote;
|
this.remote = remote;
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
package net.irext.ircontrol.ui.activity;
|
package net.irext.ircontrol.ui.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import net.irext.ircontrol.R;
|
import net.irext.ircontrol.R;
|
||||||
import net.irext.ircontrol.ui.fragment.ControlFragment;
|
import net.irext.ircontrol.ui.fragment.ControlFragment;
|
||||||
import net.irext.ircontrol.utils.MessageUtil;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filename: ControlActivity.java
|
* Filename: ControlActivity.java
|
||||||
@@ -26,12 +20,11 @@ import java.lang.ref.WeakReference;
|
|||||||
*/
|
*/
|
||||||
public class ControlActivity extends AppCompatActivity {
|
public class ControlActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final String TAG = ControlActivity.class.getSimpleName();
|
private static final String TAG = ControlActivity.class.getSimpleName();
|
||||||
|
|
||||||
public static final String KEY_REMOTE_ID = "KEY_REMOTE_ID";
|
public static final String KEY_REMOTE_ID = "KEY_REMOTE_ID";
|
||||||
|
|
||||||
private MsgHandler mMsgHandler;
|
|
||||||
|
|
||||||
private ControlFragment mFragment;
|
private ControlFragment mFragment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,8 +32,6 @@ public class ControlActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_control);
|
setContentView(R.layout.activity_control);
|
||||||
|
|
||||||
mMsgHandler = new MsgHandler(this);
|
|
||||||
|
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||||
|
|
||||||
mFragment = new ControlFragment();
|
mFragment = new ControlFragment();
|
||||||
@@ -68,26 +59,4 @@ public class ControlActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MsgHandler extends Handler {
|
|
||||||
|
|
||||||
WeakReference<ControlActivity> mControlActivity;
|
|
||||||
|
|
||||||
MsgHandler(ControlActivity activity) {
|
|
||||||
mControlActivity = new WeakReference<>(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
int cmd = msg.getData().getInt(MessageUtil.KEY_CMD);
|
|
||||||
Log.d(TAG, "handle message " + Integer.toString(cmd));
|
|
||||||
|
|
||||||
ControlActivity controlActivity = mControlActivity.get();
|
|
||||||
switch (cmd) {
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class OperatorAdapter extends BaseAdapter {
|
|||||||
} else {
|
} else {
|
||||||
holder = (ViewHolder)convertView.getTag();
|
holder = (ViewHolder)convertView.getTag();
|
||||||
}
|
}
|
||||||
holder.textView.setText(mOperators.get(position).getOperator_name());
|
holder.textView.setText(mOperators.get(position).getOperatorName());
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class RemoteControlAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
RemoteControl remoteControl = mRemoteControls.get(position);
|
RemoteControl remoteControl = mRemoteControls.get(position);
|
||||||
String remoteName;
|
String remoteName;
|
||||||
if (Constants.CategoryID.STB.getValue() != remoteControl.getCategoryID()) {
|
if (Constants.CategoryID.STB.getValue() != remoteControl.getCategoryId()) {
|
||||||
remoteName = remoteControl.getCategoryName() + "-" + remoteControl.getBrandName();
|
remoteName = remoteControl.getCategoryName() + "-" + remoteControl.getBrandName();
|
||||||
} else {
|
} else {
|
||||||
remoteName = remoteControl.getCityName() + "-" + remoteControl.getOperatorName();
|
remoteName = remoteControl.getCityName() + "-" + remoteControl.getOperatorName();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import net.irext.ircontrol.ui.activity.CreateActivity;
|
|||||||
import net.irext.ircontrol.ui.adapter.CityAdapter;
|
import net.irext.ircontrol.ui.adapter.CityAdapter;
|
||||||
import net.irext.ircontrol.ui.adapter.OperatorAdapter;
|
import net.irext.ircontrol.ui.adapter.OperatorAdapter;
|
||||||
import net.irext.ircontrol.utils.MessageUtil;
|
import net.irext.ircontrol.utils.MessageUtil;
|
||||||
import net.irext.webapi.WebAPIs;
|
|
||||||
import net.irext.webapi.model.City;
|
import net.irext.webapi.model.City;
|
||||||
import net.irext.webapi.model.StbOperator;
|
import net.irext.webapi.model.StbOperator;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import net.irext.ircontrol.ui.activity.ControlActivity;
|
|||||||
import net.irext.ircontrol.utils.FileUtils;
|
import net.irext.ircontrol.utils.FileUtils;
|
||||||
import net.irext.ircontrol.utils.MessageUtil;
|
import net.irext.ircontrol.utils.MessageUtil;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,42 +129,26 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
private void showRemote() {
|
private void showRemote() {
|
||||||
mCurrentRemoteControl = RemoteControl.getRemoteControl(mRemoteID);
|
mCurrentRemoteControl = RemoteControl.getRemoteControl(mRemoteID);
|
||||||
if (null != mCurrentRemoteControl) {
|
if (null != mCurrentRemoteControl) {
|
||||||
Log.d(TAG, "current remote control = " + mCurrentRemoteControl.getRemoteMap());
|
int category = mCurrentRemoteControl.getCategoryId();
|
||||||
int category = mCurrentRemoteControl.getCategoryID();
|
|
||||||
int ret = 0;
|
|
||||||
String binFileName = FileUtils.BIN_PATH + FileUtils.FILE_NAME_PREFIX +
|
String binFileName = FileUtils.BIN_PATH + FileUtils.FILE_NAME_PREFIX +
|
||||||
mCurrentRemoteControl.getRemoteMap() + FileUtils.FILE_NAME_EXT;
|
mCurrentRemoteControl.getRemoteMap() + FileUtils.FILE_NAME_EXT;
|
||||||
|
|
||||||
if (Constants.CategoryID.AIR_CONDITIONER.getValue() == category) {
|
/* decode SDK - load binary file */
|
||||||
|
// int ret = mIRDecode.openBinary(category, mCurrentRemoteControl.getSubCategory(), binFileName);
|
||||||
/* decode SDK - load AC binary file */
|
// Log.d(TAG, "open binary result = " + ret);
|
||||||
ret = mIRDecode.openACBinary(binFileName);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* decode SDK - load TV binary file */
|
|
||||||
ret = mIRDecode.openTVBinary(binFileName, mCurrentRemoteControl.getSubCategory());
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d(TAG, "open binary result = " + ret);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeIRBinary() {
|
public void closeIRBinary() {
|
||||||
int category = mCurrentRemoteControl.getCategoryID();
|
// mIRDecode.closeBinary();
|
||||||
if (Constants.CategoryID.AIR_CONDITIONER.getValue() == category) {
|
|
||||||
mIRDecode.closeACBinary();
|
|
||||||
} else {
|
|
||||||
mIRDecode.closeTVBinary();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private int[] irControl(int keyCode) {
|
private int[] irControl(int keyCode) {
|
||||||
|
int inputKeyCode;
|
||||||
|
ACStatus acStatus = new ACStatus();
|
||||||
/* decode SDK - decode according to key code */
|
/* decode SDK - decode according to key code */
|
||||||
if (Constants.CategoryID.AIR_CONDITIONER.getValue() == mCurrentRemoteControl.getCategoryID()) {
|
if (Constants.CategoryID.AIR_CONDITIONER.getValue() == mCurrentRemoteControl.getCategoryId()) {
|
||||||
int acFunction;
|
|
||||||
ACStatus acStatus = new ACStatus();
|
|
||||||
acStatus.setAcPower(Constants.ACPower.POWER_OFF.getValue());
|
acStatus.setAcPower(Constants.ACPower.POWER_OFF.getValue());
|
||||||
acStatus.setAcMode(Constants.ACMode.MODE_COOL.getValue());
|
acStatus.setAcMode(Constants.ACMode.MODE_COOL.getValue());
|
||||||
acStatus.setAcTemp(Constants.ACTemperature.TEMP_24.getValue());
|
acStatus.setAcTemp(Constants.ACTemperature.TEMP_24.getValue());
|
||||||
@@ -178,40 +161,46 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
switch(keyCode) {
|
switch(keyCode) {
|
||||||
case KEY_POWER:
|
case KEY_POWER:
|
||||||
// power key --> change power
|
// power key --> change power
|
||||||
acFunction = Constants.ACFunction.FUNCTION_SWITCH_POWER.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_SWITCH_POWER.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
// up key --> change wind speed
|
// up key --> change wind speed
|
||||||
acFunction = Constants.ACFunction.FUNCTION_SWITCH_WIND_SPEED.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_SWITCH_WIND_SPEED.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
// down key --> change wind dir
|
// down key --> change wind dir
|
||||||
acFunction = Constants.ACFunction.FUNCTION_SWITCH_WIND_DIR.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_SWITCH_WIND_DIR.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
// right key --> change mode
|
// right key --> change mode
|
||||||
acFunction = Constants.ACFunction.FUNCTION_CHANGE_MODE.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_CHANGE_MODE.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_OK:
|
case KEY_OK:
|
||||||
// center key --> fix wind dir
|
// center key --> fix wind dir
|
||||||
acFunction = Constants.ACFunction.FUNCTION_SWITCH_SWING.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_SWITCH_SWING.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_PLUS:
|
case KEY_PLUS:
|
||||||
// plus key --> temp up
|
// plus key --> temp up
|
||||||
acFunction = Constants.ACFunction.FUNCTION_TEMPERATURE_UP.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_TEMPERATURE_UP.getValue();
|
||||||
break;
|
break;
|
||||||
case KEY_MINUS:
|
case KEY_MINUS:
|
||||||
// minus key --> temp down
|
// minus key --> temp down
|
||||||
acFunction = Constants.ACFunction.FUNCTION_TEMPERATURE_DOWN.getValue();
|
inputKeyCode = Constants.ACFunction.FUNCTION_TEMPERATURE_DOWN.getValue();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return IRDecode.getInstance().decodeACBinary(acStatus, acFunction);
|
|
||||||
} else {
|
} else {
|
||||||
return IRDecode.getInstance().decodeTVBinary(keyCode);
|
inputKeyCode = keyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* decode SDK - decode from binary */
|
||||||
|
/* translate key code for AC according to the mapping above */
|
||||||
|
/* ac status is useless for decoding devices other than AC, it's an optional parameter */
|
||||||
|
/* change wind dir is an optional parameter, set to 0 as default */
|
||||||
|
// return mIRDecode.decodeBinary(inputKeyCode, acStatus, 0);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// control
|
// control
|
||||||
@@ -265,7 +254,8 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// send decoded integer array to IR emitter
|
// send decoded integer array to IR emitter
|
||||||
ConsumerIrManager irEmitter = (ConsumerIrManager) mParent.getSystemService(Context.CONSUMER_IR_SERVICE);
|
ConsumerIrManager irEmitter =
|
||||||
|
(ConsumerIrManager) mParent.getSystemService(Context.CONSUMER_IR_SERVICE);
|
||||||
if (irEmitter.hasIrEmitter()) {
|
if (irEmitter.hasIrEmitter()) {
|
||||||
irEmitter.transmit(38000, decoded);
|
irEmitter.transmit(38000, decoded);
|
||||||
}
|
}
|
||||||
@@ -282,7 +272,6 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
int cmd = msg.getData().getInt(MessageUtil.KEY_CMD);
|
int cmd = msg.getData().getInt(MessageUtil.KEY_CMD);
|
||||||
Log.d(TAG, "handle message " + Integer.toString(cmd));
|
|
||||||
|
|
||||||
ControlFragment controlFragment = mMainFragment.get();
|
ControlFragment controlFragment = mMainFragment.get();
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
City city = mParent.getCurrentCity();
|
City city = mParent.getCurrentCity();
|
||||||
StbOperator operator = mParent.getCurrentOperator();
|
StbOperator operator = mParent.getCurrentOperator();
|
||||||
|
|
||||||
int brandID = 0;
|
int brandId = 0;
|
||||||
String cityCode = null;
|
String cityCode = null;
|
||||||
String operatorID = null;
|
String operatorId = null;
|
||||||
|
|
||||||
if (null != brand) {
|
if (null != brand) {
|
||||||
brandID = brand.getId();
|
brandId = brand.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != city) {
|
if (null != city) {
|
||||||
@@ -80,11 +80,11 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null != operator) {
|
if (null != operator) {
|
||||||
operatorID = operator.getOperator_id();
|
operatorId = operator.getOperatorId();
|
||||||
}
|
}
|
||||||
|
|
||||||
mIndexes = mApp.mWeAPIs.listRemoteIndexes(mParent.getCurrentCategory().getId(), brandID,
|
mIndexes = mApp.mWeAPIs.listRemoteIndexes(mParent.getCurrentCategory().getId(), brandId,
|
||||||
cityCode, operatorID);
|
cityCode, operatorId);
|
||||||
if (null == mIndexes) {
|
if (null == mIndexes) {
|
||||||
mIndexes = new ArrayList<>();
|
mIndexes = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -97,22 +97,26 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String remoteMap = mCurrentIndex.getRemoteMap();
|
try {
|
||||||
int indexID = mCurrentIndex.getId();
|
String remoteMap = mCurrentIndex.getRemoteMap();
|
||||||
InputStream in = mApp.mWeAPIs.downloadBin(remoteMap, indexID);
|
int indexId = mCurrentIndex.getId();
|
||||||
if (createDirectory()) {
|
InputStream in = mApp.mWeAPIs.downloadBin(remoteMap, indexId);
|
||||||
File binFile = new File(FileUtils.BIN_PATH +
|
if (createDirectory()) {
|
||||||
FileUtils.FILE_NAME_PREFIX + mCurrentIndex.getRemoteMap() +
|
File binFile = new File(FileUtils.BIN_PATH +
|
||||||
FileUtils.FILE_NAME_EXT);
|
FileUtils.FILE_NAME_PREFIX + mCurrentIndex.getRemoteMap() +
|
||||||
FileUtils.write(binFile, in);
|
FileUtils.FILE_NAME_EXT);
|
||||||
} else {
|
FileUtils.write(binFile, in);
|
||||||
Log.w(TAG, "no directory to contain bin file");
|
} else {
|
||||||
}
|
Log.w(TAG, "no directory to contain bin file");
|
||||||
|
}
|
||||||
|
|
||||||
if (null != in) {
|
if (null != in) {
|
||||||
MessageUtil.postMessage(mMsgHandler, CMD_SAVE_REMOTE_CONTROL);
|
MessageUtil.postMessage(mMsgHandler, CMD_SAVE_REMOTE_CONTROL);
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "bin file download failed");
|
Log.e(TAG, "bin file download failed");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
@@ -120,18 +124,21 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
|
|
||||||
private boolean createDirectory() {
|
private boolean createDirectory() {
|
||||||
File file = new File(FileUtils.BIN_PATH);
|
File file = new File(FileUtils.BIN_PATH);
|
||||||
|
if (file.exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return file.mkdirs();
|
return file.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveRemoteControl() {
|
private void saveRemoteControl() {
|
||||||
RemoteControl remoteControl = new RemoteControl();
|
RemoteControl remoteControl = new RemoteControl();
|
||||||
remoteControl.setCategoryID(mCurrentIndex.getCategoryId());
|
remoteControl.setCategoryId(mCurrentIndex.getCategoryId());
|
||||||
remoteControl.setCategoryName(mCurrentIndex.getCategoryName());
|
remoteControl.setCategoryName(mCurrentIndex.getCategoryName());
|
||||||
remoteControl.setBrandID(mCurrentIndex.getBrandId());
|
remoteControl.setBrandId(mCurrentIndex.getBrandId());
|
||||||
remoteControl.setBrandName(mCurrentIndex.getBrandName());
|
remoteControl.setBrandName(mCurrentIndex.getBrandName());
|
||||||
remoteControl.setCityCode(mCurrentIndex.getCityCode());
|
remoteControl.setCityCode(mCurrentIndex.getCityCode());
|
||||||
remoteControl.setCityName(mCurrentIndex.getCityName());
|
remoteControl.setCityName(mCurrentIndex.getCityName());
|
||||||
remoteControl.setOperatorID(mCurrentIndex.getOperatorId());
|
remoteControl.setOperatorId(mCurrentIndex.getOperatorId());
|
||||||
remoteControl.setOperatorName(mCurrentIndex.getOperatorName());
|
remoteControl.setOperatorName(mCurrentIndex.getOperatorName());
|
||||||
remoteControl.setProtocol(mCurrentIndex.getProtocol());
|
remoteControl.setProtocol(mCurrentIndex.getProtocol());
|
||||||
remoteControl.setRemote(mCurrentIndex.getRemote());
|
remoteControl.setRemote(mCurrentIndex.getRemote());
|
||||||
@@ -139,7 +146,6 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
remoteControl.setSubCategory(mCurrentIndex.getSubCate());
|
remoteControl.setSubCategory(mCurrentIndex.getSubCate());
|
||||||
|
|
||||||
long id = RemoteControl.createRemoteControl(remoteControl);
|
long id = RemoteControl.createRemoteControl(remoteControl);
|
||||||
Log.d(TAG, "remote control has been saved: " + id);
|
|
||||||
mParent.finish();
|
mParent.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +203,6 @@ public class IndexFragment extends BaseCreateFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
int cmd = msg.getData().getInt(MessageUtil.KEY_CMD);
|
int cmd = msg.getData().getInt(MessageUtil.KEY_CMD);
|
||||||
Log.d(TAG, "handle message " + Integer.toString(cmd));
|
|
||||||
|
|
||||||
IndexFragment indexFragment = mIndexFragment.get();
|
IndexFragment indexFragment = mIndexFragment.get();
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|||||||
@@ -284,10 +284,10 @@ public class PullToRefreshListView extends ListView{
|
|||||||
else {
|
else {
|
||||||
previousY = -1;
|
previousY = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember where have we started
|
// Remember where have we started
|
||||||
mScrollStartY = event.getY();
|
mScrollStartY = event.getY();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
@@ -296,7 +296,6 @@ public class PullToRefreshListView extends ListView{
|
|||||||
case RELEASE_TO_REFRESH:
|
case RELEASE_TO_REFRESH:
|
||||||
setState(State.REFRESHING);
|
setState(State.REFRESHING);
|
||||||
bounceBackHeader();
|
bounceBackHeader();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PULL_TO_REFRESH:
|
case PULL_TO_REFRESH:
|
||||||
|
|||||||
3756
Android/projectFilesBackup/.idea/workspace.xml
generated
3756
Android/projectFilesBackup/.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user