Added TimeScreen

This commit is contained in:
2022-08-11 14:56:10 +08:00
parent 440fe444c5
commit 46f86b8cca
33 changed files with 631 additions and 158 deletions

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="adb-a9f1bb3a-moNgbH._adb-tls-connect._tcp" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2022-08-08T12:01:47.147887300Z" />
</component>
</project>

9
.idea/misc.xml generated
View File

@@ -9,7 +9,11 @@
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ic_menu_setting.xml" value="0.246875" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ic_menu_setting.xml" value="0.246875" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ic_menu_theme.xml" value="0.246875" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ic_menu_theme.xml" value="0.246875" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ripple_foreground.xml" value="0.15520833333333334" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v21/ripple_foreground.xml" value="0.15520833333333334" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v24/avd_anim.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.11944444444444445" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.11944444444444445" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/animation_dark_to_light_mode.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/animation_down_to_right_arrow.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/animation_light_to_dark_mode.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/animation_right_to_down_arrow.xml" value="0.164" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/animation_right_to_down_arrow.xml" value="0.164" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/background_bottom_radius.xml" value="0.2915" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/background_bottom_radius.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/background_no_radius.xml" value="0.165" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/background_no_radius.xml" value="0.165" />
@@ -23,10 +27,12 @@
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic__about.xml" value="0.184" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic__about.xml" value="0.184" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_about.xml" value="0.184" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_about.xml" value="0.184" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_check.xml" value="0.165" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_check.xml" value="0.165" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_dark_mode.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_language.xml" value="0.184" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_language.xml" value="0.184" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launch.xml" value="0.182" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launch.xml" value="0.182" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launcher.xml" value="0.1335" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launcher.xml" value="0.1335" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launcher_background.xml" value="0.11944444444444445" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_launcher_background.xml" value="0.11944444444444445" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_light_mode.xml" value="0.2915" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_about.xml" value="0.1335" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_about.xml" value="0.1335" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_camera.xml" value="0.11944444444444445" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_camera.xml" value="0.11944444444444445" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_exit.xml" value="0.3525" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/drawable/ic_menu_exit.xml" value="0.3525" />
@@ -53,7 +59,10 @@
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_main.xml" value="0.1" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_splash.xml" value="0.1693840579710145" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_splash.xml" value="0.1693840579710145" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_time_screen.xml" value="0.34739583333333335" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_time_screen.xml" value="0.34739583333333335" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/activity_tool_time_screen.xml" value="0.30615735461801596" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_bar_main.xml" value="0.1" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_bar_main.xml" value="0.1" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_content_main.xml" value="0.21932449764856776" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/app_nav_header_main.xml" value="0.21932449764856776" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/basic_tool_list.xml" value="0.25" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/basic_tool_list.xml" value="0.25" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/content_main.xml" value="0.14990942028985507" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/content_main.xml" value="0.14990942028985507" />
<entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fold_layout.xml" value="0.67" /> <entry key="..\:/.workspace-android/Project-ToolBox/OxygenToolbox/app/src/main/res/layout/fold_layout.xml" value="0.67" />

View File

@@ -0,0 +1,12 @@
package com.fatapp.oxygentoolbox;
import android.text.format.DateFormat;
import org.junit.Test;
public class Tester {
@Test
public void dateFormat() {
System.out.println(DateFormat.format("HH:mm:ss dd MMM E", System.currentTimeMillis()));
}
}

View File

@@ -37,9 +37,10 @@
android:label="@string/setting_open_source" android:label="@string/setting_open_source"
android:theme="@style/Theme.OxygenToolbox.Default" /> android:theme="@style/Theme.OxygenToolbox.Default" />
<activity <activity
android:name=".tools.TimeScreenActivity" android:name=".tools.timescreen.MainActivity"
android:exported="false" android:exported="false"
android:theme="@style/Theme.OxygenToolbox.Default"> android:theme="@style/Theme.OxygenToolbox.Default"
android:screenOrientation="sensorLandscape">
<intent-filter> <intent-filter>
<action android:name="activity.timescreen" /> <action android:name="activity.timescreen" />

View File

