From fa6154147a1384aa995946231f0adeadfadeeed8 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 15 Aug 2022 17:26:41 +0800 Subject: [PATCH] Optimized code and resources. --- .idea/deploymentTargetDropDown.xml | 17 ---- .idea/misc.xml | 16 ++-- .../java/com/fatapp/oxygentoolbox/App.java | 1 + .../fatapp/oxygentoolbox/MainActivity.java | 31 +++---- .../fatapp/oxygentoolbox/SplashActivity.java | 2 +- .../oxygentoolbox/layout/FoldLayout.java | 12 +-- .../tools/timescreen/MainActivity.java | 90 ++++++++++-------- .../tools/translation/MainActivity.java | 46 ++++++---- .../oxygentoolbox/ui/about/AboutFragment.java | 23 +++-- .../ui/about/AboutViewModel.java | 19 ---- .../ui/about/LibrariesActivity.java | 30 +++--- .../ui/about/util/LibrariesAdapter.java | 10 +- .../oxygentoolbox/ui/home/HomeFragment.java | 45 ++++----- .../oxygentoolbox/ui/home/HomeViewModel.java | 19 ---- .../ui/home/tools/ToolsFragment.java | 27 ++---- .../ui/home/tools/ToolsViewModel.java | 19 ---- .../ui/home/util/ToolsAdapter.java | 6 +- .../ui/setting/SettingFragment.java | 1 + .../ui/setting/SettingViewModel.java | 19 ---- .../oxygentoolbox/ui/theme/ThemeFragment.java | 17 ++-- .../ui/theme/ThemeViewModel.java | 19 ---- .../ui/theme/util/ThemesAdapter.java | 14 +-- .../animation_down_to_right_arrow.xml | 16 ++-- .../animation_right_to_down_arrow.xml | 16 ++-- app/src/main/res/drawable/ic_dark_mode.xml | 5 - app/src/main/res/drawable/ic_favorite.xml | 10 ++ app/src/main/res/drawable/ic_home.xml | 10 ++ app/src/main/res/drawable/ic_light_mode.xml | 5 - app/src/main/res/drawable/ic_menu_about.xml | 11 ++- app/src/main/res/drawable/ic_menu_exit.xml | 14 +-- app/src/main/res/drawable/ic_menu_home.xml | 10 +- app/src/main/res/drawable/ic_menu_setting.xml | 12 ++- app/src/main/res/drawable/ic_menu_theme.xml | 12 ++- ....xml => ic_tool_translation_translate.xml} | 0 .../main/res/layout/activity_libraries.xml | 4 +- app/src/main/res/layout/activity_splash.xml | 6 +- .../res/layout/activity_tool_time_screen.xml | 28 +++--- .../res/layout/activity_tool_translation.xml | 36 ++++---- .../main/res/layout/app_nav_header_main.xml | 7 +- app/src/main/res/layout/fold_layout_body.xml | 9 +- .../main/res/layout/fold_layout_button.xml | 2 +- app/src/main/res/layout/fold_layout_head.xml | 30 +++--- app/src/main/res/layout/fragment_about.xml | 22 ++--- app/src/main/res/layout/fragment_home.xml | 10 +- app/src/main/res/layout/fragment_home_fav.xml | 15 +-- .../main/res/layout/fragment_home_tools.xml | 6 +- app/src/main/res/layout/fragment_theme.xml | 2 +- app/src/main/res/layout/item_libraries.xml | 91 ++++++++----------- app/src/main/res/layout/item_themes.xml | 41 +++++---- .../{bottom_nav_menu.xml => bottom_nav.xml} | 4 +- app/src/main/res/values/dimens.xml | 50 +++++++--- 51 files changed, 451 insertions(+), 516 deletions(-) delete mode 100644 .idea/deploymentTargetDropDown.xml delete mode 100644 app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutViewModel.java delete mode 100644 app/src/main/java/com/fatapp/oxygentoolbox/ui/home/HomeViewModel.java delete mode 100644 app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsViewModel.java delete mode 100644 app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingViewModel.java delete mode 100644 app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeViewModel.java delete mode 100644 app/src/main/res/drawable/ic_dark_mode.xml create mode 100644 app/src/main/res/drawable/ic_favorite.xml create mode 100644 app/src/main/res/drawable/ic_home.xml delete mode 100644 app/src/main/res/drawable/ic_light_mode.xml rename app/src/main/res/drawable/{ic_translate.xml => ic_tool_translation_translate.xml} (100%) rename app/src/main/res/menu/{bottom_nav_menu.xml => bottom_nav.xml} (80%) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index d66c661..0000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 2a4adf1..be28351 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,8 +12,9 @@ + - + @@ -35,6 +36,8 @@ + + @@ -52,6 +55,7 @@ + @@ -69,17 +73,17 @@ - - + + - + - + @@ -91,7 +95,7 @@ - + diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/App.java b/app/src/main/java/com/fatapp/oxygentoolbox/App.java index 6337f82..7af5dfd 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/App.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/App.java @@ -27,6 +27,7 @@ public class App extends Application { public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle bundle) { ResourceUtil.init(App.this); SharedPreferencesUtils.init(App.this); + ResourceUtil.setAppLocale(SharedPreferencesUtils.getPreferenceLocale()); ResourceUtil.loadAppTheme(activity); loadAppUiMode(); diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/MainActivity.java b/app/src/main/java/com/fatapp/oxygentoolbox/MainActivity.java index 6882600..744d575 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/MainActivity.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/MainActivity.java @@ -25,30 +25,26 @@ import java.util.Objects; public class MainActivity extends AppCompatActivity { - public static AppCompatActivity mainActivity; - private AppBarConfiguration mAppBarConfiguration; - private DrawerLayout drawer; + private DrawerLayout drawerLayout; + private NavigationView navView; private CoordinatorLayout mainPage; private Toolbar toolbar; - private NavigationView navigationView; private void initView() { - drawer = findViewById(R.id.drawer_layout); + drawerLayout = findViewById(R.id.drawer_layout); + navView = findViewById(R.id.nav_view); mainPage = findViewById(R.id.main_page); toolbar = findViewById(R.id.toolbar); - navigationView = findViewById(R.id.nav_view); - mainActivity = this; } @Override protected void onCreate(Bundle savedInstanceState) { - SplashScreen splashScreen = SplashScreen.installSplashScreen(this); + SplashScreen.installSplashScreen(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - //init initView(); initLayout(); VibratorController.init(); @@ -60,23 +56,23 @@ public class MainActivity extends AppCompatActivity { mainPage.setPadding(0, ResourceUtil.getStatusBarHeight(getWindow(), getApplicationContext()), 0, 0); setSupportActionBar(toolbar); - navigationView.inflateHeaderView(R.layout.app_nav_header_main); - navigationView.inflateMenu(R.menu.activity_main_drawer); - navigationView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> drawer.setDrawerLockMode(navigationView.getMenu().getItem(0).isChecked() + + navView.inflateHeaderView(R.layout.app_nav_header_main); + navView.inflateMenu(R.menu.activity_main_drawer); + navView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> drawerLayout.setDrawerLockMode(navView.getMenu().getItem(0).isChecked() ? DrawerLayout.LOCK_MODE_UNLOCKED : DrawerLayout.LOCK_MODE_LOCKED_CLOSED)); - navigationView.getMenu().getItem(4).setOnMenuItemClickListener(item -> { + navView.getMenu().getItem(4).setOnMenuItemClickListener(item -> { finish(); return false; }); - // Passing each menu ID as a set of Ids because each - // menu should be considered as top level destinations. + mAppBarConfiguration = new AppBarConfiguration.Builder(R.id.nav_home) - .setOpenableLayout(drawer) + .setOpenableLayout(drawerLayout) .build(); NavController navController = ((NavHostFragment) Objects.requireNonNull(getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment))).getNavController(); NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); - NavigationUI.setupWithNavController(navigationView, navController); + NavigationUI.setupWithNavController(navView, navController); } /* @@ -103,7 +99,6 @@ public class MainActivity extends AppCompatActivity { @Override public boolean onCreateOptionsMenu(@NonNull Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/SplashActivity.java b/app/src/main/java/com/fatapp/oxygentoolbox/SplashActivity.java index a9e1392..947205d 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/SplashActivity.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/SplashActivity.java @@ -13,7 +13,7 @@ public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { // Handle the splash screen transition. - SplashScreen splashScreen = SplashScreen.installSplashScreen(this); + SplashScreen.installSplashScreen(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Thread() { diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/layout/FoldLayout.java b/app/src/main/java/com/fatapp/oxygentoolbox/layout/FoldLayout.java index f242310..910ae4e 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/layout/FoldLayout.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/layout/FoldLayout.java @@ -95,9 +95,9 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener { int contentHeight = content.getMeasuredHeight(); LayoutParams layoutParams = (LayoutParams) content.getLayoutParams(); layoutParams.height = contentHeight; - LinearLayout linearLayout = defaultView.findViewById(R.id.fold_layout_head_layout); + LinearLayout linearLayout = defaultView.findViewById(R.id.linear_layout_head); linearLayout.setBackground(AppCompatResources.getDrawable(getContext(), R.drawable.background_top_radius)); - ImageView imageView = defaultView.findViewById(R.id.fold_layout_arrow_icon); + ImageView imageView = defaultView.findViewById(R.id.image_view_arrow); imageView.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.animation_down_to_right_arrow)); content.setLayoutParams(layoutParams); @@ -112,7 +112,7 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener { public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); if (isShow) { - LinearLayout linearLayout = defaultView.findViewById(R.id.fold_layout_head_layout); + LinearLayout linearLayout = defaultView.findViewById(R.id.linear_layout_head); linearLayout.setBackground(AppCompatResources.getDrawable(getContext(), R.drawable.background_top_radius)); } } @@ -129,7 +129,7 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener { public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (!isShow) { - LinearLayout linearLayout = defaultView.findViewById(R.id.fold_layout_head_layout); + LinearLayout linearLayout = defaultView.findViewById(R.id.linear_layout_head); linearLayout.setBackground(AppCompatResources.getDrawable(getContext(), R.drawable.background_top_bottom_radius)); } } @@ -156,7 +156,7 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener { public void showItem() { isShow = true; showAnimator.start(); - ImageView imageView = defaultView.findViewById(R.id.fold_layout_arrow_icon); + ImageView imageView = defaultView.findViewById(R.id.image_view_arrow); imageView.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.animation_right_to_down_arrow)); AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageView.getDrawable(); animatedVectorDrawable.start(); @@ -165,7 +165,7 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener { public void hideItem() { isShow = false; hideAnimator.start(); - ImageView imageView = defaultView.findViewById(R.id.fold_layout_arrow_icon); + ImageView imageView = defaultView.findViewById(R.id.image_view_arrow); imageView.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.animation_down_to_right_arrow)); AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageView.getDrawable(); animatedVectorDrawable.start(); diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/tools/timescreen/MainActivity.java b/app/src/main/java/com/fatapp/oxygentoolbox/tools/timescreen/MainActivity.java index 0c9bc2e..8b2a790 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/tools/timescreen/MainActivity.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/tools/timescreen/MainActivity.java @@ -42,7 +42,7 @@ public class MainActivity extends AppCompatActivity { private VariableChangeSupport dateVisibilityChangeSupport; private VariableChangeSupport uiVisibilityChangeSupport; - private ConstraintLayout constraintLayoutTimeScreen; + private ConstraintLayout constraintLayoutRoot; private ImageView imageViewMode; private TextSwitcher textSwitcherHourTen; private TextSwitcher textSwitcherHourOne; @@ -55,7 +55,7 @@ public class MainActivity extends AppCompatActivity { private TextView textViewDate; private void initView() { - constraintLayoutTimeScreen = findViewById(R.id.constraint_layout_time_screen); + constraintLayoutRoot = findViewById(R.id.constraint_layout_root); imageViewMode = findViewById(R.id.image_view_mode); textSwitcherHourTen = findViewById(R.id.text_switcher_hour_ten); textSwitcherHourOne = findViewById(R.id.text_switcher_hour_one); @@ -77,43 +77,14 @@ public class MainActivity extends AppCompatActivity { initView(); initTextSwitcher(); + initUiVisibility(); + initUiMode(); + initDateVisibility(); - constraintLayoutTimeScreen.setOnClickListener(view -> uiVisibilityChangeSupport.setValue(!uiVisibilityChangeSupport.getValue())); - uiVisibilityChangeSupport = new VariableChangeSupport<>(true, new VariableChangeListener() { - @Override - public void onChange(T newValue, T oldValue) { - ObjectAnimator.ofFloat(imageViewMode, View.ALPHA, (boolean) newValue ? 0.0f : 1.0f, (boolean) newValue ? 1.0f : 0.0f).start(); - } - }); - - if (uiMode >= Configuration.UI_MODE_NIGHT_YES) { - imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_dark_to_light_mode)); - } - imageViewMode.setOnClickListener(view -> { - if (uiMode < Configuration.UI_MODE_NIGHT_YES) { - uiMode = ResourceUtil.UI_MODE_DARK; - setColors(ResourceUtil.getColor(R.color.app_show_dark_background), ResourceUtil.getColor(R.color.app_show_dark_primary_text)); - imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_light_to_dark_mode)); - AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageViewMode.getDrawable(); - animatedVectorDrawable.start(); - } else { - uiMode = ResourceUtil.UI_MODE_LIGHT; - setColors(ResourceUtil.getColor(R.color.app_show_light_background), ResourceUtil.getColor(R.color.app_show_light_primary_text)); - imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_dark_to_light_mode)); - AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageViewMode.getDrawable(); - animatedVectorDrawable.start(); - } - }); - - dateVisibilityChangeSupport = new VariableChangeSupport<>(true, new VariableChangeListener() { - @Override - public void onChange(T newValue, T oldValue) { - ObjectAnimator.ofFloat(textViewDate, View.ALPHA, (boolean) newValue ? 0.0f : 1.0f, (boolean) newValue ? 1.0f : 0.0f).start(); - } - }); - - textViewDate.setOnClickListener(view -> dateVisibilityChangeSupport.setValue(!dateVisibilityChangeSupport.getValue())); + initTimer(); + } + private void initTimer() { TimerTask timerTask = new TimerTask() { @Override public void run() { @@ -132,10 +103,51 @@ public class MainActivity extends AppCompatActivity { }); } }; - new Timer().schedule(timerTask, 0, 100L); } + private void initDateVisibility() { + dateVisibilityChangeSupport = new VariableChangeSupport<>(true, new VariableChangeListener() { + @Override + public void onChange(T newValue, T oldValue) { + ObjectAnimator.ofFloat(textViewDate, View.ALPHA, (boolean) newValue ? 0.0f : 1.0f, (boolean) newValue ? 1.0f : 0.0f).start(); + } + }); + textViewDate.setOnClickListener(view -> dateVisibilityChangeSupport.setValue(!dateVisibilityChangeSupport.getValue())); + } + + private void initUiMode() { + if (uiMode >= Configuration.UI_MODE_NIGHT_YES) { + imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_dark_to_light_mode)); + } + + imageViewMode.setOnClickListener(view -> { + if (uiMode < Configuration.UI_MODE_NIGHT_YES) { + uiMode = ResourceUtil.UI_MODE_DARK; + setColors(ResourceUtil.getColor(R.color.app_show_dark_background), ResourceUtil.getColor(R.color.app_show_dark_primary_text)); + imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_light_to_dark_mode)); + AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageViewMode.getDrawable(); + animatedVectorDrawable.start(); + } else { + uiMode = ResourceUtil.UI_MODE_LIGHT; + setColors(ResourceUtil.getColor(R.color.app_show_light_background), ResourceUtil.getColor(R.color.app_show_light_primary_text)); + imageViewMode.setImageDrawable(AppCompatResources.getDrawable(this, R.drawable.animation_dark_to_light_mode)); + AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) imageViewMode.getDrawable(); + animatedVectorDrawable.start(); + } + }); + } + + private void initUiVisibility() { + uiVisibilityChangeSupport = new VariableChangeSupport<>(true, new VariableChangeListener() { + @Override + public void onChange(T newValue, T oldValue) { + ObjectAnimator.ofFloat(imageViewMode, View.ALPHA, (boolean) newValue ? 0.0f : 1.0f, (boolean) newValue ? 1.0f : 0.0f).start(); + } + }); + constraintLayoutRoot.setOnClickListener(view -> uiVisibilityChangeSupport.setValue(!uiVisibilityChangeSupport.getValue())); + } + private void initTextSwitcher() { ViewSwitcher.ViewFactory viewFactory = () -> { TextView textView = new TextView(getApplicationContext()); @@ -208,7 +220,7 @@ public class MainActivity extends AppCompatActivity { } private void setColors(@ColorInt int backgroundColor, @ColorInt int primaryTextColor) { - ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofArgb(constraintLayoutTimeScreen, "backgroundColor", ((ColorDrawable) constraintLayoutTimeScreen.getBackground()).getColor(), backgroundColor); + ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofArgb(constraintLayoutRoot, "backgroundColor", ((ColorDrawable) constraintLayoutRoot.getBackground()).getColor(), backgroundColor); backgroundColorAnimator.setDuration(500L); backgroundColorAnimator.start(); ((TextView) textSwitcherHourTen.getChildAt(0)).setTextColor(primaryTextColor); diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/tools/translation/MainActivity.java b/app/src/main/java/com/fatapp/oxygentoolbox/tools/translation/MainActivity.java index 086db25..e06617e 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/tools/translation/MainActivity.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/tools/translation/MainActivity.java @@ -87,7 +87,33 @@ public class MainActivity extends AppCompatActivity { initView(); initLayout(); + initLanguageChoose(); + initTranslation(); + } + private void initTranslation() { + editTextFrom.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + imageViewTranslate.setEnabled(charSequence.length() != 0); + } + + @Override + public void afterTextChanged(Editable editable) { + } + }); + + textViewTo.setOnFocusChangeListener((view, b) -> ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(editTextFrom.getWindowToken(), 0)); + + imageViewTranslate.setEnabled(false); + imageViewTranslate.setOnClickListener(view -> translate()); + } + + private void initLanguageChoose() { textViewLanguageFrom.setOnClickListener(view -> new MaterialAlertDialogBuilder(this) .setTitle(ResourceUtil.getString(R.string.tool_translation_choose_language)) .setItems(languageTo.equals(LANGUAGE_CHINESE) ? CHINESE_ITEMS : OTHER_ITEMS, (dialogInterface, i) -> { @@ -114,26 +140,6 @@ public class MainActivity extends AppCompatActivity { textViewLanguageFrom.setText(textViewLanguageTo.getText()); textViewLanguageTo.setText(temp); }); - - editTextFrom.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { - } - - @Override - public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { - imageViewTranslate.setEnabled(charSequence.length() != 0); - } - - @Override - public void afterTextChanged(Editable editable) { - } - }); - - textViewTo.setOnFocusChangeListener((view, b) -> ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(editTextFrom.getWindowToken(), 0)); - - imageViewTranslate.setEnabled(false); - imageViewTranslate.setOnClickListener(view -> translate()); } private void initLayout() { diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutFragment.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutFragment.java index eef1c6a..a0ef9c0 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutFragment.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutFragment.java @@ -14,23 +14,34 @@ import com.fatapp.oxygentoolbox.R; import com.fatapp.oxygentoolbox.util.ResourceUtil; public class AboutFragment extends Fragment { + private TextView textViewAppVersion; + private TextView textViewOpenSource; - private AboutViewModel aboutViewModel; + private void initView(View root) { + textViewAppVersion = root.findViewById(R.id.text_view_app_version); + textViewOpenSource = root.findViewById(R.id.text_view_open_source); + } public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_about, container, false); - TextView appVersion = root.findViewById(R.id.app_version); - appVersion.setText(String.format(ResourceUtil.getAppLocale(), "%s(%d)", ResourceUtil.getAppVersionName(), ResourceUtil.getAppVersionCode())); + initView(root); + initAppVersion(); + initOpenSource(); - TextView openSource = root.findViewById(R.id.open_source); - openSource.setOnClickListener(view -> { + return root; + } + + private void initOpenSource() { + textViewOpenSource.setOnClickListener(view -> { Intent intent = new Intent(getActivity(), LibrariesActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }); + } - return root; + private void initAppVersion() { + textViewAppVersion.setText(String.format(ResourceUtil.getAppLocale(), "%s(%d)", ResourceUtil.getAppVersionName(), ResourceUtil.getAppVersionCode())); } } \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutViewModel.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutViewModel.java deleted file mode 100644 index 8c1aead..0000000 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/AboutViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fatapp.oxygentoolbox.ui.about; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class AboutViewModel extends ViewModel { - - private MutableLiveData mText; - - public AboutViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is about fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/LibrariesActivity.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/LibrariesActivity.java index a0c6b1d..39db278 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/LibrariesActivity.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/LibrariesActivity.java @@ -30,12 +30,18 @@ import java.io.InputStreamReader; import java.util.Objects; public class LibrariesActivity extends AppCompatActivity { + private LibrariesAdapter librariesAdapter; + + private ConstraintLayout constraintLayoutRoot; private Toolbar toolbar; - private ConstraintLayout librariesPage; - private RecyclerView librariesRecyclerView; + private RecyclerView recyclerViewLibraries; private SearchView searchView; - private LibrariesAdapter librariesAdapter; + private void initView() { + constraintLayoutRoot = findViewById(R.id.constraint_layout_root); + toolbar = findViewById(R.id.toolbar); + recyclerViewLibraries = findViewById(R.id.recycler_view_libraries); + } @Override protected void onCreate(Bundle savedInstanceState) { @@ -44,23 +50,17 @@ public class LibrariesActivity extends AppCompatActivity { initView(); initLayout(); - loadLibraries(); - } - - private void initView() { - toolbar = findViewById(R.id.toolbar); - librariesPage = findViewById(R.id.libraries_page); - librariesRecyclerView = findViewById(R.id.libraries_recycler_view); + initLibraries(); } private void initLayout() { - librariesPage.setPadding(0, ResourceUtil.getStatusBarHeight(getWindow(), getApplicationContext()), 0, 0); + constraintLayoutRoot.setPadding(0, ResourceUtil.getStatusBarHeight(getWindow(), getApplicationContext()), 0, 0); setSupportActionBar(toolbar); Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); Objects.requireNonNull(getSupportActionBar()).setTitle(R.string.setting_open_source); } - private void loadLibraries() { + private void initLibraries() { StringBuilder dependenciesJson = new StringBuilder(); try { InputStream inputStream = ResourceUtil.getResources().openRawResource(R.raw.dependencies); @@ -72,10 +72,10 @@ public class LibrariesActivity extends AppCompatActivity { } DependenciesJson dependencies = new Gson().fromJson(dependenciesJson.toString(), new TypeToken() { }.getType()); - librariesRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); + recyclerViewLibraries.setLayoutManager(new LinearLayoutManager(getApplicationContext())); librariesAdapter = new LibrariesAdapter(this, dependencies); - librariesRecyclerView.addItemDecoration(new LibrariesAdapter.LibrariesItemDecoration()); - librariesRecyclerView.setAdapter(librariesAdapter); + recyclerViewLibraries.addItemDecoration(new LibrariesAdapter.LibrariesItemDecoration()); + recyclerViewLibraries.setAdapter(librariesAdapter); } catch (IOException e) { Log.d("TAG", e.toString()); } diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/util/LibrariesAdapter.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/util/LibrariesAdapter.java index ec21519..aa64025 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/util/LibrariesAdapter.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/about/util/LibrariesAdapter.java @@ -141,11 +141,11 @@ public class LibrariesAdapter extends RecyclerView.Adapter { - bottomNavViewPager.setCurrentItem(item.getOrder()); + return root; + } + + private void initBottomNav() { + navigationViewBottomNav.setOnItemSelectedListener(item -> { + viewPagerBottomNav.setCurrentItem(item.getOrder()); return true; }); - bottomNavViewPager.setAdapter(new FragmentStateAdapter(this) { + + viewPagerBottomNav.setAdapter(new FragmentStateAdapter(this) { @NonNull @Override public Fragment createFragment(int position) { @@ -56,10 +56,13 @@ public class HomeFragment extends Fragment { return 2; } }); - - bottomNavViewPager.setCurrentItem(SharedPreferencesUtils.getPreferenceLaunchPage() == ResourceUtil.LaunchPage.TOOLS ? 0 : 1, false); - - return root; + viewPagerBottomNav.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + @Override + public void onPageSelected(int position) { + navigationViewBottomNav.getMenu().getItem(position).setChecked(true); + } + }); + viewPagerBottomNav.setCurrentItem(SharedPreferencesUtils.getPreferenceLaunchPage() == ResourceUtil.LaunchPage.TOOLS ? 0 : 1, false); } } \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/HomeViewModel.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/HomeViewModel.java deleted file mode 100644 index 56a4dcc..0000000 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/HomeViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fatapp.oxygentoolbox.ui.home; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class HomeViewModel extends ViewModel { - - private MutableLiveData mText; - - public HomeViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is home fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsFragment.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsFragment.java index f1c9903..7e0d985 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsFragment.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsFragment.java @@ -7,7 +7,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -16,29 +15,23 @@ import com.fatapp.oxygentoolbox.ui.home.util.ToolsAdapter; public class ToolsFragment extends Fragment { - private View root; + private RecyclerView recyclerViewTools; - private ToolsViewModel toolsViewModel; - - private RecyclerView toolsRecyclerView; + private void initView(View root) { + recyclerViewTools = root.findViewById(R.id.recycler_view_tools); + } 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); + View root = inflater.inflate(R.layout.fragment_home_tools, container, false); - //init - initView(); - initLayout(); + initView(root); + initTools(); return root; } - private void initView() { - toolsRecyclerView = root.findViewById(R.id.tools_recycler_view); - } - - private void initLayout() { - toolsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - toolsRecyclerView.setAdapter(new ToolsAdapter(getActivity())); + private void initTools() { + recyclerViewTools.setLayoutManager(new LinearLayoutManager(getContext())); + recyclerViewTools.setAdapter(new ToolsAdapter(getActivity())); } } \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsViewModel.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsViewModel.java deleted file mode 100644 index 7b391e4..0000000 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/tools/ToolsViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -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 mText; - - public ToolsViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is home fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/util/ToolsAdapter.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/util/ToolsAdapter.java index ea66f61..4651cbb 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/util/ToolsAdapter.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/home/util/ToolsAdapter.java @@ -46,7 +46,7 @@ public class ToolsAdapter extends RecyclerView.Adapter ToolsList.Tool tool = ToolsList.getToolList().get(position); for (ToolsList.Button button : tool.getButtonList()) { View toolButtonLayout = LayoutInflater.from(parent.getContext()).inflate(R.layout.fold_layout_button, parent, false); - Button toolButton = toolButtonLayout.findViewById(R.id.tool_button); + Button toolButton = toolButtonLayout.findViewById(R.id.button_tool); toolButton.setText(button.getText()); toolButton.setOnClickListener(view -> ToolsLauncher.launch(activity, parent.getContext(), button.getActivity())); toolButton.setOnTouchListener((view, motionEvent) -> { @@ -66,10 +66,10 @@ public class ToolsAdapter extends RecyclerView.Adapter autoLinefeedLayout.addView(toolButtonLayout); } - TextView foldLayoutIcon = holder.getFoldLayout().findViewById(R.id.fold_layout_icon); + TextView foldLayoutIcon = holder.getFoldLayout().findViewById(R.id.text_view_icon); foldLayoutIcon.setTypeface(Typeface.createFromAsset(parent.getContext().getAssets(), tool.getFont())); foldLayoutIcon.setText(tool.getIcon()); - ((TextView) holder.getFoldLayout().findViewById(R.id.fold_layout_text_view)).setText(tool.getFoldLayoutTitle()); + ((TextView) holder.getFoldLayout().findViewById(R.id.text_view_title)).setText(tool.getFoldLayoutTitle()); holder.getFoldLayout().addItemView(Collections.singletonList(foldLayoutBodyLayout)); } diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingFragment.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingFragment.java index 5279b7e..1620d8c 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingFragment.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingFragment.java @@ -17,6 +17,7 @@ public class SettingFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { setPreferencesFromResource(R.xml.fragment_setting, rootKey); + ListPreference appLanguagePreference = findPreference(ResourceUtil.getString(R.string.setting_language_key)); if (appLanguagePreference != null) { appLanguagePreference.setOnPreferenceChangeListener((preference, newValue) -> { diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingViewModel.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingViewModel.java deleted file mode 100644 index 2be9f35..0000000 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/setting/SettingViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fatapp.oxygentoolbox.ui.setting; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class SettingViewModel extends ViewModel { - - private MutableLiveData mText; - - public SettingViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is setting fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeFragment.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeFragment.java index 8e5dca6..8c7d001 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeFragment.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeFragment.java @@ -7,7 +7,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -15,17 +14,23 @@ import com.fatapp.oxygentoolbox.R; import com.fatapp.oxygentoolbox.ui.theme.util.ThemesAdapter; public class ThemeFragment extends Fragment { + private RecyclerView recyclerViewThemes; - private ThemeViewModel themeViewModel; + private void initView(View root) { + recyclerViewThemes = root.findViewById(R.id.recycler_view_themes); + } public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - themeViewModel = new ViewModelProvider(this).get(ThemeViewModel.class); View root = inflater.inflate(R.layout.fragment_theme, container, false); - RecyclerView themeRecyclerView = root.findViewById(R.id.theme_recycler_view); - themeRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - themeRecyclerView.setAdapter(new ThemesAdapter(getActivity())); + initView(root); + initThemes(); return root; } + + private void initThemes() { + recyclerViewThemes.setLayoutManager(new LinearLayoutManager(getContext())); + recyclerViewThemes.setAdapter(new ThemesAdapter(getActivity())); + } } \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeViewModel.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeViewModel.java deleted file mode 100644 index bbda7fb..0000000 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/ThemeViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fatapp.oxygentoolbox.ui.theme; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class ThemeViewModel extends ViewModel { - - private MutableLiveData mText; - - public ThemeViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is theme fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/util/ThemesAdapter.java b/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/util/ThemesAdapter.java index 0fc5a8a..a45db2d 100644 --- a/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/util/ThemesAdapter.java +++ b/app/src/main/java/com/fatapp/oxygentoolbox/ui/theme/util/ThemesAdapter.java @@ -116,13 +116,13 @@ public class ThemesAdapter extends RecyclerView.Adapter + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> @@ -20,9 +20,9 @@ android:duration="300" android:interpolator="@android:interpolator/fast_out_slow_in" android:propertyName="pathData" - android:valueFrom="M 1008.02 276.637 C 983.509 254.352 945.634 256.617 923.35 278.864 L 513.35 720.056 L 103.351 278.826 C 81.067 254.315 43.18 254.315 18.668 276.599 C -5.843 298.883 -5.843 336.758 16.441 361.269 L 468.782 849.245 C 479.918 860.393 495.52 869.264 513.35 869.264 C 528.941 869.264 546.77 862.583 557.906 849.245 L 1010.247 361.269 C 1032.531 336.758 1032.531 298.883 1008.02 276.599 Z M 1008.02 276.637" - android:valueTo="M 13.25 15.29 C -4.56 34.88 -2.78 65.15 15 83 L 367.64 410.64 L 15 738.32 C -4.56 756.14 -4.56 786.41 13.25 806 C 31.06 825.59 61.33 825.59 80.92 807.78 L 470.92 446.26 C 479.83 437.36 486.92 424.89 486.92 410.64 C 486.92 398.18 481.58 383.93 470.92 375.03 L 80.92 13.51 C 61.33 -4.3 31.06 -4.3 13.25 15.29 Z M 13.25 15.29" + android:valueFrom="M23.58,6.48C23.01,5.96 22.12,6.01 21.6,6.54L12.01,16.88L2.42,6.54C1.9,5.96 1.01,5.96 0.44,6.48C-0.14,7.01 -0.14,7.89 0.38,8.47L10.97,19.9C11.23,20.17 11.59,20.37 12.01,20.37C12.37,20.37 12.79,20.22 13.05,19.9L23.63,8.47C24.15,7.89 24.15,7.01 23.58,6.48Z" + android:valueTo="M0.31,0.36C-0.11,0.82 -0.07,1.53 0.35,1.95L8.6,9.62L0.35,17.3C-0.11,17.72 -0.11,18.43 0.31,18.89C0.73,19.35 1.43,19.35 1.89,18.93L11.02,10.46C11.22,10.25 11.39,9.96 11.39,9.62C11.39,9.33 11.27,9 11.02,8.79L1.89,0.32C1.43,-0.1 0.73,-0.1 0.31,0.36Z" android:valueType="pathType" /> - + \ No newline at end of file diff --git a/app/src/main/res/drawable/animation_right_to_down_arrow.xml b/app/src/main/res/drawable/animation_right_to_down_arrow.xml index 077bd57..5f2da66 100644 --- a/app/src/main/res/drawable/animation_right_to_down_arrow.xml +++ b/app/src/main/res/drawable/animation_right_to_down_arrow.xml @@ -4,13 +4,13 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> @@ -20,10 +20,10 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_dark_mode.xml b/app/src/main/res/drawable/ic_dark_mode.xml deleted file mode 100644 index 8d18990..0000000 --- a/app/src/main/res/drawable/ic_dark_mode.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_favorite.xml b/app/src/main/res/drawable/ic_favorite.xml new file mode 100644 index 0000000..199edd6 --- /dev/null +++ b/app/src/main/res/drawable/ic_favorite.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml new file mode 100644 index 0000000..e0db9e7 --- /dev/null +++ b/app/src/main/res/drawable/ic_home.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_light_mode.xml b/app/src/main/res/drawable/ic_light_mode.xml deleted file mode 100644 index 56493bb..0000000 --- a/app/src/main/res/drawable/ic_light_mode.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_menu_about.xml b/app/src/main/res/drawable/ic_menu_about.xml index 150043d..94fd6d8 100644 --- a/app/src/main/res/drawable/ic_menu_about.xml +++ b/app/src/main/res/drawable/ic_menu_about.xml @@ -1,11 +1,12 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M 12 0 C 5.376 0 0 5.376 0 12 s 5.376 12 12 12 12 -5.376 12 -12 S 18.624 0 12 0 z m 1.464 18.144 c 0 0.648 -0.528 1.176 -1.176 1.176 h -0.588 c -0.648 0 -1.176 -0.528 -1.176 -1.176 V 11.124 c 0 -0.648 0.528 -1.176 1.176 -1.176 h 0.588 c 0.648 0 1.176 0.528 1.176 1.176 v 7.02 z M 12 8.196 c -0.804 0 -1.464 -0.66 -1.464 -1.464 0 -0.804 0.66 -1.464 1.464 -1.464 s 1.464 0.66 1.464 1.464 c 0 0.804 -0.66 1.464 -1.464 1.464 z +" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu_exit.xml b/app/src/main/res/drawable/ic_menu_exit.xml index 237ce80..d8f9373 100644 --- a/app/src/main/res/drawable/ic_menu_exit.xml +++ b/app/src/main/res/drawable/ic_menu_exit.xml @@ -1,17 +1,17 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M 22.32890625 11.53359375 c -0.0328125 -0.0421875 -0.07265625 -0.0796875 -0.1125 -0.11484375 l -4.1953125 -4.19296875 c -0.29296875 -0.29296875 -0.77109375 -0.29296875 -1.0640625 0 s -0.29296875 0.77109375 0 1.0640625 l 2.953125 2.953125 H 9.87421875 h -0.00234375 c -0.4265625 0 -0.77109375 0.346875 -0.77109375 0.7734375 s 0.34453125 0.7734375 0.77109375 0.7734375 c 0.00703125 0.00234375 0.01171875 0 0.01640625 0 h 10.0265625 l -2.953125 2.953125 c -0.28828125 0.28828125 -0.28828125 0.759375 0 1.04765625 l 0.01640625 0.01640625 c 0.28828125 0.28828125 0.759375 0.28828125 1.04765625 0 l 4.265625 -4.265625 c 0.27421875 -0.27421875 0.28828125 -0.7171875 0.0375 -1.0078125 z" /> + android:pathData="M 13.17890625 18.7265625 c -0.421875 0 -0.76640625 0.34453125 -0.76640625 0.76640625 v 1.4953125 H 3.028125 V 3.01640625 h 9.384375 v 1.47890625 c 0 0.421875 0.34453125 0.76640625 0.76640625 0.76640625 s 0.76640625 -0.34453125 0.76640625 -0.76640625 V 2.25703125 c 0 -0.08203125 -0.0140625 -0.159375 -0.0375 -0.234375 -0.0984375 -0.31171875 -0.3890625 -0.5390625 -0.73125 -0.5390625 H 2.2640625 c -0.421875 0 -0.76640625 0.34453125 -0.76640625 0.76640625 v 19.49765625 c 0 0.3328125 0.215625 0.61640625 0.5109375 0.721875 0.084375 0.0328125 0.17578125 0.04921875 0.26953125 0.04921875 h 10.85625 c 0.0140625 0 0.03046875 0.00234375 0.04453125 0.00234375 0.421875 0 0.76640625 -0.34453125 0.76640625 -0.76640625 v -2.26171875 c 0 -0.421875 -0.34453125 -0.76640625 -0.76640625 -0.76640625 z" /> + android:pathData="M 6.01875 12.01640625 a 0.77109375 0.7734375 0 0.0234375 0 1.5421875 0 0.77109375 0.7734375 0 0.0234375 0 -1.5421875 0 Z" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu_home.xml b/app/src/main/res/drawable/ic_menu_home.xml index 2d291f4..025bc5a 100644 --- a/app/src/main/res/drawable/ic_menu_home.xml +++ b/app/src/main/res/drawable/ic_menu_home.xml @@ -1,11 +1,11 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M 23.7803571328125 11.8125 L 12.747321421875 0.7875 a 0.8552678671875 0.8552678671875 0 0 0 -1.2107142890625 0 L 0.503571421875 11.8125 c -0.321428578125 0.321428578125 -0.503571421875 0.7580357109375 -0.503571421875 1.2133928671875 0 0.9455357109375 0.76875 1.7142857109375 1.7142857109375 1.7142857109375 h 1.1625 V 22.6071428671875 c 0 0.4741071328125 0.3830357109375 0.8571428671875 0.8571428671875 0.85714284375 H 10.427678578125 V 17.4642857109375 h 3 v 6 h 7.122321421875 c 0.4741071328125 0 0.8571428671875 -0.3830357109375 0.8571428671875 -0.85714284375 V 14.740178578125 h 1.1625 c 0.4553571328125 0 0.8919642890625 -0.1794642890625 1.21339284375 -0.5035714453125 0.6669642890625 -0.6696428671875 0.6669642890625 -1.7544642890625 -0.002678578125 -2.4241071328125 z" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu_setting.xml b/app/src/main/res/drawable/ic_menu_setting.xml index 2b07feb..eeaa522 100644 --- a/app/src/main/res/drawable/ic_menu_setting.xml +++ b/app/src/main/res/drawable/ic_menu_setting.xml @@ -1,11 +1,13 @@ + xmlns:tools="http://schemas.android.com/tools" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M 12.714 1.9999999921875 c 0.5500000078125 -0.0100000078125 1.071 0.1900000078125 1.4599999921875 0.57 0.3910000078125 0.3700000078125 0.6 0.8800000078125 0.6 1.4200000078125 0 1.0999999921875 0.9100000078125 1.9909999921875 2.0410000078125 1.9909999921875 0.3499999921875 0 0.7000000078125 -0.1000000078125 1.0099999921875 -0.27 0.9700000078125 -0.522 2.1799999921875 -0.1900000078125 2.73 0.740000015625 l 0.680000015625 1.17 c 0.1699999921875 0.3 0.27 0.6400000078125 0.27 0.99 0 0.7099999921875 -0.39 1.3699999921875 -1.02 1.719999984375 -0.3100000078125 0.1699999921875 -0.57 0.4300000078125 -0.75 0.7300000078125 a 1.9600000078125 1.9600000078125 0 0 0 0.75 2.67 1.9780000078125 1.9780000078125 0 0 0.0234375 0.75 2.7 l -0.680000015625 1.1299999921875 c -0.36 0.6199999921875 -1.0300000078125 1.0000000078125 -1.749999984375 1.0000000078125 -0.36 0 -0.72 -0.09 -1.02 -0.27 -0.3199999921875 -0.1699999921875 -0.6700000078125 -0.27 -1.02 -0.27 -0.54 0 -1.0600000078125 0.21 -1.44 0.5899999921875 -0.39 0.3700000078125 -0.6 0.8800000078125 -0.6 1.41 0 1.0900000078125 -0.9100000078125 1.98 -2.04 1.98 h -1.370000015625 c -0.54 0 -1.05 -0.2200000078125 -1.419999984375 -0.5899999921875 -0.3799999921875 -0.3799999921875 -0.5800000078125 -0.8800000078125 -0.5800000078125 -1.3999999921875 0 -1.0999999921875 -0.9 -1.9900000078125 -2.0299999921875 -1.9900000078125 -0.3700000078125 0 -0.7300000078125 0.1000000078125 -1.040000015625 0.2899999921875 a 2.1499999921875 2.1499999921875 0 0 0.0234375 -1.5499999921875 0.200000015625 c -0.5200000078125 -0.1399999921875 -0.9700000078125 -0.48 -1.2400000078125 -0.93 l -0.639999984375 -1.130000015625 a 1.9489999921875 1.9489999921875 0 0 0.0234375 -0.2500000078125 -1.56 c 0.1399999921875 -0.5299999921875 0.4999999921875 -0.9799999921875 0.99 -1.2499999921875 0.3100000078125 -0.1699999921875 0.57 -0.42 0.75 -0.7300000078125 a 1.98 1.98 0 0 0 -0.75 -2.67 1.947 1.947 0 0 0.0234375 -0.7399999921875 -2.67 l 0.639999984375 -1.119999984375 c 0.27 -0.4699999921875 0.72 -0.81 1.250000015625 -0.950000015625 a 2.0659999921875 2.0659999921875 0 0 0.0234375 1.56 0.21 c 0.3199999921875 0.1699999921875 0.6700000078125 0.2599999921875 1.02 0.260000015625 0.54 0 1.0600000078125 -0.21 1.44 -0.5800000078125 0.3799999921875 -0.3700000078125 0.5899999921875 -0.8800000078125 0.5899999921875 -1.3999999921875 0 -1.0999999921875 0.9100000078125 -1.9900000078125 2.04 -1.9900000078125 z m 0.4009999921875 7.481000015625 a 2.853 2.853 0 0 0 -3.069999984375 0.5899999921875 c -0.7999999921875 0.78 -1.05 1.9699999921875 -0.6100000078125 2.9899999921875 a 2.7940000078125 2.7940000078125 0 0 0 2.5900000078125 1.700000015625 h 0.009999984375 c 0.75 0.0100000078125 1.4500000078125 -0.2800000078125 1.98 -0.800000015625 0.5299999921875 -0.51 0.8299999921875 -1.2100000078125 0.830000015625 -1.9399999921875 0.0100000078125 -1.11 -0.6799999921875 -2.1199999921875 -1.730000015625 -2.5399999921875 z" + tools:ignore="VectorPath" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu_theme.xml b/app/src/main/res/drawable/ic_menu_theme.xml index f034f86..e1a39c1 100644 --- a/app/src/main/res/drawable/ic_menu_theme.xml +++ b/app/src/main/res/drawable/ic_menu_theme.xml @@ -1,11 +1,13 @@ + xmlns:tools="http://schemas.android.com/tools" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:pathData="M 23.5342471875 7.52559375 L 17.8774425 1.8687890625 a 1.6000078125 1.6000078125 0 0 0 -2.262796875 0 l -0.7099921875 0.710015625 a 1.60040625 1.60040625 0 0 0.0234375 -1.1312109375 0.468796875 H 10.2298565625 a 1.5979921875 1.5979921875 0 0 0.0234375 -1.1312109375 -0.468796875 l -0.7099921875 -0.710015625 a 1.6000078125 1.6000078125 0 0 0 -2.262796875 0 L 0.4686534375 7.52559375 a 1.6000078125 1.6000078125 0 0 0 0 2.262796875 l 2.262796875 2.2628203125 a 1.59 1.59 0 0 0 1.5619921875 0.4047890625 c 0.25321875 -0.072 0.5080078125 0.0979921875 0.5080078125 0.3611953125 V 21 c 0 0.8800078125 0.72 1.6000078125 1.6000078125 1.6000078125 H 17.6014190625 c 0.8800078125 0 1.6000078125 -0.72 1.6000078125 -1.6000078125 V 12.8171953125 c 0 -0.263203125 0.2548125 -0.4331953125 0.5080078125 -0.3611953125 a 1.59 1.59 0 0 0 1.5619921875 -0.4047890625 l 2.262796875 -2.2628203125 a 1.6000078125 1.6000078125 0 0 0 0 -2.262796875 z" + tools:ignore="VectorPath" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_translate.xml b/app/src/main/res/drawable/ic_tool_translation_translate.xml similarity index 100% rename from app/src/main/res/drawable/ic_translate.xml rename to app/src/main/res/drawable/ic_tool_translation_translate.xml diff --git a/app/src/main/res/layout/activity_libraries.xml b/app/src/main/res/layout/activity_libraries.xml index 8e04f51..ef3c7fb 100644 --- a/app/src/main/res/layout/activity_libraries.xml +++ b/app/src/main/res/layout/activity_libraries.xml @@ -2,7 +2,7 @@ @@ -32,14 +32,14 @@ @@ -47,17 +47,17 @@ @@ -65,7 +65,7 @@ @@ -73,17 +73,17 @@ @@ -91,7 +91,7 @@ @@ -101,7 +101,7 @@ android:id="@+id/text_view_date" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="10dp" + android:padding="@dimen/tool_time_screen_clickable_padding" android:textColor="?attr/app_show_second_text_theme" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/activity_tool_translation.xml b/app/src/main/res/layout/activity_tool_translation.xml index c1a70fb..5233725 100644 --- a/app/src/main/res/layout/activity_tool_translation.xml +++ b/app/src/main/res/layout/activity_tool_translation.xml @@ -34,7 +34,7 @@ android:id="@+id/linear_layout_language" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="10dp" + android:layout_margin="@dimen/tool_translation_layout_margin" android:background="@drawable/background_top_bottom_radius" android:gravity="center" android:orientation="horizontal" @@ -48,14 +48,14 @@ android:gravity="center" android:text="@string/tool_translation_language_chinese" android:textColor="?attr/app_theme" - android:textSize="16sp" /> + android:textSize="@dimen/tool_translation_text_size" /> + android:textSize="@dimen/tool_translation_text_size" /> diff --git a/app/src/main/res/layout/fold_layout_body.xml b/app/src/main/res/layout/fold_layout_body.xml index 8d1fed1..814510d 100644 --- a/app/src/main/res/layout/fold_layout_body.xml +++ b/app/src/main/res/layout/fold_layout_body.xml @@ -1,6 +1,6 @@ + android:paddingHorizontal="@dimen/fold_layout_body_auto_linefeed_layout_padding_horizontal" + android:paddingBottom="@dimen/fold_layout_body_auto_linefeed_layout_padding_bottom" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fold_layout_button.xml b/app/src/main/res/layout/fold_layout_button.xml index 9b50d9c..f47d43f 100644 --- a/app/src/main/res/layout/fold_layout_button.xml +++ b/app/src/main/res/layout/fold_layout_button.xml @@ -3,6 +3,6 @@ android:layout_width="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">