Skip to content

Commit

Permalink
app: introduce 1.0.9
Browse files Browse the repository at this point in the history
- code cleanup
- gave the SearchActvity UI a fresher look & minor UI fixes
- gradle update
  • Loading branch information
verNANDo57 committed Nov 2, 2021
1 parent 272ed50 commit e6c3fd3
Show file tree
Hide file tree
Showing 46 changed files with 206 additions and 1,225 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.verNANDo57.rulebook_educational"
minSdkVersion 22
targetSdkVersion 30
versionCode 108
versionName '1.0.8'
versionCode 109
versionName '1.0.9'
multiDexEnabled true
}

Expand Down Expand Up @@ -51,7 +51,7 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0-RC'
}
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void onClick(View view){
bar_in_credits.setNavigationOnClickListener(new NavigationView.OnClickListener() {
@Override
public void onClick(View v) {
BottomNavBetweenActivitiesFragment BottomNavBetweenActivities = new BottomNavBetweenActivitiesFragment();
BottomNavAmongActivitiesFragment BottomNavBetweenActivities = new BottomNavAmongActivitiesFragment();
BottomNavBetweenActivities.show(getSupportFragmentManager(), LOG_TAG);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onCreate(Bundle savedInstanceState){
toolbar.setNavigationOnClickListener(new NavigationView.OnClickListener() {
@Override
public void onClick(View v) {
BottomNavBetweenActivitiesFragment BottomNavBetweenActivities = new BottomNavBetweenActivitiesFragment();
BottomNavAmongActivitiesFragment BottomNavBetweenActivities = new BottomNavAmongActivitiesFragment();
BottomNavBetweenActivities.show(getSupportFragmentManager(), LOG_TAG);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
import com.verNANDo57.rulebook_educational.preferences.AppSettingsActivity;
import com.verNANDo57.rulebook_educational.rules.dictionaries.AppDictionaries;

public class BottomNavBetweenActivitiesFragment extends CustomThemeEngineBottomSheetDialogFragment {
public class BottomNavAmongActivitiesFragment extends CustomThemeEngineBottomSheetDialogFragment {

public BottomNavBetweenActivitiesFragment(){
public BottomNavAmongActivitiesFragment(){
//Required empty public constructor
}

@SuppressLint("NonConstantResourceId")
public View onCreateView(LayoutInflater inflater , ViewGroup container, Bundle savedInstanceState) {
View viewFragment = inflater.inflate(R.layout.fragment_bottomsheet_between_activities, container, false);
View viewFragment = inflater.inflate(R.layout.fragment_bottomsheet_among_activities, container, false);

NavigationView navigationbetweenlessons = viewFragment.findViewById(R.id.navigation_view_between_activities);
NavigationView navigationbetweenlessons = viewFragment.findViewById(R.id.navigation_view_among_activities);
navigationbetweenlessons.setBackgroundColor(getResources().getColor(R.color.bottomsheetdialog_background));
navigationbetweenlessons.setItemTextColor(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_primary), 0.01f)));
navigationbetweenlessons.setItemIconTintList(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_accent), 0.01f)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
import com.verNANDo57.rulebook_educational.rules.mainrules.AppMainRulesActivity;
import com.verNANDo57.rulebook_educational.search.AppSearchActivity;

public class BottomNavBetweenLessonsFragment extends CustomThemeEngineBottomSheetDialogFragment {
public class BottomNavAmongLessonsFragment extends CustomThemeEngineBottomSheetDialogFragment {

public BottomNavBetweenLessonsFragment(){
public BottomNavAmongLessonsFragment(){
//Required empty public constructor
}

@SuppressLint("NonConstantResourceId")
public View onCreateView(LayoutInflater inflater , ViewGroup container, Bundle savedInstanceState) {
View viewFragment = inflater.inflate(R.layout.fragment_bottomsheet_between_lessons, container, false);
View viewFragment = inflater.inflate(R.layout.fragment_bottomsheet_among_lessons, container, false);

NavigationView navigationbetweenactivities = viewFragment.findViewById(R.id.navigation_view_between_lessons);
navigationbetweenactivities.setBackgroundColor(getResources().getColor(R.color.bottomsheetdialog_background));
navigationbetweenactivities.setItemTextColor(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_primary), 0.01f)));
navigationbetweenactivities.setItemIconTintList(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_accent), 0.01f)));
navigationbetweenactivities.setNavigationItemSelectedListener(menuItem -> {
NavigationView navigation_among_activities = viewFragment.findViewById(R.id.navigation_view_among_lessons);
navigation_among_activities.setBackgroundColor(getResources().getColor(R.color.bottomsheetdialog_background));
navigation_among_activities.setItemTextColor(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_primary), 0.01f)));
navigation_among_activities.setItemIconTintList(ColorStateList.valueOf(ColorUtils.lighter(getResources().getColor(R.color.bottomsheetdialog_accent), 0.01f)));
navigation_among_activities.setNavigationItemSelectedListener(menuItem -> {
int id = menuItem.getItemId();

switch (id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;

/**
* <p>A dialog to pick a color.</p>
Expand Down Expand Up @@ -150,8 +151,10 @@ public static Builder newBuilder() {
return new Builder();
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
assert getArguments() != null;
dialogId = getArguments().getInt(ARG_ID);
showAlphaSlider = getArguments().getBoolean(ARG_ALPHA);
showColorShades = getArguments().getBoolean(ARG_SHOW_COLOR_SHADES);
Expand Down Expand Up @@ -184,6 +187,7 @@ public void onClick(DialogInterface dialog, int which) {
}
});

assert getArguments() != null;
int dialogTitleStringRes = getArguments().getInt(ARG_DIALOG_TITLE);
if (dialogTitleStringRes != 0) {
builder.setTitle(dialogTitleStringRes);
Expand Down Expand Up @@ -243,7 +247,7 @@ public void onClick(View v) {
}

@Override
public void onDismiss(DialogInterface dialog) {
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
onDialogDismissed();
}
Expand Down Expand Up @@ -280,14 +284,15 @@ View createPickerView() {
try {
final TypedValue value = new TypedValue();
TypedArray typedArray =
getActivity().obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorPrimary });
requireActivity().obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorPrimary });
int arrowColor = typedArray.getColor(0, Color.BLACK);
typedArray.recycle();
arrowRight.setColorFilter(arrowColor);
} catch (Exception ignored) {
}

colorPicker.setAlphaSliderVisible(showAlphaSlider);
assert getArguments() != null;
oldColorPanel.setColor(getArguments().getInt(ARG_COLOR));
colorPicker.setColor(color, true);
newColorPanel.setColor(color);
Expand Down Expand Up @@ -315,7 +320,7 @@ public void onClick(View v) {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodManager imm = (InputMethodManager) requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT);
}
}
Expand All @@ -333,7 +338,7 @@ public void onColorChanged(int newColor) {
if (!fromEditText && hexEditText != null) {
setHex(newColor);
if (hexEditText.hasFocus()) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodManager imm = (InputMethodManager) requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(hexEditText.getWindowToken(), 0);
hexEditText.clearFocus();
}
Expand Down Expand Up @@ -474,6 +479,7 @@ public void onColorSelected(int newColor) {

private void loadPresets() {
int alpha = Color.alpha(color);
assert getArguments() != null;
presets = getArguments().getIntArray(ARG_PRESETS);
if (presets == null) presets = MATERIAL_COLORS;
boolean isMaterialColors = presets == MATERIAL_COLORS;
Expand Down Expand Up @@ -749,7 +755,6 @@ private int getSelectedItemPosition() {

public static final class Builder {

ColorPickerDialogListener colorPickerDialogListener;
@StringRes
int dialogTitle = R.string.colorpicker_default_title;
@StringRes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
}

finalWidth = widthAllowed;
} else if (heightMode == MeasureSpec.EXACTLY && widthMode != MeasureSpec.EXACTLY) {
} else if (widthMode != MeasureSpec.EXACTLY) {
//The height has been specified exactly, we need to stay within this height and adopt the width.

int w = (heightAllowed + panelSpacingPx + huePanelWidthPx);
Expand All @@ -627,12 +627,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
w -= (panelSpacingPx + alphaPanelHeightPx);
}

if (w > widthAllowed) {
//we can't fit within this container, set the size to whatever was allowed.
finalWidth = widthAllowed;
} else {
finalWidth = w;
}
//we can't fit within this container, set the size to whatever was allowed.
finalWidth = Math.min(w, widthAllowed);

finalHeight = heightAllowed;
} else {
Expand Down Expand Up @@ -676,7 +672,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
} else if (!heightOk && widthOk) {
finalHeight = heightAllowed;
finalWidth = widthNeeded;
} else if (!widthOk && heightOk) {
} else if (heightOk) {
finalHeight = heightNeeded;
finalWidth = widthAllowed;
} else {
Expand Down
Loading

0 comments on commit e6c3fd3

Please sign in to comment.