mirror of
https://github.com/FatttSnake/OxygenToolbox.git
synced 2026-04-06 07:31:27 +08:00
Auto init basic tools
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
|||||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -21,5 +21,10 @@
|
|||||||
<option name="name" value="Google" />
|
<option name="name" value="Google" />
|
||||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -25,10 +25,12 @@
|
|||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/top_bottom_radius_background.xml" value="0.11944444444444445" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/top_bottom_radius_background.xml" value="0.11944444444444445" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/top_radius_background.xml" value="0.11944444444444445" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/top_radius_background.xml" value="0.11944444444444445" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_main.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_time_screen.xml" value="0.34739583333333335" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_bar_main.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_bar_main.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/basic_tool_list.xml" value="0.1390625" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/basic_tool_list.xml" value="0.1390625" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/content_main.xml" value="0.14990942028985507" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/content_main.xml" value="0.14990942028985507" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fold_layout.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fold_layout.xml" value="0.1" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fold_layout_head.xml" value="0.34739583333333335" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_about.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_about.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_gallery.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_gallery.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_home.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_home.xml" value="0.1" />
|
||||||
|
|||||||
@@ -40,4 +40,6 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.OxygenToolbox">
|
android:theme="@style/Theme.OxygenToolbox">
|
||||||
|
<activity android:name=".tools.TimeScreenActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
BIN
app/src/main/assets/fonts/BasicTools.ttf
Normal file
BIN
app/src/main/assets/fonts/BasicTools.ttf
Normal file
Binary file not shown.
40
app/src/main/assets/json/BasicTools.json
Normal file
40
app/src/main/assets/json/BasicTools.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "basic",
|
||||||
|
"content": {
|
||||||
|
"version": "1.0",
|
||||||
|
"versionID": 210510,
|
||||||
|
"mainVersion": 210510,
|
||||||
|
"font": "fonts/BasicTools.ttf",
|
||||||
|
"icon": "\uE6AE",
|
||||||
|
"title": {
|
||||||
|
"cn": "\u57fa\u7840\u5de5\u5177",
|
||||||
|
"tc": "\u57fa\u790e\u5de5\u5177",
|
||||||
|
"en": "Basic Tools"
|
||||||
|
},
|
||||||
|
"desc": {
|
||||||
|
"cn": "\u4e00\u4e9b\u57fa\u7840\u7684\u5de5\u5177\uff0c\u0041\u0050\u0050\u4e3b\u4f53\u81ea\u5e26",
|
||||||
|
"tc": "\u4e00\u4e9b\u57fa\u790e\u7684\u5de5\u5177\uff0c\u0041\u0050\u0050\u4e3b\u9ad4\u81ea\u5e36",
|
||||||
|
"en": "Some basic tools, the main body of the APP comes with it"
|
||||||
|
},
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"text": {
|
||||||
|
"cn": "\u65f6\u95f4\u5c4f\u5e55",
|
||||||
|
"tc": "\u6642\u9593\u5c4f\u5e55",
|
||||||
|
"en": "Time Screen"
|
||||||
|
},
|
||||||
|
"activity": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": {
|
||||||
|
"cn": "\u7ffb\u8bd1",
|
||||||
|
"tc": "\u7ffb\u8b6f",
|
||||||
|
"en": "Translation"
|
||||||
|
},
|
||||||
|
"activity": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -5,13 +5,12 @@ import android.content.pm.ShortcutInfo;
|
|||||||
import android.content.pm.ShortcutManager;
|
import android.content.pm.ShortcutManager;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.fatapp.oxygentoolbox.layout.FoldLayout;
|
import com.fatapp.oxygentoolbox.util.ToolsList;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
@@ -22,10 +21,8 @@ import androidx.drawerlayout.widget.DrawerLayout;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@@ -62,6 +59,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
|
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
|
||||||
NavigationUI.setupWithNavController(navigationView, navController);
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ToolsList.init(getResources().getAssets().open("json/BasicTools.json"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(getApplicationContext(), "初始化工具集失败", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
shortCutCreateTest();
|
shortCutCreateTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class AutoLinefeedLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
layoutHorizontal();
|
layoutHorizontal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
init = true;
|
init = true;
|
||||||
hide();
|
|
||||||
|
|
||||||
showItem();
|
showItem();
|
||||||
}
|
}
|
||||||
@@ -140,15 +139,6 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto hide
|
|
||||||
*/
|
|
||||||
public void hide() {
|
|
||||||
LinearLayout.LayoutParams layoutParams = (LayoutParams) content.getLayoutParams();
|
|
||||||
layoutParams.height = 0;
|
|
||||||
content.setLayoutParams(layoutParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("UseCompatLoadingForDrawables")
|
@SuppressLint("UseCompatLoadingForDrawables")
|
||||||
public void showItem() {
|
public void showItem() {
|
||||||
isShow = true;
|
isShow = true;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.fatapp.oxygentoolbox.tools;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.fatapp.oxygentoolbox.R;
|
||||||
|
|
||||||
|
public class TimeScreenActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_time_screen);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,27 +1,25 @@
|
|||||||
package com.fatapp.oxygentoolbox.ui.home;
|
package com.fatapp.oxygentoolbox.ui.home;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.graphics.Typeface;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.Observer;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.fatapp.oxygentoolbox.MainActivity;
|
|
||||||
import com.fatapp.oxygentoolbox.R;
|
import com.fatapp.oxygentoolbox.R;
|
||||||
import com.fatapp.oxygentoolbox.layout.FoldLayout;
|
import com.fatapp.oxygentoolbox.layout.FoldLayout;
|
||||||
|
import com.fatapp.oxygentoolbox.util.BasicToolsLauncher;
|
||||||
|
import com.fatapp.oxygentoolbox.util.ToolsList;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -32,8 +30,7 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
private HomeViewModel homeViewModel;
|
private HomeViewModel homeViewModel;
|
||||||
|
|
||||||
private FoldLayout foldLayout;
|
private LinearLayout foldLayoutsLinearLayout;
|
||||||
private FoldLayout foldLayout1;
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
homeViewModel =
|
homeViewModel =
|
||||||
@@ -44,21 +41,56 @@ public class HomeFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
foldLayout = root.findViewById(R.id.foldLayout);
|
for (ToolsList.Tool tool : ToolsList.getToolList()) {
|
||||||
List<View> viewList = new ArrayList<>();
|
|
||||||
View layout_item = getLayoutInflater().inflate(R.layout.layout_item, null);
|
View foldLayoutBody = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
||||||
ViewGroup layout_item_AutoLinefeedLayout = layout_item.findViewById(R.id.layout_item_AutoLinefeedLayout);
|
ViewGroup layout_item_AutoLinefeedLayout = foldLayoutBody.findViewById(R.id.layout_item_AutoLinefeedLayout);
|
||||||
for (int i = 1; i < 1000; i++) {
|
|
||||||
|
for (ToolsList.Button button : tool.getButtonList()) {
|
||||||
View toolButton = getLayoutInflater().inflate(R.layout.tool_button, null);
|
View toolButton = getLayoutInflater().inflate(R.layout.tool_button, null);
|
||||||
((Button) toolButton.findViewById(R.id.toolButton)).setText("Bt" + i);
|
((Button) toolButton.findViewById(R.id.toolButton)).setText(button.getText());
|
||||||
|
toolButton.findViewById(R.id.toolButton).setOnClickListener(v -> {
|
||||||
|
BasicToolsLauncher.launch(button.getActivity(), getContext());
|
||||||
|
});
|
||||||
layout_item_AutoLinefeedLayout.addView(toolButton);
|
layout_item_AutoLinefeedLayout.addView(toolButton);
|
||||||
}
|
}
|
||||||
viewList.add(layout_item);
|
|
||||||
|
List<View> viewList = new ArrayList<>();
|
||||||
|
viewList.add(foldLayoutBody);
|
||||||
|
|
||||||
|
View foldLayoutHead = getLayoutInflater().inflate(R.layout.fold_layout, null);
|
||||||
|
FoldLayout foldLayout = foldLayoutHead.findViewById(R.id.foldLayout);
|
||||||
|
((TextView) foldLayout.findViewById(R.id.foldLayoutTextView)).setText(tool.getFoldLayoutTitle());
|
||||||
|
((TextView) foldLayout.findViewById(R.id.foldLayoutIcon)).setTypeface(Typeface.createFromAsset(getContext().getAssets(), tool.getFont()));
|
||||||
|
((TextView) foldLayout.findViewById(R.id.foldLayoutIcon)).setText(tool.getIcon());
|
||||||
|
|
||||||
foldLayout.addItemView(viewList);
|
foldLayout.addItemView(viewList);
|
||||||
|
|
||||||
foldLayout1 = root.findViewById(R.id.foldLayout1);
|
foldLayoutsLinearLayout = root.findViewById(R.id.foldLayoutsLinearLayout);
|
||||||
List<View> viewList1 = new ArrayList<>();
|
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
||||||
viewList1.add(getLayoutInflater().inflate(R.layout.layout_item, null));
|
}
|
||||||
foldLayout1.addItemView(viewList1);
|
|
||||||
|
/*for (int i = 0; i < 10; i++) {
|
||||||
|
View toolButton = getLayoutInflater().inflate(R.layout.tool_button, null);
|
||||||
|
((Button) toolButton.findViewById(R.id.toolButton)).setText("Button");
|
||||||
|
toolButton.findViewById(R.id.toolButton).setOnClickListener(v -> {
|
||||||
|
BasicToolsLauncher.launch(0, getContext());
|
||||||
|
});
|
||||||
|
|
||||||
|
View foldLayoutBody = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
||||||
|
ViewGroup layout_item_AutoLinefeedLayout = foldLayoutBody.findViewById(R.id.layout_item_AutoLinefeedLayout);
|
||||||
|
layout_item_AutoLinefeedLayout.addView(toolButton);
|
||||||
|
|
||||||
|
List<View> viewList = new ArrayList<>();
|
||||||
|
viewList.add(foldLayoutBody);
|
||||||
|
|
||||||
|
View foldLayoutHead = getLayoutInflater().inflate(R.layout.fold_layout, null);
|
||||||
|
FoldLayout foldLayout = foldLayoutHead.findViewById(R.id.foldLayout);
|
||||||
|
((TextView) foldLayout.findViewById(R.id.foldLayoutTextView)).setText("FoldLayout_" + i);
|
||||||
|
foldLayout.addItemView(viewList);
|
||||||
|
|
||||||
|
foldLayoutsLinearLayout = root.findViewById(R.id.foldLayoutsLinearLayout);
|
||||||
|
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="1024dp"
|
|
||||||
android:height="1024dp"
|
|
||||||
android:viewportWidth="1024"
|
|
||||||
android:viewportHeight="1024">
|
|
||||||
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/app_theme"
|
|
||||||
android:pathData="M810.666667 942.933333c-34.133333 0-68.266667-12.8-93.866667-38.4l-234.666667-234.666666c-140.8 51.2-302.933333-12.8-371.2-153.6-38.4-81.066667-38.4-174.933333 0-256 4.266667-12.8 17.066667-21.333333 29.866667-25.6s25.6 0 38.4 12.8L315.733333 384H384V315.733333L247.466667 179.2c-8.533333-8.533333-12.8-21.333333-12.8-38.4 4.266667-12.8 12.8-25.6 25.6-29.866667 72.533333-34.133333 153.6-38.4 230.4-12.8s136.533333 81.066667 170.666666 153.6c34.133333 72.533333 38.4 153.6 12.8 230.4l234.666667 234.666667c51.2 51.2 51.2 136.533333 0 187.733333-29.866667 25.6-64 38.4-98.133333 38.4z m-320-366.933333c12.8 0 21.333333 4.266667 29.866666 12.8l256 256c17.066667 17.066667 51.2 17.066667 68.266667 0 8.533333-8.533333 12.8-21.333333 12.8-34.133333s-4.266667-25.6-12.8-34.133334l-256-256c-12.8-12.8-17.066667-34.133333-8.533333-46.933333 29.866667-59.733333 29.866667-123.733333 0-183.466667-25.6-51.2-68.266667-93.866667-119.466667-110.933333-34.133333-12.8-68.266667-17.066667-102.4-8.533333l98.133333 98.133333c8.533333 8.533333 12.8 17.066667 12.8 29.866667v128c0 25.6-17.066667 42.666667-42.666666 42.666666H298.666667c-12.8 0-21.333333-4.266667-29.866667-12.8L170.666667 358.4c-4.266667 42.666667 0 85.333333 17.066666 123.733333 51.2 106.666667 179.2 149.333333 285.866667 102.4 4.266667-8.533333 12.8-8.533333 17.066667-8.533333z" />
|
|
||||||
</vector>
|
|
||||||
9
app/src/main/res/layout/activity_time_screen.xml
Normal file
9
app/src/main/res/layout/activity_time_screen.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".tools.TimeScreenActivity">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,36 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/foldLayoutLinearLayout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
android:layout_marginRight="10dp"
|
<com.fatapp.oxygentoolbox.layout.FoldLayout
|
||||||
android:layout_marginTop="10dp"
|
android:id="@+id/foldLayout"
|
||||||
android:background="@drawable/top_bottom_radius_background"
|
android:layout_width="match_parent"
|
||||||
android:gravity="center_vertical" >
|
android:layout_height="wrap_content"
|
||||||
|
app:layoutId="@layout/fold_layout_head"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/imageView1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
app:srcCompat="@drawable/tools_icon" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_weight="6"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:text="工具"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/arrowIcon"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
app:srcCompat="@drawable/right_to_down_arrow" />
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/layout_item_LinearLayout"
|
android:id="@+id/layout_item_LinearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
37
app/src/main/res/layout/fold_layout_head.xml
Normal file
37
app/src/main/res/layout/fold_layout_head.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/foldLayoutLinearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@drawable/top_bottom_radius_background"
|
||||||
|
android:gravity="center_vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/foldLayoutIcon"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/app_theme" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/foldLayoutTextView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_weight="6"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/arrowIcon"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:srcCompat="@drawable/right_to_down_arrow" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -10,26 +10,11 @@
|
|||||||
tools:context=".ui.home.HomeFragment">
|
tools:context=".ui.home.HomeFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/foldLayoutsLinearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="10dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.fatapp.oxygentoolbox.layout.FoldLayout
|
|
||||||
android:id="@+id/foldLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layoutId="@layout/fold_layout"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<com.fatapp.oxygentoolbox.layout.FoldLayout
|
|
||||||
android:id="@+id/foldLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layoutId="@layout/fold_layout"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -16,6 +16,7 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user