@@ -145,15 +145,12 @@ private void setupSettings() {
145145 view -> {
146146 setupModelTypeSelectorDialog ();
147147 });
148- mModelFilePath = mSettingsFields .getModelFilePath ();
149- if (!mModelFilePath .isEmpty ()) {
148+ if (mModelFilePath != null && !mModelFilePath .isEmpty ()) {
150149 mModelTextView .setText (getFilenameFromPath (mModelFilePath ));
151150 }
152- mTokenizerFilePath = mSettingsFields .getTokenizerFilePath ();
153- if (!mTokenizerFilePath .isEmpty ()) {
151+ if (mTokenizerFilePath != null && !mTokenizerFilePath .isEmpty ()) {
154152 mTokenizerTextView .setText (getFilenameFromPath (mTokenizerFilePath ));
155153 }
156- mDataPath = mSettingsFields .getDataPath ();
157154 if (mDataPath != null && !mDataPath .isEmpty ()) {
158155 mDataPathTextView .setText (getFilenameFromPath (mDataPath ));
159156 }
@@ -180,8 +177,8 @@ private void setupSettings() {
180177
181178 private void setupLoadModelButton () {
182179 mLoadModelButton = requireViewById (R .id .loadModelButton );
183- // Disable by default until settings change
184- mLoadModelButton . setEnabled ( false );
180+ // Enable button if valid pre-filled paths are available from previous session
181+ updateLoadModelButtonState ( );
185182 mLoadModelButton .setOnClickListener (
186183 view -> {
187184 new AlertDialog .Builder (this )
@@ -520,9 +517,10 @@ private boolean hasSettingsChanged() {
520517 }
521518
522519 private void updateLoadModelButtonState () {
523- boolean hasModelPath = mModelFilePath != null && !mModelFilePath .isEmpty ();
524- boolean hasTokenizerPath = mTokenizerFilePath != null && !mTokenizerFilePath .isEmpty ();
525- mLoadModelButton .setEnabled (hasSettingsChanged () && hasModelPath && hasTokenizerPath );
520+ // Enable button if settings changed OR if valid pre-filled paths are available
521+ boolean hasValidPaths = mModelFilePath != null && !mModelFilePath .isEmpty ()
522+ && mTokenizerFilePath != null && !mTokenizerFilePath .isEmpty ();
523+ mLoadModelButton .setEnabled (hasSettingsChanged () || hasValidPaths );
526524 }
527525
528526 private void setBackendSettingMode () {
0 commit comments