소스 검색

Customize buttons

masensio 11 년 전
부모
커밋
6e21c84026

+ 3 - 0
res/values/setup.xml

@@ -23,6 +23,9 @@
     <color name="actionbar_start_color">#1D2D44</color>
     <color name="actionbar_end_color">#1D2D44</color>
     
+    <!-- Button -->
+    <bool name="custom_buttons">false</bool>
+    
     <!-- Multiaccount support -->
     <bool name="multiaccount_support">false</bool>
     

+ 8 - 1
res/values/styles.xml

@@ -24,11 +24,13 @@
 	<style name="Theme.ownCloud" parent="style/Theme.Sherlock.Light.DarkActionBar">
     	<item name="android:actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
     	<item name="actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
+    	<item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
 	</style>
 	
 	<style name="Theme.ownCloud.noActionBar" parent="style/Theme.Sherlock.Light.NoActionBar">
       <item name="android:actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
       <item name="actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
+      <item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
     </style>
 	
 	<style name="Theme.ownCloud.Fullscreen" parent="style/Theme.Sherlock.NoActionBar">
@@ -53,7 +55,12 @@
 	<style name="Theme.ownCloud.Dialog" parent="style/Theme.Sherlock.Light.Dialog">
 	</style>
 	
-	
+	<!-- Buttons -->
+    <style name="Theme.ownCloud.ButtonStyle" parent="@android:style/Widget.Button">
+        <item name="android:background">@drawable/btn_default</item>
+        <item name="android:textColor">@android:color/white</item>
+    </style>
+
 	<!-- PopDownMenu -->
 	<style name="Animations.PopDownMenu" />
 	

+ 6 - 1
src/de/mobilcom/debitel/cloud/android/authentication/AuthenticatorActivity.java

@@ -197,9 +197,14 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         /// complete label for 'register account' button
         Button b = (Button) findViewById(R.id.account_register);
         if (b != null) {
-            b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));
+            b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));            
         }
 
+        /// complete background of 'OK' button
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons)
+            mOkButton.setBackgroundResource(R.drawable.btn_default);
+        
         /// initialization
         mAccountMgr = AccountManager.get(this);
         mNewCapturedUriFromOAuth2Redirection = null;

+ 8 - 0
src/de/mobilcom/debitel/cloud/android/extensions/ExtensionsAvailableDialog.java

@@ -42,6 +42,14 @@ public class ExtensionsAvailableDialog extends DialogFragment implements
                 container);
         Button btnYes = (Button) view.findViewById(R.id.buttonYes);
         Button btnNo = (Button) view.findViewById(R.id.buttonNo);
+        
+        // Set background of buttons
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) {
+            btnYes.setBackgroundResource(R.drawable.btn_default);
+            btnNo.setBackgroundResource(R.drawable.btn_default);
+        }
+        
         btnYes.setOnClickListener(this);
         btnNo.setOnClickListener(this);
         getDialog().setTitle(R.string.extensions_avail_title);

+ 7 - 0
src/de/mobilcom/debitel/cloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java

@@ -119,6 +119,13 @@ public class ErrorsWhileCopyingHandlerActivity  extends SherlockFragmentActivity
         /// customize buttons
         Button cancelBtn = (Button) findViewById(R.id.cancel);
         Button okBtn = (Button) findViewById(R.id.ok);
+        // Set background of buttons
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) {
+            cancelBtn.setBackgroundResource(R.drawable.btn_default);
+            okBtn.setBackgroundResource(R.drawable.btn_default);
+        }
+        
         okBtn.setText(R.string.foreign_files_move);
         cancelBtn.setOnClickListener(this);
         okBtn.setOnClickListener(this);

+ 7 - 2
src/de/mobilcom/debitel/cloud/android/ui/activity/FailedUploadActivity.java

