|
@@ -289,15 +289,24 @@ public class LedC2MManager extends LedManager {
|
|
|
private long createDefaultProgram(String ledResolution, int fontSize, int type, int savaType) {
|
|
|
long hProgram = 0;
|
|
|
String language = LocaleMangerUtils.getApplicationLocale().getLanguage();
|
|
|
+ int ledType = SettingConfig.getLedType(application);
|
|
|
+ int grayLevel = 1;
|
|
|
+ int nLayout = 0;
|
|
|
+ ledC2M.InitLedType(ledType);
|
|
|
+ if (ledType == 0) {
|
|
|
+ grayLevel = 0;
|
|
|
+ nLayout = 1;
|
|
|
+ }
|
|
|
+
|
|
|
if (type == 0) {
|
|
|
//仅显示时间
|
|
|
if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
//192x32
|
|
|
- hProgram = ledC2M.CreateProgram(192, 32, 1,1, savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1, grayLevel, savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
//左边添加一个静字
|
|
|
- ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, nLayout);
|
|
|
ledC2M.AddStaticTextToImageTextArea(hProgram, 0, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
//时间
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 2, 48, 0, 144, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
@@ -312,7 +321,7 @@ public class LedC2MManager extends LedManager {
|
|
|
}
|
|
|
} else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
//64x16
|
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1, grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
@@ -328,7 +337,7 @@ public class LedC2MManager extends LedManager {
|
|
|
}
|
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)) {
|
|
|
//128x16
|
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1, grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
@@ -355,7 +364,7 @@ public class LedC2MManager extends LedManager {
|
|
|
String text = SettingConfig.getLedCustomInfo(application);
|
|
|
if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
//192x32
|
|
|
- hProgram = ledC2M.CreateProgram(192, 32, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 192, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
@@ -371,12 +380,12 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 192, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 192, 32, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
} else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
//64x16
|
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
@@ -392,12 +401,12 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 64, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 64, 16, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)){
|
|
|
//128x16
|
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
@@ -405,12 +414,12 @@ public class LedC2MManager extends LedManager {
|
|
|
4, 0xff, 0, 0xff, 2, 0xff, 0);
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 16, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
} else {
|
|
|
//128x32
|
|
|
- hProgram = ledC2M.CreateProgram(128, 32, 1,1,savaType);
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 32, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
@@ -426,7 +435,7 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 32, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
}
|
|
@@ -437,18 +446,27 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
private long createCallingProgram(String ledResolution, int fontSize) {
|
|
|
long hProgram = 0;
|
|
|
+ int ledType = SettingConfig.getLedType(application);
|
|
|
+ int grayLevel = 1;
|
|
|
+ int nLayout = 0;
|
|
|
+ ledC2M.InitLedType(ledType);
|
|
|
+ if (ledType == 0) {
|
|
|
+ grayLevel = 0;
|
|
|
+ nLayout = 1;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
//192x32,双行显示
|
|
|
- hProgram = ledC2M.CreateProgram(192, 32, 1, 1, 3);
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1, grayLevel, 3);
|
|
|
int programTextCount = programTextList.size(); //呼叫信息数量
|
|
|
if (programTextCount == 1) {
|
|
|
ledC2M.AddProgram(hProgram, 0, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
//左边添加一个静字
|
|
|
- ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, nLayout);
|
|
|
ledC2M.AddStaticTextToImageTextArea(hProgram, 0, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
|
|
|
- ledC2M.AddImageTextArea(hProgram, 0, 2, 48, 0, 144, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 2, 48, 0, 144, 16, nLayout);
|
|
|
//ledC2M.AddSinglelineTextToImageTextArea(hProgram, 0, 1, 0, programTextList.get(0).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 0, 2, 0, programTextList.get(0).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
} else {
|
|
@@ -465,17 +483,17 @@ public class LedC2MManager extends LedManager {
|
|
|
int textIndex = i * 2;
|
|
|
ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
//左边添加一个静字
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 48, 32, nLayout);
|
|
|
ledC2M.AddStaticTextToImageTextArea(hProgram, i, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
|
|
|
//上面一行
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 2, 48, 0, 144, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 2, 48, 0, 144, 16, nLayout);
|
|
|
//ledC2M.AddSinglelineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(textIndex).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 2, 0, programTextList.get(textIndex).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
|
|
|
if (textIndex + 1 < programTextCount) {
|
|
|
//下面一行
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 3, 48, 16, 144, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 3, 48, 16, 144, 16, nLayout);
|
|
|
//ledC2M.AddSinglelineTextToImageTextArea(hProgram, i, 2, 0, programTextList.get(textIndex + 1).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 3, 0, programTextList.get(textIndex + 1).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
}
|
|
@@ -483,27 +501,27 @@ public class LedC2MManager extends LedManager {
|
|
|
}
|
|
|
} else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
//64x16
|
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1, 1, 3);
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1, grayLevel, 3);
|
|
|
for (int i = 0; i < programTextList.size(); i++) {
|
|
|
String text = programTextList.get(i).getText();
|
|
|
ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 64, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 64, 16, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)) {
|
|
|
//128x16
|
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1, 1, 3);
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1, grayLevel, 3);
|
|
|
for (int i = 0; i < programTextList.size(); i++) {
|
|
|
ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 16, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 16, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
} else {
|
|
|
//128x32
|
|
|
- hProgram = ledC2M.CreateProgram(128, 32, 1, 1, 3);
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 32, 1, grayLevel, 3);
|
|
|
for (int i = 0; i < programTextList.size(); i++) {
|
|
|
ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, 0);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, nLayout);
|
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
}
|
|
|
}
|
|
@@ -626,7 +644,11 @@ public class LedC2MManager extends LedManager {
|
|
|
@Override
|
|
|
public void removeAllProgram() {
|
|
|
programTextList.clear();
|
|
|
- sendDefaultProgram(true);
|
|
|
+ if (SettingConfig.getLedType(application) == 0) {
|
|
|
+ sendDefaultProgram(false);
|
|
|
+ } else {
|
|
|
+ sendDefaultProgram(true);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|