X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/ce35d6448e39f06d66596b23dc7e3ddf1e93ab5a..8a9983f7311a6bf46dadd7dc73265db240fa8682:/src/com/owncloud/android/ui/activity/Preferences.java diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index ca7f8871..6d677cd3 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -32,9 +32,11 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Configuration; import android.net.Uri; -import android.os.Build; +import android.os.AsyncTask; import android.os.Bundle; +import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.preference.CheckBoxPreference; @@ -44,17 +46,25 @@ import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; -//import android.support.v7.app.ActionBar; -import android.app.ActionBar; +import android.support.annotation.LayoutRes; +import android.support.annotation.Nullable; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatDelegate; +import android.support.v7.widget.Toolbar; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; +import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.ListView; +import android.widget.Toast; import com.owncloud.android.BuildConfig; import com.owncloud.android.MainApp; @@ -63,18 +73,31 @@ import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; +import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.db.DbHandler; import com.owncloud.android.files.FileOperationsHelper; import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.services.OperationsService; +import com.owncloud.android.ui.PreferenceWithLongSummary; import com.owncloud.android.ui.RadioButtonPreference; import com.owncloud.android.utils.DisplayUtils; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.concurrent.ExecutionException; +import java.io.File; + /** * An Activity that allows the user to change the application's settings. + * + * It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used + * with AppCompat. */ public class Preferences extends PreferenceActivity implements AccountManagerCallback, ComponentsGetter { @@ -83,10 +106,13 @@ public class Preferences extends PreferenceActivity private static final int ACTION_SELECT_UPLOAD_PATH = 1; private static final int ACTION_SELECT_UPLOAD_VIDEO_PATH = 2; + private static final int ACTION_SELECT_STORAGE_PATH = 3; + private static final int ACTION_PERFORM_MIGRATION = 4; private DbHandler mDbHandler; private CheckBoxPreference pCode; private Preference pAboutApp; + private AppCompatDelegate mDelegate; private PreferenceCategory mAccountsPrefCategory = null; private final Handler mHandler = new Handler(); @@ -105,27 +131,21 @@ public class Preferences extends PreferenceActivity protected FileDownloader.FileDownloaderBinder mDownloaderBinder = null; protected FileUploader.FileUploaderBinder mUploaderBinder = null; private ServiceConnection mDownloadServiceConnection, mUploadServiceConnection = null; + private PreferenceWithLongSummary mPrefStoragePath; + private String mStoragePath; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { + getDelegate().installViewFactory(); + getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); mDbHandler = new DbHandler(getBaseContext()); addPreferencesFromResource(R.xml.preferences); - // Set properties of Action Bar in an ugly workaround to build correctly without - // upgrading minSdk - // TODO : increase minSdk; scheduled for next realease, don't wont to mix with this US - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - ActionBar actionBar = getActionBar(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - actionBar.setIcon(DisplayUtils.getSeasonalIconId()); - } - actionBar.setDisplayHomeAsUpEnabled(true); - actionBar.setTitle(R.string.actionbar_settings); - } else { - setTitle(R.string.actionbar_settings); - } + ActionBar actionBar = getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setTitle(R.string.actionbar_settings); // For adding content description tag to a title field in the action bar int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android"); @@ -150,7 +170,49 @@ public class Preferences extends PreferenceActivity mShowContextMenu = true; mAccountName = ((RadioButtonPreference) obj).getKey(); - Preferences.this.openContextMenu(listView); + String[] items = { + getResources().getString(R.string.change_password), + getResources().getString(R.string.delete_account) + }; + final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Preferences.this); + View convertView = getLayoutInflater().inflate(R.layout.alert_dialog_list_view, null); + alertDialogBuilder.setView(convertView); + ListView lv = (ListView) convertView.findViewById(R.id.list); + ArrayAdapter adapter = new ArrayAdapter( + Preferences.this,R.layout.simple_dialog_list_item,items); + lv.setAdapter(adapter); + + //Setup proper inline listener + final AlertDialog alertDialog = alertDialogBuilder.create(); + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); + Account accounts[] = am.getAccountsByType(MainApp.getAccountType()); + for (Account a : accounts) { + if (a.name.equals(mAccountName)) { + if (position==0) { + + // Change account password + Intent updateAccountCredentials = new Intent(Preferences.this, AuthenticatorActivity.class); + updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a); + updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, + AuthenticatorActivity.ACTION_UPDATE_TOKEN); + startActivity(updateAccountCredentials); + alertDialog.cancel(); + + } else if (position==1) { + + // Remove account + am.removeAccount(a, Preferences.this, mHandler); + Log_OC.d(TAG, "Remove an account " + a.name); + alertDialog.cancel(); + } + } + } + } + }); + alertDialog.show(); View.OnLongClickListener longListener = (View.OnLongClickListener) obj; return longListener.onLongClick(view); @@ -192,10 +254,31 @@ public class Preferences extends PreferenceActivity } + final Preference pCacheSize = findPreference("pref_cache_size"); + if (pCacheSize != null){ + final SharedPreferences appPrefs = + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + Long cacheSize = ThumbnailsCacheManager.getMaxSize(); + pCacheSize.setSummary(cacheSize + " Mb"); + pCacheSize.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + Long size = Long.decode((String) newValue); + if (ThumbnailsCacheManager.setMaxSize(size)){ + appPrefs.edit().putString("pref_cache_size", size.toString()); + pCacheSize.setSummary(size + " MB"); + return true; + } else { + return false; + } + } + }); + } + PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("more"); boolean helpEnabled = getResources().getBoolean(R.bool.help_enabled); - Preference pHelp = findPreference("help"); + Preference pHelp = findPreference("help"); if (pHelp != null ){ if (helpEnabled) { pHelp.setOnPreferenceClickListener(new OnPreferenceClickListener() { @@ -217,7 +300,7 @@ public class Preferences extends PreferenceActivity } if (BuildConfig.DEBUG) { - Preference pLog = findPreference("log"); + Preference pLog = findPreference("log"); if (pLog != null ){ pLog.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override @@ -260,7 +343,7 @@ public class Preferences extends PreferenceActivity intent.putExtra(Intent.EXTRA_TEXT, recommendText); startActivity(intent); - return(true); + return true; } }); @@ -277,9 +360,10 @@ public class Preferences extends PreferenceActivity pFeedback.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - String feedbackMail =(String) getText(R.string.mail_feedback); - String feedback =(String) getText(R.string.prefs_feedback) + " - android v" + appVersion; - Intent intent = new Intent(Intent.ACTION_SENDTO); + String feedbackMail = (String) getText(R.string.mail_feedback); + String feedback = String.format("%s - android v%s", getText(R.string.prefs_feedback), appVersion); + Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, feedback); @@ -318,7 +402,29 @@ public class Preferences extends PreferenceActivity } } - mPrefInstantUploadPath = findPreference("instant_upload_path"); + mPrefStoragePath = (PreferenceWithLongSummary)findPreference("storage_path"); + if (mPrefStoragePath != null) { + + mPrefStoragePath.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent intent = new Intent(Preferences.this, LocalDirectorySelectorActivity.class); + intent.putExtra(UploadFilesActivity.KEY_DIRECTORY_PATH, mStoragePath); + startActivityForResult(intent, ACTION_SELECT_STORAGE_PATH); + return true; + } + }); + + mPrefStoragePath.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + MainApp.setStoragePath((String) newValue); + return true; + } + }); + } + + mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference("instant_upload_path"); if (mPrefInstantUploadPath != null){ mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() { @@ -338,7 +444,7 @@ public class Preferences extends PreferenceActivity mPrefInstantUploadCategory = (PreferenceCategory) findPreference("instant_uploading_category"); - mPrefInstantUploadPathWiFi = findPreference("instant_upload_on_wifi"); + mPrefInstantUploadPathWiFi = findPreference("instant_upload_on_wifi"); mPrefInstantUpload = findPreference("instant_uploading"); toggleInstantPictureOptions(((CheckBoxPreference) mPrefInstantUpload).isChecked()); @@ -384,13 +490,21 @@ public class Preferences extends PreferenceActivity }); /* About App */ - pAboutApp = (Preference) findPreference("about_app"); + pAboutApp = findPreference("about_app"); if (pAboutApp != null) { - pAboutApp.setTitle(String.format(getString(R.string.about_android), getString(R.string.app_name))); - pAboutApp.setSummary(String.format(getString(R.string.about_version), appVersion)); + pAboutApp.setTitle(String.format(getString(R.string.about_android), + getString(R.string.app_name))); + try { + Integer currentVersion = getPackageManager().getPackageInfo + (getPackageName(), 0).versionCode; + pAboutApp.setSummary(String.format(getString(R.string.about_version), + currentVersion)); + } catch (NameNotFoundException e) { + } } loadInstantUploadPath(); + loadStoragePath(); loadInstantUploadVideoPath(); /* ComponentsGetter */ @@ -405,6 +519,65 @@ public class Preferences extends PreferenceActivity Context.BIND_AUTO_CREATE); } + /* Link to Beta apks */ + Preference pBetaLink = findPreference("beta_link"); + if (pBetaLink != null ){ + pBetaLink.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Integer latestVersion = -1; + Integer currentVersion = -1; + try { + currentVersion = getPackageManager().getPackageInfo + (getPackageName(), 0).versionCode; + LoadingVersionNumberTask loadTask = new LoadingVersionNumberTask(); + loadTask.execute(); + latestVersion = loadTask.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } catch (NameNotFoundException e) { + e.printStackTrace(); + } + if (latestVersion == -1 || currentVersion == -1) { + Toast.makeText(getApplicationContext(), "No information available!", + Toast.LENGTH_SHORT).show(); + } + if (latestVersion > currentVersion) { + String betaLinkWeb = (String) getText(R.string.beta_link) + + latestVersion + ".apk"; + if (betaLinkWeb != null && betaLinkWeb.length() > 0) { + Uri uriUrl = Uri.parse(betaLinkWeb); + Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl); + startActivity(intent); + return true; + } + } else { + Toast.makeText(getApplicationContext(), "No new version available!", + Toast.LENGTH_SHORT).show(); + return true; + } + return true; + } + }); + } + + /* Link to Beta apks */ + Preference pChangelogLink = findPreference("changelog_link"); + if (pChangelogLink != null) { + pChangelogLink.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + String betaLinkWeb = getString(R.string.changelog); + if (betaLinkWeb != null && betaLinkWeb.length() > 0) { + Uri uriUrl = Uri.parse(betaLinkWeb); + Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl); + startActivity(intent); + return true; + } + return true; + } + }); + } } private void toggleInstantPictureOptions(Boolean value){ @@ -412,8 +585,8 @@ public class Preferences extends PreferenceActivity mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPathWiFi); mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPath); } else { - mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPathWiFi); - mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPath); +// mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPathWiFi); +// mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPath); } } @@ -422,8 +595,8 @@ public class Preferences extends PreferenceActivity mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPathWiFi); mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPath); } else { - mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPathWiFi); - mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPath); +// mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPathWiFi); +// mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPath); } } @@ -439,40 +612,6 @@ public class Preferences extends PreferenceActivity super.onCreateContextMenu(menu, v, menuInfo); } - /** - * Called when the user clicked on an item into the context menu created at - * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} for - * every ownCloud {@link Account} , containing 'secondary actions' for them. - * - * {@inheritDoc} - */ - @Override - public boolean onContextItemSelected(android.view.MenuItem item) { - AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); - Account accounts[] = am.getAccountsByType(MainApp.getAccountType()); - for (Account a : accounts) { - if (a.name.equals(mAccountName)) { - if (item.getItemId() == R.id.change_password) { - - // Change account password - Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); - updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a); - updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, - AuthenticatorActivity.ACTION_UPDATE_TOKEN); - startActivity(updateAccountCredentials); - - } else if (item.getItemId() == R.id.delete_account) { - - // Remove account - am.removeAccount(a, this, mHandler); - Log_OC.d(TAG, "Remove an account " + a.name); - } - } - } - - return true; - } - @Override public void run(AccountManagerFuture future) { if (future.isDone()) { @@ -543,8 +682,7 @@ public class Preferences extends PreferenceActivity if (requestCode == ACTION_SELECT_UPLOAD_PATH && resultCode == RESULT_OK){ - OCFile folderToUpload = - (OCFile) data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER); + OCFile folderToUpload = data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER); mUploadPath = folderToUpload.getRemotePath(); @@ -555,10 +693,9 @@ public class Preferences extends PreferenceActivity saveInstantUploadPathOnPreferences(); - } else if (requestCode == ACTION_SELECT_UPLOAD_VIDEO_PATH && resultCode == RESULT_OK){ + } else if (requestCode == ACTION_SELECT_UPLOAD_VIDEO_PATH && resultCode == RESULT_OK) { - OCFile folderToUploadVideo = - (OCFile) data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER); + OCFile folderToUploadVideo = data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER); mUploadVideoPath = folderToUploadVideo.getRemotePath(); @@ -568,9 +705,80 @@ public class Preferences extends PreferenceActivity mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath); saveInstantUploadVideoPathOnPreferences(); + } else if (requestCode == ACTION_SELECT_STORAGE_PATH && resultCode == RESULT_OK) { + File currentStorageDir = new File(mStoragePath); + File upcomingStorageDir = new File(data.getStringExtra(UploadFilesActivity.EXTRA_CHOSEN_FILES)); + + if (currentStorageDir != upcomingStorageDir) { + Intent migrationIntent = new Intent(this, StorageMigrationActivity.class); + migrationIntent.putExtra(StorageMigrationActivity.KEY_MIGRATION_SOURCE_DIR, + currentStorageDir.getAbsolutePath()); + migrationIntent.putExtra(StorageMigrationActivity.KEY_MIGRATION_TARGET_DIR, + upcomingStorageDir.getAbsolutePath()); + startActivityForResult(migrationIntent, ACTION_PERFORM_MIGRATION); + } + } else if (requestCode == ACTION_PERFORM_MIGRATION && resultCode == RESULT_OK) { + String resultStorageDir = data.getStringExtra(StorageMigrationActivity.KEY_MIGRATION_TARGET_DIR); + saveStoragePath(resultStorageDir); } } + public ActionBar getSupportActionBar() { + return getDelegate().getSupportActionBar(); + } + + public void setSupportActionBar(@Nullable Toolbar toolbar) { + getDelegate().setSupportActionBar(toolbar); + } + + @Override + public MenuInflater getMenuInflater() { + return getDelegate().getMenuInflater(); + } + + @Override + public void setContentView(@LayoutRes int layoutResID) { + getDelegate().setContentView(layoutResID); + } + @Override + public void setContentView(View view) { + getDelegate().setContentView(view); + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().setContentView(view, params); + } + + @Override + public void addContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().addContentView(view, params); + } + + @Override + protected void onPostResume() { + super.onPostResume(); + getDelegate().onPostResume(); + } + + @Override + protected void onTitleChanged(CharSequence title, int color) { + super.onTitleChanged(title, color); + getDelegate().setTitle(title); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + getDelegate().onConfigurationChanged(newConfig); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + getDelegate().onPostCreate(savedInstanceState); + } + @Override protected void onDestroy() { mDbHandler.close(); @@ -585,6 +793,24 @@ public class Preferences extends PreferenceActivity } super.onDestroy(); + getDelegate().onDestroy(); + } + + @Override + protected void onStop() { + super.onStop(); + getDelegate().onStop(); + } + + public void invalidateOptionsMenu() { + getDelegate().invalidateOptionsMenu(); + } + + private AppCompatDelegate getDelegate() { + if (mDelegate == null) { + mDelegate = AppCompatDelegate.create(this, null); + } + return mDelegate; } /** @@ -704,6 +930,31 @@ public class Preferences extends PreferenceActivity } /** + * Save storage path + */ + private void saveStoragePath(String newStoragePath) { + SharedPreferences appPrefs = + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + mStoragePath = newStoragePath; + MainApp.setStoragePath(mStoragePath); + SharedPreferences.Editor editor = appPrefs.edit(); + editor.putString("storage_path", mStoragePath); + editor.commit(); + mPrefStoragePath.setSummary(mStoragePath); + } + + /** + * Load storage path set on preferences + */ + private void loadStoragePath() { + SharedPreferences appPrefs = + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + mStoragePath = appPrefs.getString("storage_path", Environment.getExternalStorageDirectory() + .getAbsolutePath()); + mPrefStoragePath.setSummary(mStoragePath); + } + + /** * Save the "Instant Upload Path" on preferences */ private void saveInstantUploadPathOnPreferences() { @@ -718,10 +969,7 @@ public class Preferences extends PreferenceActivity * Load upload video path set on preferences */ private void loadInstantUploadVideoPath() { - SharedPreferences appPrefs = - PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - mUploadVideoPath = appPrefs.getString("instant_video_upload_path", getString(R.string.instant_upload_path)); - mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath); + mPrefInstantVideoUploadPath.setSummary(MainApp.getStoragePath()); } /** @@ -735,7 +983,7 @@ public class Preferences extends PreferenceActivity editor.commit(); } - // Methods for ComponetsGetter + // Methods for ComponentsGetter @Override public FileDownloader.FileDownloaderBinder getFileDownloaderBinder() { return mDownloaderBinder; @@ -774,14 +1022,10 @@ public class Preferences extends PreferenceActivity if (component.equals(new ComponentName(Preferences.this, FileDownloader.class))) { mDownloaderBinder = (FileDownloader.FileDownloaderBinder) service; - } else if (component.equals(new ComponentName(Preferences.this, FileUploader.class))) { Log_OC.d(TAG, "Upload service connected"); mUploaderBinder = (FileUploader.FileUploaderBinder) service; - } else { - return; } - } @Override @@ -795,4 +1039,29 @@ public class Preferences extends PreferenceActivity } } }; + + /** + * + * Class for loading the version number + * + */ + private class LoadingVersionNumberTask extends AsyncTask { + protected Integer doInBackground(Void... args) { + try { + URL url = new URL("https://github.com/owncloud/android/raw/beta/apks/latest"); + BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); + + Integer latestVersion = Integer.parseInt(in.readLine()); + in.close(); + + return latestVersion; + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return -1; + } + } }