Browse Source

Fix context leak due to static textview in settings

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
d14f2a098c
  1. 5
      app/src/main/java/awais/instagrabber/fragments/settings/SettingsPreferencesFragment.java
  2. 20
      app/src/main/res/layout/pref_custom_folder.xml

5
app/src/main/java/awais/instagrabber/fragments/settings/SettingsPreferencesFragment.java

@ -35,7 +35,6 @@ import static awais.instagrabber.utils.Utils.settingsHelper;
public class SettingsPreferencesFragment extends BasePreferencesFragment { public class SettingsPreferencesFragment extends BasePreferencesFragment {
private static final String TAG = "SettingsPrefsFrag"; private static final String TAG = "SettingsPrefsFrag";
private static AppCompatTextView customPathTextView;
private boolean isLoggedIn; private boolean isLoggedIn;
@Override @Override
@ -293,9 +292,9 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
} }
public static class SaveToCustomFolderPreference extends Preference { public static class SaveToCustomFolderPreference extends Preference {
private AppCompatTextView customPathTextView;
private final OnSelectFolderButtonClickListener onSelectFolderButtonClickListener; private final OnSelectFolderButtonClickListener onSelectFolderButtonClickListener;
private String key;
private final String key;
public SaveToCustomFolderPreference(final Context context, final OnSelectFolderButtonClickListener onSelectFolderButtonClickListener) { public SaveToCustomFolderPreference(final Context context, final OnSelectFolderButtonClickListener onSelectFolderButtonClickListener) {
super(context); super(context);

20
app/src/main/res/layout/pref_custom_folder.xml

@ -8,8 +8,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="vertical" android:orientation="vertical"
android:paddingEnd="?android:attr/scrollbarSize"
android:paddingRight="?android:attr/scrollbarSize">
android:paddingEnd="?android:attr/scrollbarSize">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -20,12 +19,10 @@
<RelativeLayout <RelativeLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dip"
android:layout_marginLeft="15dip"
android:layout_marginTop="6dip"
android:layout_marginEnd="6dip"
android:layout_marginRight="6dip"
android:layout_marginBottom="6dip"
android:layout_marginStart="15dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="6dp"
android:layout_weight="1"> android:layout_weight="1">
<TextView <TextView
@ -45,7 +42,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@android:id/title" android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title" android:layout_alignStart="@android:id/title"
android:layout_alignLeft="@android:id/title"
android:maxLines="4" android:maxLines="4"
android:textAppearance="?android:attr/textAppearanceListItemSmall" android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
@ -59,8 +55,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:contentDescription="@string/save_to_folder" android:contentDescription="@string/save_to_folder"
android:paddingEnd="10dp"
android:paddingRight="10dp" />
android:paddingEnd="10dp" />
</LinearLayout> </LinearLayout>
@ -68,8 +63,7 @@
android:id="@+id/button_container" android:id="@+id/button_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dip"
android:layout_marginLeft="15dip"
android:layout_marginStart="15dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone" android:visibility="gone"

Loading…
Cancel
Save