나는 그 시간을 얻기 위해 적절한 리눅스 터미널 호출 아래에 데이터와 시간을 표시하기 위해 페블 시계 인터페이스를 만드는 작업을하고있다.텍스트 레이어의 텍스트 설정이 색상을 덮어 쓰는 것 같습니다.
저는 주로 정적 인 복사 작업이 좋지만 얼굴에 타이핑 애니메이션을 추가하려고합니다.
내가이 200ms에 대한 AppTimer를 사용 할 하나 더 편지에게 그것을 호출 할 때마다 입력합니다.그러나 이제는 애니메이션 명령을 가져올 수는 있지만 많은 시간과 날짜 텍스트가 사라질 수는 없습니다. 그리고 명령이 입력을 마쳤을 때 다시 나타납니다.
가 여기에 관련 코드의 일부이며, 나머지는 GitHub의 https://github.com/vidia/Pebble-Shell/tree/type
에 나는 무엇 일어나는 것은 텍스트의 설정이 색상의 설정을 무시된다는 점이다 텍스트를 다시 표시하게 생각합니다. 그러나 나는 완전히 확신하지 못합니다. 필요한 경우 직접 설치하십시오.
static char hourmin[] = "~$date +%I:%M";
static char timecmd[] = " ";
static char monthday[] = "~$date +%h\\ %d";
static char datecmd[] = " ";
...
static void handleMinuteTick(...)
{
text_layer_set_text_color(time_layer, GColorClear);//the time text
text_layer_set_text_color(date_layer, GColorClear);//the date text
text_layer_set_text_color(dprompt_layer, GColorClear);//the date prompt
text_layer_set_text_color(prompt_layer, GColorClear);//the final, empty prompt
...
//set text of time_layer to the current time
//register a timer
}
static void animateTimePrompt()
{
static unsigned int i = 2;
static int TYPE_TIME = 200;
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 97, "i: %d", i);
strncpy(timecmd, hourmin, i++);
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 60, "timecmd: \"%s\"", timecmd);
text_layer_set_text(text_layer, timecmd);
if(i > strlen(hourmin))
{
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 97, "Typed word!!: %d", i);
i = 2;
text_layer_set_text_color(time_layer, GColorWhite);
text_layer_set_text_color(dprompt_layer, GColorWhite);
//app_timer_cancel(timer);
timer = app_timer_register(TYPE_TIME, animateDatePrompt, 0);
}
else
timer = app_timer_register(TYPE_TIME, animateTimePrompt, 0);
}
static void animateDatePrompt()
{
static int i = 2;
static int TYPE_TIME = 200;
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 97, "i: %d", i);
strncpy(datecmd, monthday, i++);
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 60, "datacmd: \"%s\"", datecmd);
text_layer_set_text(dprompt_layer, datecmd);
if((unsigned int) i > strlen(monthday))
{
app_log(APP_LOG_LEVEL_DEBUG, "unix-time.c", 97, "Typed word!!: %d", i);
i = 2;
text_layer_set_text_color(date_layer, GColorWhite);
text_layer_set_text_color(prompt_layer, GColorWhite);
//timer = app_timer_register(TYPE_TIME, animateDatePrompt, 0);
//app_timer_cancel(timer);
}
else
timer = app_timer_register(TYPE_TIME, animateDatePrompt, 0);
}
...
void handleSecondTick(...)
{
//set text of prompt_layer for the blinking cursor.
}
하지만 텍스트 색상을 항상 앞뒤로 변경하고 있습니다. 또한 이동하는 것은 무엇을 의미합니까? 진짜 타자를 치는 것은 일어나지 않는다. – Vidia
전체 레이어의 텍스트 색상이 변경됩니다. 그게 정말로 당신이하고 싶은 일입니까? 아니면 단 한 문자의 색상을 변경하고 싶습니까? – sarfata
레이어의 전체 텍스트 색상을 변경하고 싶습니다. 내 생각은 그것을 표시해야 할 때까지 명확하게 (보이지 않는 것처럼) 보이게하는 것입니다. 나는 그것이 부모로부터 그것을 다시 붙이는 것보다 쉽다는 것을 알았다. – Vidia