X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/66a005416cb7752eb197413e155afe38a0ed5780..066cd5aab34344264d2269e6a03785d20226b7e9:/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 15ae7760..63ee14df 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -17,15 +17,14 @@ */ package com.owncloud.android.ui.activity; -import java.io.File; import java.util.Vector; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; +import android.net.Uri; import android.os.Bundle; -import android.os.Environment; import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; @@ -58,8 +57,8 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere private ListPreference mTrackingUpdateInterval; private CheckBoxPreference mDeviceTracking; private CheckBoxPreference pCode; - private CheckBoxPreference pLogging; - private Preference pLoggingHistory; + //private CheckBoxPreference pLogging; + //private Preference pLoggingHistory; private Preference pAboutApp; private int mSelectedMenuItem; @@ -94,11 +93,95 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "preferences"); i.putExtra(PinCodeActivity.EXTRA_NEW_STATE, newValue.toString()); startActivity(i); + + return true; + } + }); + + } + + Preference pHelp = findPreference("help"); + if (pHelp != null ){ + pHelp.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + String helpWeb =(String) getText(R.string.url_help); + if (helpWeb != null && helpWeb.length() > 0) { + Uri uriUrl = Uri.parse(helpWeb); + Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl); + startActivity(intent); + } return true; } }); + } + + Preference pRecommend = findPreference("recommend"); + if (pRecommend != null){ + pRecommend.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + + Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + //Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this); + String appName = getString(R.string.app_name); + //String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@')); + //String recommendSubject = String.format(getString(R.string.recommend_subject), username, appName); + String recommendSubject = String.format(getString(R.string.recommend_subject), appName); + intent.putExtra(Intent.EXTRA_SUBJECT, recommendSubject); + //String recommendText = String.format(getString(R.string.recommend_text), getString(R.string.app_name), username); + String recommendText = String.format(getString(R.string.recommend_text), getString(R.string.app_name), getString(R.string.url_app_download)); + intent.putExtra(Intent.EXTRA_TEXT, recommendText); + + intent.setData(Uri.parse(getString(R.string.mail_recommend))); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + + + return(true); + + } + }); + } + Preference pFeedback = findPreference("feedback"); + if (pFeedback != null){ + 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); + Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_SUBJECT, feedback); + + intent.setData(Uri.parse(feedbackMail)); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + + return true; + } + }); + } + + Preference pImprint = findPreference("imprint"); + if (pImprint != null) { + pImprint.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + String imprintWeb = (String) getText(R.string.url_imprint); + if (imprintWeb != null && imprintWeb.length() > 0) { + Uri uriUrl = Uri.parse(imprintWeb); + Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl); + startActivity(intent); + } + //ImprintDialog.newInstance(true).show(preference.get, "IMPRINT_DIALOG"); + return true; + } + }); + } - /* About App */ + /* About App */ pAboutApp = (Preference) findPreference("about_app"); if (pAboutApp != null) { pAboutApp.setTitle(String.format(getString(R.string.about_android), getString(R.string.app_name))); @@ -148,7 +231,6 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere } */ - } } @Override