mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Text if choose only one extension #105
This commit is contained in:
@@ -35,11 +35,13 @@ import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.kunzisoft.keepass.fileselect.FilePickerStylishActivity;
|
||||
@@ -153,6 +155,16 @@ public class CreateFileDialogFragment extends DialogFragment implements AdapterV
|
||||
ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, fileTypes);
|
||||
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinner.setAdapter(dataAdapter);
|
||||
// Or text if only one item https://github.com/Kunzisoft/KeePassDX/issues/105
|
||||
if (fileTypes.length == 1) {
|
||||
ViewGroup.LayoutParams params = spinner.getLayoutParams();
|
||||
spinner.setVisibility(View.GONE);
|
||||
TextView extensionTextView = new TextView(getContext());
|
||||
extensionTextView.setText(extension);
|
||||
extensionTextView.setLayoutParams(params);
|
||||
ViewGroup parentView = (ViewGroup) spinner.getParent();
|
||||
parentView.addView(extensionTextView);
|
||||
}
|
||||
|
||||
AlertDialog dialog = builder.create();
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
android:id="@+id/filename_input_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/file_types"
|
||||
android:layout_toStartOf="@+id/file_types">
|
||||
android:layout_toLeftOf="@+id/container_file_type"
|
||||
android:layout_toStartOf="@+id/container_file_type">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/filename"
|
||||
@@ -63,14 +63,21 @@
|
||||
android:singleLine="true"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<!-- To add text view for one item -->
|
||||
<FrameLayout
|
||||
android:id="@+id/container_file_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/filename_input_layout"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" >
|
||||
<android.support.v7.widget.AppCompatSpinner
|
||||
android:id="@+id/file_types"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/filename_input_layout"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
android:layout_marginBottom="8dp"/>
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user