mirror of
https://github.com/FatttSnake/OxygenToolbox.git
synced 2026-04-06 08:51:26 +08:00
Optimized NavigationBar.
Added BottomNavigationView. Removed FloatingActionButton.
This commit is contained in:
12
.idea/deploymentTargetDropDown.xml
generated
12
.idea/deploymentTargetDropDown.xml
generated
@@ -1,6 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="deploymentTargetDropDown">
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="192.168.101.108:8888" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2022-04-13T09:35:09.839655300Z" />
|
||||||
<runningDeviceTargetsSelectedWithDialog>
|
<runningDeviceTargetsSelectedWithDialog>
|
||||||
<Target>
|
<Target>
|
||||||
<type value="RUNNING_DEVICE_TARGET" />
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
|||||||
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
@@ -41,12 +41,17 @@
|
|||||||
<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" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_home_alltools.xml" value="0.297008547008547" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_home_fav.xml" value="0.1" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_home_tools.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_slideshow.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_slideshow.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_theme.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_theme.xml" value="0.1" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fragment_tools.xml" value="0.33" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/layout_item.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/layout_item.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/nav_header_main.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/nav_header_main.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/tool_button.xml" value="0.3619791666666667" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/tool_button.xml" value="0.3619791666666667" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/menu/activity_main_drawer.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/menu/activity_main_drawer.xml" value="0.1" />
|
||||||
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/menu/bottom_nav_menu.xml" value="0.297008547008547" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/menu/main.xml" value="0.1" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/menu/main.xml" value="0.1" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.11944444444444445" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.11944444444444445" />
|
||||||
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.11944444444444445" />
|
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.11944444444444445" />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.OxygenToolbox.Starting">
|
android:theme="@style/Theme.OxygenToolbox.Default">
|
||||||
<activity
|
<activity
|
||||||
android:name=".SplashActivity"
|
android:name=".SplashActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.fatapp.oxygentoolbox;
|
package com.fatapp.oxygentoolbox;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
|
||||||
import com.fatapp.oxygentoolbox.util.ResourceUtil;
|
import com.fatapp.oxygentoolbox.util.ResourceUtil;
|
||||||
import com.fatapp.oxygentoolbox.util.VibratorController;
|
import com.fatapp.oxygentoolbox.util.VibratorController;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
|
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
@@ -26,14 +25,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
|
|
||||||
private Toolbar toolbar;
|
|
||||||
private FloatingActionButton fab;
|
|
||||||
private DrawerLayout drawer;
|
private DrawerLayout drawer;
|
||||||
|
private CoordinatorLayout mainPage;
|
||||||
|
private Toolbar toolbar;
|
||||||
private NavigationView navigationView;
|
private NavigationView navigationView;
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
toolbar = findViewById(R.id.toolbar);
|
|
||||||
fab = findViewById(R.id.fab);
|
|
||||||
drawer = findViewById(R.id.drawer_layout);
|
drawer = findViewById(R.id.drawer_layout);
|
||||||
|
mainPage = findViewById(R.id.main_page);
|
||||||
|
toolbar = findViewById(R.id.toolbar);
|
||||||
navigationView = findViewById(R.id.nav_view);
|
navigationView = findViewById(R.id.nav_view);
|
||||||
mainActivity = this;
|
mainActivity = this;
|
||||||
}
|
}
|
||||||
@@ -53,21 +53,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initLayout() {
|
private void initLayout() {
|
||||||
|
mainPage.setPadding(0, ResourceUtil.getStatusBarHeight(getWindow(), getApplicationContext()), 0, 0);
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
fab.setOnClickListener(view -> {
|
|
||||||
/*Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
|
||||||
.setAction("Action", null).show();*/
|
|
||||||
});
|
|
||||||
navigationView.inflateHeaderView(R.layout.nav_header_main);
|
navigationView.inflateHeaderView(R.layout.nav_header_main);
|
||||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||||
navigationView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
navigationView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||||
if (navigationView.getMenu().getItem(0).isChecked()) {
|
drawer.setDrawerLockMode(navigationView.getMenu().getItem(0).isChecked()
|
||||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
? DrawerLayout.LOCK_MODE_UNLOCKED
|
||||||
fab.setVisibility(View.VISIBLE);
|
: DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
} else {
|
|
||||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
|
||||||
fab.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
navigationView.getMenu().getItem(4).setOnMenuItemClickListener(item -> {
|
navigationView.getMenu().getItem(4).setOnMenuItemClickListener(item -> {
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -17,8 +17,17 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_splash);
|
setContentView(R.layout.activity_splash);
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
sleep(0);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
startActivity(new Intent(getApplicationContext(), MainActivity.class));
|
startActivity(new Intent(getApplicationContext(), MainActivity.class));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,7 @@ public class AboutFragment extends Fragment {
|
|||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
aboutViewModel =
|
aboutViewModel = new ViewModelProvider(this).get(AboutViewModel.class);
|
||||||
new ViewModelProvider(this).get(AboutViewModel.class);
|
|
||||||
View root = inflater.inflate(R.layout.fragment_about, container, false);
|
View root = inflater.inflate(R.layout.fragment_about, container, false);
|
||||||
final TextView textView = root.findViewById(R.id.text_about);
|
final TextView textView = root.findViewById(R.id.text_about);
|
||||||
aboutViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
aboutViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||||
|
|||||||
@@ -1,30 +1,20 @@
|
|||||||
package com.fatapp.oxygentoolbox.ui.home;
|
package com.fatapp.oxygentoolbox.ui.home;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
import com.fatapp.oxygentoolbox.R;
|
import com.fatapp.oxygentoolbox.R;
|
||||||
import com.fatapp.oxygentoolbox.layout.FoldLayout;
|
import com.fatapp.oxygentoolbox.ui.home.fav.FavFragment;
|
||||||
import com.fatapp.oxygentoolbox.util.ToolsLauncher;
|
import com.fatapp.oxygentoolbox.ui.home.tools.ToolsFragment;
|
||||||
import com.fatapp.oxygentoolbox.util.ToolsList;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
import com.fatapp.oxygentoolbox.util.VibratorController;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
@@ -32,109 +22,43 @@ public class HomeFragment extends Fragment {
|
|||||||
|
|
||||||
private HomeViewModel homeViewModel;
|
private HomeViewModel homeViewModel;
|
||||||
|
|
||||||
private LinearLayout foldLayoutsLinearLayout;
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
homeViewModel =
|
homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
|
||||||
new ViewModelProvider(this).get(HomeViewModel.class);
|
|
||||||
root = inflater.inflate(R.layout.fragment_home, container, false);
|
root = inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
|
|
||||||
//init
|
ViewPager2 bottomNavViewPager = root.findViewById(R.id.bottom_nav_view_pager);
|
||||||
initView();
|
BottomNavigationView bottomNavigationView = root.findViewById(R.id.bottom_navigation_view);
|
||||||
initLayout();
|
|
||||||
|
bottomNavViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback(){
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
bottomNavigationView.getMenu().getItem(position).setChecked(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bottomNavigationView.setOnItemSelectedListener(item -> {
|
||||||
|
bottomNavViewPager.setCurrentItem(item.getOrder());
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
bottomNavViewPager.setAdapter(new FragmentStateAdapter(this) {
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
return new ToolsFragment();
|
||||||
|
case 1:
|
||||||
|
return new FavFragment();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
|
||||||
foldLayoutsLinearLayout = root.findViewById(R.id.fold_layouts_linear_layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initLayout() {
|
|
||||||
initFoldLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
|
||||||
private void initFoldLayout() {
|
|
||||||
try {
|
|
||||||
ToolsList.init(getResources().getAssets().open("json/BasicTools.json"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Toast.makeText(getContext(), R.string.init_tools_failed, Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ToolsList.Tool tool : ToolsList.getToolList()) {
|
|
||||||
View foldLayoutBodyLayout = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
|
||||||
ViewGroup autoLinefeedLayout = foldLayoutBodyLayout.findViewById(R.id.auto_linefeed_layout);
|
|
||||||
|
|
||||||
for (ToolsList.Button button : tool.getButtonList()) {
|
|
||||||
View toolButtonLayout = getLayoutInflater().inflate(R.layout.tool_button, null);
|
|
||||||
Button toolButton = toolButtonLayout.findViewById(R.id.tool_button);
|
|
||||||
toolButton.setText(button.getText());
|
|
||||||
|
|
||||||
toolButton.setOnClickListener(v -> ToolsLauncher.launch(getContext(), button.getActivity()));
|
|
||||||
|
|
||||||
toolButton.setOnTouchListener((v, event) -> {
|
|
||||||
if (event.getAction()== MotionEvent.ACTION_DOWN) {
|
|
||||||
v.animate().translationZ(8f).setDuration(100L);
|
|
||||||
}
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
|
||||||
v.animate().translationZ(0).setDuration(100L);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
toolButton.setOnLongClickListener(v -> {
|
|
||||||
v.animate().translationZ(0).setDuration(100L);
|
|
||||||
VibratorController.vibrate(1);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
autoLinefeedLayout.addView(toolButtonLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<View> viewList = new ArrayList<>();
|
|
||||||
viewList.add(foldLayoutBodyLayout);
|
|
||||||
|
|
||||||
View foldLayoutHead = getLayoutInflater().inflate(R.layout.fold_layout, null);
|
|
||||||
FoldLayout foldLayout = foldLayoutHead.findViewById(R.id.fold_layout);
|
|
||||||
((TextView) foldLayout.findViewById(R.id.fold_layout_text_view)).setText(tool.getFoldLayoutTitle());
|
|
||||||
|
|
||||||
TextView foldLayoutIcon = foldLayout.findViewById(R.id.fold_layout_icon);
|
|
||||||
foldLayoutIcon.setTypeface(Typeface.createFromAsset(requireContext().getAssets(), tool.getFont()));
|
|
||||||
foldLayoutIcon.setText(tool.getIcon());
|
|
||||||
|
|
||||||
foldLayout.addItemView(viewList);
|
|
||||||
|
|
||||||
foldLayoutsLinearLayout.removeAllViews();
|
|
||||||
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
View toolButton = getLayoutInflater().inflate(R.layout.tool_button, null);
|
|
||||||
((Button) toolButton.findViewById(R.id.tool_button)).setText("Button");
|
|
||||||
toolButton.findViewById(R.id.tool_button).setOnClickListener(v -> {
|
|
||||||
BasicToolsLauncher.launch(0, getContext());
|
|
||||||
});
|
|
||||||
|
|
||||||
View foldLayoutBody = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
|
||||||
ViewGroup layout_item_AutoLinefeedLayout = foldLayoutBody.findViewById(R.id.auto_linefeed_layout);
|
|
||||||
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.fold_layout);
|
|
||||||
((TextView) foldLayout.findViewById(R.id.fold_layout_text_view)).setText("FoldLayout_" + i);
|
|
||||||
foldLayout.addItemView(viewList);
|
|
||||||
|
|
||||||
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.fatapp.oxygentoolbox.ui.home.fav;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.fatapp.oxygentoolbox.R;
|
||||||
|
|
||||||
|
public class FavFragment extends Fragment {
|
||||||
|
|
||||||
|
private View root;
|
||||||
|
|
||||||
|
private FavViewModel favViewModel;
|
||||||
|
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
favViewModel = new ViewModelProvider(this).get(FavViewModel.class);
|
||||||
|
root = inflater.inflate(R.layout.fragment_home_fav, container, false);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.fatapp.oxygentoolbox.ui.home.fav;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
public class FavViewModel extends ViewModel {
|
||||||
|
|
||||||
|
private MutableLiveData<String> mText;
|
||||||
|
|
||||||
|
public FavViewModel() {
|
||||||
|
mText = new MutableLiveData<>();
|
||||||
|
mText.setValue("This is home fragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<String> getText() {
|
||||||
|
return mText;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package com.fatapp.oxygentoolbox.ui.home.tools;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.fatapp.oxygentoolbox.R;
|
||||||
|
import com.fatapp.oxygentoolbox.layout.FoldLayout;
|
||||||
|
import com.fatapp.oxygentoolbox.util.ToolsLauncher;
|
||||||
|
import com.fatapp.oxygentoolbox.util.ToolsList;
|
||||||
|
import com.fatapp.oxygentoolbox.util.VibratorController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ToolsFragment extends Fragment {
|
||||||
|
|
||||||
|
private View root;
|
||||||
|
|
||||||
|
private ToolsViewModel toolsViewModel;
|
||||||
|
|
||||||
|
private LinearLayout foldLayoutsLinearLayout;
|
||||||
|
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
toolsViewModel = new ViewModelProvider(this).get(ToolsViewModel.class);
|
||||||
|
root = inflater.inflate(R.layout.fragment_home_tools, container, false);
|
||||||
|
|
||||||
|
//init
|
||||||
|
initView();
|
||||||
|
initLayout();
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
foldLayoutsLinearLayout = root.findViewById(R.id.fold_layouts_linear_layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initLayout() {
|
||||||
|
initFoldLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
private void initFoldLayout() {
|
||||||
|
try {
|
||||||
|
ToolsList.init(getResources().getAssets().open("json/BasicTools.json"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Toast.makeText(getContext(), R.string.init_tools_failed, Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ToolsList.Tool tool : ToolsList.getToolList()) {
|
||||||
|
View foldLayoutBodyLayout = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
||||||
|
ViewGroup autoLinefeedLayout = foldLayoutBodyLayout.findViewById(R.id.auto_linefeed_layout);
|
||||||
|
|
||||||
|
for (ToolsList.Button button : tool.getButtonList()) {
|
||||||
|
View toolButtonLayout = getLayoutInflater().inflate(R.layout.tool_button, null);
|
||||||
|
Button toolButton = toolButtonLayout.findViewById(R.id.tool_button);
|
||||||
|
toolButton.setText(button.getText());
|
||||||
|
|
||||||
|
toolButton.setOnClickListener(v -> ToolsLauncher.launch(getContext(), button.getActivity()));
|
||||||
|
|
||||||
|
toolButton.setOnTouchListener((v, event) -> {
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
v.animate().translationZ(8f).setDuration(100L);
|
||||||
|
}
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
|
v.animate().translationZ(0).setDuration(100L);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
toolButton.setOnLongClickListener(v -> {
|
||||||
|
v.animate().translationZ(0).setDuration(100L);
|
||||||
|
VibratorController.vibrate(1);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
autoLinefeedLayout.addView(toolButtonLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<View> viewList = new ArrayList<>();
|
||||||
|
viewList.add(foldLayoutBodyLayout);
|
||||||
|
|
||||||
|
View foldLayoutHead = getLayoutInflater().inflate(R.layout.fold_layout, null);
|
||||||
|
FoldLayout foldLayout = foldLayoutHead.findViewById(R.id.fold_layout);
|
||||||
|
((TextView) foldLayout.findViewById(R.id.fold_layout_text_view)).setText(tool.getFoldLayoutTitle());
|
||||||
|
|
||||||
|
TextView foldLayoutIcon = foldLayout.findViewById(R.id.fold_layout_icon);
|
||||||
|
foldLayoutIcon.setTypeface(Typeface.createFromAsset(requireContext().getAssets(), tool.getFont()));
|
||||||
|
foldLayoutIcon.setText(tool.getIcon());
|
||||||
|
|
||||||
|
foldLayout.addItemView(viewList);
|
||||||
|
|
||||||
|
foldLayoutsLinearLayout.removeAllViews();
|
||||||
|
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
View toolButton = getLayoutInflater().inflate(R.layout.tool_button, null);
|
||||||
|
((Button) toolButton.findViewById(R.id.tool_button)).setText("Button");
|
||||||
|
toolButton.findViewById(R.id.tool_button).setOnClickListener(v -> {
|
||||||
|
});
|
||||||
|
|
||||||
|
View foldLayoutBody = getLayoutInflater().inflate(R.layout.fold_layout_body, null);
|
||||||
|
ViewGroup layout_item_AutoLinefeedLayout = foldLayoutBody.findViewById(R.id.auto_linefeed_layout);
|
||||||
|
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.fold_layout);
|
||||||
|
((TextView) foldLayout.findViewById(R.id.fold_layout_text_view)).setText("FoldLayout_" + i);
|
||||||
|
foldLayout.addItemView(viewList);
|
||||||
|
|
||||||
|
foldLayoutsLinearLayout.addView(foldLayoutHead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.fatapp.oxygentoolbox.ui.home.tools;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
public class ToolsViewModel extends ViewModel {
|
||||||
|
|
||||||
|
private MutableLiveData<String> mText;
|
||||||
|
|
||||||
|
public ToolsViewModel() {
|
||||||
|
mText = new MutableLiveData<>();
|
||||||
|
mText.setValue("This is home fragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<String> getText() {
|
||||||
|
return mText;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,9 @@ import android.os.Bundle;
|
|||||||
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.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 com.fatapp.oxygentoolbox.R;
|
import com.fatapp.oxygentoolbox.R;
|
||||||
@@ -20,8 +17,7 @@ public class SettingFragment extends Fragment {
|
|||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
settingViewModel =
|
settingViewModel = new ViewModelProvider(this).get(SettingViewModel.class);
|
||||||
new ViewModelProvider(this).get(SettingViewModel.class);
|
|
||||||
View root = inflater.inflate(R.layout.fragment_setting, container, false);
|
View root = inflater.inflate(R.layout.fragment_setting, container, false);
|
||||||
/*
|
/*
|
||||||
final TextView textView = root.findViewById(R.id.text_setting);
|
final TextView textView = root.findViewById(R.id.text_setting);
|
||||||
|
|||||||
@@ -18,10 +18,8 @@ public class ThemeFragment extends Fragment {
|
|||||||
|
|
||||||
private ThemeViewModel themeViewModel;
|
private ThemeViewModel themeViewModel;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
themeViewModel = new ViewModelProvider(this).get(ThemeViewModel.class);
|
||||||
themeViewModel =
|
|
||||||
new ViewModelProvider(this).get(ThemeViewModel.class);
|
|
||||||
View root = inflater.inflate(R.layout.fragment_theme, container, false);
|
View root = inflater.inflate(R.layout.fragment_theme, container, false);
|
||||||
final TextView textView = root.findViewById(R.id.text_theme);
|
final TextView textView = root.findViewById(R.id.text_theme);
|
||||||
themeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
themeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
package com.fatapp.oxygentoolbox.util;
|
package com.fatapp.oxygentoolbox.util;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.Window;
|
||||||
|
|
||||||
|
import androidx.annotation.AttrRes;
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.StyleRes;
|
||||||
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
|
|
||||||
|
import com.google.android.material.color.MaterialColors;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class ResourceUtil {
|
public final class ResourceUtil {
|
||||||
|
|
||||||
@@ -28,4 +43,43 @@ public final class ResourceUtil {
|
|||||||
public static int getColor(int resId) {
|
public static int getColor(int resId) {
|
||||||
return sRes.getColor(resId);
|
return sRes.getColor(resId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getThemeAttrColor(@NonNull Context context, @StyleRes int themeResId, @AttrRes int attrResId) {
|
||||||
|
return MaterialColors.getColor(new ContextThemeWrapper(context, themeResId), attrResId, Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getStatusBarHeight(Window window, Context context) {
|
||||||
|
Rect localRect = new Rect();
|
||||||
|
window.getDecorView().getWindowVisibleDisplayFrame(localRect);
|
||||||
|
int mStatusBarHeight = localRect.top;
|
||||||
|
if (mStatusBarHeight == 0) {
|
||||||
|
try {
|
||||||
|
@SuppressLint("PrivateApi")
|
||||||
|
Class<?> localClass = Class.forName("com.android.internal.R$dimen");
|
||||||
|
Object localObject = localClass.newInstance();
|
||||||
|
int status_bar_height = Integer.parseInt(Objects.requireNonNull(localClass.getField("status_bar_height").get(localObject)).toString());
|
||||||
|
mStatusBarHeight = context.getResources().getDimensionPixelSize(status_bar_height);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mStatusBarHeight == 0) {
|
||||||
|
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (resourceId > 0) {
|
||||||
|
mStatusBarHeight = context.getResources().getDimensionPixelSize(resourceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mStatusBarHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNavigationBarHeight(Context context) {
|
||||||
|
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
||||||
|
if (rid != 0) {
|
||||||
|
int resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
||||||
|
return context.getResources().getDimensionPixelSize(resourceId);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="false"
|
||||||
|
android:background="?attr/app_background"
|
||||||
tools:openDrawer="start">
|
tools:openDrawer="start">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:background="?attr/windowSplashScreenBackground"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="288dp"
|
||||||
|
android:layout_height="288dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:src="@drawable/ic_launcher"
|
||||||
|
android:contentDescription="LOGO" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main_page"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
@@ -22,13 +23,4 @@
|
|||||||
|
|
||||||
<include layout="@layout/content_main" />
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/fab"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_margin="@dimen/fab_margin"
|
|
||||||
app:srcCompat="@android:drawable/ic_dialog_email"
|
|
||||||
android:contentDescription="@string/fab" />
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -1,20 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/fragment_home"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="?attr/app_background"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".ui.home.HomeFragment">
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/fold_layouts_linear_layout"
|
android:id="@+id/bottom_nav_view_pager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
|
android:id="@+id/bottom_navigation_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="10dp"
|
app:labelVisibilityMode="selected"
|
||||||
android:paddingBottom="10dp"
|
app:itemTextColor="?attr/app_on_theme"
|
||||||
android:orientation="vertical">
|
app:itemIconTint="?attr/app_on_theme"
|
||||||
</LinearLayout>
|
android:background="?attr/app_theme"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/bottom_nav_view_pager"
|
||||||
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
</ScrollView>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
18
app/src/main/res/layout/fragment_home_fav.xml
Normal file
18
app/src/main/res/layout/fragment_home_fav.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/fragment_home_tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/app_background"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".ui.home.HomeFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/fold_layouts_linear_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp" />
|
||||||
|
</ScrollView>
|
||||||
18
app/src/main/res/layout/fragment_home_tools.xml
Normal file
18
app/src/main/res/layout/fragment_home_tools.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/fragment_home_tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/app_background"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".ui.home.tools.ToolsFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/fold_layouts_linear_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp" />
|
||||||
|
</ScrollView>
|
||||||
15
app/src/main/res/menu/bottom_nav_menu.xml
Normal file
15
app/src/main/res/menu/bottom_nav_menu.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_home_tools"
|
||||||
|
android:icon="@drawable/ic_menu_home"
|
||||||
|
android:orderInCategory="0"
|
||||||
|
android:title="@string/menu_home_tools" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_home_fav"
|
||||||
|
android:icon="@drawable/ic_menu_home"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:title="@string/menu_home_fav" />
|
||||||
|
|
||||||
|
</menu>
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<string name="action_settings">设置</string>
|
<string name="action_settings">设置</string>
|
||||||
|
|
||||||
<string name="menu_home">主页</string>
|
<string name="menu_home">主页</string>
|
||||||
|
<string name="menu_home_tools">工具</string>
|
||||||
|
<string name="menu_home_fav">收藏</string>
|
||||||
<string name="menu_theme">主题</string>
|
<string name="menu_theme">主题</string>
|
||||||
<string name="menu_setting">设置</string>
|
<string name="menu_setting">设置</string>
|
||||||
<string name="menu_about">关于</string>
|
<string name="menu_about">关于</string>
|
||||||
@@ -18,7 +20,6 @@
|
|||||||
<string name="shortcutLongLabel">氧工具</string>
|
<string name="shortcutLongLabel">氧工具</string>
|
||||||
<string name="shortcutShortLabel">氧工具</string>
|
<string name="shortcutShortLabel">氧工具</string>
|
||||||
|
|
||||||
<string name="fab">浮动按钮</string>
|
|
||||||
<string name="init_tools_failed">初始化工具集失败</string>
|
<string name="init_tools_failed">初始化工具集失败</string>
|
||||||
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<string name="action_settings">设置</string>
|
<string name="action_settings">设置</string>
|
||||||
|
|
||||||
<string name="menu_home">主页</string>
|
<string name="menu_home">主页</string>
|
||||||
|
<string name="menu_home_tools">工具</string>
|
||||||
|
<string name="menu_home_fav">收藏</string>
|
||||||
<string name="menu_theme">主题</string>
|
<string name="menu_theme">主题</string>
|
||||||
<string name="menu_setting">设置</string>
|
<string name="menu_setting">设置</string>
|
||||||
<string name="menu_about">关于</string>
|
<string name="menu_about">关于</string>
|
||||||
@@ -18,7 +20,6 @@
|
|||||||
<string name="shortcutLongLabel">氧工具</string>
|
<string name="shortcutLongLabel">氧工具</string>
|
||||||
<string name="shortcutShortLabel">氧工具</string>
|
<string name="shortcutShortLabel">氧工具</string>
|
||||||
|
|
||||||
<string name="fab">浮动按钮</string>
|
|
||||||
<string name="init_tools_failed">初始化工具集失败</string>
|
<string name="init_tools_failed">初始化工具集失败</string>
|
||||||
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<string name="action_settings">设置</string>
|
<string name="action_settings">设置</string>
|
||||||
|
|
||||||
<string name="menu_home">主页</string>
|
<string name="menu_home">主页</string>
|
||||||
|
<string name="menu_home_tools">工具</string>
|
||||||
|
<string name="menu_home_fav">收藏</string>
|
||||||
<string name="menu_theme">主题</string>
|
<string name="menu_theme">主题</string>
|
||||||
<string name="menu_setting">设置</string>
|
<string name="menu_setting">设置</string>
|
||||||
<string name="menu_about">关于</string>
|
<string name="menu_about">关于</string>
|
||||||
@@ -18,7 +20,6 @@
|
|||||||
<string name="shortcutLongLabel">氧工具</string>
|
<string name="shortcutLongLabel">氧工具</string>
|
||||||
<string name="shortcutShortLabel">氧工具</string>
|
<string name="shortcutShortLabel">氧工具</string>
|
||||||
|
|
||||||
<string name="fab">浮动按钮</string>
|
|
||||||
<string name="init_tools_failed">初始化工具集失败</string>
|
<string name="init_tools_failed">初始化工具集失败</string>
|
||||||
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
<string name="activity_class_not_found">无法加载工具,该工具可能已损坏</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -5,5 +5,4 @@
|
|||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
||||||
<dimen name="nav_header_height">176dp</dimen>
|
<dimen name="nav_header_height">176dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
|
|
||||||
<string name="menu_home">Home</string>
|
<string name="menu_home">Home</string>
|
||||||
|
<string name="menu_home_tools">Tools</string>
|
||||||
|
<string name="menu_home_fav">Favorite</string>
|
||||||
<string name="menu_theme">Theme</string>
|
<string name="menu_theme">Theme</string>
|
||||||
<string name="menu_setting">Setting</string>
|
<string name="menu_setting">Setting</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
@@ -20,7 +22,6 @@
|
|||||||
|
|
||||||
<string name="arrow_icon" translatable="false"><![CDATA[>]]></string>
|
<string name="arrow_icon" translatable="false"><![CDATA[>]]></string>
|
||||||
|
|
||||||
<string name="fab">Fab</string>
|
|
||||||
<string name="init_tools_failed">Failed to initialize tools</string>
|
<string name="init_tools_failed">Failed to initialize tools</string>
|
||||||
<string name="activity_class_not_found">Can not load tool, it may be damaged</string>
|
<string name="activity_class_not_found">Can not load tool, it may be damaged</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">true</item>
|
||||||
|
|
||||||
<item name="app_theme">@color/default_app_theme</item>
|
<item name="app_theme">@color/default_app_theme</item>
|
||||||
<item name="app_on_theme">@color/default_app_on_theme</item>
|
<item name="app_on_theme">@color/default_app_on_theme</item>
|
||||||
@@ -31,15 +32,19 @@
|
|||||||
<item name="tools_button_ripple">@color/default_tools_button_ripple</item>
|
<item name="tools_button_ripple">@color/default_tools_button_ripple</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.OxygenToolbox.Full" parent="Theme.OxygenToolbox.Default">
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.OxygenToolbox.SplashActivity" parent="Theme.OxygenToolbox.Full">
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.OxygenToolbox.Starting" parent="Theme.SplashScreen">
|
<style name="Theme.OxygenToolbox.Starting" parent="Theme.SplashScreen">
|
||||||
<item name="windowSplashScreenBackground">@color/default_app_background</item>
|
<item name="windowSplashScreenBackground">@color/default_app_background</item>
|
||||||
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher</item>
|
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher</item>
|
||||||
<item name="windowSplashScreenAnimationDuration">0</item>
|
<item name="windowSplashScreenAnimationDuration">0</item>
|
||||||
<item name="postSplashScreenTheme">@style/Theme.OxygenToolbox.Default</item>
|
<item name="postSplashScreenTheme">@style/Theme.OxygenToolbox.SplashActivity</item>
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.OxygenToolbox.Full" parent="Theme.OxygenToolbox.Default">
|
|
||||||
<item name="android:windowFullscreen">true</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.OxygenToolbox.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="Theme.OxygenToolbox.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|||||||
Reference in New Issue
Block a user