mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Do not update completion item view height using ViewTreeObserver
Fix: Font size preference slider does not read values from preferences
This commit is contained in:
Generated
+1
@@ -17,6 +17,7 @@
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/fragment_editor.xml" value="0.20512820512820512" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/fragment_non_editable_editor.xml" value="0.20512820512820512" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_about_items.xml" value="0.20512820512820512" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_completion_item.xml" value="0.23854166666666668" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_crash_report.xml" value="0.25" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_diagnostic_info.xml" value="0.20512820512820512" />
|
||||
<entry key="..\:/Projects/AndroidStudioProjects/AndroidIDE/app/src/main/res/layout/layout_editor_bottom_sheet.xml" value="0.20512820512820512" />
|
||||
|
||||
@@ -85,12 +85,6 @@ public class CompletionListAdapter extends EditorCompletionAdapter {
|
||||
|
||||
showApiInfoIfNeeded(item, binding.completionApiInfo);
|
||||
|
||||
binding.getRoot().getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||
ViewGroup.LayoutParams p = binding.completionIconText.getLayoutParams();
|
||||
p.height = binding.getRoot().getHeight();
|
||||
binding.completionIconText.setLayoutParams(p);
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
+11
-15
@@ -17,7 +17,6 @@
|
||||
**************************************************************************************/
|
||||
package com.itsaky.androidide.fragments.preferences;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import androidx.preference.Preference;
|
||||
@@ -116,10 +115,9 @@ public class EditorPreferences extends BasePreferenceFragment implements Prefere
|
||||
builder.setTitle(R.string.title_tab_size);
|
||||
builder.setSingleChoiceItems(sizes, current, (d, i) -> {
|
||||
d.dismiss();
|
||||
int index = i;
|
||||
|
||||
// Reversing the logic applied above...
|
||||
int tabSize = (index + 1) * 2;
|
||||
|
||||
// Reversing the logic applied above...
|
||||
int tabSize = (i + 1) * 2;
|
||||
if(tabSize < 2 || tabSize > 8) tabSize = 4;
|
||||
getPrefManager().putInt(KEY_EDITOR_TAB_SIZE, tabSize);
|
||||
});
|
||||
@@ -133,8 +131,9 @@ public class EditorPreferences extends BasePreferenceFragment implements Prefere
|
||||
float size = getPrefManager().getFloat(KEY_EDITOR_FONT_SIZE, 14);
|
||||
if(size < 6 || size > 32) {
|
||||
size = 14;
|
||||
changeTextSize(binding, size);
|
||||
}
|
||||
changeTextSize(binding, size);
|
||||
|
||||
binding.slider.setLabelFormatter(p1 -> String.valueOf((int) p1));
|
||||
builder.setTitle(R.string.title_change_text_size);
|
||||
builder.setMessage(R.string.msg_editor_font_size);
|
||||
@@ -174,20 +173,17 @@ public class EditorPreferences extends BasePreferenceFragment implements Prefere
|
||||
};
|
||||
final MaterialAlertDialogBuilder builder = DialogUtils.newMaterialDialogBuilder (getContext ());
|
||||
builder.setTitle(R.string.idepref_editor_paintingflags_title);
|
||||
builder.setMultiChoiceItems(labels, checked, (p1, p2, p3) -> {
|
||||
DialogInterface iface = p1;
|
||||
int pos = p2;
|
||||
boolean isChecked = p3;
|
||||
builder.setMultiChoiceItems(labels, checked, (dialog, which, isChecked) -> {
|
||||
|
||||
if(pos == 0) {
|
||||
if(which == 0) {
|
||||
getPrefManager().putBoolean(KEY_EDITORFLAG_WS_LEADING, isChecked);
|
||||
} else if(pos == 1) {
|
||||
} else if(which == 1) {
|
||||
getPrefManager().putBoolean(KEY_EDITORFLAG_WS_TRAILING, isChecked);
|
||||
} else if(pos == 2) {
|
||||
} else if(which == 2) {
|
||||
getPrefManager().putBoolean(KEY_EDITORFLAG_WS_INNER, isChecked);
|
||||
} else if(pos == 3) {
|
||||
} else if(which == 3) {
|
||||
getPrefManager().putBoolean(KEY_EDITORFLAG_WS_EMPTY_LINE, isChecked);
|
||||
} else if(pos == 4) {
|
||||
} else if(which == 4) {
|
||||
getPrefManager().putBoolean(KEY_EDITORFLAG_LINE_BREAK, isChecked);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
tools:ignore="SmallSp"
|
||||
android:id="@+id/relativeLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/primaryLightColor"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@color/primaryLightColor">
|
||||
tools:ignore="SmallSp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/completion_type"
|
||||
android:textColor="@color/primaryTextColorLight"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:ellipsize="start"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="13sp"
|
||||
android:id="@+id/completion_label"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:textColor="@color/primaryTextColor"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_toStartOf="@id/completion_type"
|
||||
android:ellipsize="end"
|
||||
android:layout_toEndOf="@id/completion_iconText"
|
||||
android:layout_marginTop="2dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/completion_label"
|
||||
android:id="@+id/completion_detail"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:ellipsize="start"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryTextColorLight"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:layout_toEndOf="@id/completion_iconText"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/completion_detail"
|
||||
android:id="@+id/completion_api_info"
|
||||
android:textColor="@color/primaryTextColor"
|
||||
android:textSize="11sp"
|
||||
android:gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:layout_toEndOf="@id/completion_iconText"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/completion_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryTextColor"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@id/completion_type"
|
||||
app:layout_constraintStart_toEndOf="@id/completion_iconText"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/completion_detail"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryTextColorLight"
|
||||
android:textSize="11sp"
|
||||
android:layout_marginStart="4dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/completion_iconText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/completion_label" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/completion_api_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryTextColor"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintStart_toEndOf="@id/completion_iconText"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/completion_detail" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:id="@+id/completion_iconText"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@color/secondaryColor"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/primaryTextColor"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user