Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

各位老哥们,双填空有思路吗 #83

Open
xiaodiaoz opened this issue Jun 29, 2020 · 3 comments
Open

各位老哥们,双填空有思路吗 #83

xiaodiaoz opened this issue Jun 29, 2020 · 3 comments

Comments

@xiaodiaoz
Copy link

每周答题会出现双填空,研究了下,还是不懂,求解!

@lolisaikou
Copy link

image
每周答题可以用啊

@lolisaikou
Copy link

getFitbQuestion()部分改成这样

function getFitbQuestion() {
    var questionCollections = className("EditText").findOnce().parent().parent();
    var questionArray = [];
    var findBlank = false;
    var blankCount = 0;
    var blankNumStr = "";
    var i = 0;
    questionCollections.children().forEach(item => {
        if (item.className() != "android.widget.EditText") {
            if (item.text() != "") {//题目段
                if (findBlank) {
                    blankNumStr = "|" + blankCount.toString();
                    questionArray.push(blankNumStr);
                    findBlank = false;
                }
                questionArray.push(item.text());
            }
            else {
                findBlank = true;
                blankCount = (className("EditText").findOnce(i).parent().childCount() - 1);
                i++;
            }
        }
    });
    return questionArray;
}

就可以正常获取填空格数了
image

下面是未更改的截图,可以看到第二个填空格数不对
image

@xiaodiaoz
Copy link
Author

getFitbQuestion()部分改成这样

function getFitbQuestion() {
    var questionCollections = className("EditText").findOnce().parent().parent();
    var questionArray = [];
    var findBlank = false;
    var blankCount = 0;
    var blankNumStr = "";
    var i = 0;
    questionCollections.children().forEach(item => {
        if (item.className() != "android.widget.EditText") {
            if (item.text() != "") {//题目段
                if (findBlank) {
                    blankNumStr = "|" + blankCount.toString();
                    questionArray.push(blankNumStr);
                    findBlank = false;
                }
                questionArray.push(item.text());
            }
            else {
                findBlank = true;
                blankCount = (className("EditText").findOnce(i).parent().childCount() - 1);
                i++;
            }
        }
    });
    return questionArray;
}

就可以正常获取填空格数了
image

下面是未更改的截图,可以看到第二个填空格数不对
image

感谢老哥!!!困扰我很久的问题终于解决了

@xiaodiaoz xiaodiaoz reopened this Jul 17, 2020
@xiaodiaoz xiaodiaoz reopened this Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants