add apk
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / Preferences.java
index 6bdc1e1..7b85fe6 100644 (file)
@@ -463,7 +463,7 @@ public class Preferences extends PreferenceActivity
        pAboutApp = (Preference) 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.setSummary(String.format(getString(R.string.about_version), BuildConfig.VERSION_CODE));
        }
 
        loadInstantUploadPath();
@@ -496,21 +496,39 @@ public class Preferences extends PreferenceActivity
                     } catch (InterruptedException | ExecutionException e) {
                         e.printStackTrace();
                     }
-                    if (latestVersion == -1){
+                    if (latestVersion == -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();
+                    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;
                 }
             });
@@ -871,7 +889,7 @@ public class Preferences extends PreferenceActivity
         SharedPreferences appPrefs =
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         mUploadVideoPath = appPrefs.getString("instant_video_upload_path", getString(R.string.instant_upload_path));
-//        mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath);
+        mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath);
     }
 
     /**
@@ -954,7 +972,7 @@ public class Preferences extends PreferenceActivity
     private class LoadingVersionNumberTask extends AsyncTask<Void, Void, Integer> {
         protected Integer doInBackground(Void... args) {
             try {
-                URL url = new URL("https://www.tobiaskaminsky.de/ocVersion");
+                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());