@@ -44,8 +44,13 @@ public class FailedUploadActivity extends Activity {
         String message = getIntent().getStringExtra(MESSAGE);
         TextView textView = (TextView) findViewById(R.id.faild_upload_message);
         textView.setText(message);
-        Button close_button = (Button) findViewById(R.id.failed_uploadactivity_close_button);
-        close_button.setOnClickListener(new OnClickListener() {
+        Button closeBtn = (Button) findViewById(R.id.failed_uploadactivity_close_button);
+        // Set background of 'close' button
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) 
+            closeBtn.setBackgroundResource(R.drawable.btn_default);
+        
+        closeBtn.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
                 finish();

+ 11 - 4
src/de/mobilcom/debitel/cloud/android/ui/activity/InstantUploadActivity.java

@@ -76,13 +76,20 @@ public class InstantUploadActivity extends Activity {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.failed_upload_files);
 
-        Button delete_all_btn = (Button) findViewById(R.id.failed_upload_delete_all_btn);
-        delete_all_btn.setOnClickListener(getDeleteListner());
-        Button retry_all_btn = (Button) findViewById(R.id.failed_upload_retry_all_btn);
-        retry_all_btn.setOnClickListener(getRetryListner());
+        Button deleteAllBtn = (Button) findViewById(R.id.failed_upload_delete_all_btn);
+        deleteAllBtn.setOnClickListener(getDeleteListner());
+        Button retryAllBtn = (Button) findViewById(R.id.failed_upload_retry_all_btn);
+        retryAllBtn.setOnClickListener(getRetryListner());
         this.failed_upload_all_cb = (CheckBox) findViewById(R.id.failed_upload_headline_cb);
         failed_upload_all_cb.setOnCheckedChangeListener(getCheckAllListener());
         listView = (LinearLayout) findViewById(R.id.failed_upload_scrollviewlayout);
+        
+        // Set background of buttons
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) {
+            deleteAllBtn.setBackgroundResource(R.drawable.btn_default);
+            retryAllBtn.setBackgroundResource(R.drawable.btn_default);
+        }
 
         loadListView(true);
 

+ 6 - 0
src/de/mobilcom/debitel/cloud/android/ui/activity/LogHistoryActivity.java

@@ -53,6 +53,12 @@ public class LogHistoryActivity extends SherlockPreferenceActivity implements On
         actionBar.setDisplayHomeAsUpEnabled(true);
         ListView listView = (ListView) findViewById(android.R.id.list);
         Button deleteHistoryButton = (Button) findViewById(R.id.deleteLogHistoryButton);
+        
+        // Set background of 'deleteHistory' button
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) 
+            deleteHistoryButton.setBackgroundResource(R.drawable.btn_default);
+            
         deleteHistoryButton.setOnClickListener(new OnClickListener() {
             
             @Override

+ 4 - 1
src/de/mobilcom/debitel/cloud/android/ui/activity/PinCodeActivity.java

@@ -81,7 +81,10 @@ public class PinCodeActivity extends SherlockFragmentActivity {
         mText3 = (EditText) findViewById(R.id.txt3);
         mText4 = (EditText) findViewById(R.id.txt4);
         
-        
+        // Set background of 'Cancel' button
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) 
+            bCancel.setBackgroundResource(R.drawable.btn_default);
         
         SharedPreferences appPrefs = PreferenceManager
                 .getDefaultSharedPreferences(getApplicationContext());

+ 7 - 0
src/de/mobilcom/debitel/cloud/android/ui/activity/UploadFilesActivity.java

@@ -107,6 +107,13 @@ public class UploadFilesActivity extends FileActivity implements
         mCancelBtn.setOnClickListener(this);
         mUploadBtn = (Button) findViewById(R.id.upload_files_btn_upload);
         mUploadBtn.setOnClickListener(this);
+        
+        // Set background of buttons
+        boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
+        if (customButtons) {
+            mCancelBtn.setBackgroundResource(R.drawable.btn_default);
+            mUploadBtn.setBackgroundResource(R.drawable.btn_default);
+        }
             
         // Action bar setup
         ActionBar actionBar = getSupportActionBar();