mirror of
https://github.com/FatttSnake/OxygenToolbox.git
synced 2026-04-06 14:11:29 +08:00
Auto init basic tools
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.fatapp.oxygentoolbox.util;
|
||||
|
||||
import static androidx.core.content.ContextCompat.startActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.fatapp.oxygentoolbox.tools.TimeScreenActivity;
|
||||
|
||||
public class BasicToolsLauncher {
|
||||
public static void launch(int activity, Context context) {
|
||||
switch (activity) {
|
||||
case 0:
|
||||
startActivity(context, new Intent(context, TimeScreenActivity.class), null);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.fatapp.oxygentoolbox.util;
|
||||
|
||||
public class Config {
|
||||
}
|
||||
233
app/src/main/java/com/fatapp/oxygentoolbox/util/ToolsJson.java
Normal file
233
app/src/main/java/com/fatapp/oxygentoolbox/util/ToolsJson.java
Normal file
@@ -0,0 +1,233 @@
|
||||
package com.fatapp.oxygentoolbox.util;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ToolsJson {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("content")
|
||||
private Content content;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Content getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(Content content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public static class Content {
|
||||
@SerializedName("version")
|
||||
private String version;
|
||||
@SerializedName("versionID")
|
||||
private Integer versionID;
|
||||
@SerializedName("mainVersion")
|
||||
private Integer mainVersion;
|
||||
@SerializedName("font")
|
||||
private String font;
|
||||
@SerializedName("icon")
|
||||
private String icon;
|
||||
@SerializedName("title")
|
||||
private Title title;
|
||||
@SerializedName("desc")
|
||||
private Desc desc;
|
||||
@SerializedName("buttons")
|
||||
private List<Buttons> buttons;
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Integer getVersionID() {
|
||||
return versionID;
|
||||
}
|
||||
|
||||
public void setVersionID(Integer versionID) {
|
||||
this.versionID = versionID;
|
||||
}
|
||||
|
||||
public Integer getMainVersion() {
|
||||
return mainVersion;
|
||||
}
|
||||
|
||||
public void setMainVersion(Integer mainVersion) {
|
||||
this.mainVersion = mainVersion;
|
||||
}
|
||||
|
||||
public Title getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(Title title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getFont() {
|
||||
return font;
|
||||
}
|
||||
|
||||
public void setFont(String font) {
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public Desc getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(Desc desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public List<Buttons> getButtons() {
|
||||
return buttons;
|
||||
}
|
||||
|
||||
public void setButtons(List<Buttons> buttons) {
|
||||
this.buttons = buttons;
|
||||
}
|
||||
|
||||
public static class Title {
|
||||
@SerializedName("cn")
|
||||
private String cn;
|
||||
@SerializedName("tc")
|
||||
private String tc;
|
||||
@SerializedName("en")
|
||||
private String en;
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getTc() {
|
||||
return tc;
|
||||
}
|
||||
|
||||
public void setTc(String tc) {
|
||||
this.tc = tc;
|
||||
}
|
||||
|
||||
public String getEn() {
|
||||
return en;
|
||||
}
|
||||
|
||||
public void setEn(String en) {
|
||||
this.en = en;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Desc {
|
||||
@SerializedName("cn")
|
||||
private String cn;
|
||||
@SerializedName("tc")
|
||||
private String tc;
|
||||
@SerializedName("en")
|
||||
private String en;
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getTc() {
|
||||
return tc;
|
||||
}
|
||||
|
||||
public void setTc(String tc) {
|
||||
this.tc = tc;
|
||||
}
|
||||
|
||||
public String getEn() {
|
||||
return en;
|
||||
}
|
||||
|
||||
public void setEn(String en) {
|
||||
this.en = en;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Buttons {
|
||||
@SerializedName("text")
|
||||
private Text text;
|
||||
@SerializedName("activity")
|
||||
private Integer activity;
|
||||
|
||||
public Text getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(Text text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public void setActivity(Integer activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public static class Text {
|
||||
@SerializedName("cn")
|
||||
private String cn;
|
||||
@SerializedName("tc")
|
||||
private String tc;
|
||||
@SerializedName("en")
|
||||
private String en;
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getTc() {
|
||||
return tc;
|
||||
}
|
||||
|
||||
public void setTc(String tc) {
|
||||
this.tc = tc;
|
||||
}
|
||||
|
||||
public String getEn() {
|
||||
return en;
|
||||
}
|
||||
|
||||
public void setEn(String en) {
|
||||
this.en = en;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
106
app/src/main/java/com/fatapp/oxygentoolbox/util/ToolsList.java
Normal file
106
app/src/main/java/com/fatapp/oxygentoolbox/util/ToolsList.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.fatapp.oxygentoolbox.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ToolsList {
|
||||
private static List<Tool> toolList = new ArrayList<>();
|
||||
|
||||
public static void init(InputStream file) throws IOException {
|
||||
int i;
|
||||
StringBuilder jsonStringBuilder = new StringBuilder();
|
||||
|
||||
while ((i = file.read()) != -1) {
|
||||
jsonStringBuilder.append((char) i);
|
||||
}
|
||||
file.close();
|
||||
List<ToolsJson> toolsJsonList = new Gson().fromJson(jsonStringBuilder.toString(), new TypeToken<List<ToolsJson>>(){}.getType());
|
||||
|
||||
for (ToolsJson toolsJson : toolsJsonList) {
|
||||
Tool tool = new Tool();
|
||||
tool.setFont(toolsJson.getContent().getFont());
|
||||
tool.setIcon(toolsJson.getContent().getIcon());
|
||||
tool.setFoldLayoutTitle(toolsJson.getContent().getTitle().getCn());
|
||||
for (ToolsJson.Content.Buttons cButton : toolsJson.getContent().getButtons()) {
|
||||
Button button = new Button();
|
||||
button.setText(cButton.getText().getCn());
|
||||
button.setActivity(cButton.getActivity());
|
||||
tool.buttonList.add(button);
|
||||
}
|
||||
toolList.add(tool);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Tool> getToolList() {
|
||||
return toolList;
|
||||
}
|
||||
|
||||
public void setToolList(List<Tool> toolList) {
|
||||
ToolsList.toolList = toolList;
|
||||
}
|
||||
|
||||
public static class Tool {
|
||||
private String font;
|
||||
private String icon;
|
||||
private String foldLayoutTitle;
|
||||
private List<Button> buttonList = new ArrayList<>();
|
||||
|
||||
public String getFont() {
|
||||
return font;
|
||||
}
|
||||
|
||||
public void setFont(String font) {
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getFoldLayoutTitle() {
|
||||
return foldLayoutTitle;
|
||||
}
|
||||
|
||||
public void setFoldLayoutTitle(String foldLayoutTitle) {
|
||||
this.foldLayoutTitle = foldLayoutTitle;
|
||||
}
|
||||
|
||||
public List<Button> getButtonList() {
|
||||
return buttonList;
|
||||
}
|
||||
|
||||
public void setButtonList(List<Button> buttonList) {
|
||||
this.buttonList = buttonList;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Button {
|
||||
private String text;
|
||||
private Integer activity;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public void setActivity(Integer activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user