1
0
mirror of https://codeberg.org/Starfish/Imagepipe.git synced 2025-10-05 22:52:39 +02:00

improve SeekBarPreference,versionCode 51, versionName "0.72"

This commit is contained in:
Starfish
2025-01-01 13:57:21 +01:00
parent e98a94f5da
commit 82a8aae314
7 changed files with 63 additions and 15 deletions

View File

@@ -2,9 +2,11 @@ Version 0.72
============
- add support for ACTION_EDIT intent
- fix GET_CONTENT intent never added exif data
- fix GET_CONTENT not working if used immediately after clean app install
- fix GET_CONTENT not working when used immediately after clean app install
- remove non-static access to sharedPreferences
- fix piping of multiple images fails after resetting preferences
- fix sharing not working in some cases when clear data after sharing was enabled
- change the maximum quality setting to a seek bar for better user experience
Version 0.71
============

View File

@@ -34,8 +34,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 33
versionCode 50
versionName "0.71"
versionCode 51
versionName "0.72"
}
buildTypes {

View File

@@ -843,7 +843,7 @@ public class ImageReceiver extends Activity{
PictureCache.clearPictureCache(context);
ImagepipePreferences.setCurrentAppVersionFlag(context);
}
// since with version 51 this setting moved from a String (list) to an Integer (seekBar), we need to map
// since version 51 this setting moved from a String (list) to an Integer (seekBar), we need to map
// the old string value to the new integer value.
if (ImagepipePreferences.getLastAppVersion(context)<51){
ImagepipePreferences.setQualitymaxvalue(context,ImagepipePreferences.getQualitymaxvalue_Legacy(context));

View File

@@ -36,8 +36,8 @@ public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarCh
private int value;
private int min;
private int max;
private int minWarning;
private int maxWarning;
private int[] colorThresholds;
private int[] colors;
private boolean displayProgressValue = false;
private View preferenceView;
@@ -54,21 +54,48 @@ public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarCh
readAttributes(context,attrs,0);
}
/**
* Internal function to read the attributes from the xml definition of this preference. This is called by the
* constructors to unify attribute interpretation.
*
* Attributes are:
* min: defines the minimum value allowed. The seekBar cannot be moved to a position lower than this minimum.
* max: defines the maximum value allowed. The seekBar will be cut-off at this value.
* label: defines color labeling of values. The color of the value switches as soon as a threshold is reached.
* Format is "threshold,color", the thresholds are separated by a pipe symbol (|). Example in xml:
* android:label="20,#ffffff66|60,#ff66ff66|90,#ffff6666"
* The displayed value will be yellow when equal or above 20,
* green when equal or above 60,
* red when equal or above 90.
* When below 20, the color won't be modified.
*
* To display a progress value, define at least one threshold color.
*
* @param context
* @param attrs
* @param defStyleAttr
*/
private void readAttributes(Context context, AttributeSet attrs, int defStyleAttr){
setMax(100);
this.context = context;
TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.SeekBarPreference,defStyleAttr,0);
min = attrs.getAttributeIntValue(NAMESPACE,"min",0);
max = attrs.getAttributeIntValue(NAMESPACE,"max",100);
minWarning = min; maxWarning=max;
displayProgressValue = false;
String progressLabel = attrs.getAttributeValue(NAMESPACE,"label");
if (progressLabel!=null){
displayProgressValue = true;
String[] labelIitems = progressLabel.split("\\|");
if (labelIitems.length>1){
minWarning = Integer.parseInt(labelIitems[0]);
maxWarning = Integer.parseInt(labelIitems[1]);
if (labelIitems.length>0){
colorThresholds = new int[labelIitems.length]; colors = new int[labelIitems.length];
for (int i=0; i<labelIitems.length; i++){
String values[] = labelIitems[i].split(",");
if (values.length>1){
colorThresholds[i] = Integer.parseInt(values[0]);
colors[i] = Color.parseColor(values[1]);
}
}
}
}
typedArray.recycle();
@@ -130,10 +157,18 @@ public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarCh
private void displayValueNumber(int i){
if (displayProgressValue){
TextView textViewValue = (TextView) preferenceView.findViewById(R.id.value);
if ((i<minWarning) || (i>maxWarning)){
textViewValue.setTextColor(context.getResources().getColor(R.color.colorpicker15));
} else {
textViewValue.setTextColor(context.getResources().getColor(R.color.primaryTextColor));
if ((colorThresholds!=null) && (colors!=null)){
if ((colorThresholds.length>0) && (colors.length>0)) {
int colorPosition=-1;
for (int pos=0; pos<colorThresholds.length; pos++){
if (i>=colorThresholds[pos]){
colorPosition = pos;
}
}
if (colorPosition!=-1){
textViewValue.setTextColor(colors[colorPosition]);
}
}
}
textViewValue.setText(Integer.toString(i));
}

View File

@@ -83,7 +83,7 @@
android:summary="@string/preference_maxquality_summary"
android:min="20"
android:max="100"
android:label="50|90"
android:label="20,#ffffff66|60,#ff66ff66|90,#ffff6666"
/>
<CheckBoxPreference

View File

@@ -0,0 +1,6 @@
- Imagepipe kann nun auch als Bild-Editor aus anderen Apps aufgerufen werden
- behoben: bei Aufruf aus anderen Apps wurden nie Bilddaten hinzugefügt
- behoben: Aufruf aus anderen Apps funktionierte nicht unmittelbar nach einer Neuinstallation
- behoben: Teilen mehrerer Bilder schlug fehl, falls die Einstellungen zurückgesetzt worden sind
- behoben: Teilen funktionierte in manchen Fällen nicht, falls die Option "nach dem Teilen löschen" aktiviert war
- die Einstellung der maximalen Qualität erfolgt zur Verbesserung des Nutzerlebnisses nun über einen Schieberegeler

View File

@@ -0,0 +1,5 @@
- Imagepipe can now also be called from other apps to edit the image
- fixed: when called from other apps, exif data was never added
- fixed: calling Imagepipe from other apps did not work immediately after installing it
- fixed: sharing failed sometimes with the setting "clear after sharing" enabled
- setting the maximum quality is now done using a slider to improve user experience