@@ -21,7 +21,7 @@
"cn": "\u65f6\u95f4\u5c4f\u5e55", "cn": "\u65f6\u95f4\u5c4f\u5e55",
"en": "Time Screen" "en": "Time Screen"
}, },
"activity": "com.fatapp.oxygentoolbox.tools.TimeScreenActivity" "activity": "com.fatapp.oxygentoolbox.tools.timescreen.MainActivity"
}, },
{ {
"text": { "text": {

View File

@@ -92,7 +92,7 @@ public class MainActivity extends AppCompatActivity {
builder = new ShortcutInfo.Builder(this, "Time Screen") builder = new ShortcutInfo.Builder(this, "Time Screen")
.setIntent(new Intent() .setIntent(new Intent()
.setAction("activity.timescreen") .setAction("activity.timescreen")
.setClassName("com.fatapp.oxygentoolbox", "com.fatapp.oxygentoolbox.tools.TimeScreenActivity")) .setClassName("com.fatapp.oxygentoolbox", "com.fatapp.oxygentoolbox.tools.timescreen.TimeScreenActivity"))
.setShortLabel("Time Screen") .setShortLabel("Time Screen")
.setLongLabel("Time Screen") .setLongLabel("Time Screen")
.setIcon(Icon.createWithResource(this, R.drawable.ic_menu_home)); .setIcon(Icon.createWithResource(this, R.drawable.ic_menu_home));

View File

@@ -1,16 +0,0 @@
package com.fatapp.oxygentoolbox.tools;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.fatapp.oxygentoolbox.R;
public class TimeScreenActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_time_screen);
}
}

View File

@@ -0,0 +1,233 @@
package com.fatapp.oxygentoolbox.tools.timescreen;
import android.animation.ObjectAnimator;
import android.content.res.Configuration;
import android.graphics.Typeface;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.ViewSwitcher;
import androidx.annotation.ColorInt;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.fatapp.oxygentoolbox.R;
import com.fatapp.oxygentoolbox.util.ResourceUtil;
import com.fatapp.oxygentoolbox.util.VariableChangeListener;
import com.fatapp.oxygentoolbox.util.VariableChangeSupport;
import com.ypz.bangscreentools.BangScreenTools;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity extends AppCompatActivity {
private int uiMode = ResourceUtil.getAppUiMode();
private VariableChangeSupport<String> hourTenVariableChangeSupport;
private VariableChangeSupport<String> hourOneVariableChangeSupport;
private VariableChangeSupport<String> minuteTenVariableChangeSupport;
private VariableChangeSupport<String> minuteOneVariableChangeSupport;
private VariableChangeSupport<String> secondTenVariableChangeSupport;
private VariableChangeSupport<String> secondOneVariableChangeSupport;
private VariableChangeSupport<Boolean> dateVisibilityChangeSupport;
private VariableChangeSupport<Boolean> uiVisibilityChangeSupport;
private ConstraintLayout constraintLayoutTimeScreen;
private ImageView imageViewMode;
private TextSwitcher textSwitcherHourTen;
private TextSwitcher textSwitcherHourOne;
private TextView textViewColonHourMinute;
private TextSwitcher textSwitcherMinuteTen;
private TextSwitcher textSwitcherMinuteOne;
private TextView textViewColonMinuteSecond;
private TextSwitcher textSwitcherSecondTen;
private TextSwitcher textSwitcherSecondOne;
private TextView textViewDate;
private void initView() {
constraintLayoutTimeScreen = findViewById(R.id.constraint_layout_time_screen);
imageViewMode = findViewById(R.id.image_view_mode);
textSwitcherHourTen = findViewById(R.id.text_switcher_hour_ten);
textSwitcherHourOne = findViewById(R.id.text_switcher_hour_one);
textViewColonHourMinute = findViewById(R.id.text_view_colon_hour_minute);
textSwitcherMinuteTen = findViewById(R.id.text_switcher_minute_ten);
textSwitcherMinuteOne = findViewById(R.id.text_switcher_minute_one);
textViewColonMinuteSecond = findViewById(R.id.text_view_colon_minute_second);
textSwitcherSecondTen = findViewById(R.id.text_switcher_second_ten);
textSwitcherSecondOne = findViewById(R.id.text_switcher_second_one);
textViewDate = findViewById(R.id.text_view_date);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
BangScreenTools.getBangScreenTools().fullscreen(getWindow(), this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tool_time_screen);
initView();
initTextSwitcher();
constraintLayoutTimeScreen.setOnClickListener(view -> uiVisibilityChangeSupport.setValue(!uiVisibilityChangeSupport.getValue()));
uiVisibilityChangeSupport = new VariableChangeSupport<>(true, new VariableChangeListener() {
@Override
public <T> 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 <T> 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()));
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
runOnUiThread(() -> {
if (ResourceUtil.getAppLocale().getLanguage().equals("zh")) {
textViewDate.setText(new SimpleDateFormat("yyyy年M月d日 EEEE", ResourceUtil.getAppLocale()).format(new Date(System.currentTimeMillis())));
} else {
textViewDate.setText(new SimpleDateFormat("EEEE, d MMMM, yyyy", ResourceUtil.getAppLocale()).format(new Date(System.currentTimeMillis())));
}
hourTenVariableChangeSupport.setValue(DateFormat.format("HH", System.currentTimeMillis()).toString().substring(0, 1));
hourOneVariableChangeSupport.setValue(DateFormat.format("HH", System.currentTimeMillis()).toString().substring(1));
minuteTenVariableChangeSupport.setValue(DateFormat.format("mm", System.currentTimeMillis()).toString().substring(0, 1));
minuteOneVariableChangeSupport.setValue(DateFormat.format("mm", System.currentTimeMillis()).toString().substring(1));
secondTenVariableChangeSupport.setValue(DateFormat.format("ss", System.currentTimeMillis()).toString().substring(0, 1));
secondOneVariableChangeSupport.setValue(DateFormat.format("ss", System.currentTimeMillis()).toString().substring(1));
});
}
};
new Timer().schedule(timerTask, 0, 100L);
}
private void initTextSwitcher() {
ViewSwitcher.ViewFactory viewFactory = () -> {
TextView textView = new TextView(getApplicationContext());
textView.setGravity(Gravity.CENTER);
textView.setTextColor(ResourceUtil.getColor(R.color.app_show_primary_text));
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setTextSize(100f);
return textView;
};
String hourTen = DateFormat.format("HH", System.currentTimeMillis()).toString().substring(0, 1);
textSwitcherHourTen.setFactory(viewFactory);
textSwitcherHourTen.setCurrentText(hourTen);
hourTenVariableChangeSupport = new VariableChangeSupport<>(hourTen, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherHourTen.setText((CharSequence) newValue);
}
});
String hourOne = DateFormat.format("HH", System.currentTimeMillis()).toString().substring(1);
textSwitcherHourOne.setFactory(viewFactory);
textSwitcherHourOne.setCurrentText(hourOne);
hourOneVariableChangeSupport = new VariableChangeSupport<>(hourOne, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherHourOne.setText((CharSequence) newValue);
}
});
String minuteTen = DateFormat.format("mm", System.currentTimeMillis()).toString().substring(0, 1);
textSwitcherMinuteTen.setFactory(viewFactory);
textSwitcherMinuteTen.setCurrentText(minuteTen);
minuteTenVariableChangeSupport = new VariableChangeSupport<>(minuteTen, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherMinuteTen.setText((CharSequence) newValue);
}
});
String minuteOne = DateFormat.format("mm", System.currentTimeMillis()).toString().substring(1);
textSwitcherMinuteOne.setFactory(viewFactory);
textSwitcherMinuteOne.setCurrentText(minuteOne);
minuteOneVariableChangeSupport = new VariableChangeSupport<>(minuteOne, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherMinuteOne.setText((CharSequence) newValue);
}
});
String secondTen = DateFormat.format("ss", System.currentTimeMillis()).toString().substring(0, 1);
textSwitcherSecondTen.setFactory(viewFactory);
textSwitcherSecondTen.setCurrentText(secondTen);
secondTenVariableChangeSupport = new VariableChangeSupport<>(secondTen, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherSecondTen.setText((CharSequence) newValue);
}
});
String secondOne = DateFormat.format("ss", System.currentTimeMillis()).toString().substring(1);
textSwitcherSecondOne.setFactory(viewFactory);
textSwitcherSecondOne.setCurrentText(secondOne);
secondOneVariableChangeSupport = new VariableChangeSupport<>(secondOne, new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
textSwitcherSecondOne.setText((CharSequence) newValue);
}
});
}
private void setColors(@ColorInt int backgroundColor, @ColorInt int primaryTextColor) {
ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofArgb(constraintLayoutTimeScreen, "backgroundColor", ((ColorDrawable) constraintLayoutTimeScreen.getBackground()).getColor(), backgroundColor);
backgroundColorAnimator.setDuration(500L);
backgroundColorAnimator.start();
((TextView) textSwitcherHourTen.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherHourTen.getChildAt(1)).setTextColor(primaryTextColor);
((TextView) textSwitcherHourOne.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherHourOne.getChildAt(1)).setTextColor(primaryTextColor);
textViewColonHourMinute.setTextColor(primaryTextColor);
((TextView) textSwitcherMinuteTen.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherMinuteTen.getChildAt(1)).setTextColor(primaryTextColor);
((TextView) textSwitcherMinuteOne.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherMinuteOne.getChildAt(1)).setTextColor(primaryTextColor);
textViewColonMinuteSecond.setTextColor(primaryTextColor);
((TextView) textSwitcherSecondTen.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherSecondTen.getChildAt(1)).setTextColor(primaryTextColor);
((TextView) textSwitcherSecondOne.getChildAt(0)).setTextColor(primaryTextColor);
((TextView) textSwitcherSecondOne.getChildAt(1)).setTextColor(primaryTextColor);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
BangScreenTools.getBangScreenTools().windowChangeFullscreen(getWindow());
super.onWindowFocusChanged(hasFocus);
}
}

