فهرست منبع

Added help link, feedback email, recommendations through email, and (disabled) imprint link to app settings

David A. Velasco 12 سال پیش
والد
کامیت
12bffce50c
4فایلهای تغییر یافته به همراه108 افزوده شده و 5 حذف شده
  1. 8 0
      res/values/branding.xml
  2. 8 0
      res/values/strings.xml
  3. 9 0
      res/xml/preferences.xml
  4. 83 5
      src/com/owncloud/android/ui/activity/Preferences.java

+ 8 - 0
res/values/branding.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="url_help">https://owncloud.com/mobile/help</string>
+    <string name="url_imprint"></string>
+    <string name="mail_recommend">"mailto:"</string>
+    <string name="mail_feedback">"mailto:apps@owncloud.com"</string>
+    <string name="url_app_download">"https://play.google.com/store/apps/details?id=com.owncloud.android"</string>
+</resources>

+ 8 - 0
res/values/strings.xml

@@ -27,6 +27,7 @@
     <string name="actionbar_see_details">Details</string>
     
     <string name="prefs_category_general">General</string>
+    <string name="prefs_category_more">More</string>
     <string name="prefs_add_session">Add new session</string>
     <string name="prefs_create_img_thumbnails">Create image thumbnails</string>
     <string name="prefs_select_oc_account">Select an account</string>
@@ -47,7 +48,14 @@
     <string name="prefs_log_title_history">Logging History</string>
     <string name="prefs_log_summary_history">This shows the recorded logs</string>
     <string name="prefs_log_delete_history_button">Delete History</string>
+    <string name="prefs_help">Help</string>
+    <string name="prefs_recommend">Recommend to a friend</string>
+    <string name="prefs_feedback">Feedback</string>
+    <string name="prefs_imprint">Imprint</string>
     
+	<string name="recommend_subject">"Try %1$s on your smartphone!"</string>
+	<string name="recommend_text">"I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s"</string>  
+
     <string name="auth_host_url">Server address</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>

+ 9 - 0
res/xml/preferences.xml

@@ -42,6 +42,15 @@
 	<Preference 		android:key="log_history" 
                         android:title="@string/prefs_log_title_history"  
                         android:summary="@string/prefs_log_summary_history"/ -->
+                        
+    </PreferenceCategory>
+	
+	<PreferenceCategory android:title="@string/prefs_category_more">
+    <Preference android:title="@string/prefs_help" android:key="help" />
+    <Preference android:title="@string/prefs_recommend" android:key="recommend" />
+    <Preference android:title="@string/prefs_feedback" android:key="feedback" />
+    <!-- Preference android:title="@string/prefs_imprint" android:key="imprint" / -->
+                        
 	<Preference 		android:id="@+id/about_app" 
         				android:title="@string/about_title" 
         				android:key="about_app" />

+ 83 - 5
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,6 +93,86 @@ 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);
+                    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);
+                    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;
                 }
             });
@@ -148,7 +227,6 @@ public class Preferences extends SherlockPreferenceActivity implements OnPrefere
        }
        */
        
-      }
     }
 
     @Override