import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBar;
+//import android.support.v7.app.ActionBar;
+import android.app.ActionBar;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.widget.ListAdapter;
import android.widget.ListView;
+import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
mDbHandler = new DbHandler(getBaseContext());
addPreferencesFromResource(R.xml.preferences);
- // TODO: Add Toolbar
-// ActionBar actionBar = getSherlock().getActionBar();
-// actionBar.setIcon(DisplayUtils.getSeasonalIconId());
-// actionBar.setDisplayHomeAsUpEnabled(true);
-// actionBar.setTitle(R.string.actionbar_settings);
+ // 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);
+ }
// For adding content description tag to a title field in the action bar
int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android");
}
}
+
+ if (BuildConfig.DEBUG) {
+ Preference pLog = findPreference("log");
+ if (pLog != null ){
+ pLog.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class);
+ startActivity(loggerIntent);
+ return true;
+ }
+ });
+ }
+ }
-
boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
Preference pRecommend = findPreference("recommend");
if (pRecommend != null){
Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this);
String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@'));
- String recommendSubject = String.format(getString(R.string.recommend_subject), appName);
+ String recommendSubject = String.format(getString(R.string.recommend_subject),
+ appName);
String recommendText = String.format(getString(R.string.recommend_text),
appName, downloadUrl, username);