View File

@@ -14,6 +14,7 @@ import androidx.viewpager2.widget.ViewPager2;
import com.fatapp.oxygentoolbox.R; import com.fatapp.oxygentoolbox.R;
import com.fatapp.oxygentoolbox.ui.home.fav.FavFragment; import com.fatapp.oxygentoolbox.ui.home.fav.FavFragment;
import com.fatapp.oxygentoolbox.ui.home.tools.ToolsFragment; import com.fatapp.oxygentoolbox.ui.home.tools.ToolsFragment;
import com.fatapp.oxygentoolbox.util.ResourceUtil;
import com.fatapp.oxygentoolbox.util.SharedPreferencesUtils; import com.fatapp.oxygentoolbox.util.SharedPreferencesUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
@@ -56,7 +57,7 @@ public class HomeFragment extends Fragment {
} }
}); });
bottomNavViewPager.setCurrentItem(SharedPreferencesUtils.getPreferenceLaunchPage() == SharedPreferencesUtils.LaunchPage.TOOLS ? 0 : 1, false); bottomNavViewPager.setCurrentItem(SharedPreferencesUtils.getPreferenceLaunchPage() == ResourceUtil.LaunchPage.TOOLS ? 0 : 1, false);
return root; return root;
} }

View File

@@ -95,14 +95,14 @@ public class ThemesAdapter extends RecyclerView.Adapter<ThemesAdapter.ViewHolder
} }
holder.getThemeLayout().setOnClickListener(view -> { holder.getThemeLayout().setOnClickListener(view -> {
SharedPreferencesUtils.setPreferenceTheme(SharedPreferencesUtils.Theme.values()[position]); SharedPreferencesUtils.setPreferenceTheme(ResourceUtil.Theme.values()[position]);
ResourceUtil.restartActivity(activity, activity.getClass()); ResourceUtil.restartActivity(activity, activity.getClass());
}); });
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return SharedPreferencesUtils.Theme.values().length; return ResourceUtil.Theme.values().length;
} }
public static class ViewHolder extends RecyclerView.ViewHolder { public static class ViewHolder extends RecyclerView.ViewHolder {

View File

@@ -272,4 +272,19 @@ public final class ResourceUtil {
break; break;
} }
} }
@SuppressWarnings("unused")
public enum LaunchPage {
TOOLS, FAVOURITES
}
@SuppressWarnings("unused")
public enum UiMode {
SYSTEM, LIGHT, DARK
}
@SuppressWarnings("unused")
public enum Theme {
RED, PINK, PURPLE, DEEP_PURPLE, INDIGO, BLUE, LIGHT_BLUE, CYAN, TEAL, GREEN, LIGHT_GREEN, LIME, YELLOW, AMBER, ORANGE, DEEP_ORANGE, BROWN, GREY, BLUE_GREY
}
} }

View File

@@ -37,36 +37,21 @@ public class SharedPreferencesUtils {
return new Locale(language, country); return new Locale(language, country);
} }
public static LaunchPage getPreferenceLaunchPage() { public static ResourceUtil.LaunchPage getPreferenceLaunchPage() {
return LaunchPage.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_launch_page_key), ResourceUtil.getString(R.string.setting_launch_page_default_value))); return ResourceUtil.LaunchPage.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_launch_page_key), ResourceUtil.getString(R.string.setting_launch_page_default_value)));
} }
public static UiMode getPreferenceUiMode() { public static ResourceUtil.UiMode getPreferenceUiMode() {
return UiMode.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_ui_mode_key), ResourceUtil.getString(R.string.setting_ui_mode_default_value))); return ResourceUtil.UiMode.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_ui_mode_key), ResourceUtil.getString(R.string.setting_ui_mode_default_value)));
} }
public static Theme getPreferenceTheme() { public static ResourceUtil.Theme getPreferenceTheme() {
return Theme.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_theme_key), ResourceUtil.getString(R.string.setting_theme_default_value))); return ResourceUtil.Theme.valueOf(preferences.getString(ResourceUtil.getString(R.string.setting_theme_key), ResourceUtil.getString(R.string.setting_theme_default_value)));
} }
public static void setPreferenceTheme(Theme theme) { public static void setPreferenceTheme(ResourceUtil.Theme theme) {
SharedPreferences.Editor editor = preferences.edit(); SharedPreferences.Editor editor = preferences.edit();
editor.putString(ResourceUtil.getString(R.string.setting_theme_key), theme.toString()); editor.putString(ResourceUtil.getString(R.string.setting_theme_key), theme.toString());
editor.apply(); editor.apply();
} }
@SuppressWarnings("unused")
public enum LaunchPage {
TOOLS, FAVOURITES
}
@SuppressWarnings("unused")
public enum UiMode {
SYSTEM, LIGHT, DARK
}
@SuppressWarnings("unused")
public enum Theme {
RED, PINK, PURPLE, DEEP_PURPLE, INDIGO, BLUE, LIGHT_BLUE, CYAN, TEAL, GREEN, LIGHT_GREEN, LIME, YELLOW, AMBER, ORANGE, DEEP_ORANGE, BROWN, GREY, BLUE_GREY
}
} }

View File

@@ -0,0 +1,5 @@
package com.fatapp.oxygentoolbox.util;
public interface VariableChangeListener {
<T> void onChange(T newValue, T oldValue);
}

View File

