@@ -0,0 +1,3741 @@
+/*%0A * Copyright (C) 2007 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A * MODIFICATIONS:%0A * - getEditTextPreference() returns EditTextPreferenceFix instead of EditTextPreference%0A * - onBindDialogView(View view) retrieves the EditText from EditTextPreferenceFix%0A */%0A%0Apackage android.support.v7.preference;%0A%0Aimport android.app.Dialog;%0Aimport android.os.Bundle;%0Aimport android.support.annotation.NonNull;%0Aimport android.text.Editable;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.view.ViewParent;%0Aimport android.view.WindowManager;%0Aimport android.widget.EditText;%0A%0Apublic class EditTextPreferenceDialogFragmentCompatFix extends PreferenceDialogFragmentCompat %7B%0A    private EditText mEditText;%0A%0A    public EditTextPreferenceDialogFragmentCompatFix() %7B%0A    %7D%0A%0A    public static EditTextPreferenceDialogFragmentCompatFix newInstance(String key) %7B%0A        EditTextPreferenceDialogFragmentCompatFix fragment = new EditTextPreferenceDialogFragmentCompatFix();%0A        Bundle b = new Bundle(1);%0A        b.putString(%22key%22, key);%0A        fragment.setArguments(b);%0A        return fragment;%0A    %7D%0A%0A    protected void onBindDialogView(View view) %7B%0A        super.onBindDialogView(view);%0A%0A        this.mEditText = getEditTextPreference().getEditText();%0A        this.mEditText.setText(this.getEditTextPreference().getText());%0A%0A        Editable text = mEditText.getText();%0A        if (text != null) %7B%0A            mEditText.setSelection(text.length(), text.length());%0A        %7D%0A%0A        ViewParent oldParent = this.mEditText.getParent();%0A        if (oldParent != view) %7B%0A            if (oldParent != null) %7B%0A                ((ViewGroup) oldParent).removeView(this.mEditText);%0A            %7D%0A%0A            this.onAddEditTextToDialogView(view, this.mEditText);%0A        %7D%0A    %7D%0A%0A    private void showKeyboard(Dialog dialog) %7B%0A        if (!needInputMethod())%0A            return;%0A%0A        mEditText.requestFocus();%0A        dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);%0A    %7D%0A%0A    @NonNull%0A    @Override%0A    public Dialog onCreateDialog(Bundle savedInstanceState) %7B%0A        Dialog dialog = super.onCreateDialog(savedInstanceState);%0A        showKeyboard(dialog);%0A        return dialog;%0A    %7D%0A%0A    private EditTextPreferenceFix getEditTextPreference() %7B%0A        return (EditTextPreferenceFix) this.getPreference();%0A    %7D%0A%0A    protected boolean needInputMethod() %7B%0A        return true;%0A    %7D%0A%0A    protected void onAddEditTextToDialogView(View dialogView, EditText editText) %7B%0A        View oldEditText = dialogView.findViewById(android.R.id.edit);%0A        if (oldEditText != null) %7B%0A            ViewGroup container = (ViewGroup) (oldEditText.getParent());%0A            if (container != null) %7B%0A                container.removeView(oldEditText);%0A                container.addView(editText, -1, -2);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void onDialogClosed(boolean positiveResult) %7B%0A        if (positiveResult) %7B%0A            String value = this.mEditText.getText().toString();%0A            if (this.getEditTextPreference().callChangeListener(value)) %7B%0A                this.getEditTextPreference().setText(value);%0A            %7D%0A        %7D%0A%0A    %7D%0A%7D%0A

Create EditTextPreferenceDialogFragmentCompatFix.java