From 31192667e56ec83915b51ac3ddaf69f93b26c304 Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Sat, 24 Oct 2020 01:36:58 +0500 Subject: [PATCH] Bug Fixes --- .idea/inspectionProfiles/Project_Default.xml | 5 +- app/src/main/AndroidManifest.xml | 13 +- .../appManager/homeManager/geckoClients.java | 2 +- .../settingAccessibilityController.java | 147 ++++++++ .../settingAccessibilityModel.java | 44 +++ .../settingAccessibilityViewController.java | 122 ++++++ .../settingHomePage/settingController.java | 5 + .../settingHomePage/settingModel.java | 26 -- .../genesissearchengine/constants/keys.java | 2 + .../genesissearchengine/constants/status.java | 4 + .../res/layouts/setting/layout/setting.xml | 64 ++++ .../layout/setting_accessibility_view.xml | 355 ++++++++++++++++++ .../setting/layout/setting_search_view.xml | 5 + app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 12 + 15 files changed, 772 insertions(+), 35 deletions(-) create mode 100644 app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java create mode 100644 app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java create mode 100644 app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java create mode 100644 app/src/main/res/layouts/setting/layout/setting_accessibility_view.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 14111354..a850ce8f 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,10 +1,6 @@ \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8eece8b1..0261dddd 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -43,10 +43,15 @@ android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustNothing" /> + android:name="com.darkweb.genesissearchengine.appManager.languageManager.languageController" + android:configChanges="keyboard|keyboardHidden|orientation|screenSize" + android:label="@string/SETTING_HEADER" + android:windowSoftInputMode="adjustNothing" /> + data, enums.etype e_type) + { + return null; + } + } + + + public class settingAccessibilityModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, enums.etype e_type) + { + return null; + } + } + + public void initializeListeners(){ + mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { + int percentage = ((progress+5)*10); + mSeekBarSample.setTextSize((int)((12.0*percentage)/100)); + mScalePercentage.setText(percentage+"%"); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage)); + status.sSettingFontSize = percentage; + activityContextManager.getInstance().getHomeController().onLoadFont(); + } + }); + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + finish(); + } + + /*UI Redirection*/ + public void onClose(View view){ + finish(); + } + + public void onZoomSettingUpdate(View view){ + mSettingAccessibilityModel.onZoomSettingUpdate(!mZoom.isChecked()); + mZoom.toggle(); + } + + public void onVoiceInputSettingUpdate(View view){ + mSettingAccessibilityModel.onVoiceInputSettingUpdate(!mVoiceInput.isChecked()); + mVoiceInput.toggle(); + } + + public void onFontSizeAdjustableUpdate(View view){ + mSettingAccessibilityModel.onFontSizeAdjustableUpdate(!mFontSizeAdjustable.isChecked()); + mFontSizeAdjustable.toggle(); + + if(!mFontSizeAdjustable.isChecked()){ + mSettingAccessibilityViewController.enableFontManual(); + }else { + mSettingAccessibilityViewController.disableFontManual(); + } + activityContextManager.getInstance().getHomeController().onLoadFont(); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java new file mode 100644 index 00000000..449585a7 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java @@ -0,0 +1,44 @@ +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +import android.view.View; + +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.helperManager.eventObserver; + +import java.util.Arrays; + +class settingAccessibilityModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingAccessibilityModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + public void onZoomSettingUpdate(boolean pStatus){ + status.sSettingEnableZoom = pStatus; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,pStatus)); + } + + public void onVoiceInputSettingUpdate(boolean pStatus){ + status.sSettingEnableVoiceInput = pStatus; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,pStatus)); + } + + public void onFontSizeAdjustableUpdate(boolean pStatus){ + status.sSettingFontAdjustable = pStatus; + status.sSettingFontSize = 5; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,pStatus)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,(int)status.sSettingFontSize)); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java new file mode 100644 index 00000000..cf67fec2 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java @@ -0,0 +1,122 @@ +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.SeekBar; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; + +class settingAccessibilityViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private SwitchMaterial mZoom; + private SwitchMaterial mVoiceInput; + private SwitchMaterial mFontSizeAdjustable; + private SeekBar mSeekBar; + private TextView mSeekBarSample; + private TextView mScalePercentage; + + /*Initializations*/ + + settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SwitchMaterial pFontSizeAdjustable, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mZoom = pZoom; + this.mVoiceInput = pVoiceInput; + this.mFontSizeAdjustable = pFontSizeAdjustable; + this.mSeekBar = pSeekBar; + this.mSeekBarSample = mSeekBarSample; + this.mScalePercentage = pScalePercentage; + + initViews(); + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + private void initViews() + { + if(status.sSettingEnableZoom){ + mZoom.setChecked(true); + }else { + mZoom.setChecked(false); + } + if(status.sSettingEnableVoiceInput){ + mVoiceInput.setChecked(true); + }else { + mVoiceInput.setChecked(false); + } + if(status.sSettingFontAdjustable){ + mFontSizeAdjustable.setChecked(true); + mSeekBar.setProgress(5); + mScalePercentage.setText("100%"); + mSeekBar.setEnabled(false); + mSeekBar.setAlpha(0.5f); + mScalePercentage.setAlpha(0.5f); + mSeekBarSample.setAlpha(0.3f); + disableFontManual(); + }else { + mFontSizeAdjustable.setChecked(false); + mSeekBar.setProgress((int)status.sSettingFontSize/10-5); + int percentage = (int)status.sSettingFontSize; + if(status.sSettingFontSize<100){ + mSeekBarSample.setTextSize((int)(12.0*percentage)/100); + }else if(status.sSettingFontSize>100){ + mSeekBarSample.setTextSize((int)(12.0*percentage)/100); + } + + mScalePercentage.setText(percentage+"%"); + mSeekBar.setAlpha(1f); + mScalePercentage.setAlpha(1f); + mSeekBarSample.setAlpha(1f); + mSeekBar.setEnabled(true); + } + } + + public void disableFontManual(){ + mSeekBar.setProgress(5); + mSeekBarSample.setTextSize(12); + mScalePercentage.setText("100%"); + mSeekBar.setEnabled(false); + mSeekBar.animate().setDuration(250).alpha(0.5f); + mScalePercentage.animate().setDuration(250).alpha(0.5f); + mSeekBarSample.animate().setDuration(250).alpha(0.3f); + } + + public void enableFontManual(){ + mSeekBar.setProgress(5); + mSeekBarSample.setTextSize(12); + mScalePercentage.setText("100%"); + mSeekBar.setEnabled(true); + mSeekBar.animate().setDuration(250).alpha(1f); + mScalePercentage.animate().setDuration(250).alpha(1f); + mSeekBarSample.animate().setDuration(250).alpha(1f); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingController.java index 096b16d6..ec8850b5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingController.java @@ -11,6 +11,7 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController; import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController; import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; import com.darkweb.genesissearchengine.constants.constants; @@ -222,6 +223,10 @@ public class settingController extends AppCompatActivity helperMethod.openActivity(settingSearchController.class, constants.CONST_LIST_HISTORY, this,true); } + public void onManageSearchAccessibility(View view) { + helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true); + } + /*Event Observer*/ public class settingViewCallback implements eventObserver.eventListener{ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingModel.java index e87fefff..6e53f804 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingModel.java @@ -124,32 +124,6 @@ class settingModel status.sSettingHistoryStatus = mHistoryStatus; mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.update_history); } - if(status.sSettingFontAdjustable != mFontAdjustable) - { - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,mFontAdjustable)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); - - status.sSettingFontAdjustable = mFontAdjustable; - status.sSettingFontSize = 100; - mFontSize = 100; - - mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_adjustable); - } - if(status.sSettingFontSize != mFontSize) - { - if(mFontSize <=0){ - mFontSize = 1; - } - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,(int)mFontSize)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,false)); - - status.sSettingFontSize = mFontSize; - status.sSettingFontAdjustable = false; - mFontAdjustable = false; - - mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_size); - } if(status.sSettingCookieStatus != mCookieStatus) { status.sSettingCookieStatus = mCookieStatus; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java index 6e9523a8..b0fd4c56 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -38,6 +38,8 @@ public class keys public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS"; public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY"; public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS"; + public static final String SETTING_ZOOM = "SETTING_ZOOM"; + public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT"; /*Bridge Settings*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 1bc0ffeb..fa995e93 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -20,6 +20,8 @@ public class status public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; + public static boolean sSettingEnableZoom = true; + public static boolean sSettingEnableVoiceInput = true; public static boolean sSettingSearchHistory = false; public static boolean getsSettingSearchSuggestion = false; public static boolean sSettingJavaStatus = true; @@ -58,6 +60,8 @@ public class status status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,true)); status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true)); + status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); + status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); diff --git a/app/src/main/res/layouts/setting/layout/setting.xml b/app/src/main/res/layouts/setting/layout/setting.xml index e4e4b807..a6337af4 100644 --- a/app/src/main/res/layouts/setting/layout/setting.xml +++ b/app/src/main/res/layouts/setting/layout/setting.xml @@ -255,6 +255,70 @@ android:layout_height="1dp" android:background="@color/holo_gray_light"/> + + + +