@@ -0,0 +1,41 @@
package com.fatapp.oxygentoolbox.util;
import java.util.Objects;
public class VariableChangeSupport<T> {
private T value;
private VariableChangeListener onChangeListener;
public VariableChangeSupport() {
}
public VariableChangeSupport(T value) {
this.value = value;
}
public VariableChangeSupport(VariableChangeListener onChangeListener) {
this.onChangeListener = onChangeListener;
}
public VariableChangeSupport(T value, VariableChangeListener onChangeListener) {
this.value = value;
this.onChangeListener = onChangeListener;
}
public void setValue(T value) {
if (!Objects.equals(this.value, value)) {
if (onChangeListener != null) {
onChangeListener.onChange(value, this.value);
}
this.value = value;
}
}
public T getValue() {
return value;
}
public void setOnChangeListener(VariableChangeListener onChangeListener) {
this.onChangeListener = onChangeListener;
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="0"
android:fromYDelta="-100%"
android:toXDelta="0"
android:toYDelta="0" />
</set>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromXDelta="0"
android:fromYDelta="0"
android:toXDelta="0"
android:toYDelta="100%" />
</set>

View File

@@ -0,0 +1,28 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="mode"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:fillColor="?attr/app_show_second_text_theme"
android:pathData="M 11.1 7.5 C 11.1 5.69 11.99 4.08 13.36 3.1 C 12.92 3.04 12.46 3 12 3 L 12 3 L 12 3 C 7.03 3 3 7.03 3 12 C 3 16.97 7.03 21 12 21 C 16.97 21 21 16.97 21 12 C 21 11.54 20.96 11.08 20.9 10.64 C 19.92 12.01 18.32 12.9 16.5 12.9 C 15.507 12.9 14.576 12.631 13.776 12.162 C 12.976 11.693 12.307 11.024 11.838 10.224 C 11.369 9.424 11.1 8.493 11.1 7.5 M 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 L 3 12 M 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 L 21 12 M 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 L 12 3 M 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 L 12 21 M 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 M 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 M 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 L 18.185 5.815 M 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185"
android:strokeWidth="1" />
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
android:valueFrom="M 11.1 7.5 C 11.1 5.69 11.99 4.08 13.36 3.1 C 12.92 3.04 12.46 3 12 3 L 12 3 L 12 3 C 7.03 3 3 7.03 3 12 C 3 16.97 7.03 21 12 21 C 16.97 21 21 16.97 21 12 C 21 11.54 20.96 11.08 20.9 10.64 C 19.92 12.01 18.32 12.9 16.5 12.9 C 15.507 12.9 14.576 12.631 13.776 12.162 C 12.976 11.693 12.307 11.024 11.838 10.224 C 11.369 9.424 11.1 8.493 11.1 7.5 M 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 L 3 12 M 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 L 21 12 M 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 L 12 3 M 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 L 12 21 M 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 M 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 M 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 L 18.185 5.815 M 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185"
android:valueTo="M 13.329 7.179 C 12.906 7.062 12.46 7 12 7 C 12 7 12 7 12 7 L 12 7 L 12 7 C 9.24 7 7 9.24 7 12 C 7 14.76 9.24 17 12 17 C 14.76 17 17 14.76 17 12 C 17 11.54 16.938 11.094 16.821 10.671 C 16.705 10.248 16.534 9.847 16.317 9.477 C 16.1 9.107 15.837 8.767 15.535 8.465 C 15.233 8.163 14.893 7.9 14.523 7.683 C 14.153 7.466 13.752 7.295 13.329 7.179 M 2 13 C 1.45 13 1 12.55 1 12 C 1 11.45 1.45 11 2 11 L 4 11 C 4.55 11 5 11.45 5 12 C 5 12.55 4.55 13 4 13 L 2 13 L 2 13 M 20 13 C 19.45 13 19 12.55 19 12 C 19 11.45 19.45 11 20 11 L 22 11 C 22.55 11 23 11.45 23 12 C 23 12.55 22.55 13 22 13 L 20 13 L 20 13 M 11 2 C 11 1.45 11.45 1 12 1 C 12.55 1 13 1.45 13 2 L 13 4 C 13 4.55 12.55 5 12 5 C 11.45 5 11 4.55 11 4 L 11 2 L 11 2 M 11 20 C 11 19.45 11.45 19 12 19 C 12.55 19 13 19.45 13 20 L 13 22 C 13 22.55 12.55 23 12 23 C 11.45 23 11 22.55 11 22 L 11 20 L 11 20 M 5.99 4.58 L 7.05 5.64 C 7.44 6.02 7.43 6.66 7.05 7.05 C 6.67 7.44 6.03 7.44 5.64 7.05 L 4.58 5.99 C 4.19 5.61 4.19 4.97 4.58 4.58 C 4.96 4.19 5.6 4.19 5.99 4.58 L 5.99 4.58 M 18.36 16.95 L 19.42 18.01 C 19.81 18.39 19.81 19.03 19.42 19.42 C 19.04 19.81 18.4 19.81 18.01 19.42 L 16.95 18.36 C 16.56 17.98 16.56 17.34 16.95 16.95 C 17.33 16.56 17.97 16.56 18.36 16.95 L 18.36 16.95 M 18.36 7.05 C 17.98 7.44 17.34 7.43 16.95 7.05 C 16.56 6.67 16.56 6.03 16.95 5.64 L 18.01 4.58 C 18.39 4.19 19.03 4.19 19.42 4.58 C 19.81 4.96 19.81 5.6 19.42 5.99 L 19.42 5.99 L 18.36 7.05 M 7.05 18.36 L 5.99 19.42 C 5.61 19.81 4.97 19.8 4.58 19.42 C 4.19 19.04 4.19 18.4 4.58 18.01 L 5.64 16.95 C 6.02 16.56 6.66 16.56 7.05 16.95 C 7.44 17.33 7.44 17.97 7.05 18.36 L 7.05 18.36"
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>

View File

@@ -1,5 +1,4 @@
<animated-vector <animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"> xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable"> <aapt:attr name="android:drawable">
<vector <vector
@@ -10,20 +9,20 @@
android:viewportHeight="1024"> android:viewportHeight="1024">
<path <path
android:name="path" android:name="path"
android:pathData="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:fillColor="?attr/tools_arrow" android:fillColor="?attr/tools_arrow"
android:strokeWidth="1"/> android:pathData="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:strokeWidth="1" />
</vector> </vector>
</aapt:attr> </aapt:attr>
<target android:name="path"> <target android:name="path">
<aapt:attr name="android:animation"> <aapt:attr name="android:animation">
<objectAnimator <objectAnimator
android:propertyName="pathData"
android:duration="300" 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: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: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:valueType="pathType" android:valueType="pathType" />
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</aapt:attr> </aapt:attr>
</target> </target>
</animated-vector> </animated-vector>

View File

@@ -0,0 +1,28 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="mode"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:fillColor="?attr/app_show_second_text_theme"
android:pathData="M 13.329 7.179 C 12.906 7.062 12.46 7 12 7 C 12 7 12 7 12 7 L 12 7 L 12 7 C 9.24 7 7 9.24 7 12 C 7 14.76 9.24 17 12 17 C 14.76 17 17 14.76 17 12 C 17 11.54 16.938 11.094 16.821 10.671 C 16.705 10.248 16.534 9.847 16.317 9.477 C 16.1 9.107 15.837 8.767 15.535 8.465 C 15.233 8.163 14.893 7.9 14.523 7.683 C 14.153 7.466 13.752 7.295 13.329 7.179 M 2 13 C 1.45 13 1 12.55 1 12 C 1 11.45 1.45 11 2 11 L 4 11 C 4.55 11 5 11.45 5 12 C 5 12.55 4.55 13 4 13 L 2 13 L 2 13 M 20 13 C 19.45 13 19 12.55 19 12 C 19 11.45 19.45 11 20 11 L 22 11 C 22.55 11 23 11.45 23 12 C 23 12.55 22.55 13 22 13 L 20 13 L 20 13 M 11 2 C 11 1.45 11.45 1 12 1 C 12.55 1 13 1.45 13 2 L 13 4 C 13 4.55 12.55 5 12 5 C 11.45 5 11 4.55 11 4 L 11 2 L 11 2 M 11 20 C 11 19.45 11.45 19 12 19 C 12.55 19 13 19.45 13 20 L 13 22 C 13 22.55 12.55 23 12 23 C 11.45 23 11 22.55 11 22 L 11 20 L 11 20 M 5.99 4.58 L 7.05 5.64 C 7.44 6.02 7.43 6.66 7.05 7.05 C 6.67 7.44 6.03 7.44 5.64 7.05 L 4.58 5.99 C 4.19 5.61 4.19 4.97 4.58 4.58 C 4.96 4.19 5.6 4.19 5.99 4.58 L 5.99 4.58 M 18.36 16.95 L 19.42 18.01 C 19.81 18.39 19.81 19.03 19.42 19.42 C 19.04 19.81 18.4 19.81 18.01 19.42 L 16.95 18.36 C 16.56 17.98 16.56 17.34 16.95 16.95 C 17.33 16.56 17.97 16.56 18.36 16.95 L 18.36 16.95 M 18.36 7.05 C 17.98 7.44 17.34 7.43 16.95 7.05 C 16.56 6.67 16.56 6.03 16.95 5.64 L 18.01 4.58 C 18.39 4.19 19.03 4.19 19.42 4.58 C 19.81 4.96 19.81 5.6 19.42 5.99 L 19.42 5.99 L 18.36 7.05 M 7.05 18.36 L 5.99 19.42 C 5.61 19.81 4.97 19.8 4.58 19.42 C 4.19 19.04 4.19 18.4 4.58 18.01 L 5.64 16.95 C 6.02 16.56 6.66 16.56 7.05 16.95 C 7.44 17.33 7.44 17.97 7.05 18.36 L 7.05 18.36"
android:strokeWidth="1" />
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
android:valueFrom="M 13.329 7.179 C 12.906 7.062 12.46 7 12 7 C 12 7 12 7 12 7 L 12 7 L 12 7 C 9.24 7 7 9.24 7 12 C 7 14.76 9.24 17 12 17 C 14.76 17 17 14.76 17 12 C 17 11.54 16.938 11.094 16.821 10.671 C 16.705 10.248 16.534 9.847 16.317 9.477 C 16.1 9.107 15.837 8.767 15.535 8.465 C 15.233 8.163 14.893 7.9 14.523 7.683 C 14.153 7.466 13.752 7.295 13.329 7.179 M 2 13 C 1.45 13 1 12.55 1 12 C 1 11.45 1.45 11 2 11 L 4 11 C 4.55 11 5 11.45 5 12 C 5 12.55 4.55 13 4 13 L 2 13 L 2 13 M 20 13 C 19.45 13 19 12.55 19 12 C 19 11.45 19.45 11 20 11 L 22 11 C 22.55 11 23 11.45 23 12 C 23 12.55 22.55 13 22 13 L 20 13 L 20 13 M 11 2 C 11 1.45 11.45 1 12 1 C 12.55 1 13 1.45 13 2 L 13 4 C 13 4.55 12.55 5 12 5 C 11.45 5 11 4.55 11 4 L 11 2 L 11 2 M 11 20 C 11 19.45 11.45 19 12 19 C 12.55 19 13 19.45 13 20 L 13 22 C 13 22.55 12.55 23 12 23 C 11.45 23 11 22.55 11 22 L 11 20 L 11 20 M 5.99 4.58 L 7.05 5.64 C 7.44 6.02 7.43 6.66 7.05 7.05 C 6.67 7.44 6.03 7.44 5.64 7.05 L 4.58 5.99 C 4.19 5.61 4.19 4.97 4.58 4.58 C 4.96 4.19 5.6 4.19 5.99 4.58 L 5.99 4.58 M 18.36 16.95 L 19.42 18.01 C 19.81 18.39 19.81 19.03 19.42 19.42 C 19.04 19.81 18.4 19.81 18.01 19.42 L 16.95 18.36 C 16.56 17.98 16.56 17.34 16.95 16.95 C 17.33 16.56 17.97 16.56 18.36 16.95 L 18.36 16.95 M 18.36 7.05 C 17.98 7.44 17.34 7.43 16.95 7.05 C 16.56 6.67 16.56 6.03 16.95 5.64 L 18.01 4.58 C 18.39 4.19 19.03 4.19 19.42 4.58 C 19.81 4.96 19.81 5.6 19.42 5.99 L 19.42 5.99 L 18.36 7.05 M 7.05 18.36 L 5.99 19.42 C 5.61 19.81 4.97 19.8 4.58 19.42 C 4.19 19.04 4.19 18.4 4.58 18.01 L 5.64 16.95 C 6.02 16.56 6.66 16.56 7.05 16.95 C 7.44 17.33 7.44 17.97 7.05 18.36 L 7.05 18.36"
android:valueTo="M 11.1 7.5 C 11.1 5.69 11.99 4.08 13.36 3.1 C 12.92 3.04 12.46 3 12 3 L 12 3 L 12 3 C 7.03 3 3 7.03 3 12 C 3 16.97 7.03 21 12 21 C 16.97 21 21 16.97 21 12 C 21 11.54 20.96 11.08 20.9 10.64 C 19.92 12.01 18.32 12.9 16.5 12.9 C 15.507 12.9 14.576 12.631 13.776 12.162 C 12.976 11.693 12.307 11.024 11.838 10.224 C 11.369 9.424 11.1 8.493 11.1 7.5 M 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 C 3 12 3 12 3 12 C 3 12 3 12 3 12 L 3 12 L 3 12 M 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 C 21 12 21 12 21 12 C 21 12 21 12 21 12 L 21 12 L 21 12 M 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 C 12 3 12 3 12 3 C 12 3 12 3 12 3 L 12 3 L 12 3 M 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 C 12 21 12 21 12 21 C 12 21 12 21 12 21 L 12 21 L 12 21 M 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 C 5.815 5.815 5.815 5.815 5.815 5.815 L 5.815 5.815 M 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 C 18.185 18.185 18.185 18.185 18.185 18.185 L 18.185 18.185 M 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 C 18.185 5.815 18.185 5.815 18.185 5.815 L 18.185 5.815 L 18.185 5.815 M 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 C 5.815 18.185 5.815 18.185 5.815 18.185 L 5.815 18.185"
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>

View File

@@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#000000" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9s9,-4.03 9,-9c0,-0.46 -0.04,-0.92 -0.1,-1.36c-0.98,1.37 -2.58,2.26 -4.4,2.26c-2.98,0 -5.4,-2.42 -5.4,-5.4c0,-1.81 0.89,-3.42 2.26,-4.4C12.92,3.04 12.46,3 12,3L12,3z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#000000" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5s5,-2.24 5,-5S14.76,7 12,7L12,7zM2,13l2,0c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1l-2,0c-0.55,0 -1,0.45 -1,1S1.45,13 2,13zM20,13l2,0c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1l-2,0c-0.55,0 -1,0.45 -1,1S19.45,13 20,13zM11,2v2c0,0.55 0.45,1 1,1s1,-0.45 1,-1V2c0,-0.55 -0.45,-1 -1,-1S11,1.45 11,2zM11,20v2c0,0.55 0.45,1 1,1s1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1C11.45,19 11,19.45 11,20zM5.99,4.58c-0.39,-0.39 -1.03,-0.39 -1.41,0c-0.39,0.39 -0.39,1.03 0,1.41l1.06,1.06c0.39,0.39 1.03,0.39 1.41,0s0.39,-1.03 0,-1.41L5.99,4.58zM18.36,16.95c-0.39,-0.39 -1.03,-0.39 -1.41,0c-0.39,0.39 -0.39,1.03 0,1.41l1.06,1.06c0.39,0.39 1.03,0.39 1.41,0c0.39,-0.39 0.39,-1.03 0,-1.41L18.36,16.95zM19.42,5.99c0.39,-0.39 0.39,-1.03 0,-1.41c-0.39,-0.39 -1.03,-0.39 -1.41,0l-1.06,1.06c-0.39,0.39 -0.39,1.03 0,1.41s1.03,0.39 1.41,0L19.42,5.99zM7.05,18.36c0.39,-0.39 0.39,-1.03 0,-1.41c-0.39,-0.39 -1.03,-0.39 -1.41,0l-1.06,1.06c-0.39,0.39 -0.39,1.03 0,1.41s1.03,0.39 1.41,0L7.05,18.36z"/>
</vector>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".tools.TimeScreenActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraint_layout_time_screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_show_background_theme"
tools:context=".tools.timescreen.MainActivity">
<ImageView
android:id="@+id/image_view_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:contentDescription="@string/tool_time_change_mode"
android:padding="10dp"
android:src="@drawable/animation_light_to_dark_mode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/linear_layout_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextSwitcher
android:id="@+id/text_switcher_hour_ten"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
<TextSwitcher
android:id="@+id/text_switcher_hour_one"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
<TextView
android:id="@+id/text_view_colon_hour_minute"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:text="@string/tool_time_screen_colon"
android:textColor="?attr/app_show_text_theme"
android:textSize="100sp"
android:textStyle="bold" />
<TextSwitcher
android:id="@+id/text_switcher_minute_ten"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
<TextSwitcher
android:id="@+id/text_switcher_minute_one"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
<TextView
android:id="@+id/text_view_colon_minute_second"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:text="@string/tool_time_screen_colon"
android:textColor="?attr/app_show_text_theme"
android:textSize="100sp"
android:textStyle="bold" />
<TextSwitcher
android:id="@+id/text_switcher_second_ten"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
<TextSwitcher
android:id="@+id/text_switcher_second_one"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:gravity="center"
android:inAnimation="@anim/text_from_top_in"
android:outAnimation="@anim/text_to_down_out" />
</LinearLayout>
<TextView
android:id="@+id/text_view_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="?attr/app_show_second_text_theme"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/linear_layout_time" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,16 +3,15 @@
android:id="@+id/fold_layout_head_layout" android:id="@+id/fold_layout_head_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginStart="10dp" android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:gravity="center_vertical"> android:gravity="center_vertical">
<TextView <TextView
android:id="@+id/fold_layout_icon" android:id="@+id/fold_layout_icon"
android:layout_width="0dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_weight="1" android:layout_marginHorizontal="10dp"
android:gravity="center" android:gravity="center"
android:textAlignment="center" android:textAlignment="center"
android:textColor="?attr/app_theme" android:textColor="?attr/app_theme"
@@ -22,7 +21,7 @@
android:id="@+id/fold_layout_text_view" android:id="@+id/fold_layout_text_view"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_weight="6" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="?attr/app_text_theme" android:textColor="?attr/app_text_theme"
android:textSize="18sp" android:textSize="18sp"
@@ -30,8 +29,8 @@
<ImageView <ImageView
android:id="@+id/fold_layout_arrow_icon" android:id="@+id/fold_layout_arrow_icon"
android:layout_width="0dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_weight="1" android:layout_marginHorizontal="10dp"
android:contentDescription="@string/arrow_icon" /> android:contentDescription="@string/arrow_icon" />
</LinearLayout> </LinearLayout>

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,15 @@
<color name="app_on_background">#FF303030</color> <color name="app_on_background">#FF303030</color>
<color name="app_primary_text">#FFEEEEEE</color> <color name="app_primary_text">#FFEEEEEE</color>
<color name="app_secondary_text">#FF757575</color> <color name="app_secondary_text">#FF757575</color>
<color name="app_show_light_background">@color/white</color>
<color name="app_show_light_primary_text">#FF757575</color>
<color name="app_show_light_secondary_text">#FF757575</color>
<color name="app_show_dark_background">@color/black</color>
<color name="app_show_dark_primary_text">#FFEEEEEE</color>
<color name="app_show_dark_secondary_text">#FF757575</color>
<color name="app_show_background">@color/app_show_dark_background</color>
<color name="app_show_primary_text">@color/app_show_dark_primary_text</color>
<color name="app_show_secondary_text">@color/app_show_dark_secondary_text</color>
<color name="app_ripple">#88CCCCCC</color> <color name="app_ripple">#88CCCCCC</color>
<color name="app_divider">#FFADADAD</color> <color name="app_divider">#FFADADAD</color>
</resources> </resources>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.OxygenToolbox.Default" parent="Theme.MaterialComponents.DayNight.Bridge">
<item name="app_theme">@color/deep_purple_primary</item>
<item name="app_variant_theme">@color/deep_purple_primary_dark</item>
<item name="app_on_theme">@color/deep_purple_text_icons</item>
<item name="app_second_theme">@color/deep_purple_accent</item>
<item name="app_second_variant_theme">@color/deep_purple_accent</item>
<item name="app_second_on_theme">@color/deep_purple_text_icons</item>
<item name="app_background_theme">@color/app_background</item>
<item name="app_on_background_theme">@color/app_on_background</item>
<item name="app_text_theme">@color/app_primary_text</item>
<item name="app_second_text_theme">@color/app_secondary_text</item>
<item name="app_show_background_theme">@color/app_show_background</item>
<item name="app_show_text_theme">@color/app_show_primary_text</item>
<item name="app_show_second_text_theme">@color/app_show_secondary_text</item>
<item name="app_ripple_theme">@color/app_ripple</item>
<item name="app_divider_theme">@color/app_divider</item>
<!-- Primary brand color. -->
<item name="colorPrimary">?attr/app_theme</item>
<item name="colorPrimaryVariant">?attr/app_theme</item>
<item name="colorOnPrimary">?attr/app_on_theme</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">?attr/app_second_theme</item>
<item name="colorSecondaryVariant">?attr/app_second_variant_theme</item>
<item name="colorOnSecondary">?attr/app_on_theme</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/app_theme</item>
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="fold_layout_background">?attr/app_on_background_theme</item>
<item name="tools_arrow">?attr/app_second_text_theme</item>
<item name="tools_button_background">?attr/app_background_theme</item>
<item name="tools_button_text">?attr/app_text_theme</item>
<item name="tools_button_ripple">?attr/app_ripple_theme</item>
</style>
</resources>

View File

@@ -16,6 +16,9 @@
<attr name="app_on_background_theme" format="color" /> <attr name="app_on_background_theme" format="color" />
<attr name="app_text_theme" format="color" /> <attr name="app_text_theme" format="color" />
<attr name="app_second_text_theme" format="color" /> <attr name="app_second_text_theme" format="color" />
<attr name="app_show_background_theme" format="color" />
<attr name="app_show_text_theme" format="color" />
<attr name="app_show_second_text_theme" format="color" />
<attr name="app_ripple_theme" format="color" /> <attr name="app_ripple_theme" format="color" />
<attr name="app_divider_theme" format="color" /> <attr name="app_divider_theme" format="color" />

View File

@@ -8,6 +8,15 @@
<color name="app_on_background">@color/white</color> <color name="app_on_background">@color/white</color>
<color name="app_primary_text">#FF212121</color> <color name="app_primary_text">#FF212121</color>
<color name="app_secondary_text">#FF757575</color> <color name="app_secondary_text">#FF757575</color>
<color name="app_show_light_background">@color/white</color>
<color name="app_show_light_primary_text">#FF757575</color>
<color name="app_show_light_secondary_text">#FF757575</color>
<color name="app_show_dark_background">@color/black</color>
<color name="app_show_dark_primary_text">#FFEEEEEE</color>
<color name="app_show_dark_secondary_text">#FF757575</color>
<color name="app_show_background">@color/app_show_light_background</color>
<color name="app_show_primary_text">@color/app_show_light_primary_text</color>
<color name="app_show_secondary_text">@color/app_show_light_secondary_text</color>
<color name="app_ripple">#88CCCCCC</color> <color name="app_ripple">#88CCCCCC</color>
<color name="app_divider">#FFDDDDDD</color> <color name="app_divider">#FFDDDDDD</color>

View File

@@ -106,4 +106,7 @@
<string name="setting_about">About</string> <string name="setting_about">About</string>
<string name="setting_about_oxygen_toolbox">About OxygenToolbox</string> <string name="setting_about_oxygen_toolbox">About OxygenToolbox</string>
<string name="setting_about_oxygen_toolbox_key" translatable="false">app_about</string> <string name="setting_about_oxygen_toolbox_key" translatable="false">app_about</string>
<string name="tool_time_screen_colon" translatable="false"> : </string>
<string name="tool_time_change_mode" translatable="false">Change Mode</string>
</resources> </resources>

View File

@@ -13,19 +13,4 @@
<item name="android:stateListAnimator">@null</item> <item name="android:stateListAnimator">@null</item>
<item name="android:textColor">?attr/tools_button_text</item> <item name="android:textColor">?attr/tools_button_text</item>
</style> </style>
<style name="ToolsLinearLayout">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="ThemeSpinner" parent="Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:textSize">@dimen/default_text_size</item>
<item name="android:textColor">?attr/app_text_theme</item>
</style>
<style name="RoundImage">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">64dp</item>
</style>
</resources> </resources>

View File

@@ -13,6 +13,9 @@
<item name="app_on_background_theme">@color/app_on_background</item> <item name="app_on_background_theme">@color/app_on_background</item>
<item name="app_text_theme">@color/app_primary_text</item> <item name="app_text_theme">@color/app_primary_text</item>
<item name="app_second_text_theme">@color/app_secondary_text</item> <item name="app_second_text_theme">@color/app_secondary_text</item>
<item name="app_show_background_theme">@color/app_show_background</item>
<item name="app_show_text_theme">@color/app_show_primary_text</item>
<item name="app_show_second_text_theme">@color/app_show_secondary_text</item>
<item name="app_ripple_theme">@color/app_ripple</item> <item name="app_ripple_theme">@color/app_ripple</item>
<item name="app_divider_theme">@color/app_divider</item> <item name="app_divider_theme">@color/app_divider</item>

View File

@@ -1,8 +1,11 @@
package com.fatapp.oxygentoolbox; package com.fatapp.oxygentoolbox;
import org.junit.Test; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*; import com.fatapp.oxygentoolbox.util.VariableChangeListener;
import com.fatapp.oxygentoolbox.util.VariableChangeSupport;
import org.junit.Test;
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
@@ -14,4 +17,21 @@ public class ExampleUnitTest {
public void addition_isCorrect() { public void addition_isCorrect() {
assertEquals(4, 2 + 2); assertEquals(4, 2 + 2);
} }
@Test
public void variableChangeTest() {
VariableChangeSupport<String> stringVariableChangeSupport = new VariableChangeSupport<>("Hello", new VariableChangeListener() {
@Override
public <T> void onChange(T newValue, T oldValue) {
System.out.println("newValue = " + newValue);
System.out.println("oldValue = " + oldValue);
}
});
stringVariableChangeSupport.setValue("Hello");
stringVariableChangeSupport.setValue("Hi");
stringVariableChangeSupport.setValue("Hi");
stringVariableChangeSupport.setValue("HI");
stringVariableChangeSupport.setValue("HI");
}
} }