-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
android widget: add log.txt and error_log.txt + add notification perm…
…ission for showing toasts This is (probably) the last commit for this year, since i'll be away until January 2nd. Thank you so much for all the support for customfetch. I wish you an Happy New Year and hope everything goes well. I hope that the next year, when i'll release 0.11.0 with the android app and support, customfetch will be even more popular than now. Surely android ricers will love this feature. Thank you again and see you next year. Bye Bye :)
- Loading branch information
1 parent
95d25ba
commit ca7cc0c
Showing
7 changed files
with
78 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
#include <jni.h> | ||
|
||
#include <string> | ||
#include <sstream> | ||
|
||
#include "query.hpp" | ||
#include "util.hpp" | ||
|
||
#define ARRAY_SIZE(x) sizeof(x) / sizeof(x[0]) | ||
|
||
void stringToCharArray(const std::vector<std::string>& tokens, char *argv[]) { | ||
// Allocate memory for each word | ||
for (size_t i = 0; i < tokens.size(); ++i) { | ||
argv[i] = strdup(tokens[i].c_str()); | ||
} | ||
//argv[size] = nullptr; // Null-terminate | ||
} | ||
|
||
extern std::string mainAndroid_and_render(int argc, char *argv[], JNIEnv *env, jobject obj); | ||
|
||
extern "C" JNIEXPORT jstring JNICALL | ||
Java_org_toni_customfetch_1android_widget_CustomfetchMainRender_mainAndroid(JNIEnv *env, jobject obj, jstring args) { | ||
const std::string& str_args = env->GetStringUTFChars(args, nullptr); | ||
const std::vector<std::string>& tokens = split(str_args, ' '); | ||
char *argv[tokens.size()]; | ||
stringToCharArray(tokens, argv); | ||
for (size_t i = 0; i < tokens.size(); ++i) | ||
argv[i] = strdup(tokens[i].c_str()); | ||
|
||
return env->NewStringUTF(mainAndroid_and_render(ARRAY_SIZE(argv), argv, env, obj).c_str()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters